diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/CHANGELOG.md b/sdk/networkcloud/azure-mgmt-networkcloud/CHANGELOG.md index 36aeb7898147..e10fc45c6ae6 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/CHANGELOG.md +++ b/sdk/networkcloud/azure-mgmt-networkcloud/CHANGELOG.md @@ -1,5 +1,123 @@ # Release History +## 3.0.0b1 (2026-04-02) + +### Features Added + + - Client `NetworkCloudMgmtClient` added method `send_request` + - Added enum `ExtendedLocationType` + - Added model `ProxyResource` + +### Breaking Changes + + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. + - Model `AgentPoolPatchParameters` moved instance variable `administrator_configuration`, `count` and `upgrade_settings` under property `properties` whose type is `AgentPoolPatchProperties` + - Model `BareMetalMachineKeySetPatchParameters` moved instance variable `expiration`, `jump_hosts_allowed` and `user_list` under property `properties` whose type is `BareMetalMachineKeySetPatchProperties` + - Model `BareMetalMachinePatchParameters` moved instance variable `machine_details` under property `properties` whose type is `BareMetalMachinePatchProperties` + - Model `BmcKeySetPatchParameters` moved instance variable `expiration` and `user_list` under property `properties` whose type is `BmcKeySetPatchProperties` + - Model `CloudServicesNetworkPatchParameters` moved instance variable `additional_egress_endpoints`, `enable_default_egress_endpoints` and `storage_options` under property `properties` whose type is `CloudServicesNetworkPatchProperties` + - Model `ClusterMetricsConfigurationPatchParameters` moved instance variable `collection_interval` and `enabled_metrics` under property `properties` whose type is `ClusterMetricsConfigurationPatchProperties` + - Model `ClusterPatchParameters` moved instance variable `aggregator_or_single_rack_definition`, `analytics_output_settings`, `cluster_location`, `cluster_service_principal`, `command_output_settings`, `compute_deployment_threshold`, `compute_rack_definitions`, `runtime_protection_configuration`, `secret_archive`, `secret_archive_settings`, `update_strategy` and `vulnerability_scanning_settings` under property `properties` whose type is `ClusterPatchProperties` + - Model `ConsolePatchParameters` moved instance variable `enabled`, `expiration` and `ssh_public_key` under property `properties` whose type is `ConsolePatchProperties` + - Model `KubernetesClusterFeaturePatchParameters` moved instance variable `options` under property `properties` whose type is `KubernetesClusterFeaturePatchProperties` + - Model `KubernetesClusterPatchParameters` moved instance variable `administrator_configuration`, `control_plane_node_configuration` and `kubernetes_version` under property `properties` whose type is `KubernetesClusterPatchProperties` + - Model `MachineSkuSlot` moved instance variable `bootstrap_protocol`, `cpu_cores`, `cpu_sockets`, `disks`, `generation`, `hardware_version`, `memory_capacity_gb`, `model`, `network_interfaces`, `total_threads` and `vendor` under property `properties` whose type is `MachineSkuProperties` + - Model `RackPatchParameters` moved instance variable `rack_location` and `rack_serial_number` under property `properties` whose type is `RacksPatchProperties` + - Model `StorageAppliancePatchParameters` moved instance variable `serial_number` under property `properties` whose type is `StorageAppliancePatchProperties` + - Model `StorageApplianceSkuSlot` moved instance variable `capacity_gb` and `model` under property `properties` whose type is `StorageApplianceSkuProperties` + - Model `VirtualMachinePatchParameters` moved instance variable `vm_image_repository_credentials` under property `properties` whose type is `VirtualMachinePatchProperties` + - Deleted or renamed model `AgentPoolConfiguration` + - Deleted or renamed model `TagsParameter` + - Method `AgentPoolsOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `AgentPoolsOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `AgentPoolsOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `AgentPoolsOperations.list_by_kubernetes_cluster` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `BareMetalMachineKeySetsOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachineKeySetsOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachineKeySetsOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachineKeySetsOperations.list_by_cluster` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `BareMetalMachinesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachinesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachinesOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BareMetalMachinesOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `BareMetalMachinesOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `BmcKeySetsOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BmcKeySetsOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BmcKeySetsOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `BmcKeySetsOperations.list_by_cluster` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `CloudServicesNetworksOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `CloudServicesNetworksOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `CloudServicesNetworksOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `CloudServicesNetworksOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `CloudServicesNetworksOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ClusterManagersOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClusterManagersOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClusterManagersOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ClusterManagersOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ClusterManagersOperations.update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClustersOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClustersOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClustersOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ClustersOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ClustersOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ConsolesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ConsolesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ConsolesOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `ConsolesOperations.list_by_virtual_machine` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `KubernetesClusterFeaturesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClusterFeaturesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClusterFeaturesOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClusterFeaturesOperations.list_by_kubernetes_cluster` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `KubernetesClustersOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClustersOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClustersOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `KubernetesClustersOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `KubernetesClustersOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `L2NetworksOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `L2NetworksOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `L2NetworksOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `L2NetworksOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `L2NetworksOperations.update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `L3NetworksOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `L3NetworksOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `L3NetworksOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `L3NetworksOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `L3NetworksOperations.update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `MetricsConfigurationsOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `MetricsConfigurationsOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `MetricsConfigurationsOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `MetricsConfigurationsOperations.list_by_cluster` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `RacksOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `RacksOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `RacksOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `RacksOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `RacksOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `StorageAppliancesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `StorageAppliancesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `StorageAppliancesOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `StorageAppliancesOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `StorageAppliancesOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `TrunkedNetworksOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `TrunkedNetworksOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `TrunkedNetworksOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `TrunkedNetworksOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `TrunkedNetworksOperations.update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VirtualMachinesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VirtualMachinesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VirtualMachinesOperations.begin_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VirtualMachinesOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `VirtualMachinesOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `VolumesOperations.begin_create_or_update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VolumesOperations.begin_delete` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + - Method `VolumesOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `VolumesOperations.list_by_subscription` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `VolumesOperations.update` replaced positional_or_keyword parameters `if_match`/`if_none_match` to keyword_only parameters `etag`/`match_condition` + +### Other Changes + + - Deleted model `AgentPoolList`/`BareMetalMachineKeySetList`/`BareMetalMachineList`/`BmcKeySetList`/`CloudServicesNetworkList`/`ClusterList`/`ClusterManagerList`/`ClusterMetricsConfigurationList`/`ConsoleList`/`KubernetesClusterFeatureList`/`KubernetesClusterList`/`L2NetworkList`/`L3NetworkList`/`RackList`/`RackSkuList`/`StorageApplianceList`/`TrunkedNetworkList`/`VirtualMachineList`/`VolumeList` which actually were not used by SDK users + ## 2.2.0 (2025-12-22) ### Features Added diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/_metadata.json b/sdk/networkcloud/azure-mgmt-networkcloud/_metadata.json index 2ab0edaeb098..999ca3729abd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/_metadata.json +++ b/sdk/networkcloud/azure-mgmt-networkcloud/_metadata.json @@ -1,11 +1,10 @@ { - "commit": "46c51b03d99b113ecc3b38883e3cb2d395fe94a4", + "apiVersion": "2025-09-01", + "apiVersions": { + "Microsoft.NetworkCloud": "2025-09-01" + }, + "commit": "0b5796a12cf5dca2f6b8ec3dce4566806497986c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.43.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/networkcloud/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.43.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/networkcloud/resource-manager/readme.md" + "typespec_src": "specification/networkcloud/NetworkCloud.Management", + "emitterVersion": "0.61.2" } \ No newline at end of file diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/apiview-properties.json b/sdk/networkcloud/azure-mgmt-networkcloud/apiview-properties.json index 84389ec22c30..6d0409ccdad3 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/apiview-properties.json +++ b/sdk/networkcloud/azure-mgmt-networkcloud/apiview-properties.json @@ -1,535 +1,550 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.NetworkCloud", "CrossLanguageDefinitionId": { - "azure.mgmt.networkcloud.models.AadConfiguration": null, - "azure.mgmt.networkcloud.models.ActionState": null, - "azure.mgmt.networkcloud.models.AdministrativeCredentials": null, - "azure.mgmt.networkcloud.models.AdministratorConfiguration": null, - "azure.mgmt.networkcloud.models.AdministratorConfigurationPatch": null, - "azure.mgmt.networkcloud.models.AgentOptions": null, - "azure.mgmt.networkcloud.models.Resource": null, - "azure.mgmt.networkcloud.models.TrackedResource": null, - "azure.mgmt.networkcloud.models.AgentPool": null, - "azure.mgmt.networkcloud.models.AgentPoolConfiguration": null, - "azure.mgmt.networkcloud.models.AgentPoolList": null, - "azure.mgmt.networkcloud.models.AgentPoolPatchParameters": null, - "azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings": null, - "azure.mgmt.networkcloud.models.AnalyticsOutputSettings": null, - "azure.mgmt.networkcloud.models.AttachedNetworkConfiguration": null, - "azure.mgmt.networkcloud.models.AvailableUpgrade": null, - "azure.mgmt.networkcloud.models.BareMetalMachine": null, - "azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification": null, - "azure.mgmt.networkcloud.models.BareMetalMachineConfigurationData": null, - "azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySet": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetList": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineList": null, - "azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters": null, - "azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters": null, - "azure.mgmt.networkcloud.models.BgpAdvertisement": null, - "azure.mgmt.networkcloud.models.BgpServiceLoadBalancerConfiguration": null, - "azure.mgmt.networkcloud.models.BmcKeySet": null, - "azure.mgmt.networkcloud.models.BmcKeySetList": null, - "azure.mgmt.networkcloud.models.BmcKeySetPatchParameters": null, - "azure.mgmt.networkcloud.models.CertificateInfo": null, - "azure.mgmt.networkcloud.models.CloudServicesNetwork": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkList": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptions": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptionsPatch": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatus": null, - "azure.mgmt.networkcloud.models.Cluster": null, - "azure.mgmt.networkcloud.models.ClusterAvailableUpgradeVersion": null, - "azure.mgmt.networkcloud.models.ClusterAvailableVersion": null, - "azure.mgmt.networkcloud.models.ClusterCapacity": null, - "azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters": null, - "azure.mgmt.networkcloud.models.ClusterDeployParameters": null, - "azure.mgmt.networkcloud.models.ClusterList": null, - "azure.mgmt.networkcloud.models.ClusterManager": null, - "azure.mgmt.networkcloud.models.ClusterManagerList": null, - "azure.mgmt.networkcloud.models.ClusterManagerPatchParameters": null, - "azure.mgmt.networkcloud.models.ClusterMetricsConfiguration": null, - "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationList": null, - "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters": null, - "azure.mgmt.networkcloud.models.ClusterPatchParameters": null, - "azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters": null, - "azure.mgmt.networkcloud.models.ClusterSecretArchive": null, - "azure.mgmt.networkcloud.models.ClusterUpdateStrategy": null, - "azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters": null, - "azure.mgmt.networkcloud.models.CommandOutputOverride": null, - "azure.mgmt.networkcloud.models.CommandOutputSettings": null, - "azure.mgmt.networkcloud.models.Console": null, - "azure.mgmt.networkcloud.models.ConsoleList": null, - "azure.mgmt.networkcloud.models.ConsolePatchParameters": null, - "azure.mgmt.networkcloud.models.ControlPlaneNodeConfiguration": null, - "azure.mgmt.networkcloud.models.ControlPlaneNodePatchConfiguration": null, - "azure.mgmt.networkcloud.models.EgressEndpoint": null, - "azure.mgmt.networkcloud.models.EndpointDependency": null, - "azure.mgmt.networkcloud.models.ErrorAdditionalInfo": null, - "azure.mgmt.networkcloud.models.ErrorDetail": null, - "azure.mgmt.networkcloud.models.ErrorResponse": null, - "azure.mgmt.networkcloud.models.ExtendedLocation": null, - "azure.mgmt.networkcloud.models.FeatureStatus": null, - "azure.mgmt.networkcloud.models.HardwareInventory": null, - "azure.mgmt.networkcloud.models.HardwareInventoryNetworkInterface": null, - "azure.mgmt.networkcloud.models.HardwareValidationStatus": null, - "azure.mgmt.networkcloud.models.IdentitySelector": null, - "azure.mgmt.networkcloud.models.ImageRepositoryCredentials": null, - "azure.mgmt.networkcloud.models.InitialAgentPoolConfiguration": null, - "azure.mgmt.networkcloud.models.IpAddressPool": null, - "azure.mgmt.networkcloud.models.KeySetUser": null, - "azure.mgmt.networkcloud.models.KeySetUserStatus": null, - "azure.mgmt.networkcloud.models.KubernetesCluster": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeature": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeatureList": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters": null, - "azure.mgmt.networkcloud.models.KubernetesClusterList": null, - "azure.mgmt.networkcloud.models.KubernetesClusterNode": null, - "azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters": null, - "azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters": null, - "azure.mgmt.networkcloud.models.KubernetesLabel": null, - "azure.mgmt.networkcloud.models.L2Network": null, - "azure.mgmt.networkcloud.models.L2NetworkAttachmentConfiguration": null, - "azure.mgmt.networkcloud.models.L2NetworkList": null, - "azure.mgmt.networkcloud.models.L2NetworkPatchParameters": null, - "azure.mgmt.networkcloud.models.L2ServiceLoadBalancerConfiguration": null, - "azure.mgmt.networkcloud.models.L3Network": null, - "azure.mgmt.networkcloud.models.L3NetworkAttachmentConfiguration": null, - "azure.mgmt.networkcloud.models.L3NetworkList": null, - "azure.mgmt.networkcloud.models.L3NetworkPatchParameters": null, - "azure.mgmt.networkcloud.models.LldpNeighbor": null, - "azure.mgmt.networkcloud.models.MachineDisk": null, - "azure.mgmt.networkcloud.models.MachineSkuSlot": null, - "azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration": null, - "azure.mgmt.networkcloud.models.ManagedServiceIdentity": null, - "azure.mgmt.networkcloud.models.NetworkAttachment": null, - "azure.mgmt.networkcloud.models.NetworkConfiguration": null, - "azure.mgmt.networkcloud.models.NetworkInterface": null, - "azure.mgmt.networkcloud.models.Nic": null, - "azure.mgmt.networkcloud.models.NodePoolAdministratorConfigurationPatch": null, - "azure.mgmt.networkcloud.models.Operation": null, - "azure.mgmt.networkcloud.models.OperationDisplay": null, - "azure.mgmt.networkcloud.models.OperationListResult": null, - "azure.mgmt.networkcloud.models.OperationStatusResult": null, - "azure.mgmt.networkcloud.models.OsDisk": null, - "azure.mgmt.networkcloud.models.Rack": null, - "azure.mgmt.networkcloud.models.RackDefinition": null, - "azure.mgmt.networkcloud.models.RackList": null, - "azure.mgmt.networkcloud.models.RackPatchParameters": null, - "azure.mgmt.networkcloud.models.RackSku": null, - "azure.mgmt.networkcloud.models.RackSkuList": null, - "azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration": null, - "azure.mgmt.networkcloud.models.RuntimeProtectionStatus": null, - "azure.mgmt.networkcloud.models.SecretArchiveReference": null, - "azure.mgmt.networkcloud.models.SecretArchiveSettings": null, - "azure.mgmt.networkcloud.models.SecretRotationStatus": null, - "azure.mgmt.networkcloud.models.ServiceLoadBalancerBgpPeer": null, - "azure.mgmt.networkcloud.models.ServicePrincipalInformation": null, - "azure.mgmt.networkcloud.models.SshPublicKey": null, - "azure.mgmt.networkcloud.models.StepState": null, - "azure.mgmt.networkcloud.models.StorageAppliance": null, - "azure.mgmt.networkcloud.models.StorageApplianceCommandSpecification": null, - "azure.mgmt.networkcloud.models.StorageApplianceConfigurationData": null, - "azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters": null, - "azure.mgmt.networkcloud.models.StorageApplianceList": null, - "azure.mgmt.networkcloud.models.StorageAppliancePatchParameters": null, - "azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters": null, - "azure.mgmt.networkcloud.models.StorageApplianceSkuSlot": null, - "azure.mgmt.networkcloud.models.StorageProfile": null, - "azure.mgmt.networkcloud.models.StringKeyValuePair": null, - "azure.mgmt.networkcloud.models.SystemData": null, - "azure.mgmt.networkcloud.models.TagsParameter": null, - "azure.mgmt.networkcloud.models.TrunkedNetwork": null, - "azure.mgmt.networkcloud.models.TrunkedNetworkAttachmentConfiguration": null, - "azure.mgmt.networkcloud.models.TrunkedNetworkList": null, - "azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters": null, - "azure.mgmt.networkcloud.models.UserAssignedIdentity": null, - "azure.mgmt.networkcloud.models.ValidationThreshold": null, - "azure.mgmt.networkcloud.models.VirtualMachine": null, - "azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters": null, - "azure.mgmt.networkcloud.models.VirtualMachineList": null, - "azure.mgmt.networkcloud.models.VirtualMachinePatchParameters": null, - "azure.mgmt.networkcloud.models.VirtualMachinePlacementHint": null, - "azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters": null, - "azure.mgmt.networkcloud.models.Volume": null, - "azure.mgmt.networkcloud.models.VolumeList": null, - "azure.mgmt.networkcloud.models.VolumePatchParameters": null, - "azure.mgmt.networkcloud.models.VulnerabilityScanningSettings": null, - "azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsPatch": null, - "azure.mgmt.networkcloud.models.Origin": null, - "azure.mgmt.networkcloud.models.ActionType": null, - "azure.mgmt.networkcloud.models.StepStateStatus": null, - "azure.mgmt.networkcloud.models.ActionStateStatus": null, - "azure.mgmt.networkcloud.models.CreatedByType": null, - "azure.mgmt.networkcloud.models.BareMetalMachineCordonStatus": null, - "azure.mgmt.networkcloud.models.BareMetalMachineDetailedStatus": null, - "azure.mgmt.networkcloud.models.BareMetalMachineHardwareValidationResult": null, - "azure.mgmt.networkcloud.models.BareMetalMachinePowerState": null, - "azure.mgmt.networkcloud.models.BareMetalMachineProvisioningState": null, - "azure.mgmt.networkcloud.models.BareMetalMachineReadyState": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkDetailedStatus": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkProvisioningState": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode": null, - "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatusStatus": null, - "azure.mgmt.networkcloud.models.ManagedServiceIdentityType": null, - "azure.mgmt.networkcloud.models.ClusterManagerDetailedStatus": null, - "azure.mgmt.networkcloud.models.ClusterManagerProvisioningState": null, - "azure.mgmt.networkcloud.models.ControlImpact": null, - "azure.mgmt.networkcloud.models.WorkloadImpact": null, - "azure.mgmt.networkcloud.models.ManagedServiceIdentitySelectorType": null, - "azure.mgmt.networkcloud.models.CommandOutputType": null, - "azure.mgmt.networkcloud.models.ClusterConnectionStatus": null, - "azure.mgmt.networkcloud.models.ClusterManagerConnectionStatus": null, - "azure.mgmt.networkcloud.models.ClusterType": null, - "azure.mgmt.networkcloud.models.ValidationThresholdGrouping": null, - "azure.mgmt.networkcloud.models.ValidationThresholdType": null, - "azure.mgmt.networkcloud.models.ClusterDetailedStatus": null, - "azure.mgmt.networkcloud.models.ClusterProvisioningState": null, - "azure.mgmt.networkcloud.models.RuntimeProtectionEnforcementLevel": null, - "azure.mgmt.networkcloud.models.ClusterSecretArchiveEnabled": null, - "azure.mgmt.networkcloud.models.ClusterUpdateStrategyType": null, - "azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan": null, - "azure.mgmt.networkcloud.models.AvailabilityLifecycle": null, - "azure.mgmt.networkcloud.models.FeatureDetailedStatus": null, - "azure.mgmt.networkcloud.models.KubernetesPluginType": null, - "azure.mgmt.networkcloud.models.L3NetworkConfigurationIpamEnabled": null, - "azure.mgmt.networkcloud.models.HugepagesSize": null, - "azure.mgmt.networkcloud.models.AgentPoolMode": null, - "azure.mgmt.networkcloud.models.AdvertiseToFabric": null, - "azure.mgmt.networkcloud.models.BfdEnabled": null, - "azure.mgmt.networkcloud.models.BgpMultiHop": null, - "azure.mgmt.networkcloud.models.DefaultGateway": null, - "azure.mgmt.networkcloud.models.VirtualMachineIPAllocationMethod": null, - "azure.mgmt.networkcloud.models.KubernetesClusterNodeDetailedStatus": null, - "azure.mgmt.networkcloud.models.KubernetesNodePowerState": null, - "azure.mgmt.networkcloud.models.KubernetesNodeRole": null, - "azure.mgmt.networkcloud.models.KubernetesClusterDetailedStatus": null, - "azure.mgmt.networkcloud.models.FabricPeeringEnabled": null, - "azure.mgmt.networkcloud.models.KubernetesClusterProvisioningState": null, - "azure.mgmt.networkcloud.models.L2NetworkDetailedStatus": null, - "azure.mgmt.networkcloud.models.HybridAksPluginType": null, - "azure.mgmt.networkcloud.models.L2NetworkProvisioningState": null, - "azure.mgmt.networkcloud.models.L3NetworkDetailedStatus": null, - "azure.mgmt.networkcloud.models.HybridAksIpamEnabled": null, - "azure.mgmt.networkcloud.models.IpAllocationType": null, - "azure.mgmt.networkcloud.models.L3NetworkProvisioningState": null, - "azure.mgmt.networkcloud.models.MachineSkuDiskConnectionType": null, - "azure.mgmt.networkcloud.models.DiskType": null, - "azure.mgmt.networkcloud.models.DeviceConnectionType": null, - "azure.mgmt.networkcloud.models.BootstrapProtocol": null, - "azure.mgmt.networkcloud.models.RackSkuProvisioningState": null, - "azure.mgmt.networkcloud.models.RackSkuType": null, - "azure.mgmt.networkcloud.models.RackDetailedStatus": null, - "azure.mgmt.networkcloud.models.RackProvisioningState": null, - "azure.mgmt.networkcloud.models.StorageApplianceDetailedStatus": null, - "azure.mgmt.networkcloud.models.StorageApplianceProvisioningState": null, - "azure.mgmt.networkcloud.models.RemoteVendorManagementFeature": null, - "azure.mgmt.networkcloud.models.RemoteVendorManagementStatus": null, - "azure.mgmt.networkcloud.models.TrunkedNetworkDetailedStatus": null, - "azure.mgmt.networkcloud.models.TrunkedNetworkProvisioningState": null, - "azure.mgmt.networkcloud.models.VirtualMachinePlacementHintType": null, - "azure.mgmt.networkcloud.models.VirtualMachineSchedulingExecution": null, - "azure.mgmt.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope": null, - "azure.mgmt.networkcloud.models.VirtualMachineBootMethod": null, - "azure.mgmt.networkcloud.models.VirtualMachineDetailedStatus": null, - "azure.mgmt.networkcloud.models.VirtualMachineIsolateEmulatorThread": null, - "azure.mgmt.networkcloud.models.VirtualMachinePowerState": null, - "azure.mgmt.networkcloud.models.VirtualMachineProvisioningState": null, - "azure.mgmt.networkcloud.models.OsDiskCreateOption": null, - "azure.mgmt.networkcloud.models.OsDiskDeleteOption": null, - "azure.mgmt.networkcloud.models.VirtualMachineVirtioInterfaceType": null, - "azure.mgmt.networkcloud.models.VirtualMachineDeviceModelType": null, - "azure.mgmt.networkcloud.models.VolumeDetailedStatus": null, - "azure.mgmt.networkcloud.models.VolumeProvisioningState": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetUserSetupStatus": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetDetailedStatus": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetPrivilegeLevel": null, - "azure.mgmt.networkcloud.models.BareMetalMachineKeySetProvisioningState": null, - "azure.mgmt.networkcloud.models.BmcKeySetDetailedStatus": null, - "azure.mgmt.networkcloud.models.BmcKeySetPrivilegeLevel": null, - "azure.mgmt.networkcloud.models.BmcKeySetProvisioningState": null, - "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationDetailedStatus": null, - "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProvisioningState": null, - "azure.mgmt.networkcloud.models.AgentPoolDetailedStatus": null, - "azure.mgmt.networkcloud.models.AgentPoolProvisioningState": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeatureAvailabilityLifecycle": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeatureDetailedStatus": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeatureProvisioningState": null, - "azure.mgmt.networkcloud.models.KubernetesClusterFeatureRequired": null, - "azure.mgmt.networkcloud.models.ConsoleDetailedStatus": null, - "azure.mgmt.networkcloud.models.ConsoleEnabled": null, - "azure.mgmt.networkcloud.models.ConsoleProvisioningState": null, - "azure.mgmt.networkcloud.models.BareMetalMachineEvacuate": null, - "azure.mgmt.networkcloud.models.BareMetalMachineSkipShutdown": null, - "azure.mgmt.networkcloud.models.BareMetalMachineReplaceSafeguardMode": null, - "azure.mgmt.networkcloud.models.BareMetalMachineReplaceStoragePolicy": null, - "azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionMachineGroupTargetingMode": null, - "azure.mgmt.networkcloud.models.ClusterScanRuntimeParametersScanActivity": null, - "azure.mgmt.networkcloud.models.RelayType": null, - "azure.mgmt.networkcloud.models.SkipShutdown": null, - "azure.mgmt.networkcloud.operations.Operations.list": null, - "azure.mgmt.networkcloud.aio.operations.Operations.list": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.get": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_cordon": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_cordon": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_power_off": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_power_off": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_reimage": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_reimage": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_replace": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_replace": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_restart": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_restart": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_command": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_command": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_data_extracts": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_data_extracts": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_data_extracts_restricted": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_data_extracts_restricted": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_read_commands": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_read_commands": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_start": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_start": null, - "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_uncordon": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_uncordon": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.get": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.get": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.ClusterManagersOperations.update": null, - "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.update": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.get": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_continue_update_version": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_continue_update_version": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_deploy": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_deploy": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_scan_runtime": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_scan_runtime": null, - "azure.mgmt.networkcloud.operations.ClustersOperations.begin_update_version": null, - "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_update_version": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.get": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_restart_node": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_restart_node": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.get": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.L2NetworksOperations.update": null, - "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.update": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.get": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.L3NetworksOperations.update": null, - "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.update": null, - "azure.mgmt.networkcloud.operations.RackSkusOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.RackSkusOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.RackSkusOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.RackSkusOperations.get": null, - "azure.mgmt.networkcloud.operations.RacksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.RacksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.RacksOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.get": null, - "azure.mgmt.networkcloud.operations.RacksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.RacksOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.RacksOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.get": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_disable_remote_vendor_management": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_disable_remote_vendor_management": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_enable_remote_vendor_management": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_enable_remote_vendor_management": null, - "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_run_read_commands": null, - "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_run_read_commands": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.get": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.update": null, - "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.update": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.get": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_assign_relay": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_assign_relay": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_power_off": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_power_off": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_reimage": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_reimage": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_restart": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_restart": null, - "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_start": null, - "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_start": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.list_by_subscription": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.list_by_resource_group": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.get": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.VolumesOperations.update": null, - "azure.mgmt.networkcloud.aio.operations.VolumesOperations.update": null, - "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.get": null, - "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.get": null, - "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.list_by_cluster": null, - "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.get": null, - "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.AgentPoolsOperations.list_by_kubernetes_cluster": null, - "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.list_by_kubernetes_cluster": null, - "azure.mgmt.networkcloud.operations.AgentPoolsOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.get": null, - "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.list_by_kubernetes_cluster": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.list_by_kubernetes_cluster": null, - "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.get": null, - "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_update": null, - "azure.mgmt.networkcloud.operations.ConsolesOperations.list_by_virtual_machine": null, - "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.list_by_virtual_machine": null, - "azure.mgmt.networkcloud.operations.ConsolesOperations.get": null, - "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.get": null, - "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_create_or_update": null, - "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_delete": null, - "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_delete": null, - "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_update": null, - "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_update": null + "azure.mgmt.networkcloud.models.AadConfiguration": "Microsoft.NetworkCloud.AadConfiguration", + "azure.mgmt.networkcloud.models.ActionState": "Microsoft.NetworkCloud.ActionState", + "azure.mgmt.networkcloud.models.AdministrativeCredentials": "Microsoft.NetworkCloud.AdministrativeCredentials", + "azure.mgmt.networkcloud.models.AdministratorConfiguration": "Microsoft.NetworkCloud.AdministratorConfiguration", + "azure.mgmt.networkcloud.models.AdministratorConfigurationPatch": "Microsoft.NetworkCloud.AdministratorConfigurationPatch", + "azure.mgmt.networkcloud.models.AgentOptions": "Microsoft.NetworkCloud.AgentOptions", + "azure.mgmt.networkcloud.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.networkcloud.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.networkcloud.models.AgentPool": "Microsoft.NetworkCloud.AgentPool", + "azure.mgmt.networkcloud.models.AgentPoolPatchParameters": "Microsoft.NetworkCloud.AgentPoolPatchParameters", + "azure.mgmt.networkcloud.models.AgentPoolPatchProperties": "Microsoft.NetworkCloud.AgentPoolPatchProperties", + "azure.mgmt.networkcloud.models.AgentPoolProperties": "Microsoft.NetworkCloud.AgentPoolProperties", + "azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings": "Microsoft.NetworkCloud.AgentPoolUpgradeSettings", + "azure.mgmt.networkcloud.models.AnalyticsOutputSettings": "Microsoft.NetworkCloud.AnalyticsOutputSettings", + "azure.mgmt.networkcloud.models.AttachedNetworkConfiguration": "Microsoft.NetworkCloud.AttachedNetworkConfiguration", + "azure.mgmt.networkcloud.models.AvailableUpgrade": "Microsoft.NetworkCloud.AvailableUpgrade", + "azure.mgmt.networkcloud.models.BareMetalMachine": "Microsoft.NetworkCloud.BareMetalMachine", + "azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification": "Microsoft.NetworkCloud.BareMetalMachineCommandSpecification", + "azure.mgmt.networkcloud.models.BareMetalMachineConfigurationData": "Microsoft.NetworkCloud.BareMetalMachineConfigurationData", + "azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters": "Microsoft.NetworkCloud.BareMetalMachineCordonParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySet": "Microsoft.NetworkCloud.BareMetalMachineKeySet", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters": "Microsoft.NetworkCloud.BareMetalMachineKeySetPatchParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchProperties": "Microsoft.NetworkCloud.BareMetalMachineKeySetPatchProperties", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetProperties": "Microsoft.NetworkCloud.BareMetalMachineKeySetProperties", + "azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters": "Microsoft.NetworkCloud.BareMetalMachinePatchParameters", + "azure.mgmt.networkcloud.models.BareMetalMachinePatchProperties": "Microsoft.NetworkCloud.BareMetalMachinePatchProperties", + "azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters": "Microsoft.NetworkCloud.BareMetalMachinePowerOffParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineProperties": "Microsoft.NetworkCloud.BareMetalMachineProperties", + "azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters": "Microsoft.NetworkCloud.BareMetalMachineReplaceParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters": "Microsoft.NetworkCloud.BareMetalMachineRunCommandParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters": "Microsoft.NetworkCloud.BareMetalMachineRunDataExtractsParameters", + "azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters": "Microsoft.NetworkCloud.BareMetalMachineRunReadCommandsParameters", + "azure.mgmt.networkcloud.models.BgpAdvertisement": "Microsoft.NetworkCloud.BgpAdvertisement", + "azure.mgmt.networkcloud.models.BgpServiceLoadBalancerConfiguration": "Microsoft.NetworkCloud.BgpServiceLoadBalancerConfiguration", + "azure.mgmt.networkcloud.models.BmcKeySet": "Microsoft.NetworkCloud.BmcKeySet", + "azure.mgmt.networkcloud.models.BmcKeySetPatchParameters": "Microsoft.NetworkCloud.BmcKeySetPatchParameters", + "azure.mgmt.networkcloud.models.BmcKeySetPatchProperties": "Microsoft.NetworkCloud.BmcKeySetPatchProperties", + "azure.mgmt.networkcloud.models.BmcKeySetProperties": "Microsoft.NetworkCloud.BmcKeySetProperties", + "azure.mgmt.networkcloud.models.CertificateInfo": "Microsoft.NetworkCloud.CertificateInfo", + "azure.mgmt.networkcloud.models.CloudServicesNetwork": "Microsoft.NetworkCloud.CloudServicesNetwork", + "azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters": "Microsoft.NetworkCloud.CloudServicesNetworkPatchParameters", + "azure.mgmt.networkcloud.models.CloudServicesNetworkPatchProperties": "Microsoft.NetworkCloud.CloudServicesNetworkPatchProperties", + "azure.mgmt.networkcloud.models.CloudServicesNetworkProperties": "Microsoft.NetworkCloud.CloudServicesNetworkProperties", + "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptions": "Microsoft.NetworkCloud.CloudServicesNetworkStorageOptions", + "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptionsPatch": "Microsoft.NetworkCloud.CloudServicesNetworkStorageOptionsPatch", + "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatus": "Microsoft.NetworkCloud.CloudServicesNetworkStorageStatus", + "azure.mgmt.networkcloud.models.Cluster": "Microsoft.NetworkCloud.Cluster", + "azure.mgmt.networkcloud.models.ClusterAvailableUpgradeVersion": "Microsoft.NetworkCloud.ClusterAvailableUpgradeVersion", + "azure.mgmt.networkcloud.models.ClusterAvailableVersion": "Microsoft.NetworkCloud.ClusterAvailableVersion", + "azure.mgmt.networkcloud.models.ClusterCapacity": "Microsoft.NetworkCloud.ClusterCapacity", + "azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters": "Microsoft.NetworkCloud.ClusterContinueUpdateVersionParameters", + "azure.mgmt.networkcloud.models.ClusterDeployParameters": "Microsoft.NetworkCloud.ClusterDeployParameters", + "azure.mgmt.networkcloud.models.ClusterManager": "Microsoft.NetworkCloud.ClusterManager", + "azure.mgmt.networkcloud.models.ClusterManagerPatchParameters": "Microsoft.NetworkCloud.ClusterManagerPatchParameters", + "azure.mgmt.networkcloud.models.ClusterManagerProperties": "Microsoft.NetworkCloud.ClusterManagerProperties", + "azure.mgmt.networkcloud.models.ClusterMetricsConfiguration": "Microsoft.NetworkCloud.ClusterMetricsConfiguration", + "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters": "Microsoft.NetworkCloud.ClusterMetricsConfigurationPatchParameters", + "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchProperties": "Microsoft.NetworkCloud.ClusterMetricsConfigurationPatchProperties", + "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProperties": "Microsoft.NetworkCloud.ClusterMetricsConfigurationProperties", + "azure.mgmt.networkcloud.models.ClusterPatchParameters": "Microsoft.NetworkCloud.ClusterPatchParameters", + "azure.mgmt.networkcloud.models.ClusterPatchProperties": "Microsoft.NetworkCloud.ClusterPatchProperties", + "azure.mgmt.networkcloud.models.ClusterProperties": "Microsoft.NetworkCloud.ClusterProperties", + "azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters": "Microsoft.NetworkCloud.ClusterScanRuntimeParameters", + "azure.mgmt.networkcloud.models.ClusterSecretArchive": "Microsoft.NetworkCloud.ClusterSecretArchive", + "azure.mgmt.networkcloud.models.ClusterUpdateStrategy": "Microsoft.NetworkCloud.ClusterUpdateStrategy", + "azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters": "Microsoft.NetworkCloud.ClusterUpdateVersionParameters", + "azure.mgmt.networkcloud.models.CommandOutputOverride": "Microsoft.NetworkCloud.CommandOutputOverride", + "azure.mgmt.networkcloud.models.CommandOutputSettings": "Microsoft.NetworkCloud.CommandOutputSettings", + "azure.mgmt.networkcloud.models.Console": "Microsoft.NetworkCloud.Console", + "azure.mgmt.networkcloud.models.ConsolePatchParameters": "Microsoft.NetworkCloud.ConsolePatchParameters", + "azure.mgmt.networkcloud.models.ConsolePatchProperties": "Microsoft.NetworkCloud.ConsolePatchProperties", + "azure.mgmt.networkcloud.models.ConsoleProperties": "Microsoft.NetworkCloud.ConsoleProperties", + "azure.mgmt.networkcloud.models.ControlPlaneNodeConfiguration": "Microsoft.NetworkCloud.ControlPlaneNodeConfiguration", + "azure.mgmt.networkcloud.models.ControlPlaneNodePatchConfiguration": "Microsoft.NetworkCloud.ControlPlaneNodePatchConfiguration", + "azure.mgmt.networkcloud.models.EgressEndpoint": "Microsoft.NetworkCloud.EgressEndpoint", + "azure.mgmt.networkcloud.models.EndpointDependency": "Microsoft.NetworkCloud.EndpointDependency", + "azure.mgmt.networkcloud.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.networkcloud.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.networkcloud.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.networkcloud.models.ExtendedLocation": "Azure.ResourceManager.CommonTypes.ExtendedLocation", + "azure.mgmt.networkcloud.models.FeatureStatus": "Microsoft.NetworkCloud.FeatureStatus", + "azure.mgmt.networkcloud.models.HardwareInventory": "Microsoft.NetworkCloud.HardwareInventory", + "azure.mgmt.networkcloud.models.HardwareInventoryNetworkInterface": "Microsoft.NetworkCloud.HardwareInventoryNetworkInterface", + "azure.mgmt.networkcloud.models.HardwareValidationStatus": "Microsoft.NetworkCloud.HardwareValidationStatus", + "azure.mgmt.networkcloud.models.IdentitySelector": "Microsoft.NetworkCloud.IdentitySelector", + "azure.mgmt.networkcloud.models.ImageRepositoryCredentials": "Microsoft.NetworkCloud.ImageRepositoryCredentials", + "azure.mgmt.networkcloud.models.InitialAgentPoolConfiguration": "Microsoft.NetworkCloud.InitialAgentPoolConfiguration", + "azure.mgmt.networkcloud.models.IpAddressPool": "Microsoft.NetworkCloud.IpAddressPool", + "azure.mgmt.networkcloud.models.KeySetUser": "Microsoft.NetworkCloud.KeySetUser", + "azure.mgmt.networkcloud.models.KeySetUserStatus": "Microsoft.NetworkCloud.KeySetUserStatus", + "azure.mgmt.networkcloud.models.KubernetesCluster": "Microsoft.NetworkCloud.KubernetesCluster", + "azure.mgmt.networkcloud.models.KubernetesClusterFeature": "Microsoft.NetworkCloud.KubernetesClusterFeature", + "azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters": "Microsoft.NetworkCloud.KubernetesClusterFeaturePatchParameters", + "azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchProperties": "Microsoft.NetworkCloud.KubernetesClusterFeaturePatchProperties", + "azure.mgmt.networkcloud.models.KubernetesClusterFeatureProperties": "Microsoft.NetworkCloud.KubernetesClusterFeatureProperties", + "azure.mgmt.networkcloud.models.KubernetesClusterNode": "Microsoft.NetworkCloud.KubernetesClusterNode", + "azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters": "Microsoft.NetworkCloud.KubernetesClusterPatchParameters", + "azure.mgmt.networkcloud.models.KubernetesClusterPatchProperties": "Microsoft.NetworkCloud.KubernetesClusterPatchProperties", + "azure.mgmt.networkcloud.models.KubernetesClusterProperties": "Microsoft.NetworkCloud.KubernetesClusterProperties", + "azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters": "Microsoft.NetworkCloud.KubernetesClusterRestartNodeParameters", + "azure.mgmt.networkcloud.models.KubernetesLabel": "Microsoft.NetworkCloud.KubernetesLabel", + "azure.mgmt.networkcloud.models.L2Network": "Microsoft.NetworkCloud.L2Network", + "azure.mgmt.networkcloud.models.L2NetworkAttachmentConfiguration": "Microsoft.NetworkCloud.L2NetworkAttachmentConfiguration", + "azure.mgmt.networkcloud.models.L2NetworkPatchParameters": "Microsoft.NetworkCloud.L2NetworkPatchParameters", + "azure.mgmt.networkcloud.models.L2NetworkProperties": "Microsoft.NetworkCloud.L2NetworkProperties", + "azure.mgmt.networkcloud.models.L2ServiceLoadBalancerConfiguration": "Microsoft.NetworkCloud.L2ServiceLoadBalancerConfiguration", + "azure.mgmt.networkcloud.models.L3Network": "Microsoft.NetworkCloud.L3Network", + "azure.mgmt.networkcloud.models.L3NetworkAttachmentConfiguration": "Microsoft.NetworkCloud.L3NetworkAttachmentConfiguration", + "azure.mgmt.networkcloud.models.L3NetworkPatchParameters": "Microsoft.NetworkCloud.L3NetworkPatchParameters", + "azure.mgmt.networkcloud.models.L3NetworkProperties": "Microsoft.NetworkCloud.L3NetworkProperties", + "azure.mgmt.networkcloud.models.LldpNeighbor": "Microsoft.NetworkCloud.LldpNeighbor", + "azure.mgmt.networkcloud.models.MachineDisk": "Microsoft.NetworkCloud.MachineDisk", + "azure.mgmt.networkcloud.models.MachineSkuProperties": "Microsoft.NetworkCloud.MachineSkuProperties", + "azure.mgmt.networkcloud.models.MachineSkuSlot": "Microsoft.NetworkCloud.MachineSkuSlot", + "azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration": "Microsoft.NetworkCloud.ManagedResourceGroupConfiguration", + "azure.mgmt.networkcloud.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.networkcloud.models.NetworkAttachment": "Microsoft.NetworkCloud.NetworkAttachment", + "azure.mgmt.networkcloud.models.NetworkConfiguration": "Microsoft.NetworkCloud.NetworkConfiguration", + "azure.mgmt.networkcloud.models.NetworkInterface": "Microsoft.NetworkCloud.NetworkInterface", + "azure.mgmt.networkcloud.models.Nic": "Microsoft.NetworkCloud.Nic", + "azure.mgmt.networkcloud.models.NodePoolAdministratorConfigurationPatch": "Microsoft.NetworkCloud.NodePoolAdministratorConfigurationPatch", + "azure.mgmt.networkcloud.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.networkcloud.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.networkcloud.models.OperationStatusResult": "Microsoft.NetworkCloud.OperationStatusResult", + "azure.mgmt.networkcloud.models.OperationStatusResultProperties": "Microsoft.NetworkCloud.OperationStatusResultProperties", + "azure.mgmt.networkcloud.models.OsDisk": "Microsoft.NetworkCloud.OsDisk", + "azure.mgmt.networkcloud.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.networkcloud.models.Rack": "Microsoft.NetworkCloud.Rack", + "azure.mgmt.networkcloud.models.RackDefinition": "Microsoft.NetworkCloud.RackDefinition", + "azure.mgmt.networkcloud.models.RackPatchParameters": "Microsoft.NetworkCloud.RackPatchParameters", + "azure.mgmt.networkcloud.models.RackProperties": "Microsoft.NetworkCloud.RackProperties", + "azure.mgmt.networkcloud.models.RackSku": "Microsoft.NetworkCloud.RackSku", + "azure.mgmt.networkcloud.models.RackSkuProperties": "Microsoft.NetworkCloud.RackSkuProperties", + "azure.mgmt.networkcloud.models.RacksPatchProperties": "Microsoft.NetworkCloud.RacksPatchProperties", + "azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration": "Microsoft.NetworkCloud.RuntimeProtectionConfiguration", + "azure.mgmt.networkcloud.models.RuntimeProtectionStatus": "Microsoft.NetworkCloud.RuntimeProtectionStatus", + "azure.mgmt.networkcloud.models.SecretArchiveReference": "Microsoft.NetworkCloud.SecretArchiveReference", + "azure.mgmt.networkcloud.models.SecretArchiveSettings": "Microsoft.NetworkCloud.SecretArchiveSettings", + "azure.mgmt.networkcloud.models.SecretRotationStatus": "Microsoft.NetworkCloud.SecretRotationStatus", + "azure.mgmt.networkcloud.models.ServiceLoadBalancerBgpPeer": "Microsoft.NetworkCloud.ServiceLoadBalancerBgpPeer", + "azure.mgmt.networkcloud.models.ServicePrincipalInformation": "Microsoft.NetworkCloud.ServicePrincipalInformation", + "azure.mgmt.networkcloud.models.SshPublicKey": "Microsoft.NetworkCloud.SshPublicKey", + "azure.mgmt.networkcloud.models.StepState": "Microsoft.NetworkCloud.StepState", + "azure.mgmt.networkcloud.models.StorageAppliance": "Microsoft.NetworkCloud.StorageAppliance", + "azure.mgmt.networkcloud.models.StorageApplianceCommandSpecification": "Microsoft.NetworkCloud.StorageApplianceCommandSpecification", + "azure.mgmt.networkcloud.models.StorageApplianceConfigurationData": "Microsoft.NetworkCloud.StorageApplianceConfigurationData", + "azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters": "Microsoft.NetworkCloud.StorageApplianceEnableRemoteVendorManagementParameters", + "azure.mgmt.networkcloud.models.StorageAppliancePatchParameters": "Microsoft.NetworkCloud.StorageAppliancePatchParameters", + "azure.mgmt.networkcloud.models.StorageAppliancePatchProperties": "Microsoft.NetworkCloud.StorageAppliancePatchProperties", + "azure.mgmt.networkcloud.models.StorageApplianceProperties": "Microsoft.NetworkCloud.StorageApplianceProperties", + "azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters": "Microsoft.NetworkCloud.StorageApplianceRunReadCommandsParameters", + "azure.mgmt.networkcloud.models.StorageApplianceSkuProperties": "Microsoft.NetworkCloud.StorageApplianceSkuProperties", + "azure.mgmt.networkcloud.models.StorageApplianceSkuSlot": "Microsoft.NetworkCloud.StorageApplianceSkuSlot", + "azure.mgmt.networkcloud.models.StorageProfile": "Microsoft.NetworkCloud.StorageProfile", + "azure.mgmt.networkcloud.models.StringKeyValuePair": "Microsoft.NetworkCloud.StringKeyValuePair", + "azure.mgmt.networkcloud.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.networkcloud.models.TrunkedNetwork": "Microsoft.NetworkCloud.TrunkedNetwork", + "azure.mgmt.networkcloud.models.TrunkedNetworkAttachmentConfiguration": "Microsoft.NetworkCloud.TrunkedNetworkAttachmentConfiguration", + "azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters": "Microsoft.NetworkCloud.TrunkedNetworkPatchParameters", + "azure.mgmt.networkcloud.models.TrunkedNetworkProperties": "Microsoft.NetworkCloud.TrunkedNetworkProperties", + "azure.mgmt.networkcloud.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.networkcloud.models.ValidationThreshold": "Microsoft.NetworkCloud.ValidationThreshold", + "azure.mgmt.networkcloud.models.VirtualMachine": "Microsoft.NetworkCloud.VirtualMachine", + "azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters": "Microsoft.NetworkCloud.VirtualMachineAssignRelayParameters", + "azure.mgmt.networkcloud.models.VirtualMachinePatchParameters": "Microsoft.NetworkCloud.VirtualMachinePatchParameters", + "azure.mgmt.networkcloud.models.VirtualMachinePatchProperties": "Microsoft.NetworkCloud.VirtualMachinePatchProperties", + "azure.mgmt.networkcloud.models.VirtualMachinePlacementHint": "Microsoft.NetworkCloud.VirtualMachinePlacementHint", + "azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters": "Microsoft.NetworkCloud.VirtualMachinePowerOffParameters", + "azure.mgmt.networkcloud.models.VirtualMachineProperties": "Microsoft.NetworkCloud.VirtualMachineProperties", + "azure.mgmt.networkcloud.models.Volume": "Microsoft.NetworkCloud.Volume", + "azure.mgmt.networkcloud.models.VolumePatchParameters": "Microsoft.NetworkCloud.VolumePatchParameters", + "azure.mgmt.networkcloud.models.VolumeProperties": "Microsoft.NetworkCloud.VolumeProperties", + "azure.mgmt.networkcloud.models.VulnerabilityScanningSettings": "Microsoft.NetworkCloud.VulnerabilityScanningSettings", + "azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsPatch": "Microsoft.NetworkCloud.VulnerabilityScanningSettingsPatch", + "azure.mgmt.networkcloud.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.networkcloud.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.networkcloud.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.networkcloud.models.ActionStateStatus": "Microsoft.NetworkCloud.ActionStateStatus", + "azure.mgmt.networkcloud.models.StepStateStatus": "Microsoft.NetworkCloud.StepStateStatus", + "azure.mgmt.networkcloud.models.BareMetalMachineCordonStatus": "Microsoft.NetworkCloud.BareMetalMachineCordonStatus", + "azure.mgmt.networkcloud.models.BareMetalMachineDetailedStatus": "Microsoft.NetworkCloud.BareMetalMachineDetailedStatus", + "azure.mgmt.networkcloud.models.BareMetalMachineHardwareValidationResult": "Microsoft.NetworkCloud.BareMetalMachineHardwareValidationResult", + "azure.mgmt.networkcloud.models.BareMetalMachinePowerState": "Microsoft.NetworkCloud.BareMetalMachinePowerState", + "azure.mgmt.networkcloud.models.BareMetalMachineReadyState": "Microsoft.NetworkCloud.BareMetalMachineReadyState", + "azure.mgmt.networkcloud.models.BareMetalMachineProvisioningState": "Microsoft.NetworkCloud.BareMetalMachineProvisioningState", + "azure.mgmt.networkcloud.models.ExtendedLocationType": "Azure.ResourceManager.CommonTypes.ExtendedLocationType", + "azure.mgmt.networkcloud.models.BareMetalMachineEvacuate": "Microsoft.NetworkCloud.BareMetalMachineEvacuate", + "azure.mgmt.networkcloud.models.BareMetalMachineSkipShutdown": "Microsoft.NetworkCloud.BareMetalMachineSkipShutdown", + "azure.mgmt.networkcloud.models.BareMetalMachineReplaceSafeguardMode": "Microsoft.NetworkCloud.BareMetalMachineReplaceSafeguardMode", + "azure.mgmt.networkcloud.models.BareMetalMachineReplaceStoragePolicy": "Microsoft.NetworkCloud.BareMetalMachineReplaceStoragePolicy", + "azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints": "Microsoft.NetworkCloud.CloudServicesNetworkEnableDefaultEgressEndpoints", + "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode": "Microsoft.NetworkCloud.CloudServicesNetworkStorageMode", + "azure.mgmt.networkcloud.models.CloudServicesNetworkDetailedStatus": "Microsoft.NetworkCloud.CloudServicesNetworkDetailedStatus", + "azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatusStatus": "Microsoft.NetworkCloud.CloudServicesNetworkStorageStatusStatus", + "azure.mgmt.networkcloud.models.CloudServicesNetworkProvisioningState": "Microsoft.NetworkCloud.CloudServicesNetworkProvisioningState", + "azure.mgmt.networkcloud.models.ClusterManagerDetailedStatus": "Microsoft.NetworkCloud.ClusterManagerDetailedStatus", + "azure.mgmt.networkcloud.models.ClusterManagerProvisioningState": "Microsoft.NetworkCloud.ClusterManagerProvisioningState", + "azure.mgmt.networkcloud.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.networkcloud.models.ManagedServiceIdentitySelectorType": "Microsoft.NetworkCloud.ManagedServiceIdentitySelectorType", + "azure.mgmt.networkcloud.models.ClusterType": "Microsoft.NetworkCloud.ClusterType", + "azure.mgmt.networkcloud.models.CommandOutputType": "Microsoft.NetworkCloud.CommandOutputType", + "azure.mgmt.networkcloud.models.ValidationThresholdGrouping": "Microsoft.NetworkCloud.ValidationThresholdGrouping", + "azure.mgmt.networkcloud.models.ValidationThresholdType": "Microsoft.NetworkCloud.ValidationThresholdType", + "azure.mgmt.networkcloud.models.RuntimeProtectionEnforcementLevel": "Microsoft.NetworkCloud.RuntimeProtectionEnforcementLevel", + "azure.mgmt.networkcloud.models.ClusterSecretArchiveEnabled": "Microsoft.NetworkCloud.ClusterSecretArchiveEnabled", + "azure.mgmt.networkcloud.models.ClusterUpdateStrategyType": "Microsoft.NetworkCloud.ClusterUpdateStrategyType", + "azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan": "Microsoft.NetworkCloud.VulnerabilityScanningSettingsContainerScan", + "azure.mgmt.networkcloud.models.ControlImpact": "Microsoft.NetworkCloud.ControlImpact", + "azure.mgmt.networkcloud.models.WorkloadImpact": "Microsoft.NetworkCloud.WorkloadImpact", + "azure.mgmt.networkcloud.models.ClusterConnectionStatus": "Microsoft.NetworkCloud.ClusterConnectionStatus", + "azure.mgmt.networkcloud.models.ClusterManagerConnectionStatus": "Microsoft.NetworkCloud.ClusterManagerConnectionStatus", + "azure.mgmt.networkcloud.models.ClusterDetailedStatus": "Microsoft.NetworkCloud.ClusterDetailedStatus", + "azure.mgmt.networkcloud.models.ClusterProvisioningState": "Microsoft.NetworkCloud.ClusterProvisioningState", + "azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionMachineGroupTargetingMode": "Microsoft.NetworkCloud.ClusterContinueUpdateVersionMachineGroupTargetingMode", + "azure.mgmt.networkcloud.models.ClusterScanRuntimeParametersScanActivity": "Microsoft.NetworkCloud.ClusterScanRuntimeParametersScanActivity", + "azure.mgmt.networkcloud.models.HugepagesSize": "Microsoft.NetworkCloud.HugepagesSize", + "azure.mgmt.networkcloud.models.KubernetesPluginType": "Microsoft.NetworkCloud.KubernetesPluginType", + "azure.mgmt.networkcloud.models.L3NetworkConfigurationIpamEnabled": "Microsoft.NetworkCloud.L3NetworkConfigurationIpamEnabled", + "azure.mgmt.networkcloud.models.AgentPoolMode": "Microsoft.NetworkCloud.AgentPoolMode", + "azure.mgmt.networkcloud.models.AdvertiseToFabric": "Microsoft.NetworkCloud.AdvertiseToFabric", + "azure.mgmt.networkcloud.models.BfdEnabled": "Microsoft.NetworkCloud.BfdEnabled", + "azure.mgmt.networkcloud.models.BgpMultiHop": "Microsoft.NetworkCloud.BgpMultiHop", + "azure.mgmt.networkcloud.models.FabricPeeringEnabled": "Microsoft.NetworkCloud.FabricPeeringEnabled", + "azure.mgmt.networkcloud.models.AvailabilityLifecycle": "Microsoft.NetworkCloud.AvailabilityLifecycle", + "azure.mgmt.networkcloud.models.KubernetesClusterDetailedStatus": "Microsoft.NetworkCloud.KubernetesClusterDetailedStatus", + "azure.mgmt.networkcloud.models.FeatureDetailedStatus": "Microsoft.NetworkCloud.FeatureDetailedStatus", + "azure.mgmt.networkcloud.models.KubernetesClusterNodeDetailedStatus": "Microsoft.NetworkCloud.KubernetesClusterNodeDetailedStatus", + "azure.mgmt.networkcloud.models.DefaultGateway": "Microsoft.NetworkCloud.DefaultGateway", + "azure.mgmt.networkcloud.models.VirtualMachineIPAllocationMethod": "Microsoft.NetworkCloud.VirtualMachineIPAllocationMethod", + "azure.mgmt.networkcloud.models.KubernetesNodePowerState": "Microsoft.NetworkCloud.KubernetesNodePowerState", + "azure.mgmt.networkcloud.models.KubernetesNodeRole": "Microsoft.NetworkCloud.KubernetesNodeRole", + "azure.mgmt.networkcloud.models.KubernetesClusterProvisioningState": "Microsoft.NetworkCloud.KubernetesClusterProvisioningState", + "azure.mgmt.networkcloud.models.HybridAksPluginType": "Microsoft.NetworkCloud.HybridAksPluginType", + "azure.mgmt.networkcloud.models.L2NetworkDetailedStatus": "Microsoft.NetworkCloud.L2NetworkDetailedStatus", + "azure.mgmt.networkcloud.models.L2NetworkProvisioningState": "Microsoft.NetworkCloud.L2NetworkProvisioningState", + "azure.mgmt.networkcloud.models.HybridAksIpamEnabled": "Microsoft.NetworkCloud.HybridAksIpamEnabled", + "azure.mgmt.networkcloud.models.IpAllocationType": "Microsoft.NetworkCloud.IpAllocationType", + "azure.mgmt.networkcloud.models.L3NetworkDetailedStatus": "Microsoft.NetworkCloud.L3NetworkDetailedStatus", + "azure.mgmt.networkcloud.models.L3NetworkProvisioningState": "Microsoft.NetworkCloud.L3NetworkProvisioningState", + "azure.mgmt.networkcloud.models.BootstrapProtocol": "Microsoft.NetworkCloud.BootstrapProtocol", + "azure.mgmt.networkcloud.models.MachineSkuDiskConnectionType": "Microsoft.NetworkCloud.MachineSkuDiskConnectionType", + "azure.mgmt.networkcloud.models.DiskType": "Microsoft.NetworkCloud.DiskType", + "azure.mgmt.networkcloud.models.DeviceConnectionType": "Microsoft.NetworkCloud.DeviceConnectionType", + "azure.mgmt.networkcloud.models.RackSkuProvisioningState": "Microsoft.NetworkCloud.RackSkuProvisioningState", + "azure.mgmt.networkcloud.models.RackSkuType": "Microsoft.NetworkCloud.RackSkuType", + "azure.mgmt.networkcloud.models.RackDetailedStatus": "Microsoft.NetworkCloud.RackDetailedStatus", + "azure.mgmt.networkcloud.models.RackProvisioningState": "Microsoft.NetworkCloud.RackProvisioningState", + "azure.mgmt.networkcloud.models.StorageApplianceDetailedStatus": "Microsoft.NetworkCloud.StorageApplianceDetailedStatus", + "azure.mgmt.networkcloud.models.RemoteVendorManagementFeature": "Microsoft.NetworkCloud.RemoteVendorManagementFeature", + "azure.mgmt.networkcloud.models.RemoteVendorManagementStatus": "Microsoft.NetworkCloud.RemoteVendorManagementStatus", + "azure.mgmt.networkcloud.models.StorageApplianceProvisioningState": "Microsoft.NetworkCloud.StorageApplianceProvisioningState", + "azure.mgmt.networkcloud.models.TrunkedNetworkDetailedStatus": "Microsoft.NetworkCloud.TrunkedNetworkDetailedStatus", + "azure.mgmt.networkcloud.models.TrunkedNetworkProvisioningState": "Microsoft.NetworkCloud.TrunkedNetworkProvisioningState", + "azure.mgmt.networkcloud.models.VirtualMachineBootMethod": "Microsoft.NetworkCloud.VirtualMachineBootMethod", + "azure.mgmt.networkcloud.models.VirtualMachineIsolateEmulatorThread": "Microsoft.NetworkCloud.VirtualMachineIsolateEmulatorThread", + "azure.mgmt.networkcloud.models.VirtualMachinePlacementHintType": "Microsoft.NetworkCloud.VirtualMachinePlacementHintType", + "azure.mgmt.networkcloud.models.VirtualMachineSchedulingExecution": "Microsoft.NetworkCloud.VirtualMachineSchedulingExecution", + "azure.mgmt.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope": "Microsoft.NetworkCloud.VirtualMachinePlacementHintPodAffinityScope", + "azure.mgmt.networkcloud.models.OsDiskCreateOption": "Microsoft.NetworkCloud.OsDiskCreateOption", + "azure.mgmt.networkcloud.models.OsDiskDeleteOption": "Microsoft.NetworkCloud.OsDiskDeleteOption", + "azure.mgmt.networkcloud.models.VirtualMachineVirtioInterfaceType": "Microsoft.NetworkCloud.VirtualMachineVirtioInterfaceType", + "azure.mgmt.networkcloud.models.VirtualMachineDeviceModelType": "Microsoft.NetworkCloud.VirtualMachineDeviceModelType", + "azure.mgmt.networkcloud.models.VirtualMachineDetailedStatus": "Microsoft.NetworkCloud.VirtualMachineDetailedStatus", + "azure.mgmt.networkcloud.models.VirtualMachinePowerState": "Microsoft.NetworkCloud.VirtualMachinePowerState", + "azure.mgmt.networkcloud.models.VirtualMachineProvisioningState": "Microsoft.NetworkCloud.VirtualMachineProvisioningState", + "azure.mgmt.networkcloud.models.RelayType": "Microsoft.NetworkCloud.RelayType", + "azure.mgmt.networkcloud.models.SkipShutdown": "Microsoft.NetworkCloud.SkipShutdown", + "azure.mgmt.networkcloud.models.VolumeDetailedStatus": "Microsoft.NetworkCloud.VolumeDetailedStatus", + "azure.mgmt.networkcloud.models.VolumeProvisioningState": "Microsoft.NetworkCloud.VolumeProvisioningState", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetPrivilegeLevel": "Microsoft.NetworkCloud.BareMetalMachineKeySetPrivilegeLevel", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetDetailedStatus": "Microsoft.NetworkCloud.BareMetalMachineKeySetDetailedStatus", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetUserSetupStatus": "Microsoft.NetworkCloud.BareMetalMachineKeySetUserSetupStatus", + "azure.mgmt.networkcloud.models.BareMetalMachineKeySetProvisioningState": "Microsoft.NetworkCloud.BareMetalMachineKeySetProvisioningState", + "azure.mgmt.networkcloud.models.BmcKeySetPrivilegeLevel": "Microsoft.NetworkCloud.BmcKeySetPrivilegeLevel", + "azure.mgmt.networkcloud.models.BmcKeySetDetailedStatus": "Microsoft.NetworkCloud.BmcKeySetDetailedStatus", + "azure.mgmt.networkcloud.models.BmcKeySetProvisioningState": "Microsoft.NetworkCloud.BmcKeySetProvisioningState", + "azure.mgmt.networkcloud.models.AgentPoolDetailedStatus": "Microsoft.NetworkCloud.AgentPoolDetailedStatus", + "azure.mgmt.networkcloud.models.AgentPoolProvisioningState": "Microsoft.NetworkCloud.AgentPoolProvisioningState", + "azure.mgmt.networkcloud.models.KubernetesClusterFeatureAvailabilityLifecycle": "Microsoft.NetworkCloud.KubernetesClusterFeatureAvailabilityLifecycle", + "azure.mgmt.networkcloud.models.KubernetesClusterFeatureDetailedStatus": "Microsoft.NetworkCloud.KubernetesClusterFeatureDetailedStatus", + "azure.mgmt.networkcloud.models.KubernetesClusterFeatureRequired": "Microsoft.NetworkCloud.KubernetesClusterFeatureRequired", + "azure.mgmt.networkcloud.models.KubernetesClusterFeatureProvisioningState": "Microsoft.NetworkCloud.KubernetesClusterFeatureProvisioningState", + "azure.mgmt.networkcloud.models.ConsoleEnabled": "Microsoft.NetworkCloud.ConsoleEnabled", + "azure.mgmt.networkcloud.models.ConsoleDetailedStatus": "Microsoft.NetworkCloud.ConsoleDetailedStatus", + "azure.mgmt.networkcloud.models.ConsoleProvisioningState": "Microsoft.NetworkCloud.ConsoleProvisioningState", + "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationDetailedStatus": "Microsoft.NetworkCloud.ClusterMetricsConfigurationDetailedStatus", + "azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProvisioningState": "Microsoft.NetworkCloud.ClusterMetricsConfigurationProvisioningState", + "azure.mgmt.networkcloud.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.networkcloud.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.get": "Microsoft.NetworkCloud.BareMetalMachines.get", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.get": "Microsoft.NetworkCloud.BareMetalMachines.get", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_create_or_update": "Microsoft.NetworkCloud.BareMetalMachines.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_create_or_update": "Microsoft.NetworkCloud.BareMetalMachines.createOrUpdate", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_update": "Microsoft.NetworkCloud.BareMetalMachines.update", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_update": "Microsoft.NetworkCloud.BareMetalMachines.update", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_delete": "Microsoft.NetworkCloud.BareMetalMachines.delete", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_delete": "Microsoft.NetworkCloud.BareMetalMachines.delete", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.list_by_resource_group": "Microsoft.NetworkCloud.BareMetalMachines.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.list_by_resource_group": "Microsoft.NetworkCloud.BareMetalMachines.listByResourceGroup", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.list_by_subscription": "Microsoft.NetworkCloud.BareMetalMachines.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.list_by_subscription": "Microsoft.NetworkCloud.BareMetalMachines.listBySubscription", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_cordon": "Microsoft.NetworkCloud.BareMetalMachines.cordon", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_cordon": "Microsoft.NetworkCloud.BareMetalMachines.cordon", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_power_off": "Microsoft.NetworkCloud.BareMetalMachines.powerOff", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_power_off": "Microsoft.NetworkCloud.BareMetalMachines.powerOff", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_reimage": "Microsoft.NetworkCloud.BareMetalMachines.reimage", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_reimage": "Microsoft.NetworkCloud.BareMetalMachines.reimage", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_replace": "Microsoft.NetworkCloud.BareMetalMachines.replace", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_replace": "Microsoft.NetworkCloud.BareMetalMachines.replace", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_restart": "Microsoft.NetworkCloud.BareMetalMachines.restart", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_restart": "Microsoft.NetworkCloud.BareMetalMachines.restart", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_command": "Microsoft.NetworkCloud.BareMetalMachines.runCommand", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_command": "Microsoft.NetworkCloud.BareMetalMachines.runCommand", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_data_extracts": "Microsoft.NetworkCloud.BareMetalMachines.runDataExtracts", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_data_extracts": "Microsoft.NetworkCloud.BareMetalMachines.runDataExtracts", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_data_extracts_restricted": "Microsoft.NetworkCloud.BareMetalMachines.runDataExtractsRestricted", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_data_extracts_restricted": "Microsoft.NetworkCloud.BareMetalMachines.runDataExtractsRestricted", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_run_read_commands": "Microsoft.NetworkCloud.BareMetalMachines.runReadCommands", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_run_read_commands": "Microsoft.NetworkCloud.BareMetalMachines.runReadCommands", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_start": "Microsoft.NetworkCloud.BareMetalMachines.start", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_start": "Microsoft.NetworkCloud.BareMetalMachines.start", + "azure.mgmt.networkcloud.operations.BareMetalMachinesOperations.begin_uncordon": "Microsoft.NetworkCloud.BareMetalMachines.uncordon", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachinesOperations.begin_uncordon": "Microsoft.NetworkCloud.BareMetalMachines.uncordon", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.get": "Microsoft.NetworkCloud.CloudServicesNetworks.get", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.get": "Microsoft.NetworkCloud.CloudServicesNetworks.get", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.CloudServicesNetworks.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.CloudServicesNetworks.createOrUpdate", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_update": "Microsoft.NetworkCloud.CloudServicesNetworks.update", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_update": "Microsoft.NetworkCloud.CloudServicesNetworks.update", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.begin_delete": "Microsoft.NetworkCloud.CloudServicesNetworks.delete", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.begin_delete": "Microsoft.NetworkCloud.CloudServicesNetworks.delete", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.CloudServicesNetworks.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.CloudServicesNetworks.listByResourceGroup", + "azure.mgmt.networkcloud.operations.CloudServicesNetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.CloudServicesNetworks.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.CloudServicesNetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.CloudServicesNetworks.listBySubscription", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.get": "Microsoft.NetworkCloud.ClusterManagers.get", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.get": "Microsoft.NetworkCloud.ClusterManagers.get", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.begin_create_or_update": "Microsoft.NetworkCloud.ClusterManagers.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.begin_create_or_update": "Microsoft.NetworkCloud.ClusterManagers.createOrUpdate", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.update": "Microsoft.NetworkCloud.ClusterManagers.update", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.update": "Microsoft.NetworkCloud.ClusterManagers.update", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.begin_delete": "Microsoft.NetworkCloud.ClusterManagers.delete", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.begin_delete": "Microsoft.NetworkCloud.ClusterManagers.delete", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.list_by_resource_group": "Microsoft.NetworkCloud.ClusterManagers.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.list_by_resource_group": "Microsoft.NetworkCloud.ClusterManagers.listByResourceGroup", + "azure.mgmt.networkcloud.operations.ClusterManagersOperations.list_by_subscription": "Microsoft.NetworkCloud.ClusterManagers.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.ClusterManagersOperations.list_by_subscription": "Microsoft.NetworkCloud.ClusterManagers.listBySubscription", + "azure.mgmt.networkcloud.operations.ClustersOperations.get": "Microsoft.NetworkCloud.Clusters.get", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.get": "Microsoft.NetworkCloud.Clusters.get", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_create_or_update": "Microsoft.NetworkCloud.Clusters.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_create_or_update": "Microsoft.NetworkCloud.Clusters.createOrUpdate", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_update": "Microsoft.NetworkCloud.Clusters.update", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_update": "Microsoft.NetworkCloud.Clusters.update", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_delete": "Microsoft.NetworkCloud.Clusters.delete", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_delete": "Microsoft.NetworkCloud.Clusters.delete", + "azure.mgmt.networkcloud.operations.ClustersOperations.list_by_resource_group": "Microsoft.NetworkCloud.Clusters.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.list_by_resource_group": "Microsoft.NetworkCloud.Clusters.listByResourceGroup", + "azure.mgmt.networkcloud.operations.ClustersOperations.list_by_subscription": "Microsoft.NetworkCloud.Clusters.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.list_by_subscription": "Microsoft.NetworkCloud.Clusters.listBySubscription", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_continue_update_version": "Microsoft.NetworkCloud.Clusters.continueUpdateVersion", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_continue_update_version": "Microsoft.NetworkCloud.Clusters.continueUpdateVersion", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_deploy": "Microsoft.NetworkCloud.Clusters.deploy", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_deploy": "Microsoft.NetworkCloud.Clusters.deploy", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_scan_runtime": "Microsoft.NetworkCloud.Clusters.scanRuntime", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_scan_runtime": "Microsoft.NetworkCloud.Clusters.scanRuntime", + "azure.mgmt.networkcloud.operations.ClustersOperations.begin_update_version": "Microsoft.NetworkCloud.Clusters.updateVersion", + "azure.mgmt.networkcloud.aio.operations.ClustersOperations.begin_update_version": "Microsoft.NetworkCloud.Clusters.updateVersion", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.get": "Microsoft.NetworkCloud.KubernetesClusters.get", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.get": "Microsoft.NetworkCloud.KubernetesClusters.get", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_create_or_update": "Microsoft.NetworkCloud.KubernetesClusters.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_create_or_update": "Microsoft.NetworkCloud.KubernetesClusters.createOrUpdate", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_update": "Microsoft.NetworkCloud.KubernetesClusters.update", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_update": "Microsoft.NetworkCloud.KubernetesClusters.update", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_delete": "Microsoft.NetworkCloud.KubernetesClusters.delete", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_delete": "Microsoft.NetworkCloud.KubernetesClusters.delete", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.list_by_resource_group": "Microsoft.NetworkCloud.KubernetesClusters.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.list_by_resource_group": "Microsoft.NetworkCloud.KubernetesClusters.listByResourceGroup", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.list_by_subscription": "Microsoft.NetworkCloud.KubernetesClusters.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.list_by_subscription": "Microsoft.NetworkCloud.KubernetesClusters.listBySubscription", + "azure.mgmt.networkcloud.operations.KubernetesClustersOperations.begin_restart_node": "Microsoft.NetworkCloud.KubernetesClusters.restartNode", + "azure.mgmt.networkcloud.aio.operations.KubernetesClustersOperations.begin_restart_node": "Microsoft.NetworkCloud.KubernetesClusters.restartNode", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.get": "Microsoft.NetworkCloud.L2Networks.get", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.get": "Microsoft.NetworkCloud.L2Networks.get", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.L2Networks.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.L2Networks.createOrUpdate", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.update": "Microsoft.NetworkCloud.L2Networks.update", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.update": "Microsoft.NetworkCloud.L2Networks.update", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.begin_delete": "Microsoft.NetworkCloud.L2Networks.delete", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.begin_delete": "Microsoft.NetworkCloud.L2Networks.delete", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.L2Networks.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.L2Networks.listByResourceGroup", + "azure.mgmt.networkcloud.operations.L2NetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.L2Networks.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.L2NetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.L2Networks.listBySubscription", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.get": "Microsoft.NetworkCloud.L3Networks.get", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.get": "Microsoft.NetworkCloud.L3Networks.get", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.L3Networks.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.L3Networks.createOrUpdate", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.update": "Microsoft.NetworkCloud.L3Networks.update", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.update": "Microsoft.NetworkCloud.L3Networks.update", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.begin_delete": "Microsoft.NetworkCloud.L3Networks.delete", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.begin_delete": "Microsoft.NetworkCloud.L3Networks.delete", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.L3Networks.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.L3Networks.listByResourceGroup", + "azure.mgmt.networkcloud.operations.L3NetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.L3Networks.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.L3NetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.L3Networks.listBySubscription", + "azure.mgmt.networkcloud.operations.RackSkusOperations.get": "Microsoft.NetworkCloud.RackSkus.get", + "azure.mgmt.networkcloud.aio.operations.RackSkusOperations.get": "Microsoft.NetworkCloud.RackSkus.get", + "azure.mgmt.networkcloud.operations.RackSkusOperations.list_by_subscription": "Microsoft.NetworkCloud.RackSkus.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.RackSkusOperations.list_by_subscription": "Microsoft.NetworkCloud.RackSkus.listBySubscription", + "azure.mgmt.networkcloud.operations.RacksOperations.get": "Microsoft.NetworkCloud.Racks.get", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.get": "Microsoft.NetworkCloud.Racks.get", + "azure.mgmt.networkcloud.operations.RacksOperations.begin_create_or_update": "Microsoft.NetworkCloud.Racks.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_create_or_update": "Microsoft.NetworkCloud.Racks.createOrUpdate", + "azure.mgmt.networkcloud.operations.RacksOperations.begin_update": "Microsoft.NetworkCloud.Racks.update", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_update": "Microsoft.NetworkCloud.Racks.update", + "azure.mgmt.networkcloud.operations.RacksOperations.begin_delete": "Microsoft.NetworkCloud.Racks.delete", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.begin_delete": "Microsoft.NetworkCloud.Racks.delete", + "azure.mgmt.networkcloud.operations.RacksOperations.list_by_resource_group": "Microsoft.NetworkCloud.Racks.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.list_by_resource_group": "Microsoft.NetworkCloud.Racks.listByResourceGroup", + "azure.mgmt.networkcloud.operations.RacksOperations.list_by_subscription": "Microsoft.NetworkCloud.Racks.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.RacksOperations.list_by_subscription": "Microsoft.NetworkCloud.Racks.listBySubscription", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.get": "Microsoft.NetworkCloud.StorageAppliances.get", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.get": "Microsoft.NetworkCloud.StorageAppliances.get", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_create_or_update": "Microsoft.NetworkCloud.StorageAppliances.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_create_or_update": "Microsoft.NetworkCloud.StorageAppliances.createOrUpdate", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_update": "Microsoft.NetworkCloud.StorageAppliances.update", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_update": "Microsoft.NetworkCloud.StorageAppliances.update", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_delete": "Microsoft.NetworkCloud.StorageAppliances.delete", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_delete": "Microsoft.NetworkCloud.StorageAppliances.delete", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.list_by_resource_group": "Microsoft.NetworkCloud.StorageAppliances.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.list_by_resource_group": "Microsoft.NetworkCloud.StorageAppliances.listByResourceGroup", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.list_by_subscription": "Microsoft.NetworkCloud.StorageAppliances.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.list_by_subscription": "Microsoft.NetworkCloud.StorageAppliances.listBySubscription", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_disable_remote_vendor_management": "Microsoft.NetworkCloud.StorageAppliances.disableRemoteVendorManagement", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_disable_remote_vendor_management": "Microsoft.NetworkCloud.StorageAppliances.disableRemoteVendorManagement", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_enable_remote_vendor_management": "Microsoft.NetworkCloud.StorageAppliances.enableRemoteVendorManagement", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_enable_remote_vendor_management": "Microsoft.NetworkCloud.StorageAppliances.enableRemoteVendorManagement", + "azure.mgmt.networkcloud.operations.StorageAppliancesOperations.begin_run_read_commands": "Microsoft.NetworkCloud.StorageAppliances.runReadCommands", + "azure.mgmt.networkcloud.aio.operations.StorageAppliancesOperations.begin_run_read_commands": "Microsoft.NetworkCloud.StorageAppliances.runReadCommands", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.get": "Microsoft.NetworkCloud.TrunkedNetworks.get", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.get": "Microsoft.NetworkCloud.TrunkedNetworks.get", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.TrunkedNetworks.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.begin_create_or_update": "Microsoft.NetworkCloud.TrunkedNetworks.createOrUpdate", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.update": "Microsoft.NetworkCloud.TrunkedNetworks.update", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.update": "Microsoft.NetworkCloud.TrunkedNetworks.update", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.begin_delete": "Microsoft.NetworkCloud.TrunkedNetworks.delete", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.begin_delete": "Microsoft.NetworkCloud.TrunkedNetworks.delete", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.TrunkedNetworks.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.list_by_resource_group": "Microsoft.NetworkCloud.TrunkedNetworks.listByResourceGroup", + "azure.mgmt.networkcloud.operations.TrunkedNetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.TrunkedNetworks.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.TrunkedNetworksOperations.list_by_subscription": "Microsoft.NetworkCloud.TrunkedNetworks.listBySubscription", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.get": "Microsoft.NetworkCloud.VirtualMachines.get", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.get": "Microsoft.NetworkCloud.VirtualMachines.get", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_create_or_update": "Microsoft.NetworkCloud.VirtualMachines.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_create_or_update": "Microsoft.NetworkCloud.VirtualMachines.createOrUpdate", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_update": "Microsoft.NetworkCloud.VirtualMachines.update", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_update": "Microsoft.NetworkCloud.VirtualMachines.update", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_delete": "Microsoft.NetworkCloud.VirtualMachines.delete", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_delete": "Microsoft.NetworkCloud.VirtualMachines.delete", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.list_by_resource_group": "Microsoft.NetworkCloud.VirtualMachines.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.list_by_resource_group": "Microsoft.NetworkCloud.VirtualMachines.listByResourceGroup", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.list_by_subscription": "Microsoft.NetworkCloud.VirtualMachines.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.list_by_subscription": "Microsoft.NetworkCloud.VirtualMachines.listBySubscription", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_assign_relay": "Microsoft.NetworkCloud.VirtualMachines.assignRelay", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_assign_relay": "Microsoft.NetworkCloud.VirtualMachines.assignRelay", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_power_off": "Microsoft.NetworkCloud.VirtualMachines.powerOff", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_power_off": "Microsoft.NetworkCloud.VirtualMachines.powerOff", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_reimage": "Microsoft.NetworkCloud.VirtualMachines.reimage", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_reimage": "Microsoft.NetworkCloud.VirtualMachines.reimage", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_restart": "Microsoft.NetworkCloud.VirtualMachines.restart", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_restart": "Microsoft.NetworkCloud.VirtualMachines.restart", + "azure.mgmt.networkcloud.operations.VirtualMachinesOperations.begin_start": "Microsoft.NetworkCloud.VirtualMachines.start", + "azure.mgmt.networkcloud.aio.operations.VirtualMachinesOperations.begin_start": "Microsoft.NetworkCloud.VirtualMachines.start", + "azure.mgmt.networkcloud.operations.VolumesOperations.get": "Microsoft.NetworkCloud.Volumes.get", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.get": "Microsoft.NetworkCloud.Volumes.get", + "azure.mgmt.networkcloud.operations.VolumesOperations.begin_create_or_update": "Microsoft.NetworkCloud.Volumes.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.begin_create_or_update": "Microsoft.NetworkCloud.Volumes.createOrUpdate", + "azure.mgmt.networkcloud.operations.VolumesOperations.update": "Microsoft.NetworkCloud.Volumes.update", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.update": "Microsoft.NetworkCloud.Volumes.update", + "azure.mgmt.networkcloud.operations.VolumesOperations.begin_delete": "Microsoft.NetworkCloud.Volumes.delete", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.begin_delete": "Microsoft.NetworkCloud.Volumes.delete", + "azure.mgmt.networkcloud.operations.VolumesOperations.list_by_resource_group": "Microsoft.NetworkCloud.Volumes.listByResourceGroup", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.list_by_resource_group": "Microsoft.NetworkCloud.Volumes.listByResourceGroup", + "azure.mgmt.networkcloud.operations.VolumesOperations.list_by_subscription": "Microsoft.NetworkCloud.Volumes.listBySubscription", + "azure.mgmt.networkcloud.aio.operations.VolumesOperations.list_by_subscription": "Microsoft.NetworkCloud.Volumes.listBySubscription", + "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.get": "Microsoft.NetworkCloud.BareMetalMachineKeySets.get", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.get": "Microsoft.NetworkCloud.BareMetalMachineKeySets.get", + "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_create_or_update": "Microsoft.NetworkCloud.BareMetalMachineKeySets.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_create_or_update": "Microsoft.NetworkCloud.BareMetalMachineKeySets.createOrUpdate", + "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_update": "Microsoft.NetworkCloud.BareMetalMachineKeySets.update", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_update": "Microsoft.NetworkCloud.BareMetalMachineKeySets.update", + "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.begin_delete": "Microsoft.NetworkCloud.BareMetalMachineKeySets.delete", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.begin_delete": "Microsoft.NetworkCloud.BareMetalMachineKeySets.delete", + "azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations.list_by_cluster": "Microsoft.NetworkCloud.BareMetalMachineKeySets.listByCluster", + "azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations.list_by_cluster": "Microsoft.NetworkCloud.BareMetalMachineKeySets.listByCluster", + "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.get": "Microsoft.NetworkCloud.BmcKeySets.get", + "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.get": "Microsoft.NetworkCloud.BmcKeySets.get", + "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_create_or_update": "Microsoft.NetworkCloud.BmcKeySets.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_create_or_update": "Microsoft.NetworkCloud.BmcKeySets.createOrUpdate", + "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_update": "Microsoft.NetworkCloud.BmcKeySets.update", + "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_update": "Microsoft.NetworkCloud.BmcKeySets.update", + "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.begin_delete": "Microsoft.NetworkCloud.BmcKeySets.delete", + "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.begin_delete": "Microsoft.NetworkCloud.BmcKeySets.delete", + "azure.mgmt.networkcloud.operations.BmcKeySetsOperations.list_by_cluster": "Microsoft.NetworkCloud.BmcKeySets.listByCluster", + "azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations.list_by_cluster": "Microsoft.NetworkCloud.BmcKeySets.listByCluster", + "azure.mgmt.networkcloud.operations.AgentPoolsOperations.get": "Microsoft.NetworkCloud.AgentPools.get", + "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.get": "Microsoft.NetworkCloud.AgentPools.get", + "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_create_or_update": "Microsoft.NetworkCloud.AgentPools.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_create_or_update": "Microsoft.NetworkCloud.AgentPools.createOrUpdate", + "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_update": "Microsoft.NetworkCloud.AgentPools.update", + "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_update": "Microsoft.NetworkCloud.AgentPools.update", + "azure.mgmt.networkcloud.operations.AgentPoolsOperations.begin_delete": "Microsoft.NetworkCloud.AgentPools.delete", + "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.begin_delete": "Microsoft.NetworkCloud.AgentPools.delete", + "azure.mgmt.networkcloud.operations.AgentPoolsOperations.list_by_kubernetes_cluster": "Microsoft.NetworkCloud.AgentPools.listByKubernetesCluster", + "azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations.list_by_kubernetes_cluster": "Microsoft.NetworkCloud.AgentPools.listByKubernetesCluster", + "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.get": "Microsoft.NetworkCloud.KubernetesClusterFeatures.get", + "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.get": "Microsoft.NetworkCloud.KubernetesClusterFeatures.get", + "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_create_or_update": "Microsoft.NetworkCloud.KubernetesClusterFeatures.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_create_or_update": "Microsoft.NetworkCloud.KubernetesClusterFeatures.createOrUpdate", + "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_update": "Microsoft.NetworkCloud.KubernetesClusterFeatures.update", + "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_update": "Microsoft.NetworkCloud.KubernetesClusterFeatures.update", + "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.begin_delete": "Microsoft.NetworkCloud.KubernetesClusterFeatures.delete", + "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.begin_delete": "Microsoft.NetworkCloud.KubernetesClusterFeatures.delete", + "azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations.list_by_kubernetes_cluster": "Microsoft.NetworkCloud.KubernetesClusterFeatures.listByKubernetesCluster", + "azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations.list_by_kubernetes_cluster": "Microsoft.NetworkCloud.KubernetesClusterFeatures.listByKubernetesCluster", + "azure.mgmt.networkcloud.operations.ConsolesOperations.get": "Microsoft.NetworkCloud.Consoles.get", + "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.get": "Microsoft.NetworkCloud.Consoles.get", + "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_create_or_update": "Microsoft.NetworkCloud.Consoles.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_create_or_update": "Microsoft.NetworkCloud.Consoles.createOrUpdate", + "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_update": "Microsoft.NetworkCloud.Consoles.update", + "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_update": "Microsoft.NetworkCloud.Consoles.update", + "azure.mgmt.networkcloud.operations.ConsolesOperations.begin_delete": "Microsoft.NetworkCloud.Consoles.delete", + "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.begin_delete": "Microsoft.NetworkCloud.Consoles.delete", + "azure.mgmt.networkcloud.operations.ConsolesOperations.list_by_virtual_machine": "Microsoft.NetworkCloud.Consoles.listByVirtualMachine", + "azure.mgmt.networkcloud.aio.operations.ConsolesOperations.list_by_virtual_machine": "Microsoft.NetworkCloud.Consoles.listByVirtualMachine", + "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.get": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.get", + "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.get": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.get", + "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_create_or_update": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.createOrUpdate", + "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_create_or_update": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.createOrUpdate", + "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_update": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.update", + "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_update": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.update", + "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.begin_delete": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.delete", + "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.begin_delete": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.delete", + "azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations.list_by_cluster": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.listByCluster", + "azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations.list_by_cluster": "Microsoft.NetworkCloud.ClusterMetricsConfigurations.listByCluster" } } \ No newline at end of file diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/__init__.py index a88321f3c1e6..9c5e01d3afdd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/__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 ._network_cloud_mgmt_client import NetworkCloudMgmtClient # type: ignore +from ._client import NetworkCloudMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_network_cloud_mgmt_client.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_client.py similarity index 91% rename from sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_network_cloud_mgmt_client.py rename to sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_client.py index b2fdf4894dcd..eb6dab1a8ea0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_network_cloud_mgmt_client.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_client.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. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import NetworkCloudMgmtClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -86,9 +85,6 @@ class NetworkCloudMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.networkcloud.operations.BareMetalMachineKeySetsOperations :ivar bmc_key_sets: BmcKeySetsOperations operations :vartype bmc_key_sets: azure.mgmt.networkcloud.operations.BmcKeySetsOperations - :ivar metrics_configurations: MetricsConfigurationsOperations operations - :vartype metrics_configurations: - azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.networkcloud.operations.AgentPoolsOperations :ivar kubernetes_cluster_features: KubernetesClusterFeaturesOperations operations @@ -96,17 +92,21 @@ class NetworkCloudMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.networkcloud.operations.KubernetesClusterFeaturesOperations :ivar consoles: ConsolesOperations operations :vartype consoles: azure.mgmt.networkcloud.operations.ConsolesOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar metrics_configurations: MetricsConfigurationsOperations operations + :vartype metrics_configurations: + azure.mgmt.networkcloud.operations.MetricsConfigurationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-09-01". + Default value is "2025-09-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -121,6 +121,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -129,6 +130,7 @@ def __init__( self._config = NetworkCloudMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -152,11 +154,10 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.bare_metal_machines = BareMetalMachinesOperations( @@ -190,22 +191,22 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.bmc_key_sets = BmcKeySetsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metrics_configurations = MetricsConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.kubernetes_cluster_features = KubernetesClusterFeaturesOperations( self._client, self._config, self._serialize, self._deserialize ) self.consoles = ConsolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.metrics_configurations = MetricsConfigurationsOperations( + 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 @@ -218,7 +219,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/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_configuration.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_configuration.py index 6ca5813887b5..eb7848c77ba0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_configuration.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,15 +24,18 @@ class NetworkCloudMgmtClientConfiguration: # pylint: disable=too-many-instance- Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-09-01". + Default value is "2025-09-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -40,6 +43,7 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/model_base.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/model_base.py new file mode 100644 index 000000000000..7b7f8ba67b53 --- /dev/null +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/model_base.py @@ -0,0 +1,1350 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/serialization.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/serialization.py index ff543ed937ff..81ec1de5922b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/serialization.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -821,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1757,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1783,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/utils.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/utils.py new file mode 100644 index 000000000000..cbaa624660e4 --- /dev/null +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_utils/utils.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Optional + +from azure.core import MatchConditions + + +def quote_etag(etag: Optional[str]) -> Optional[str]: + if not etag or etag == "*": + return etag + if etag.startswith("W/"): + return etag + if etag.startswith('"') and etag.endswith('"'): + return etag + if etag.startswith("'") and etag.endswith("'"): + return etag + return '"' + etag + '"' + + +def prep_if_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfNotModified: + if_match = quote_etag(etag) if etag else None + return if_match + if match_condition == MatchConditions.IfPresent: + return "*" + return None + + +def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfModified: + if_none_match = quote_etag(etag) if etag else None + return if_none_match + if match_condition == MatchConditions.IfMissing: + return "*" + return None diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_version.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_version.py index f30401ec2040..fd5e9189cf06 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_version.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/_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.2.0" +VERSION = "3.0.0b1" diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/__init__.py index b567a3af0a50..717f17b176cf 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/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 ._network_cloud_mgmt_client import NetworkCloudMgmtClient # type: ignore +from ._client import NetworkCloudMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_network_cloud_mgmt_client.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_client.py similarity index 92% rename from sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_network_cloud_mgmt_client.py rename to sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_client.py index adc800e46b89..04d04a9dc89f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_network_cloud_mgmt_client.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_client.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. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import NetworkCloudMgmtClientConfiguration from .operations import ( @@ -88,9 +87,6 @@ class NetworkCloudMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.networkcloud.aio.operations.BareMetalMachineKeySetsOperations :ivar bmc_key_sets: BmcKeySetsOperations operations :vartype bmc_key_sets: azure.mgmt.networkcloud.aio.operations.BmcKeySetsOperations - :ivar metrics_configurations: MetricsConfigurationsOperations operations - :vartype metrics_configurations: - azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.networkcloud.aio.operations.AgentPoolsOperations :ivar kubernetes_cluster_features: KubernetesClusterFeaturesOperations operations @@ -98,17 +94,21 @@ class NetworkCloudMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.networkcloud.aio.operations.KubernetesClusterFeaturesOperations :ivar consoles: ConsolesOperations operations :vartype consoles: azure.mgmt.networkcloud.aio.operations.ConsolesOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar metrics_configurations: MetricsConfigurationsOperations operations + :vartype metrics_configurations: + azure.mgmt.networkcloud.aio.operations.MetricsConfigurationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-09-01". + Default value is "2025-09-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -123,6 +123,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -131,6 +132,7 @@ def __init__( self._config = NetworkCloudMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -155,12 +157,11 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.bare_metal_machines = BareMetalMachinesOperations( @@ -194,16 +195,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.bmc_key_sets = BmcKeySetsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metrics_configurations = MetricsConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.kubernetes_cluster_features = KubernetesClusterFeaturesOperations( self._client, self._config, self._serialize, self._deserialize ) self.consoles = ConsolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.metrics_configurations = MetricsConfigurationsOperations( + 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. @@ -211,7 +212,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -224,7 +225,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_configuration.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_configuration.py index 735a00beac7f..d35964fd8912 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_configuration.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,15 +24,18 @@ class NetworkCloudMgmtClientConfiguration: # pylint: disable=too-many-instance- Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2025-09-01". + Default value is "2025-09-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -40,6 +43,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/__init__.py index 364ebc77254d..a3eb236d5878 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,25 +13,25 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._bare_metal_machines_operations import BareMetalMachinesOperations # type: ignore -from ._cloud_services_networks_operations import CloudServicesNetworksOperations # type: ignore -from ._cluster_managers_operations import ClusterManagersOperations # type: ignore -from ._clusters_operations import ClustersOperations # type: ignore -from ._kubernetes_clusters_operations import KubernetesClustersOperations # type: ignore -from ._l2_networks_operations import L2NetworksOperations # type: ignore -from ._l3_networks_operations import L3NetworksOperations # type: ignore -from ._rack_skus_operations import RackSkusOperations # type: ignore -from ._racks_operations import RacksOperations # type: ignore -from ._storage_appliances_operations import StorageAppliancesOperations # type: ignore -from ._trunked_networks_operations import TrunkedNetworksOperations # type: ignore -from ._virtual_machines_operations import VirtualMachinesOperations # type: ignore -from ._volumes_operations import VolumesOperations # type: ignore -from ._bare_metal_machine_key_sets_operations import BareMetalMachineKeySetsOperations # type: ignore -from ._bmc_key_sets_operations import BmcKeySetsOperations # type: ignore -from ._metrics_configurations_operations import MetricsConfigurationsOperations # type: ignore -from ._agent_pools_operations import AgentPoolsOperations # type: ignore -from ._kubernetes_cluster_features_operations import KubernetesClusterFeaturesOperations # type: ignore -from ._consoles_operations import ConsolesOperations # type: ignore +from ._operations import BareMetalMachinesOperations # type: ignore +from ._operations import CloudServicesNetworksOperations # type: ignore +from ._operations import ClusterManagersOperations # type: ignore +from ._operations import ClustersOperations # type: ignore +from ._operations import KubernetesClustersOperations # type: ignore +from ._operations import L2NetworksOperations # type: ignore +from ._operations import L3NetworksOperations # type: ignore +from ._operations import RackSkusOperations # type: ignore +from ._operations import RacksOperations # type: ignore +from ._operations import StorageAppliancesOperations # type: ignore +from ._operations import TrunkedNetworksOperations # type: ignore +from ._operations import VirtualMachinesOperations # type: ignore +from ._operations import VolumesOperations # type: ignore +from ._operations import BareMetalMachineKeySetsOperations # type: ignore +from ._operations import BmcKeySetsOperations # type: ignore +from ._operations import AgentPoolsOperations # type: ignore +from ._operations import KubernetesClusterFeaturesOperations # type: ignore +from ._operations import ConsolesOperations # type: ignore +from ._operations import MetricsConfigurationsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -54,10 +54,10 @@ "VolumesOperations", "BareMetalMachineKeySetsOperations", "BmcKeySetsOperations", - "MetricsConfigurationsOperations", "AgentPoolsOperations", "KubernetesClusterFeaturesOperations", "ConsolesOperations", + "MetricsConfigurationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_agent_pools_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_agent_pools_operations.py deleted file mode 100644 index 33fadb8a681a..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_agent_pools_operations.py +++ /dev/null @@ -1,918 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._agent_pools_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_kubernetes_cluster_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AgentPoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`agent_pools` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_kubernetes_cluster( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.AgentPool"]: - """List agent pools of the Kubernetes cluster. - - Get a list of agent pools for the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either AgentPool or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AgentPoolList] = 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_kubernetes_cluster_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("AgentPoolList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, kubernetes_cluster_name: str, agent_pool_name: str, **kwargs: Any - ) -> _models.AgentPool: - """Retrieve the Kubernetes cluster agent pool. - - Get properties of the provided Kubernetes cluster agent pool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.AgentPool - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: Union[_models.AgentPool, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(agent_pool_parameters, (IOBase, bytes)): - _content = agent_pool_parameters - else: - _json = self._serialize.body(agent_pool_parameters, "AgentPool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: _models.AgentPool, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Required. - :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Required. - :type agent_pool_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: Union[_models.AgentPool, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Is either a AgentPool type or a IO[bytes] type. - Required. - :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - agent_pool_parameters=agent_pool_parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster agent pool. - - Delete the provided Kubernetes cluster agent pool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if agent_pool_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if agent_pool_update_parameters else None - _json = None - _content = None - if isinstance(agent_pool_update_parameters, (IOBase, bytes)): - _content = agent_pool_update_parameters - else: - if agent_pool_update_parameters is not None: - _json = self._serialize.body(agent_pool_update_parameters, "AgentPoolPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[_models.AgentPoolPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Default value is None. - :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Default value is None. - :type agent_pool_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Is either a AgentPoolPatchParameters - type or a IO[bytes] type. Default value is None. - :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if agent_pool_update_parameters else None - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - if_match=if_match, - if_none_match=if_none_match, - agent_pool_update_parameters=agent_pool_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machine_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machine_key_sets_operations.py deleted file mode 100644 index 08ac4b8cb7a0..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machine_key_sets_operations.py +++ /dev/null @@ -1,932 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._bare_metal_machine_key_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_cluster_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class BareMetalMachineKeySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`bare_metal_machine_key_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.BareMetalMachineKeySet"]: - """List bare metal machine key sets of the cluster. - - Get a list of bare metal machine key sets for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachineKeySet or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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.BareMetalMachineKeySetList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("BareMetalMachineKeySetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, bare_metal_machine_key_set_name: str, **kwargs: Any - ) -> _models.BareMetalMachineKeySet: - """Retrieve the bare metal machine key set of the cluster. - - Get bare metal machine key set of the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :return: BareMetalMachineKeySet or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet - :raises ~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.BareMetalMachineKeySet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BareMetalMachineKeySet", 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, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bare_metal_machine_key_set_parameters, (IOBase, bytes)): - _content = bare_metal_machine_key_set_parameters - else: - _json = self._serialize.body(bare_metal_machine_key_set_parameters, "BareMetalMachineKeySet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: _models.BareMetalMachineKeySet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Required. - :type bare_metal_machine_key_set_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Required. - :type bare_metal_machine_key_set_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Is either a - BareMetalMachineKeySet type or a IO[bytes] type. Required. - :type bare_metal_machine_key_set_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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.BareMetalMachineKeySet] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - bare_metal_machine_key_set_parameters=bare_metal_machine_key_set_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BareMetalMachineKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BareMetalMachineKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BareMetalMachineKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the bare metal machine key set of the cluster. - - Delete the bare metal machine key set of the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[ - Union[_models.BareMetalMachineKeySetPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_key_set_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_key_set_update_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_key_set_update_parameters, (IOBase, bytes)): - _content = bare_metal_machine_key_set_update_parameters - else: - if bare_metal_machine_key_set_update_parameters is not None: - _json = self._serialize.body( - bare_metal_machine_key_set_update_parameters, "BareMetalMachineKeySetPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[_models.BareMetalMachineKeySetPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. - :type bare_metal_machine_key_set_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters - :keyword content_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 BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. - :type bare_metal_machine_key_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[ - Union[_models.BareMetalMachineKeySetPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Is either a - BareMetalMachineKeySetPatchParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_key_set_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BareMetalMachineKeySet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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)) - content_type = content_type if bare_metal_machine_key_set_update_parameters else None - cls: ClsType[_models.BareMetalMachineKeySet] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - bare_metal_machine_key_set_update_parameters=bare_metal_machine_key_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BareMetalMachineKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BareMetalMachineKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BareMetalMachineKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machines_operations.py deleted file mode 100644 index f8f5c9bc5c0f..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bare_metal_machines_operations.py +++ /dev/null @@ -1,3049 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._bare_metal_machines_operations import ( - build_cordon_request, - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_power_off_request, - build_reimage_request, - build_replace_request, - build_restart_request, - build_run_command_request, - build_run_data_extracts_request, - build_run_data_extracts_restricted_request, - build_run_read_commands_request, - build_start_request, - build_uncordon_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class BareMetalMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`bare_metal_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.BareMetalMachine"]: - """List bare metal machines in the subscription. - - Get a list of bare metal machines in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachineList] = 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, - top=top, - skip_token=skip_token, - 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("BareMetalMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.BareMetalMachine"]: - """List bare metal machines in the resource group. - - Get a list of bare metal machines in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachineList] = 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, - top=top, - skip_token=skip_token, - 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("BareMetalMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> _models.BareMetalMachine: - """Retrieve the bare metal machine. - - Get properties of the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: BareMetalMachine or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachine - :raises ~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.BareMetalMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BareMetalMachine", 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, - bare_metal_machine_name: str, - bare_metal_machine_parameters: Union[_models.BareMetalMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bare_metal_machine_parameters, (IOBase, bytes)): - _content = bare_metal_machine_parameters - else: - _json = self._serialize.body(bare_metal_machine_parameters, "BareMetalMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bare_metal_machine_name: str, - bare_metal_machine_parameters: _models.BareMetalMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Required. - :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Required. - :type bare_metal_machine_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_parameters: Union[_models.BareMetalMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Is either a BareMetalMachine type or a - IO[bytes] type. Required. - :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachine] = 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, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_parameters=bare_metal_machine_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BareMetalMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BareMetalMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BareMetalMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the bare metal machine. - - Delete the provided bare metal machine. All customer initiated requests will be rejected as the - life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[ - Union[_models.BareMetalMachinePatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_update_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_update_parameters, (IOBase, bytes)): - _content = bare_metal_machine_update_parameters - else: - if bare_metal_machine_update_parameters is not None: - _json = self._serialize.body(bare_metal_machine_update_parameters, "BareMetalMachinePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[_models.BareMetalMachinePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Default value is None. - :type bare_metal_machine_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters - :keyword content_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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Default value is None. - :type bare_metal_machine_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[ - Union[_models.BareMetalMachinePatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Is either a - BareMetalMachinePatchParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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)) - content_type = content_type if bare_metal_machine_update_parameters else None - cls: ClsType[_models.BareMetalMachine] = 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, - bare_metal_machine_name=bare_metal_machine_name, - if_match=if_match, - if_none_match=if_none_match, - bare_metal_machine_update_parameters=bare_metal_machine_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BareMetalMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BareMetalMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BareMetalMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _cordon_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[ - Union[_models.BareMetalMachineCordonParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_cordon_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_cordon_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_cordon_parameters, (IOBase, bytes)): - _content = bare_metal_machine_cordon_parameters - else: - if bare_metal_machine_cordon_parameters is not None: - _json = self._serialize.body(bare_metal_machine_cordon_parameters, "BareMetalMachineCordonParameters") - else: - _json = None - - _request = build_cordon_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[_models.BareMetalMachineCordonParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Default value is None. - :type bare_metal_machine_cordon_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Default value is None. - :type bare_metal_machine_cordon_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[ - Union[_models.BareMetalMachineCordonParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Is either a - BareMetalMachineCordonParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_cordon_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_cordon_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._cordon_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_cordon_parameters=bare_metal_machine_cordon_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _power_off_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[ - Union[_models.BareMetalMachinePowerOffParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_power_off_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_power_off_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_power_off_parameters, (IOBase, bytes)): - _content = bare_metal_machine_power_off_parameters - else: - if bare_metal_machine_power_off_parameters is not None: - _json = self._serialize.body( - bare_metal_machine_power_off_parameters, "BareMetalMachinePowerOffParameters" - ) - else: - _json = None - - _request = build_power_off_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[_models.BareMetalMachinePowerOffParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Default value is None. - :type bare_metal_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Default value is None. - :type bare_metal_machine_power_off_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[ - Union[_models.BareMetalMachinePowerOffParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Is either a - BareMetalMachinePowerOffParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_power_off_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_power_off_parameters=bare_metal_machine_power_off_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _reimage_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reimage( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Reimage the bare metal machine. - - Reimage the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _replace_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[ - Union[_models.BareMetalMachineReplaceParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_replace_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_replace_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_replace_parameters, (IOBase, bytes)): - _content = bare_metal_machine_replace_parameters - else: - if bare_metal_machine_replace_parameters is not None: - _json = self._serialize.body(bare_metal_machine_replace_parameters, "BareMetalMachineReplaceParameters") - else: - _json = None - - _request = build_replace_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[_models.BareMetalMachineReplaceParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Default value is None. - :type bare_metal_machine_replace_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Default value is None. - :type bare_metal_machine_replace_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[ - Union[_models.BareMetalMachineReplaceParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Is either a - BareMetalMachineReplaceParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_replace_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_replace_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._replace_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_replace_parameters=bare_metal_machine_replace_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _restart_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Restart the bare metal machine. - - Restart the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _run_command_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, 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(bare_metal_machine_run_command_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_command_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_command_parameters, "BareMetalMachineRunCommandParameters" - ) - - _request = build_run_command_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: _models.BareMetalMachineRunCommandParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Required. - :type bare_metal_machine_run_command_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Required. - :type bare_metal_machine_run_command_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Is either a - BareMetalMachineRunCommandParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_command_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_command_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_command_parameters=bare_metal_machine_run_command_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _run_data_extracts_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_data_extracts_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_data_extracts_parameters, "BareMetalMachineRunDataExtractsParameters" - ) - - _request = build_run_data_extracts_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: _models.BareMetalMachineRunDataExtractsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Is either a - BareMetalMachineRunDataExtractsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_data_extracts_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_data_extracts_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_data_extracts_parameters=bare_metal_machine_run_data_extracts_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _run_data_extracts_restricted_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_restricted_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_data_extracts_restricted_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_data_extracts_restricted_parameters, "BareMetalMachineRunDataExtractsParameters" - ) - - _request = build_run_data_extracts_restricted_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: _models.BareMetalMachineRunDataExtractsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_restricted_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Is either - a BareMetalMachineRunDataExtractsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_data_extracts_restricted_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_data_extracts_restricted_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_data_extracts_restricted_parameters=bare_metal_machine_run_data_extracts_restricted_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _run_read_commands_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: Union[ - _models.BareMetalMachineRunReadCommandsParameters, 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(bare_metal_machine_run_read_commands_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_read_commands_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_read_commands_parameters, "BareMetalMachineRunReadCommandsParameters" - ) - - _request = build_run_read_commands_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: _models.BareMetalMachineRunReadCommandsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Required. - :type bare_metal_machine_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Required. - :type bare_metal_machine_run_read_commands_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: Union[ - _models.BareMetalMachineRunReadCommandsParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Is either a - BareMetalMachineRunReadCommandsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_read_commands_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_read_commands_parameters=bare_metal_machine_run_read_commands_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _start_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Start the bare metal machine. - - Start the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _uncordon_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_uncordon_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_uncordon( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Uncordon the bare metal machine. - - Uncordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._uncordon_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bmc_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bmc_key_sets_operations.py deleted file mode 100644 index 74232dd1cbf4..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_bmc_key_sets_operations.py +++ /dev/null @@ -1,918 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._bmc_key_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_cluster_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class BmcKeySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`bmc_key_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.BmcKeySet"]: - """List baseboard management controller key sets of the cluster. - - Get a list of baseboard management controller key sets for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BmcKeySet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BmcKeySet] - :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.BmcKeySetList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("BmcKeySetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, bmc_key_set_name: str, **kwargs: Any - ) -> _models.BmcKeySet: - """Retrieve the baseboard management controller key set of the cluster. - - Get baseboard management controller key set of the provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :return: BmcKeySet or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BmcKeySet - :raises ~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.BmcKeySet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BmcKeySet", 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, - bmc_key_set_name: str, - bmc_key_set_parameters: Union[_models.BmcKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bmc_key_set_parameters, (IOBase, bytes)): - _content = bmc_key_set_parameters - else: - _json = self._serialize.body(bmc_key_set_parameters, "BmcKeySet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bmc_key_set_name: str, - bmc_key_set_parameters: _models.BmcKeySet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Required. - :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - bmc_key_set_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Required. - :type bmc_key_set_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - bmc_key_set_parameters: Union[_models.BmcKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Is either a BmcKeySet type or a IO[bytes] - type. Required. - :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :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.BmcKeySet] = 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, - bmc_key_set_name=bmc_key_set_name, - bmc_key_set_parameters=bmc_key_set_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BmcKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BmcKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BmcKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the baseboard management controller key set of the cluster. - - Delete the baseboard management controller key set of the provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bmc_key_set_name=bmc_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if bmc_key_set_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bmc_key_set_update_parameters else None - _json = None - _content = None - if isinstance(bmc_key_set_update_parameters, (IOBase, bytes)): - _content = bmc_key_set_update_parameters - else: - if bmc_key_set_update_parameters is not None: - _json = self._serialize.body(bmc_key_set_update_parameters, "BmcKeySetPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[_models.BmcKeySetPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Default value is None. - :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters - :keyword content_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 BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Default value is None. - :type bmc_key_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Is either a BmcKeySetPatchParameters - type or a IO[bytes] type. Default value is None. - :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BmcKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :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)) - content_type = content_type if bmc_key_set_update_parameters else None - cls: ClsType[_models.BmcKeySet] = 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, - bmc_key_set_name=bmc_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - bmc_key_set_update_parameters=bmc_key_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BmcKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BmcKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BmcKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cloud_services_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cloud_services_networks_operations.py deleted file mode 100644 index cf12f82f6d2f..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cloud_services_networks_operations.py +++ /dev/null @@ -1,987 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_services_networks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudServicesNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`cloud_services_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.CloudServicesNetwork"]: - """List cloud services networks in the subscription. - - Get a list of cloud services networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either CloudServicesNetwork or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("CloudServicesNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.CloudServicesNetwork"]: - """List cloud services networks in the resource group. - - Get a list of cloud services networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either CloudServicesNetwork or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("CloudServicesNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, cloud_services_network_name: str, **kwargs: Any - ) -> _models.CloudServicesNetwork: - """Retrieve the cloud services network. - - Get properties of the provided cloud services network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :return: CloudServicesNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - :raises ~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.CloudServicesNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServicesNetwork", 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, - cloud_services_network_name: str, - cloud_services_network_parameters: Union[_models.CloudServicesNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cloud_services_network_parameters, (IOBase, bytes)): - _content = cloud_services_network_parameters - else: - _json = self._serialize.body(cloud_services_network_parameters, "CloudServicesNetwork") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - cloud_services_network_name: str, - cloud_services_network_parameters: _models.CloudServicesNetwork, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Required. - :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - cloud_services_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Required. - :type cloud_services_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - cloud_services_network_parameters: Union[_models.CloudServicesNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Is either a CloudServicesNetwork - type or a IO[bytes] type. Required. - :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetwork] = 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, - cloud_services_network_name=cloud_services_network_name, - cloud_services_network_parameters=cloud_services_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("CloudServicesNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CloudServicesNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CloudServicesNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the cloud services network. - - Delete the provided cloud services network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - cloud_services_network_name=cloud_services_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[ - Union[_models.CloudServicesNetworkPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if cloud_services_network_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cloud_services_network_update_parameters else None - _json = None - _content = None - if isinstance(cloud_services_network_update_parameters, (IOBase, bytes)): - _content = cloud_services_network_update_parameters - else: - if cloud_services_network_update_parameters is not None: - _json = self._serialize.body( - cloud_services_network_update_parameters, "CloudServicesNetworkPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[_models.CloudServicesNetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Default value is None. - :type cloud_services_network_update_parameters: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters - :keyword content_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 CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Default value is None. - :type cloud_services_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[ - Union[_models.CloudServicesNetworkPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Is either a - CloudServicesNetworkPatchParameters type or a IO[bytes] type. Default value is None. - :type cloud_services_network_update_parameters: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CloudServicesNetwork or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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)) - content_type = content_type if cloud_services_network_update_parameters else None - cls: ClsType[_models.CloudServicesNetwork] = 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, - cloud_services_network_name=cloud_services_network_name, - if_match=if_match, - if_none_match=if_none_match, - cloud_services_network_update_parameters=cloud_services_network_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudServicesNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CloudServicesNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CloudServicesNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cluster_managers_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cluster_managers_operations.py deleted file mode 100644 index f8b7d4907711..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_cluster_managers_operations.py +++ /dev/null @@ -1,888 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cluster_managers_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ClusterManagersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`cluster_managers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ClusterManager"]: - """List cluster managers in the subscription. - - Get a list of cluster managers in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterManager or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManagerList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterManagerList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ClusterManager"]: - """List cluster managers in the resource group. - - Get a list of cluster managers in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterManager or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManagerList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterManagerList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, cluster_manager_name: str, **kwargs: Any) -> _models.ClusterManager: - """Retrieve the cluster manager. - - Get the properties of the provided cluster manager. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~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.ClusterManager] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterManager", 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_manager_name: str, - cluster_manager_parameters: Union[_models.ClusterManager, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cluster_manager_parameters, (IOBase, bytes)): - _content = cluster_manager_parameters - else: - _json = self._serialize.body(cluster_manager_parameters, "ClusterManager") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_manager_name: str, - cluster_manager_parameters: _models.ClusterManager, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Required. - :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_manager_name: str, - cluster_manager_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Required. - :type cluster_manager_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_manager_name: str, - cluster_manager_parameters: Union[_models.ClusterManager, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Is either a ClusterManager type or a - IO[bytes] type. Required. - :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManager] = 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_manager_name=cluster_manager_name, - cluster_manager_parameters=cluster_manager_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("ClusterManager", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ClusterManager].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ClusterManager]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the cluster manager. - - Delete the provided cluster manager. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_manager_name=cluster_manager_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[_models.ClusterManagerPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Default value is None. - :type cluster_manager_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Default value is None. - :type cluster_manager_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[Union[_models.ClusterManagerPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Is either a - ClusterManagerPatchParameters type or a IO[bytes] type. Default value is None. - :type cluster_manager_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters or IO[bytes] - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~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)) - content_type = content_type if cluster_manager_update_parameters else None - cls: ClsType[_models.ClusterManager] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_manager_update_parameters else None - _json = None - _content = None - if isinstance(cluster_manager_update_parameters, (IOBase, bytes)): - _content = cluster_manager_update_parameters - else: - if cluster_manager_update_parameters is not None: - _json = self._serialize.body(cluster_manager_update_parameters, "ClusterManagerPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterManager", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_clusters_operations.py deleted file mode 100644 index 5531a5a6f75c..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_clusters_operations.py +++ /dev/null @@ -1,1838 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._clusters_operations import ( - build_continue_update_version_request, - build_create_or_update_request, - build_delete_request, - build_deploy_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_scan_runtime_request, - build_update_request, - build_update_version_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Cluster"]: - """List clusters in the subscription. - - Get a list of clusters in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Cluster] - :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.ClusterList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Cluster"]: - """List clusters in the resource group. - - Get a list of clusters in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Cluster] - :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.ClusterList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Retrieve the cluster. - - Get properties of the provided 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. Required. - :type cluster_name: str - :return: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Cluster - :raises ~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.Cluster] = 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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Cluster", 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, - cluster_parameters: Union[_models.Cluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cluster_parameters, (IOBase, bytes)): - _content = cluster_parameters - else: - _json = self._serialize.body(cluster_parameters, "Cluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - cluster_parameters: _models.Cluster, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Required. - :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - cluster_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Required. - :type cluster_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - cluster_parameters: Union[_models.Cluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Is either a Cluster type or a IO[bytes] type. - Required. - :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :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.Cluster] = 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, - cluster_parameters=cluster_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Cluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Cluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Cluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the cluster. - - Delete the provided 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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_update_parameters else None - _json = None - _content = None - if isinstance(cluster_update_parameters, (IOBase, bytes)): - _content = cluster_update_parameters - else: - if cluster_update_parameters is not None: - _json = self._serialize.body(cluster_update_parameters, "ClusterPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[_models.ClusterPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Default value is None. - :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters - :keyword content_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 Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Default value is None. - :type cluster_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Is either a ClusterPatchParameters type or - a IO[bytes] type. Default value is None. - :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either Cluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] - :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)) - content_type = content_type if cluster_update_parameters else None - cls: ClsType[_models.Cluster] = 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, - if_match=if_match, - if_none_match=if_none_match, - cluster_update_parameters=cluster_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Cluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Cluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Cluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _continue_update_version_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: Union[_models.ClusterContinueUpdateVersionParameters, 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(cluster_continue_update_version_parameters, (IOBase, bytes)): - _content = cluster_continue_update_version_parameters - else: - _json = self._serialize.body( - cluster_continue_update_version_parameters, "ClusterContinueUpdateVersionParameters" - ) - - _request = build_continue_update_version_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: _models.ClusterContinueUpdateVersionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Required. - :type cluster_continue_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Required. - :type cluster_continue_update_version_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: Union[_models.ClusterContinueUpdateVersionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Is either a - ClusterContinueUpdateVersionParameters type or a IO[bytes] type. Required. - :type cluster_continue_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._continue_update_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_continue_update_version_parameters=cluster_continue_update_version_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _deploy_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_deploy_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_deploy_parameters else None - _json = None - _content = None - if isinstance(cluster_deploy_parameters, (IOBase, bytes)): - _content = cluster_deploy_parameters - else: - if cluster_deploy_parameters is not None: - _json = self._serialize.body(cluster_deploy_parameters, "ClusterDeployParameters") - else: - _json = None - - _request = build_deploy_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[_models.ClusterDeployParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Default value is None. - :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Default value is None. - :type cluster_deploy_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Is either a ClusterDeployParameters type or - a IO[bytes] type. Default value is None. - :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if cluster_deploy_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._deploy_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_deploy_parameters=cluster_deploy_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _scan_runtime_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_scan_runtime_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_scan_runtime_parameters else None - _json = None - _content = None - if isinstance(cluster_scan_runtime_parameters, (IOBase, bytes)): - _content = cluster_scan_runtime_parameters - else: - if cluster_scan_runtime_parameters is not None: - _json = self._serialize.body(cluster_scan_runtime_parameters, "ClusterScanRuntimeParameters") - else: - _json = None - - _request = build_scan_runtime_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[_models.ClusterScanRuntimeParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Default value is None. - :type cluster_scan_runtime_parameters: - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Default value is None. - :type cluster_scan_runtime_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Is either a - ClusterScanRuntimeParameters type or a IO[bytes] type. Default value is None. - :type cluster_scan_runtime_parameters: - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if cluster_scan_runtime_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._scan_runtime_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_scan_runtime_parameters=cluster_scan_runtime_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_version_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, 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(cluster_update_version_parameters, (IOBase, bytes)): - _content = cluster_update_version_parameters - else: - _json = self._serialize.body(cluster_update_version_parameters, "ClusterUpdateVersionParameters") - - _request = build_update_version_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: _models.ClusterUpdateVersionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Required. - :type cluster_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Required. - :type cluster_update_version_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Is either a - ClusterUpdateVersionParameters type or a IO[bytes] type. Required. - :type cluster_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_update_version_parameters=cluster_update_version_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_consoles_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_consoles_operations.py deleted file mode 100644 index 23e970019016..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_consoles_operations.py +++ /dev/null @@ -1,918 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._consoles_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_virtual_machine_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConsolesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`consoles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_virtual_machine( - self, - resource_group_name: str, - virtual_machine_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Console"]: - """List consoles of the virtual machine. - - Get a list of consoles for the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Console or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Console] - :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.ConsoleList] = 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_virtual_machine_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("ConsoleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, console_name: str, **kwargs: Any - ) -> _models.Console: - """Retrieve the virtual machine console. - - Get properties of the provided virtual machine console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :return: Console or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Console - :raises ~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.Console] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Console", 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, - virtual_machine_name: str, - console_name: str, - console_parameters: Union[_models.Console, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(console_parameters, (IOBase, bytes)): - _content = console_parameters - else: - _json = self._serialize.body(console_parameters, "Console") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - virtual_machine_name: str, - console_name: str, - console_parameters: _models.Console, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Required. - :type console_parameters: ~azure.mgmt.networkcloud.models.Console - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - console_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Required. - :type console_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - console_parameters: Union[_models.Console, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Is either a Console type or a IO[bytes] type. - Required. - :type console_parameters: ~azure.mgmt.networkcloud.models.Console or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :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.Console] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - console_parameters=console_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Console", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Console].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Console]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the virtual machine console. - - Delete the provided virtual machine console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[Union[_models.ConsolePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if console_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if console_update_parameters else None - _json = None - _content = None - if isinstance(console_update_parameters, (IOBase, bytes)): - _content = console_update_parameters - else: - if console_update_parameters is not None: - _json = self._serialize.body(console_update_parameters, "ConsolePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[_models.ConsolePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Default value is None. - :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters - :keyword content_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 Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Default value is None. - :type console_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[Union[_models.ConsolePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Is either a ConsolePatchParameters type or - a IO[bytes] type. Default value is None. - :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either Console or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] - :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)) - content_type = content_type if console_update_parameters else None - cls: ClsType[_models.Console] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - if_match=if_match, - if_none_match=if_none_match, - console_update_parameters=console_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Console", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Console].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Console]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_cluster_features_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_cluster_features_operations.py deleted file mode 100644 index e15886aa6696..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_cluster_features_operations.py +++ /dev/null @@ -1,932 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._kubernetes_cluster_features_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_kubernetes_cluster_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class KubernetesClusterFeaturesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`kubernetes_cluster_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_kubernetes_cluster( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.KubernetesClusterFeature"]: - """List features for the Kubernetes cluster. - - Get a list of features for the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesClusterFeature or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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.KubernetesClusterFeatureList] = 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_kubernetes_cluster_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("KubernetesClusterFeatureList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, kubernetes_cluster_name: str, feature_name: str, **kwargs: Any - ) -> _models.KubernetesClusterFeature: - """Retrieve the Kubernetes cluster feature. - - Get properties of the provided the Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :return: KubernetesClusterFeature or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.KubernetesClusterFeature - :raises ~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.KubernetesClusterFeature] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KubernetesClusterFeature", 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, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(kubernetes_cluster_feature_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_feature_parameters - else: - _json = self._serialize.body(kubernetes_cluster_feature_parameters, "KubernetesClusterFeature") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: _models.KubernetesClusterFeature, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Required. - :type kubernetes_cluster_feature_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeature - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Required. - :type kubernetes_cluster_feature_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Is either a - KubernetesClusterFeature type or a IO[bytes] type. Required. - :type kubernetes_cluster_feature_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeature or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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.KubernetesClusterFeature] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - kubernetes_cluster_feature_parameters=kubernetes_cluster_feature_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("KubernetesClusterFeature", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.KubernetesClusterFeature].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.KubernetesClusterFeature]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster feature. - - Delete the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[ - Union[_models.KubernetesClusterFeaturePatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if kubernetes_cluster_feature_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if kubernetes_cluster_feature_update_parameters else None - _json = None - _content = None - if isinstance(kubernetes_cluster_feature_update_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_feature_update_parameters - else: - if kubernetes_cluster_feature_update_parameters is not None: - _json = self._serialize.body( - kubernetes_cluster_feature_update_parameters, "KubernetesClusterFeaturePatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[_models.KubernetesClusterFeaturePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_feature_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters - :keyword content_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 KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_feature_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[ - Union[_models.KubernetesClusterFeaturePatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Is either a - KubernetesClusterFeaturePatchParameters type or a IO[bytes] type. Default value is None. - :type kubernetes_cluster_feature_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either KubernetesClusterFeature or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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)) - content_type = content_type if kubernetes_cluster_feature_update_parameters else None - cls: ClsType[_models.KubernetesClusterFeature] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - if_match=if_match, - if_none_match=if_none_match, - kubernetes_cluster_feature_update_parameters=kubernetes_cluster_feature_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubernetesClusterFeature", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.KubernetesClusterFeature].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.KubernetesClusterFeature]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_clusters_operations.py deleted file mode 100644 index 8c160e5d3d21..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_kubernetes_clusters_operations.py +++ /dev/null @@ -1,1191 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._kubernetes_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_restart_node_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class KubernetesClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`kubernetes_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.KubernetesCluster"]: - """List Kubernetes clusters in the subscription. - - Get a list of Kubernetes clusters in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesClusterList] = 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, - top=top, - skip_token=skip_token, - 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("KubernetesClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.KubernetesCluster"]: - """List Kubernetes clusters in the resource group. - - Get a list of Kubernetes clusters in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesClusterList] = 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, - top=top, - skip_token=skip_token, - 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("KubernetesClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, kubernetes_cluster_name: str, **kwargs: Any - ) -> _models.KubernetesCluster: - """Retrieve the Kubernetes cluster. - - Get properties of the provided the Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :return: KubernetesCluster or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.KubernetesCluster - :raises ~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.KubernetesCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KubernetesCluster", 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, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: Union[_models.KubernetesCluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(kubernetes_cluster_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_parameters - else: - _json = self._serialize.body(kubernetes_cluster_parameters, "KubernetesCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: _models.KubernetesCluster, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Required. - :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Required. - :type kubernetes_cluster_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: Union[_models.KubernetesCluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Is either a KubernetesCluster type or a - IO[bytes] type. Required. - :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesCluster] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - kubernetes_cluster_parameters=kubernetes_cluster_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("KubernetesCluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.KubernetesCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.KubernetesCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster. - - Delete the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[ - Union[_models.KubernetesClusterPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if kubernetes_cluster_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if kubernetes_cluster_update_parameters else None - _json = None - _content = None - if isinstance(kubernetes_cluster_update_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_update_parameters - else: - if kubernetes_cluster_update_parameters is not None: - _json = self._serialize.body(kubernetes_cluster_update_parameters, "KubernetesClusterPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[_models.KubernetesClusterPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters - :keyword content_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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[ - Union[_models.KubernetesClusterPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Is either a - KubernetesClusterPatchParameters type or a IO[bytes] type. Default value is None. - :type kubernetes_cluster_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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)) - content_type = content_type if kubernetes_cluster_update_parameters else None - cls: ClsType[_models.KubernetesCluster] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - if_match=if_match, - if_none_match=if_none_match, - kubernetes_cluster_update_parameters=kubernetes_cluster_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubernetesCluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.KubernetesCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.KubernetesCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _restart_node_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: Union[_models.KubernetesClusterRestartNodeParameters, 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(kubernetes_cluster_restart_node_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_restart_node_parameters - else: - _json = self._serialize.body( - kubernetes_cluster_restart_node_parameters, "KubernetesClusterRestartNodeParameters" - ) - - _request = build_restart_node_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: _models.KubernetesClusterRestartNodeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Required. - :type kubernetes_cluster_restart_node_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Required. - :type kubernetes_cluster_restart_node_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: Union[_models.KubernetesClusterRestartNodeParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Is either a - KubernetesClusterRestartNodeParameters type or a IO[bytes] type. Required. - :type kubernetes_cluster_restart_node_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_node_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - kubernetes_cluster_restart_node_parameters=kubernetes_cluster_restart_node_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l2_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l2_networks_operations.py deleted file mode 100644 index 9c612cd34ae1..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l2_networks_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._l2_networks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class L2NetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`l2_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.L2Network"]: - """List layer 2 (L2) networks in the subscription. - - Get a list of layer 2 (L2) networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L2Network or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L2Network] - :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.L2NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L2NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.L2Network"]: - """List layer 2 (L2) networks in the resource group. - - Get a list of layer 2 (L2) networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L2Network or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L2Network] - :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.L2NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L2NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, l2_network_name: str, **kwargs: Any) -> _models.L2Network: - """Retrieve the layer 2 (L2) network. - - Get properties of the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~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.L2Network] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L2Network", 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, - l2_network_name: str, - l2_network_parameters: Union[_models.L2Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(l2_network_parameters, (IOBase, bytes)): - _content = l2_network_parameters - else: - _json = self._serialize.body(l2_network_parameters, "L2Network") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - l2_network_name: str, - l2_network_parameters: _models.L2Network, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Required. - :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 L2Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - l2_network_name: str, - l2_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Required. - :type l2_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 L2Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - l2_network_name: str, - l2_network_parameters: Union[_models.L2Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Is either a L2Network type or a IO[bytes] type. - Required. - :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either L2Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] - :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.L2Network] = 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, - l2_network_name=l2_network_name, - l2_network_parameters=l2_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("L2Network", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.L2Network].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.L2Network]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the layer 2 (L2) network. - - Delete the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - l2_network_name=l2_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[_models.L2NetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Default value is None. - :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Default value is None. - :type l2_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[Union[_models.L2NetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Is either a L2NetworkPatchParameters - type or a IO[bytes] type. Default value is None. - :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters or - IO[bytes] - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~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)) - content_type = content_type if l2_network_update_parameters else None - cls: ClsType[_models.L2Network] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if l2_network_update_parameters else None - _json = None - _content = None - if isinstance(l2_network_update_parameters, (IOBase, bytes)): - _content = l2_network_update_parameters - else: - if l2_network_update_parameters is not None: - _json = self._serialize.body(l2_network_update_parameters, "L2NetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L2Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l3_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l3_networks_operations.py deleted file mode 100644 index 3828f7361d3c..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_l3_networks_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._l3_networks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class L3NetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`l3_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.L3Network"]: - """List layer 3 (L3) networks in the subscription. - - Get a list of layer 3 (L3) networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L3Network or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L3Network] - :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.L3NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L3NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.L3Network"]: - """List layer 3 (L3) networks in the resource group. - - Get a list of layer 3 (L3) networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L3Network or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L3Network] - :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.L3NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L3NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, l3_network_name: str, **kwargs: Any) -> _models.L3Network: - """Retrieve the layer 3 (L3) network. - - Get properties of the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~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.L3Network] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L3Network", 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, - l3_network_name: str, - l3_network_parameters: Union[_models.L3Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(l3_network_parameters, (IOBase, bytes)): - _content = l3_network_parameters - else: - _json = self._serialize.body(l3_network_parameters, "L3Network") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - l3_network_name: str, - l3_network_parameters: _models.L3Network, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Required. - :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 L3Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - l3_network_name: str, - l3_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Required. - :type l3_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 L3Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - l3_network_name: str, - l3_network_parameters: Union[_models.L3Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Is either a L3Network type or a IO[bytes] type. - Required. - :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either L3Network or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] - :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.L3Network] = 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, - l3_network_name=l3_network_name, - l3_network_parameters=l3_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("L3Network", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.L3Network].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.L3Network]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the layer 3 (L3) network. - - Delete the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - l3_network_name=l3_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[_models.L3NetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Default value is None. - :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Default value is None. - :type l3_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[Union[_models.L3NetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Is either a L3NetworkPatchParameters - type or a IO[bytes] type. Default value is None. - :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters or - IO[bytes] - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~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)) - content_type = content_type if l3_network_update_parameters else None - cls: ClsType[_models.L3Network] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if l3_network_update_parameters else None - _json = None - _content = None - if isinstance(l3_network_update_parameters, (IOBase, bytes)): - _content = l3_network_update_parameters - else: - if l3_network_update_parameters is not None: - _json = self._serialize.body(l3_network_update_parameters, "L3NetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L3Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_metrics_configurations_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_metrics_configurations_operations.py deleted file mode 100644 index 6108f54fd3a0..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_metrics_configurations_operations.py +++ /dev/null @@ -1,940 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._metrics_configurations_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_cluster_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MetricsConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`metrics_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.ClusterMetricsConfiguration"]: - """List metrics configurations of the cluster. - - Get a list of metrics configurations for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterMetricsConfiguration or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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.ClusterMetricsConfigurationList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("ClusterMetricsConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, metrics_configuration_name: str, **kwargs: Any - ) -> _models.ClusterMetricsConfiguration: - """Retrieve the metrics configuration of the cluster. - - Get metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :return: ClusterMetricsConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration - :raises ~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.ClusterMetricsConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterMetricsConfiguration", 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, - metrics_configuration_name: str, - metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(metrics_configuration_parameters, (IOBase, bytes)): - _content = metrics_configuration_parameters - else: - _json = self._serialize.body(metrics_configuration_parameters, "ClusterMetricsConfiguration") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - metrics_configuration_name: str, - metrics_configuration_parameters: _models.ClusterMetricsConfiguration, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Required. - :type metrics_configuration_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - metrics_configuration_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Required. - :type metrics_configuration_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Is either a - ClusterMetricsConfiguration type or a IO[bytes] type. Required. - :type metrics_configuration_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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.ClusterMetricsConfiguration] = 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, - metrics_configuration_name=metrics_configuration_name, - metrics_configuration_parameters=metrics_configuration_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("ClusterMetricsConfiguration", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ClusterMetricsConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ClusterMetricsConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the metrics configuration of the cluster. - - Delete the metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - metrics_configuration_name=metrics_configuration_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[ - Union[_models.ClusterMetricsConfigurationPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if metrics_configuration_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if metrics_configuration_update_parameters else None - _json = None - _content = None - if isinstance(metrics_configuration_update_parameters, (IOBase, bytes)): - _content = metrics_configuration_update_parameters - else: - if metrics_configuration_update_parameters is not None: - _json = self._serialize.body( - metrics_configuration_update_parameters, "ClusterMetricsConfigurationPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[_models.ClusterMetricsConfigurationPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Default value is None. - :type metrics_configuration_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters - :keyword content_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 ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Default value is None. - :type metrics_configuration_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[ - Union[_models.ClusterMetricsConfigurationPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Is either a - ClusterMetricsConfigurationPatchParameters type or a IO[bytes] type. Default value is None. - :type metrics_configuration_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ClusterMetricsConfiguration or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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)) - content_type = content_type if metrics_configuration_update_parameters else None - cls: ClsType[_models.ClusterMetricsConfiguration] = 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, - metrics_configuration_name=metrics_configuration_name, - if_match=if_match, - if_none_match=if_none_match, - metrics_configuration_update_parameters=metrics_configuration_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClusterMetricsConfiguration", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ClusterMetricsConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ClusterMetricsConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_operations.py index 16ea2e275bd5..5b9227aaff1c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_operations.py @@ -1,37 +1,178 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse -from azure.core import AsyncPipelineClient +from azure.core import AsyncPipelineClient, MatchConditions from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ...operations._operations import ( + build_agent_pools_create_or_update_request, + build_agent_pools_delete_request, + build_agent_pools_get_request, + build_agent_pools_list_by_kubernetes_cluster_request, + build_agent_pools_update_request, + build_bare_metal_machine_key_sets_create_or_update_request, + build_bare_metal_machine_key_sets_delete_request, + build_bare_metal_machine_key_sets_get_request, + build_bare_metal_machine_key_sets_list_by_cluster_request, + build_bare_metal_machine_key_sets_update_request, + build_bare_metal_machines_cordon_request, + build_bare_metal_machines_create_or_update_request, + build_bare_metal_machines_delete_request, + build_bare_metal_machines_get_request, + build_bare_metal_machines_list_by_resource_group_request, + build_bare_metal_machines_list_by_subscription_request, + build_bare_metal_machines_power_off_request, + build_bare_metal_machines_reimage_request, + build_bare_metal_machines_replace_request, + build_bare_metal_machines_restart_request, + build_bare_metal_machines_run_command_request, + build_bare_metal_machines_run_data_extracts_request, + build_bare_metal_machines_run_data_extracts_restricted_request, + build_bare_metal_machines_run_read_commands_request, + build_bare_metal_machines_start_request, + build_bare_metal_machines_uncordon_request, + build_bare_metal_machines_update_request, + build_bmc_key_sets_create_or_update_request, + build_bmc_key_sets_delete_request, + build_bmc_key_sets_get_request, + build_bmc_key_sets_list_by_cluster_request, + build_bmc_key_sets_update_request, + build_cloud_services_networks_create_or_update_request, + build_cloud_services_networks_delete_request, + build_cloud_services_networks_get_request, + build_cloud_services_networks_list_by_resource_group_request, + build_cloud_services_networks_list_by_subscription_request, + build_cloud_services_networks_update_request, + build_cluster_managers_create_or_update_request, + build_cluster_managers_delete_request, + build_cluster_managers_get_request, + build_cluster_managers_list_by_resource_group_request, + build_cluster_managers_list_by_subscription_request, + build_cluster_managers_update_request, + build_clusters_continue_update_version_request, + build_clusters_create_or_update_request, + build_clusters_delete_request, + build_clusters_deploy_request, + build_clusters_get_request, + build_clusters_list_by_resource_group_request, + build_clusters_list_by_subscription_request, + build_clusters_scan_runtime_request, + build_clusters_update_request, + build_clusters_update_version_request, + build_consoles_create_or_update_request, + build_consoles_delete_request, + build_consoles_get_request, + build_consoles_list_by_virtual_machine_request, + build_consoles_update_request, + build_kubernetes_cluster_features_create_or_update_request, + build_kubernetes_cluster_features_delete_request, + build_kubernetes_cluster_features_get_request, + build_kubernetes_cluster_features_list_by_kubernetes_cluster_request, + build_kubernetes_cluster_features_update_request, + build_kubernetes_clusters_create_or_update_request, + build_kubernetes_clusters_delete_request, + build_kubernetes_clusters_get_request, + build_kubernetes_clusters_list_by_resource_group_request, + build_kubernetes_clusters_list_by_subscription_request, + build_kubernetes_clusters_restart_node_request, + build_kubernetes_clusters_update_request, + build_l2_networks_create_or_update_request, + build_l2_networks_delete_request, + build_l2_networks_get_request, + build_l2_networks_list_by_resource_group_request, + build_l2_networks_list_by_subscription_request, + build_l2_networks_update_request, + build_l3_networks_create_or_update_request, + build_l3_networks_delete_request, + build_l3_networks_get_request, + build_l3_networks_list_by_resource_group_request, + build_l3_networks_list_by_subscription_request, + build_l3_networks_update_request, + build_metrics_configurations_create_or_update_request, + build_metrics_configurations_delete_request, + build_metrics_configurations_get_request, + build_metrics_configurations_list_by_cluster_request, + build_metrics_configurations_update_request, + build_operations_list_request, + build_rack_skus_get_request, + build_rack_skus_list_by_subscription_request, + build_racks_create_or_update_request, + build_racks_delete_request, + build_racks_get_request, + build_racks_list_by_resource_group_request, + build_racks_list_by_subscription_request, + build_racks_update_request, + build_storage_appliances_create_or_update_request, + build_storage_appliances_delete_request, + build_storage_appliances_disable_remote_vendor_management_request, + build_storage_appliances_enable_remote_vendor_management_request, + build_storage_appliances_get_request, + build_storage_appliances_list_by_resource_group_request, + build_storage_appliances_list_by_subscription_request, + build_storage_appliances_run_read_commands_request, + build_storage_appliances_update_request, + build_trunked_networks_create_or_update_request, + build_trunked_networks_delete_request, + build_trunked_networks_get_request, + build_trunked_networks_list_by_resource_group_request, + build_trunked_networks_list_by_subscription_request, + build_trunked_networks_update_request, + build_virtual_machines_assign_relay_request, + build_virtual_machines_create_or_update_request, + build_virtual_machines_delete_request, + build_virtual_machines_get_request, + build_virtual_machines_list_by_resource_group_request, + build_virtual_machines_list_by_subscription_request, + build_virtual_machines_power_off_request, + build_virtual_machines_reimage_request, + build_virtual_machines_restart_request, + build_virtual_machines_start_request, + build_virtual_machines_update_request, + build_volumes_create_or_update_request, + build_volumes_delete_request, + build_volumes_get_request, + build_volumes_list_by_resource_group_request, + build_volumes_list_by_subscription_request, + build_volumes_update_request, +) from .._configuration import NetworkCloudMgmtClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -45,8 +186,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -56,20 +195,944 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: - """List resource provider operations. + """List the operations for the provider. - Get a list of all available resource provider operations. It contains a URL link to get the - next set of results. - - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Operation] :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.Operation]] = 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.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BareMetalMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`bare_metal_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bare_metal_machine_name: str, **kwargs: Any + ) -> _models.BareMetalMachine: + """Get properties of the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: BareMetalMachine. The BareMetalMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachine + :raises ~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.BareMetalMachine] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_get_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BareMetalMachine, 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, + bare_metal_machine_name: str, + bare_metal_machine_parameters: Union[_models.BareMetalMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bare_metal_machine_parameters, (IOBase, bytes)): + _content = bare_metal_machine_parameters + else: + _content = json.dumps(bare_metal_machine_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_create_or_update_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: _models.BareMetalMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: Union[_models.BareMetalMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Is one of the following types: + BareMetalMachine, JSON, IO[bytes] Required. + :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :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.BareMetalMachine] = 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, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_parameters=bare_metal_machine_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachine, 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.BareMetalMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BareMetalMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[ + Union[_models.BareMetalMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bare_metal_machine_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_update_parameters else None + _content = None + if isinstance(bare_metal_machine_update_parameters, (IOBase, bytes)): + _content = bare_metal_machine_update_parameters + else: + if bare_metal_machine_update_parameters is not None: + _content = json.dumps(bare_metal_machine_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_update_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[_models.BareMetalMachinePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[ + Union[_models.BareMetalMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Is one of the following types: + BareMetalMachinePatchParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :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)) + content_type = content_type if bare_metal_machine_update_parameters else None + cls: ClsType[_models.BareMetalMachine] = 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, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_update_parameters=bare_metal_machine_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachine, 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.BareMetalMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BareMetalMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bare_metal_machines_delete_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + bare_metal_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided bare metal machine. All customer initiated requests will be rejected as the + life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.BareMetalMachine"]: + """Get a list of bare metal machines in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachine + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] + :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.BareMetalMachine]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -82,12 +1145,21 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_bare_metal_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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 +1174,22083 @@ 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.BareMetalMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.BareMetalMachine"]: + """Get a list of bare metal machines in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachine + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BareMetalMachine]] = 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_bare_metal_machines_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BareMetalMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _cordon_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[ + Union[_models.BareMetalMachineCordonParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_cordon_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_cordon_parameters else None + _content = None + if isinstance(bare_metal_machine_cordon_parameters, (IOBase, bytes)): + _content = bare_metal_machine_cordon_parameters + else: + if bare_metal_machine_cordon_parameters is not None: + _content = json.dumps(bare_metal_machine_cordon_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_cordon_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[_models.BareMetalMachineCordonParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[ + Union[_models.BareMetalMachineCordonParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Is one of the following types: + BareMetalMachineCordonParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_cordon_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_cordon_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._cordon_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_cordon_parameters=bare_metal_machine_cordon_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _power_off_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[ + Union[_models.BareMetalMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_power_off_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_power_off_parameters else None + _content = None + if isinstance(bare_metal_machine_power_off_parameters, (IOBase, bytes)): + _content = bare_metal_machine_power_off_parameters + else: + if bare_metal_machine_power_off_parameters is not None: + _content = json.dumps(bare_metal_machine_power_off_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_power_off_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[_models.BareMetalMachinePowerOffParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[ + Union[_models.BareMetalMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Is one of the following + types: BareMetalMachinePowerOffParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_power_off_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_power_off_parameters=bare_metal_machine_power_off_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_reimage_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reimage( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Reimage the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _replace_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[ + Union[_models.BareMetalMachineReplaceParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_replace_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_replace_parameters else None + _content = None + if isinstance(bare_metal_machine_replace_parameters, (IOBase, bytes)): + _content = bare_metal_machine_replace_parameters + else: + if bare_metal_machine_replace_parameters is not None: + _content = json.dumps(bare_metal_machine_replace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_replace_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[_models.BareMetalMachineReplaceParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[ + Union[_models.BareMetalMachineReplaceParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Is one of the following types: + BareMetalMachineReplaceParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_replace_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_replace_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._replace_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_replace_parameters=bare_metal_machine_replace_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_restart_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_command_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, 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(bare_metal_machine_run_command_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_command_parameters + else: + _content = json.dumps(bare_metal_machine_run_command_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_command_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: _models.BareMetalMachineRunCommandParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Is one of the following + types: BareMetalMachineRunCommandParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_command_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_command_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_command_parameters=bare_metal_machine_run_command_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_data_extracts_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_data_extracts_parameters + else: + _content = json.dumps(bare_metal_machine_run_data_extracts_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_data_extracts_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: _models.BareMetalMachineRunDataExtractsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Is one of the + following types: BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_data_extracts_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_data_extracts_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_data_extracts_parameters=bare_metal_machine_run_data_extracts_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_data_extracts_restricted_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_restricted_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_data_extracts_restricted_parameters + else: + _content = json.dumps(bare_metal_machine_run_data_extracts_restricted_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_data_extracts_restricted_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: _models.BareMetalMachineRunDataExtractsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Is one of + the following types: BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_data_extracts_restricted_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_data_extracts_restricted_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_data_extracts_restricted_parameters=bare_metal_machine_run_data_extracts_restricted_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_read_commands_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: Union[ + _models.BareMetalMachineRunReadCommandsParameters, 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(bare_metal_machine_run_read_commands_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_read_commands_parameters + else: + _content = json.dumps(bare_metal_machine_run_read_commands_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_read_commands_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: _models.BareMetalMachineRunReadCommandsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: Union[ + _models.BareMetalMachineRunReadCommandsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Is one of the + following types: BareMetalMachineRunReadCommandsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_read_commands_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_read_commands_parameters=bare_metal_machine_run_read_commands_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _start_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_start_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Start the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _uncordon_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_uncordon_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_uncordon( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Uncordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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._uncordon_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class CloudServicesNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`cloud_services_networks` 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: NetworkCloudMgmtClientConfiguration = 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, cloud_services_network_name: str, **kwargs: Any + ) -> _models.CloudServicesNetwork: + """Get properties of the provided cloud services network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :return: CloudServicesNetwork. The CloudServicesNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + :raises ~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.CloudServicesNetwork] = kwargs.pop("cls", None) + + _request = build_cloud_services_networks_get_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudServicesNetwork, 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, + cloud_services_network_name: str, + cloud_services_network_parameters: Union[_models.CloudServicesNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cloud_services_network_parameters, (IOBase, bytes)): + _content = cloud_services_network_parameters + else: + _content = json.dumps(cloud_services_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_services_networks_create_or_update_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: _models.CloudServicesNetwork, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: Union[_models.CloudServicesNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Is one of the following types: + CloudServicesNetwork, JSON, IO[bytes] Required. + :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :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.CloudServicesNetwork] = 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, + cloud_services_network_name=cloud_services_network_name, + cloud_services_network_parameters=cloud_services_network_parameters, + etag=etag, + match_condition=match_condition, + 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.CloudServicesNetwork, 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.CloudServicesNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudServicesNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[ + Union[_models.CloudServicesNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cloud_services_network_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cloud_services_network_update_parameters else None + _content = None + if isinstance(cloud_services_network_update_parameters, (IOBase, bytes)): + _content = cloud_services_network_update_parameters + else: + if cloud_services_network_update_parameters is not None: + _content = json.dumps(cloud_services_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_cloud_services_networks_update_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[_models.CloudServicesNetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: + ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[ + Union[_models.CloudServicesNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Is one of the following + types: CloudServicesNetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type cloud_services_network_update_parameters: + ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns CloudServicesNetwork. The + CloudServicesNetwork is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :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)) + content_type = content_type if cloud_services_network_update_parameters else None + cls: ClsType[_models.CloudServicesNetwork] = 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, + cloud_services_network_name=cloud_services_network_name, + cloud_services_network_update_parameters=cloud_services_network_update_parameters, + etag=etag, + match_condition=match_condition, + 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.CloudServicesNetwork, 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.CloudServicesNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudServicesNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + cloud_services_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_cloud_services_networks_delete_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cloud_services_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided cloud services network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + cloud_services_network_name=cloud_services_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.CloudServicesNetwork"]: + """Get a list of cloud services networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of CloudServicesNetwork + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudServicesNetwork]] = 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_cloud_services_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.CloudServicesNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.CloudServicesNetwork"]: + """Get a list of cloud services networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of CloudServicesNetwork + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudServicesNetwork]] = 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_cloud_services_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.CloudServicesNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ClusterManagersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`cluster_managers` 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: NetworkCloudMgmtClientConfiguration = 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_manager_name: str, **kwargs: Any) -> _models.ClusterManager: + """Get the properties of the provided cluster manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~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.ClusterManager] = kwargs.pop("cls", None) + + _request = build_cluster_managers_get_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterManager, 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_manager_name: str, + cluster_manager_parameters: Union[_models.ClusterManager, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cluster_manager_parameters, (IOBase, bytes)): + _content = cluster_manager_parameters + else: + _content = json.dumps(cluster_manager_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cluster_managers_create_or_update_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: _models.ClusterManager, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterManager. The ClusterManager is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterManager. The ClusterManager is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterManager. The ClusterManager is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: Union[_models.ClusterManager, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Is one of the following types: + ClusterManager, JSON, IO[bytes] Required. + :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterManager. The ClusterManager is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :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.ClusterManager] = 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_manager_name=cluster_manager_name, + cluster_manager_parameters=cluster_manager_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterManager, 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.ClusterManager].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ClusterManager]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[_models.ClusterManagerPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[ + Union[_models.ClusterManagerPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Is one of the following types: + ClusterManagerPatchParameters, JSON, IO[bytes] Default value is None. + :type cluster_manager_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cluster_manager_update_parameters else None + cls: ClsType[_models.ClusterManager] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_manager_update_parameters else None + _content = None + if isinstance(cluster_manager_update_parameters, (IOBase, bytes)): + _content = cluster_manager_update_parameters + else: + if cluster_manager_update_parameters is not None: + _content = json.dumps(cluster_manager_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_cluster_managers_update_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterManager, 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_manager_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_cluster_managers_delete_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_manager_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided cluster manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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_manager_name=cluster_manager_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ClusterManager"]: + """Get a list of cluster managers in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterManager + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterManager]] = 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_cluster_managers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.ClusterManager], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ClusterManager"]: + """Get a list of cluster managers in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterManager + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterManager]] = 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_cluster_managers_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.ClusterManager], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`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: NetworkCloudMgmtClientConfiguration = 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.Cluster: + """Get properties of the provided 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. Required. + :type cluster_name: str + :return: Cluster. The Cluster is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Cluster + :raises ~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.Cluster] = kwargs.pop("cls", None) + + _request = build_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Cluster, 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, + cluster_parameters: Union[_models.Cluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cluster_parameters, (IOBase, bytes)): + _content = cluster_parameters + else: + _content = json.dumps(cluster_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: _models.Cluster, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: Union[_models.Cluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Is one of the following types: Cluster, JSON, + IO[bytes] Required. + :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :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.Cluster] = 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, + cluster_parameters=cluster_parameters, + etag=etag, + match_condition=match_condition, + 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.Cluster, 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.Cluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cluster_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_update_parameters else None + _content = None + if isinstance(cluster_update_parameters, (IOBase, bytes)): + _content = cluster_update_parameters + else: + if cluster_update_parameters is not None: + _content = json.dumps(cluster_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[_models.ClusterPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Is one of the following types: + ClusterPatchParameters, JSON, IO[bytes] Default value is None. + :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Cluster] + :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)) + content_type = content_type if cluster_update_parameters else None + cls: ClsType[_models.Cluster] = 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, + cluster_update_parameters=cluster_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Cluster, 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.Cluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided 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. Required. + :type cluster_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Cluster"]: + """Get a list of clusters in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Cluster + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Cluster]] = 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_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Cluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Cluster"]: + """Get a list of clusters in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Cluster + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Cluster]] = 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_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Cluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _continue_update_version_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: Union[ + _models.ClusterContinueUpdateVersionParameters, 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(cluster_continue_update_version_parameters, (IOBase, bytes)): + _content = cluster_continue_update_version_parameters + else: + _content = json.dumps(cluster_continue_update_version_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_continue_update_version_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: _models.ClusterContinueUpdateVersionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: Union[ + _models.ClusterContinueUpdateVersionParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Is one of the following + types: ClusterContinueUpdateVersionParameters, JSON, IO[bytes] Required. + :type cluster_continue_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._continue_update_version_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_continue_update_version_parameters=cluster_continue_update_version_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _deploy_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, JSON, IO[bytes]]] = None, + **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)) + content_type = content_type if cluster_deploy_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_deploy_parameters else None + _content = None + if isinstance(cluster_deploy_parameters, (IOBase, bytes)): + _content = cluster_deploy_parameters + else: + if cluster_deploy_parameters is not None: + _content = json.dumps(cluster_deploy_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_deploy_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[_models.ClusterDeployParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Is one of the following types: + ClusterDeployParameters, JSON, IO[bytes] Default value is None. + :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if cluster_deploy_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._deploy_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_deploy_parameters=cluster_deploy_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _scan_runtime_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, JSON, IO[bytes]]] = None, + **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)) + content_type = content_type if cluster_scan_runtime_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_scan_runtime_parameters else None + _content = None + if isinstance(cluster_scan_runtime_parameters, (IOBase, bytes)): + _content = cluster_scan_runtime_parameters + else: + if cluster_scan_runtime_parameters is not None: + _content = json.dumps(cluster_scan_runtime_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_scan_runtime_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[_models.ClusterScanRuntimeParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_parameters: + ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Is one of the following types: + ClusterScanRuntimeParameters, JSON, IO[bytes] Default value is None. + :type cluster_scan_runtime_parameters: + ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if cluster_scan_runtime_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._scan_runtime_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_scan_runtime_parameters=cluster_scan_runtime_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_version_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, 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(cluster_update_version_parameters, (IOBase, bytes)): + _content = cluster_update_version_parameters + else: + _content = json.dumps(cluster_update_version_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_update_version_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: _models.ClusterUpdateVersionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Is one of the following types: + ClusterUpdateVersionParameters, JSON, IO[bytes] Required. + :type cluster_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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_version_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_update_version_parameters=cluster_update_version_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class KubernetesClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`kubernetes_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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, **kwargs: Any + ) -> _models.KubernetesCluster: + """Get properties of the provided the Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :return: KubernetesCluster. The KubernetesCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.KubernetesCluster + :raises ~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.KubernetesCluster] = kwargs.pop("cls", None) + + _request = build_kubernetes_clusters_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KubernetesCluster, 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, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: Union[_models.KubernetesCluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(kubernetes_cluster_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_parameters + else: + _content = json.dumps(kubernetes_cluster_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_clusters_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: _models.KubernetesCluster, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: Union[_models.KubernetesCluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Is one of the following types: + KubernetesCluster, JSON, IO[bytes] Required. + :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :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.KubernetesCluster] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_parameters=kubernetes_cluster_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesCluster, 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.KubernetesCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.KubernetesCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[ + Union[_models.KubernetesClusterPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if kubernetes_cluster_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if kubernetes_cluster_update_parameters else None + _content = None + if isinstance(kubernetes_cluster_update_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_update_parameters + else: + if kubernetes_cluster_update_parameters is not None: + _content = json.dumps(kubernetes_cluster_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_kubernetes_clusters_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[_models.KubernetesClusterPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[ + Union[_models.KubernetesClusterPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Is one of the following types: + KubernetesClusterPatchParameters, JSON, IO[bytes] Default value is None. + :type kubernetes_cluster_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :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)) + content_type = content_type if kubernetes_cluster_update_parameters else None + cls: ClsType[_models.KubernetesCluster] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_update_parameters=kubernetes_cluster_update_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesCluster, 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.KubernetesCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.KubernetesCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_kubernetes_clusters_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.KubernetesCluster"]: + """Get a list of Kubernetes clusters in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesCluster]] = 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_kubernetes_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesCluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.KubernetesCluster"]: + """Get a list of Kubernetes clusters in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesCluster]] = 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_kubernetes_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesCluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _restart_node_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: Union[ + _models.KubernetesClusterRestartNodeParameters, 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(kubernetes_cluster_restart_node_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_restart_node_parameters + else: + _content = json.dumps(kubernetes_cluster_restart_node_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_clusters_restart_node_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: _models.KubernetesClusterRestartNodeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: Union[ + _models.KubernetesClusterRestartNodeParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Is one of the following + types: KubernetesClusterRestartNodeParameters, JSON, IO[bytes] Required. + :type kubernetes_cluster_restart_node_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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_node_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_restart_node_parameters=kubernetes_cluster_restart_node_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class L2NetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`l2_networks` 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: NetworkCloudMgmtClientConfiguration = 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, l2_network_name: str, **kwargs: Any) -> _models.L2Network: + """Get properties of the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~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.L2Network] = kwargs.pop("cls", None) + + _request = build_l2_networks_get_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L2Network, 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, + l2_network_name: str, + l2_network_parameters: Union[_models.L2Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(l2_network_parameters, (IOBase, bytes)): + _content = l2_network_parameters + else: + _content = json.dumps(l2_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_l2_networks_create_or_update_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: _models.L2Network, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: Union[_models.L2Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Is one of the following types: L2Network, JSON, + IO[bytes] Required. + :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L2Network] + :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.L2Network] = 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, + l2_network_name=l2_network_name, + l2_network_parameters=l2_network_parameters, + etag=etag, + match_condition=match_condition, + 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.L2Network, 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.L2Network].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.L2Network]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[_models.L2NetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[Union[_models.L2NetworkPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Is one of the following types: + L2NetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if l2_network_update_parameters else None + cls: ClsType[_models.L2Network] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if l2_network_update_parameters else None + _content = None + if isinstance(l2_network_update_parameters, (IOBase, bytes)): + _content = l2_network_update_parameters + else: + if l2_network_update_parameters is not None: + _content = json.dumps(l2_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_l2_networks_update_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L2Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + l2_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_l2_networks_delete_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + l2_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + l2_network_name=l2_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.L2Network"]: + """Get a list of layer 2 (L2) networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L2Network + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L2Network]] = 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_l2_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L2Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.L2Network"]: + """Get a list of layer 2 (L2) networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L2Network + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L2Network]] = 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_l2_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L2Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class L3NetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`l3_networks` 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: NetworkCloudMgmtClientConfiguration = 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, l3_network_name: str, **kwargs: Any) -> _models.L3Network: + """Get properties of the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~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.L3Network] = kwargs.pop("cls", None) + + _request = build_l3_networks_get_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L3Network, 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, + l3_network_name: str, + l3_network_parameters: Union[_models.L3Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(l3_network_parameters, (IOBase, bytes)): + _content = l3_network_parameters + else: + _content = json.dumps(l3_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_l3_networks_create_or_update_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: _models.L3Network, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: Union[_models.L3Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Is one of the following types: L3Network, JSON, + IO[bytes] Required. + :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.L3Network] + :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.L3Network] = 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, + l3_network_name=l3_network_name, + l3_network_parameters=l3_network_parameters, + etag=etag, + match_condition=match_condition, + 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.L3Network, 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.L3Network].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.L3Network]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[_models.L3NetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[Union[_models.L3NetworkPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Is one of the following types: + L3NetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if l3_network_update_parameters else None + cls: ClsType[_models.L3Network] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if l3_network_update_parameters else None + _content = None + if isinstance(l3_network_update_parameters, (IOBase, bytes)): + _content = l3_network_update_parameters + else: + if l3_network_update_parameters is not None: + _content = json.dumps(l3_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_l3_networks_update_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L3Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + l3_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_l3_networks_delete_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + l3_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + l3_network_name=l3_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.L3Network"]: + """Get a list of layer 3 (L3) networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L3Network + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L3Network]] = 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_l3_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L3Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.L3Network"]: + """Get a list of layer 3 (L3) networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L3Network + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L3Network]] = 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_l3_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L3Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RackSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`rack_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: NetworkCloudMgmtClientConfiguration = 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, rack_sku_name: str, **kwargs: Any) -> _models.RackSku: + """Get the properties of the provided rack SKU. + + :param rack_sku_name: The name of the rack SKU. Required. + :type rack_sku_name: str + :return: RackSku. The RackSku is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.RackSku + :raises ~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.RackSku] = kwargs.pop("cls", None) + + _request = build_rack_skus_get_request( + rack_sku_name=rack_sku_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RackSku, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.RackSku"]: + """Get a list of rack SKUs in the provided subscription. + + :return: An iterator like instance of RackSku + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.RackSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RackSku]] = 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_rack_skus_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.RackSku], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`racks` 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: NetworkCloudMgmtClientConfiguration = 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, rack_name: str, **kwargs: Any) -> _models.Rack: + """Get properties of the provided rack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :return: Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Rack + :raises ~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.Rack] = kwargs.pop("cls", None) + + _request = build_racks_get_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Rack, 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, + rack_name: str, + rack_parameters: Union[_models.Rack, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(rack_parameters, (IOBase, bytes)): + _content = rack_parameters + else: + _content = json.dumps(rack_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_racks_create_or_update_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: _models.Rack, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: Union[_models.Rack, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Is one of the following types: Rack, JSON, IO[bytes] + Required. + :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :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.Rack] = 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, + rack_name=rack_name, + rack_parameters=rack_parameters, + etag=etag, + match_condition=match_condition, + 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.Rack, 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.Rack].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Rack]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[Union[_models.RackPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if rack_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if rack_update_parameters else None + _content = None + if isinstance(rack_update_parameters, (IOBase, bytes)): + _content = rack_update_parameters + else: + if rack_update_parameters is not None: + _content = json.dumps(rack_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_racks_update_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[_models.RackPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[Union[_models.RackPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Is one of the following types: + RackPatchParameters, JSON, IO[bytes] Default value is None. + :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Rack. The Rack is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] + :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)) + content_type = content_type if rack_update_parameters else None + cls: ClsType[_models.Rack] = 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, + rack_name=rack_name, + rack_update_parameters=rack_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Rack, 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.Rack].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Rack]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + rack_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_racks_delete_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + rack_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided rack. All customer initiated requests will be rejected as the life cycle of + this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + rack_name=rack_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Rack"]: + """Get a list of racks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Rack + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Rack]] = 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_racks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Rack], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Rack"]: + """Get a list of racks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Rack + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Rack]] = 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_racks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Rack], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class StorageAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`storage_appliances` 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: NetworkCloudMgmtClientConfiguration = 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, storage_appliance_name: str, **kwargs: Any + ) -> _models.StorageAppliance: + """Get properties of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :return: StorageAppliance. The StorageAppliance is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.StorageAppliance + :raises ~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.StorageAppliance] = kwargs.pop("cls", None) + + _request = build_storage_appliances_get_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageAppliance, 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, + storage_appliance_name: str, + storage_appliance_parameters: Union[_models.StorageAppliance, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(storage_appliance_parameters, (IOBase, bytes)): + _content = storage_appliance_parameters + else: + _content = json.dumps(storage_appliance_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_appliances_create_or_update_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: _models.StorageAppliance, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: Union[_models.StorageAppliance, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Is one of the following types: + StorageAppliance, JSON, IO[bytes] Required. + :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :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.StorageAppliance] = 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, + storage_appliance_name=storage_appliance_name, + storage_appliance_parameters=storage_appliance_parameters, + etag=etag, + match_condition=match_condition, + 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.StorageAppliance, 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.StorageAppliance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageAppliance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[ + Union[_models.StorageAppliancePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if storage_appliance_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if storage_appliance_update_parameters else None + _content = None + if isinstance(storage_appliance_update_parameters, (IOBase, bytes)): + _content = storage_appliance_update_parameters + else: + if storage_appliance_update_parameters is not None: + _content = json.dumps(storage_appliance_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_appliances_update_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[_models.StorageAppliancePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: + ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[ + Union[_models.StorageAppliancePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Is one of the following types: + StorageAppliancePatchParameters, JSON, IO[bytes] Default value is None. + :type storage_appliance_update_parameters: + ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :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)) + content_type = content_type if storage_appliance_update_parameters else None + cls: ClsType[_models.StorageAppliance] = 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, + storage_appliance_name=storage_appliance_name, + storage_appliance_update_parameters=storage_appliance_update_parameters, + etag=etag, + match_condition=match_condition, + 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.StorageAppliance, 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.StorageAppliance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageAppliance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_storage_appliances_delete_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_appliance_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided storage appliance. All customer initiated requests will be rejected as the + life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + storage_appliance_name=storage_appliance_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageAppliance"]: + """Get a list of storage appliances in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of StorageAppliance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageAppliance]] = 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_storage_appliances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.StorageAppliance], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageAppliance"]: + """Get a list of storage appliances in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of StorageAppliance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageAppliance]] = 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_storage_appliances_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.StorageAppliance], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _disable_remote_vendor_management_initial( # pylint: disable=name-too-long + self, resource_group_name: str, storage_appliance_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_storage_appliances_disable_remote_vendor_management_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_disable_remote_vendor_management( + self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Disable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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._disable_remote_vendor_management_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _enable_remote_vendor_management_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = ( + content_type or "application/json" if storage_appliance_enable_remote_vendor_management_parameters else None + ) + _content = None + if isinstance(storage_appliance_enable_remote_vendor_management_parameters, (IOBase, bytes)): + _content = storage_appliance_enable_remote_vendor_management_parameters + else: + if storage_appliance_enable_remote_vendor_management_parameters is not None: + _content = json.dumps(storage_appliance_enable_remote_vendor_management_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_appliances_enable_remote_vendor_management_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + _models.StorageApplianceEnableRemoteVendorManagementParameters + ] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Is one + of the following types: StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes] + Default value is None. + :type storage_appliance_enable_remote_vendor_management_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._enable_remote_vendor_management_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + storage_appliance_enable_remote_vendor_management_parameters=storage_appliance_enable_remote_vendor_management_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _run_read_commands_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: Union[ + _models.StorageApplianceRunReadCommandsParameters, 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(storage_appliance_run_read_commands_parameters, (IOBase, bytes)): + _content = storage_appliance_run_read_commands_parameters + else: + _content = json.dumps(storage_appliance_run_read_commands_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_appliances_run_read_commands_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: _models.StorageApplianceRunReadCommandsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: Union[ + _models.StorageApplianceRunReadCommandsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Is one of the + following types: StorageApplianceRunReadCommandsParameters, JSON, IO[bytes] Required. + :type storage_appliance_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_read_commands_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + storage_appliance_run_read_commands_parameters=storage_appliance_run_read_commands_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class TrunkedNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`trunked_networks` 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: NetworkCloudMgmtClientConfiguration = 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, trunked_network_name: str, **kwargs: Any) -> _models.TrunkedNetwork: + """Get properties of the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~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.TrunkedNetwork] = kwargs.pop("cls", None) + + _request = build_trunked_networks_get_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TrunkedNetwork, 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, + trunked_network_name: str, + trunked_network_parameters: Union[_models.TrunkedNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(trunked_network_parameters, (IOBase, bytes)): + _content = trunked_network_parameters + else: + _content = json.dumps(trunked_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_trunked_networks_create_or_update_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: _models.TrunkedNetwork, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns TrunkedNetwork. The TrunkedNetwork is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns TrunkedNetwork. The TrunkedNetwork is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns TrunkedNetwork. The TrunkedNetwork is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: Union[_models.TrunkedNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Is one of the following types: + TrunkedNetwork, JSON, IO[bytes] Required. + :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns TrunkedNetwork. The TrunkedNetwork is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :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.TrunkedNetwork] = 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, + trunked_network_name=trunked_network_name, + trunked_network_parameters=trunked_network_parameters, + etag=etag, + match_condition=match_condition, + 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.TrunkedNetwork, 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.TrunkedNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.TrunkedNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[_models.TrunkedNetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: + ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[ + Union[_models.TrunkedNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Is one of the following types: + TrunkedNetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type trunked_network_update_parameters: + ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if trunked_network_update_parameters else None + cls: ClsType[_models.TrunkedNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if trunked_network_update_parameters else None + _content = None + if isinstance(trunked_network_update_parameters, (IOBase, bytes)): + _content = trunked_network_update_parameters + else: + if trunked_network_update_parameters is not None: + _content = json.dumps(trunked_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_trunked_networks_update_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TrunkedNetwork, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + trunked_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_trunked_networks_delete_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + trunked_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + trunked_network_name=trunked_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.TrunkedNetwork"]: + """Get a list of trunked networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of TrunkedNetwork + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TrunkedNetwork]] = 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_trunked_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.TrunkedNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.TrunkedNetwork"]: + """Get a list of trunked networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of TrunkedNetwork + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TrunkedNetwork]] = 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_trunked_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.TrunkedNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VirtualMachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`virtual_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: + """Get properties of the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.VirtualMachine + :raises ~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.VirtualMachine] = kwargs.pop("cls", None) + + _request = build_virtual_machines_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VirtualMachine, 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, + virtual_machine_name: str, + virtual_machine_parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(virtual_machine_parameters, (IOBase, bytes)): + _content = virtual_machine_parameters + else: + _content = json.dumps(virtual_machine_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: _models.VirtualMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Is one of the following types: + VirtualMachine, JSON, IO[bytes] Required. + :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :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.VirtualMachine] = 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_parameters=virtual_machine_parameters, + etag=etag, + match_condition=match_condition, + 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.VirtualMachine, 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.VirtualMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[ + Union[_models.VirtualMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if virtual_machine_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_update_parameters else None + _content = None + if isinstance(virtual_machine_update_parameters, (IOBase, bytes)): + _content = virtual_machine_update_parameters + else: + if virtual_machine_update_parameters is not None: + _content = json.dumps(virtual_machine_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[_models.VirtualMachinePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[ + Union[_models.VirtualMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Is one of the following types: + VirtualMachinePatchParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_update_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns VirtualMachine. The VirtualMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :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)) + content_type = content_type if virtual_machine_update_parameters else None + cls: ClsType[_models.VirtualMachine] = 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_update_parameters=virtual_machine_update_parameters, + etag=etag, + match_condition=match_condition, + 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.VirtualMachine, 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.VirtualMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_virtual_machines_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """Get a list of virtual machines in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = 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_virtual_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.VirtualMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.VirtualMachine"]: + """Get a list of virtual machines in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = 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_virtual_machines_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.VirtualMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _assign_relay_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[ + Union[_models.VirtualMachineAssignRelayParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if virtual_machine_assign_relay_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_assign_relay_parameters else None + _content = None + if isinstance(virtual_machine_assign_relay_parameters, (IOBase, bytes)): + _content = virtual_machine_assign_relay_parameters + else: + if virtual_machine_assign_relay_parameters is not None: + _content = json.dumps(virtual_machine_assign_relay_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_assign_relay_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[_models.VirtualMachineAssignRelayParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[ + Union[_models.VirtualMachineAssignRelayParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Is one of the following + types: VirtualMachineAssignRelayParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_assign_relay_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if virtual_machine_assign_relay_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._assign_relay_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + virtual_machine_assign_relay_parameters=virtual_machine_assign_relay_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _power_off_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[ + Union[_models.VirtualMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if virtual_machine_power_off_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_power_off_parameters else None + _content = None + if isinstance(virtual_machine_power_off_parameters, (IOBase, bytes)): + _content = virtual_machine_power_off_parameters + else: + if virtual_machine_power_off_parameters is not None: + _content = json.dumps(virtual_machine_power_off_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_power_off_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[_models.VirtualMachinePowerOffParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters + :keyword content_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_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 OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[ + Union[_models.VirtualMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Is one of the following types: + VirtualMachinePowerOffParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if virtual_machine_power_off_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + virtual_machine_power_off_parameters=virtual_machine_power_off_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reimage_initial( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reimage( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Reimage the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Restart the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _start_initial( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Start the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class VolumesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`volumes` 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: NetworkCloudMgmtClientConfiguration = 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, volume_name: str, **kwargs: Any) -> _models.Volume: + """Get properties of the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~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.Volume] = kwargs.pop("cls", None) + + _request = build_volumes_get_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Volume, 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, + volume_name: str, + volume_parameters: Union[_models.Volume, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(volume_parameters, (IOBase, bytes)): + _content = volume_parameters + else: + _content = json.dumps(volume_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_volumes_create_or_update_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: _models.Volume, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: Union[_models.Volume, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Is one of the following types: Volume, JSON, + IO[bytes] Required. + :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] + :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.Volume] = 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, + volume_name=volume_name, + volume_parameters=volume_parameters, + etag=etag, + match_condition=match_condition, + 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.Volume, 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.Volume].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[_models.VolumePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[Union[_models.VolumePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Is one of the following types: + VolumePatchParameters, JSON, IO[bytes] Default value is None. + :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if volume_update_parameters else None + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if volume_update_parameters else None + _content = None + if isinstance(volume_update_parameters, (IOBase, bytes)): + _content = volume_update_parameters + else: + if volume_update_parameters is not None: + _content = json.dumps(volume_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_volumes_update_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Volume, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + volume_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_volumes_delete_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + volume_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + volume_name=volume_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Volume"]: + """Get a list of volumes in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Volume + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Volume]] = 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_volumes_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Volume], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Volume"]: + """Get a list of volumes in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Volume + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Volume]] = 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_volumes_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Volume], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BareMetalMachineKeySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`bare_metal_machine_key_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bare_metal_machine_key_set_name: str, **kwargs: Any + ) -> _models.BareMetalMachineKeySet: + """Get bare metal machine key set of the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :return: BareMetalMachineKeySet. The BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet + :raises ~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.BareMetalMachineKeySet] = kwargs.pop("cls", None) + + _request = build_bare_metal_machine_key_sets_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BareMetalMachineKeySet, 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, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bare_metal_machine_key_set_parameters, (IOBase, bytes)): + _content = bare_metal_machine_key_set_parameters + else: + _content = json.dumps(bare_metal_machine_key_set_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machine_key_sets_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: _models.BareMetalMachineKeySet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Is one of the following types: + BareMetalMachineKeySet, JSON, IO[bytes] Required. + :type bare_metal_machine_key_set_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :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.BareMetalMachineKeySet] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + bare_metal_machine_key_set_parameters=bare_metal_machine_key_set_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachineKeySet, 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.BareMetalMachineKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BareMetalMachineKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[ + Union[_models.BareMetalMachineKeySetPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bare_metal_machine_key_set_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_key_set_update_parameters else None + _content = None + if isinstance(bare_metal_machine_key_set_update_parameters, (IOBase, bytes)): + _content = bare_metal_machine_key_set_update_parameters + else: + if bare_metal_machine_key_set_update_parameters is not None: + _content = json.dumps(bare_metal_machine_key_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machine_key_sets_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[_models.BareMetalMachineKeySetPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[ + Union[_models.BareMetalMachineKeySetPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Is one of the following + types: BareMetalMachineKeySetPatchParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_key_set_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :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)) + content_type = content_type if bare_metal_machine_key_set_update_parameters else None + cls: ClsType[_models.BareMetalMachineKeySet] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + bare_metal_machine_key_set_update_parameters=bare_metal_machine_key_set_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachineKeySet, 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.BareMetalMachineKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BareMetalMachineKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bare_metal_machine_key_sets_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the bare metal machine key set of the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.BareMetalMachineKeySet"]: + """Get a list of bare metal machine key sets for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachineKeySet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BareMetalMachineKeySet]] = 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_bare_metal_machine_key_sets_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BareMetalMachineKeySet], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BmcKeySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`bmc_key_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bmc_key_set_name: str, **kwargs: Any + ) -> _models.BmcKeySet: + """Get baseboard management controller key set of the provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :return: BmcKeySet. The BmcKeySet is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BmcKeySet + :raises ~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.BmcKeySet] = kwargs.pop("cls", None) + + _request = build_bmc_key_sets_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BmcKeySet, 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, + bmc_key_set_name: str, + bmc_key_set_parameters: Union[_models.BmcKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bmc_key_set_parameters, (IOBase, bytes)): + _content = bmc_key_set_parameters + else: + _content = json.dumps(bmc_key_set_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bmc_key_sets_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: _models.BmcKeySet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: Union[_models.BmcKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Is one of the following types: BmcKeySet, + JSON, IO[bytes] Required. + :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :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.BmcKeySet] = 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, + bmc_key_set_name=bmc_key_set_name, + bmc_key_set_parameters=bmc_key_set_parameters, + etag=etag, + match_condition=match_condition, + 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.BmcKeySet, 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.BmcKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BmcKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bmc_key_set_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bmc_key_set_update_parameters else None + _content = None + if isinstance(bmc_key_set_update_parameters, (IOBase, bytes)): + _content = bmc_key_set_update_parameters + else: + if bmc_key_set_update_parameters is not None: + _content = json.dumps(bmc_key_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bmc_key_sets_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[_models.BmcKeySetPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Is one of the following types: + BmcKeySetPatchParameters, JSON, IO[bytes] Default value is None. + :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters + or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :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)) + content_type = content_type if bmc_key_set_update_parameters else None + cls: ClsType[_models.BmcKeySet] = 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, + bmc_key_set_name=bmc_key_set_name, + bmc_key_set_update_parameters=bmc_key_set_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BmcKeySet, 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.BmcKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BmcKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bmc_key_sets_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the baseboard management controller key set of the provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bmc_key_set_name=bmc_key_set_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.BmcKeySet"]: + """Get a list of baseboard management controller key sets for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BmcKeySet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BmcKeySet]] = 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_bmc_key_sets_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BmcKeySet], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`agent_pools` 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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Get properties of the provided Kubernetes cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :return: AgentPool. The AgentPool is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + + _request = build_agent_pools_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentPool, 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, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: Union[_models.AgentPool, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(agent_pool_parameters, (IOBase, bytes)): + _content = agent_pool_parameters + else: + _content = json.dumps(agent_pool_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agent_pools_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: _models.AgentPool, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: Union[_models.AgentPool, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Is one of the following types: AgentPool, JSON, + IO[bytes] Required. + :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :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.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + agent_pool_parameters=agent_pool_parameters, + etag=etag, + match_condition=match_condition, + 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.AgentPool, 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.AgentPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AgentPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if agent_pool_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if agent_pool_update_parameters else None + _content = None + if isinstance(agent_pool_update_parameters, (IOBase, bytes)): + _content = agent_pool_update_parameters + else: + if agent_pool_update_parameters is not None: + _content = json.dumps(agent_pool_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_agent_pools_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[_models.AgentPoolPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Is one of the following types: + AgentPoolPatchParameters, JSON, IO[bytes] Default value is None. + :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :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)) + content_type = content_type if agent_pool_update_parameters else None + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + agent_pool_update_parameters=agent_pool_update_parameters, + etag=etag, + match_condition=match_condition, + 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.AgentPool, 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.AgentPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AgentPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_agent_pools_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_kubernetes_cluster( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.AgentPool"]: + """Get a list of agent pools for the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of AgentPool + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentPool]] = 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_agent_pools_list_by_kubernetes_cluster_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.AgentPool], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class KubernetesClusterFeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`kubernetes_cluster_features` 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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, feature_name: str, **kwargs: Any + ) -> _models.KubernetesClusterFeature: + """Get properties of the provided the Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :return: KubernetesClusterFeature. The KubernetesClusterFeature is compatible with + MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.KubernetesClusterFeature + :raises ~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.KubernetesClusterFeature] = kwargs.pop("cls", None) + + _request = build_kubernetes_cluster_features_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KubernetesClusterFeature, 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, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(kubernetes_cluster_feature_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_feature_parameters + else: + _content = json.dumps(kubernetes_cluster_feature_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_cluster_features_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: _models.KubernetesClusterFeature, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeature + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Is one of the following types: + KubernetesClusterFeature, JSON, IO[bytes] Required. + :type kubernetes_cluster_feature_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeature or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :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.KubernetesClusterFeature] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + kubernetes_cluster_feature_parameters=kubernetes_cluster_feature_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesClusterFeature, 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.KubernetesClusterFeature].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.KubernetesClusterFeature]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[ + Union[_models.KubernetesClusterFeaturePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if kubernetes_cluster_feature_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if kubernetes_cluster_feature_update_parameters else None + _content = None + if isinstance(kubernetes_cluster_feature_update_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_feature_update_parameters + else: + if kubernetes_cluster_feature_update_parameters is not None: + _content = json.dumps(kubernetes_cluster_feature_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_kubernetes_cluster_features_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[_models.KubernetesClusterFeaturePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[ + Union[_models.KubernetesClusterFeaturePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Is one of the following + types: KubernetesClusterFeaturePatchParameters, JSON, IO[bytes] Default value is None. + :type kubernetes_cluster_feature_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :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)) + content_type = content_type if kubernetes_cluster_feature_update_parameters else None + cls: ClsType[_models.KubernetesClusterFeature] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + kubernetes_cluster_feature_update_parameters=kubernetes_cluster_feature_update_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesClusterFeature, 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.KubernetesClusterFeature].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.KubernetesClusterFeature]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_kubernetes_cluster_features_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_kubernetes_cluster( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.KubernetesClusterFeature"]: + """Get a list of features for the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesClusterFeature + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesClusterFeature]] = 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_kubernetes_cluster_features_list_by_kubernetes_cluster_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesClusterFeature], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ConsolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`consoles` 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: NetworkCloudMgmtClientConfiguration = 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, virtual_machine_name: str, console_name: str, **kwargs: Any + ) -> _models.Console: + """Get properties of the provided virtual machine console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :return: Console. The Console is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Console + :raises ~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.Console] = kwargs.pop("cls", None) + + _request = build_consoles_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Console, 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, + virtual_machine_name: str, + console_name: str, + console_parameters: Union[_models.Console, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(console_parameters, (IOBase, bytes)): + _content = console_parameters + else: + _content = json.dumps(console_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_consoles_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: _models.Console, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_parameters: ~azure.mgmt.networkcloud.models.Console + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: Union[_models.Console, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Is one of the following types: Console, JSON, + IO[bytes] Required. + :type console_parameters: ~azure.mgmt.networkcloud.models.Console or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :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.Console] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + console_parameters=console_parameters, + etag=etag, + match_condition=match_condition, + 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.Console, 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.Console].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Console]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[Union[_models.ConsolePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if console_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if console_update_parameters else None + _content = None + if isinstance(console_update_parameters, (IOBase, bytes)): + _content = console_update_parameters + else: + if console_update_parameters is not None: + _content = json.dumps(console_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_consoles_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[_models.ConsolePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[Union[_models.ConsolePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Is one of the following types: + ConsolePatchParameters, JSON, IO[bytes] Default value is None. + :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Console] + :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)) + content_type = content_type if console_update_parameters else None + cls: ClsType[_models.Console] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + console_update_parameters=console_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Console, 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.Console].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Console]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_consoles_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the provided virtual machine console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_virtual_machine( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Console"]: + """Get a list of consoles for the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Console + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Console]] = 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_consoles_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Console], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class MetricsConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s + :attr:`metrics_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, metrics_configuration_name: str, **kwargs: Any + ) -> _models.ClusterMetricsConfiguration: + """Get metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :return: ClusterMetricsConfiguration. The ClusterMetricsConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration + :raises ~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.ClusterMetricsConfiguration] = kwargs.pop("cls", None) + + _request = build_metrics_configurations_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterMetricsConfiguration, 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, + metrics_configuration_name: str, + metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(metrics_configuration_parameters, (IOBase, bytes)): + _content = metrics_configuration_parameters + else: + _content = json.dumps(metrics_configuration_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_metrics_configurations_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: _models.ClusterMetricsConfiguration, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Is one of the following types: + ClusterMetricsConfiguration, JSON, IO[bytes] Required. + :type metrics_configuration_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :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.ClusterMetricsConfiguration] = 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, + metrics_configuration_name=metrics_configuration_name, + metrics_configuration_parameters=metrics_configuration_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterMetricsConfiguration, 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.ClusterMetricsConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ClusterMetricsConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[ + Union[_models.ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if metrics_configuration_update_parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if metrics_configuration_update_parameters else None + _content = None + if isinstance(metrics_configuration_update_parameters, (IOBase, bytes)): + _content = metrics_configuration_update_parameters + else: + if metrics_configuration_update_parameters is not None: + _content = json.dumps(metrics_configuration_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_metrics_configurations_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[_models.ClusterMetricsConfigurationPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[ + Union[_models.ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Is one of the following + types: ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes] Default value is None. + :type metrics_configuration_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :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)) + content_type = content_type if metrics_configuration_update_parameters else None + cls: ClsType[_models.ClusterMetricsConfiguration] = 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, + metrics_configuration_name=metrics_configuration_name, + metrics_configuration_update_parameters=metrics_configuration_update_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterMetricsConfiguration, 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.ClusterMetricsConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ClusterMetricsConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_metrics_configurations_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Delete the metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + metrics_configuration_name=metrics_configuration_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ClusterMetricsConfiguration"]: + """Get a list of metrics configurations for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterMetricsConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterMetricsConfiguration]] = 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_metrics_configurations_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.ClusterMetricsConfiguration], + 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 +23263,9 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_rack_skus_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_rack_skus_operations.py deleted file mode 100644 index 40c483b6eae4..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_rack_skus_operations.py +++ /dev/null @@ -1,193 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._rack_skus_operations import build_get_request, build_list_by_subscription_request -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RackSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`rack_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.RackSku"]: - """List rack SKUs in the subscription. - - Get a list of rack SKUs in the provided subscription. - - :return: An iterator like instance of either RackSku or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.RackSku] - :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.RackSkuList] = 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("RackSkuList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, rack_sku_name: str, **kwargs: Any) -> _models.RackSku: - """Retrieve the rack SKU. - - Get the properties of the provided rack SKU. - - :param rack_sku_name: The name of the rack SKU. Required. - :type rack_sku_name: str - :return: RackSku or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.RackSku - :raises ~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.RackSku] = kwargs.pop("cls", None) - - _request = build_get_request( - rack_sku_name=rack_sku_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RackSku", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_racks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_racks_operations.py deleted file mode 100644 index afbb7ac5cb7d..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_racks_operations.py +++ /dev/null @@ -1,960 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._racks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RacksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`racks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Rack"]: - """List racks in the subscription. - - Get a list of racks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Rack or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Rack] - :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.RackList] = 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, - top=top, - skip_token=skip_token, - 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("RackList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Rack"]: - """List racks in the resource group. - - Get a list of racks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Rack or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Rack] - :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.RackList] = 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, - top=top, - skip_token=skip_token, - 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("RackList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, rack_name: str, **kwargs: Any) -> _models.Rack: - """Retrieve the rack. - - Get properties of the provided rack. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :return: Rack or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Rack - :raises ~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.Rack] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Rack", 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, - rack_name: str, - rack_parameters: Union[_models.Rack, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(rack_parameters, (IOBase, bytes)): - _content = rack_parameters - else: - _json = self._serialize.body(rack_parameters, "Rack") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - rack_name: str, - rack_parameters: _models.Rack, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Required. - :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - rack_name: str, - rack_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Required. - :type rack_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - rack_name: str, - rack_parameters: Union[_models.Rack, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Is either a Rack type or a IO[bytes] type. Required. - :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :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.Rack] = 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, - rack_name=rack_name, - rack_parameters=rack_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Rack", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Rack].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Rack]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the rack. - - Delete the provided rack. All customer initiated requests will be rejected as the life cycle of - this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - rack_name=rack_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[Union[_models.RackPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if rack_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if rack_update_parameters else None - _json = None - _content = None - if isinstance(rack_update_parameters, (IOBase, bytes)): - _content = rack_update_parameters - else: - if rack_update_parameters is not None: - _json = self._serialize.body(rack_update_parameters, "RackPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[_models.RackPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Default value is None. - :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters - :keyword content_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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Default value is None. - :type rack_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[Union[_models.RackPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Is either a RackPatchParameters type or a - IO[bytes] type. Default value is None. - :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Rack] - :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)) - content_type = content_type if rack_update_parameters else None - cls: ClsType[_models.Rack] = 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, - rack_name=rack_name, - if_match=if_match, - if_none_match=if_none_match, - rack_update_parameters=rack_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Rack", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Rack].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Rack]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_storage_appliances_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_storage_appliances_operations.py deleted file mode 100644 index e8cea3e5c6d2..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_storage_appliances_operations.py +++ /dev/null @@ -1,1556 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._storage_appliances_operations import ( - build_create_or_update_request, - build_delete_request, - build_disable_remote_vendor_management_request, - build_enable_remote_vendor_management_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_run_read_commands_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class StorageAppliancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`storage_appliances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.StorageAppliance"]: - """List storage appliances in the subscription. - - Get a list of storage appliances in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either StorageAppliance or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageApplianceList] = 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, - top=top, - skip_token=skip_token, - 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("StorageApplianceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.StorageAppliance"]: - """List storage appliances in the resource group. - - Get a list of storage appliances in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either StorageAppliance or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageApplianceList] = 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, - top=top, - skip_token=skip_token, - 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("StorageApplianceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any - ) -> _models.StorageAppliance: - """Retrieve the storage appliance. - - Get properties of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :return: StorageAppliance or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.StorageAppliance - :raises ~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.StorageAppliance] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("StorageAppliance", 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, - storage_appliance_name: str, - storage_appliance_parameters: Union[_models.StorageAppliance, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(storage_appliance_parameters, (IOBase, bytes)): - _content = storage_appliance_parameters - else: - _json = self._serialize.body(storage_appliance_parameters, "StorageAppliance") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - storage_appliance_name: str, - storage_appliance_parameters: _models.StorageAppliance, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Required. - :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Required. - :type storage_appliance_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_parameters: Union[_models.StorageAppliance, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Is either a StorageAppliance type or a - IO[bytes] type. Required. - :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageAppliance] = 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, - storage_appliance_name=storage_appliance_name, - storage_appliance_parameters=storage_appliance_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("StorageAppliance", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageAppliance].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageAppliance]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the storage appliance. - - Delete the provided storage appliance. All customer initiated requests will be rejected as the - life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - storage_appliance_name=storage_appliance_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[Union[_models.StorageAppliancePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if storage_appliance_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if storage_appliance_update_parameters else None - _json = None - _content = None - if isinstance(storage_appliance_update_parameters, (IOBase, bytes)): - _content = storage_appliance_update_parameters - else: - if storage_appliance_update_parameters is not None: - _json = self._serialize.body(storage_appliance_update_parameters, "StorageAppliancePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[_models.StorageAppliancePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Default value is None. - :type storage_appliance_update_parameters: - ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters - :keyword content_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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Default value is None. - :type storage_appliance_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[Union[_models.StorageAppliancePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Is either a - StorageAppliancePatchParameters type or a IO[bytes] type. Default value is None. - :type storage_appliance_update_parameters: - ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :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)) - content_type = content_type if storage_appliance_update_parameters else None - cls: ClsType[_models.StorageAppliance] = 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, - storage_appliance_name=storage_appliance_name, - if_match=if_match, - if_none_match=if_none_match, - storage_appliance_update_parameters=storage_appliance_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAppliance", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageAppliance].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageAppliance]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _disable_remote_vendor_management_initial( # pylint: disable=name-too-long - self, resource_group_name: str, storage_appliance_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_disable_remote_vendor_management_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable_remote_vendor_management( - self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Turn off remote vendor management for a storage appliance, if supported. - - Disable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._disable_remote_vendor_management_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _enable_remote_vendor_management_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = ( - content_type or "application/json" if storage_appliance_enable_remote_vendor_management_parameters else None - ) - _json = None - _content = None - if isinstance(storage_appliance_enable_remote_vendor_management_parameters, (IOBase, bytes)): - _content = storage_appliance_enable_remote_vendor_management_parameters - else: - if storage_appliance_enable_remote_vendor_management_parameters is not None: - _json = self._serialize.body( - storage_appliance_enable_remote_vendor_management_parameters, - "StorageApplianceEnableRemoteVendorManagementParameters", - ) - else: - _json = None - - _request = build_enable_remote_vendor_management_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - _models.StorageApplianceEnableRemoteVendorManagementParameters - ] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default - value is None. - :type storage_appliance_enable_remote_vendor_management_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default - value is None. - :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Is - either a StorageApplianceEnableRemoteVendorManagementParameters type or a IO[bytes] type. - Default value is None. - :type storage_appliance_enable_remote_vendor_management_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._enable_remote_vendor_management_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - storage_appliance_enable_remote_vendor_management_parameters=storage_appliance_enable_remote_vendor_management_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _run_read_commands_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: Union[ - _models.StorageApplianceRunReadCommandsParameters, 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(storage_appliance_run_read_commands_parameters, (IOBase, bytes)): - _content = storage_appliance_run_read_commands_parameters - else: - _json = self._serialize.body( - storage_appliance_run_read_commands_parameters, "StorageApplianceRunReadCommandsParameters" - ) - - _request = build_run_read_commands_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: _models.StorageApplianceRunReadCommandsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Required. - :type storage_appliance_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Required. - :type storage_appliance_run_read_commands_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: Union[ - _models.StorageApplianceRunReadCommandsParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Is either a - StorageApplianceRunReadCommandsParameters type or a IO[bytes] type. Required. - :type storage_appliance_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_read_commands_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - storage_appliance_run_read_commands_parameters=storage_appliance_run_read_commands_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_trunked_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_trunked_networks_operations.py deleted file mode 100644 index ce29cefd28e6..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_trunked_networks_operations.py +++ /dev/null @@ -1,885 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._trunked_networks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TrunkedNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`trunked_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.TrunkedNetwork"]: - """List trunked networks in the subscription. - - Get a list of trunked networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either TrunkedNetwork or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("TrunkedNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.TrunkedNetwork"]: - """List trunked networks in the resource group. - - Get a list of trunked networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either TrunkedNetwork or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("TrunkedNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, trunked_network_name: str, **kwargs: Any) -> _models.TrunkedNetwork: - """Retrieve the trunked network. - - Get properties of the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~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.TrunkedNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TrunkedNetwork", 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, - trunked_network_name: str, - trunked_network_parameters: Union[_models.TrunkedNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(trunked_network_parameters, (IOBase, bytes)): - _content = trunked_network_parameters - else: - _json = self._serialize.body(trunked_network_parameters, "TrunkedNetwork") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - trunked_network_name: str, - trunked_network_parameters: _models.TrunkedNetwork, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Required. - :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - trunked_network_name: str, - trunked_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Required. - :type trunked_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - trunked_network_name: str, - trunked_network_parameters: Union[_models.TrunkedNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Is either a TrunkedNetwork type or a - IO[bytes] type. Required. - :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetwork] = 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, - trunked_network_name=trunked_network_name, - trunked_network_parameters=trunked_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("TrunkedNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.TrunkedNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.TrunkedNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the trunked network. - - Delete the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - trunked_network_name=trunked_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[_models.TrunkedNetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Default value is None. - :type trunked_network_update_parameters: - ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Default value is None. - :type trunked_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[Union[_models.TrunkedNetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Is either a - TrunkedNetworkPatchParameters type or a IO[bytes] type. Default value is None. - :type trunked_network_update_parameters: - ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters or IO[bytes] - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~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)) - content_type = content_type if trunked_network_update_parameters else None - cls: ClsType[_models.TrunkedNetwork] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if trunked_network_update_parameters else None - _json = None - _content = None - if isinstance(trunked_network_update_parameters, (IOBase, bytes)): - _content = trunked_network_update_parameters - else: - if trunked_network_update_parameters is not None: - _json = self._serialize.body(trunked_network_update_parameters, "TrunkedNetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TrunkedNetwork", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_virtual_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_virtual_machines_operations.py deleted file mode 100644 index ed5237d8c2d1..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_virtual_machines_operations.py +++ /dev/null @@ -1,1789 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_machines_operations import ( - build_assign_relay_request, - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_power_off_request, - build_reimage_request, - build_restart_request, - build_start_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VirtualMachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """List virtual machines in the subscription. - - Get a list of virtual machines in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachineList] = 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, - top=top, - skip_token=skip_token, - 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("VirtualMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VirtualMachine"]: - """List virtual machines in the resource group. - - Get a list of virtual machines in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachineList] = 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, - top=top, - skip_token=skip_token, - 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("VirtualMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: - """Retrieve the virtual machine. - - Get properties of the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.VirtualMachine - :raises ~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.VirtualMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", 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, - virtual_machine_name: str, - virtual_machine_parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(virtual_machine_parameters, (IOBase, bytes)): - _content = virtual_machine_parameters - else: - _json = self._serialize.body(virtual_machine_parameters, "VirtualMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - virtual_machine_name: str, - virtual_machine_parameters: _models.VirtualMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Required. - :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Required. - :type virtual_machine_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Is either a VirtualMachine type or a - IO[bytes] type. Required. - :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachine] = 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, - virtual_machine_name=virtual_machine_name, - virtual_machine_parameters=virtual_machine_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the virtual machine. - - Delete the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[Union[_models.VirtualMachinePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if virtual_machine_update_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_update_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_update_parameters, (IOBase, bytes)): - _content = virtual_machine_update_parameters - else: - if virtual_machine_update_parameters is not None: - _json = self._serialize.body(virtual_machine_update_parameters, "VirtualMachinePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[_models.VirtualMachinePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Default value is None. - :type virtual_machine_update_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters - :keyword content_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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Default value is None. - :type virtual_machine_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[Union[_models.VirtualMachinePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Is either a - VirtualMachinePatchParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_update_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :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)) - content_type = content_type if virtual_machine_update_parameters else None - cls: ClsType[_models.VirtualMachine] = 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, - virtual_machine_name=virtual_machine_name, - if_match=if_match, - if_none_match=if_none_match, - virtual_machine_update_parameters=virtual_machine_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _assign_relay_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[ - Union[_models.VirtualMachineAssignRelayParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if virtual_machine_assign_relay_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_assign_relay_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_assign_relay_parameters, (IOBase, bytes)): - _content = virtual_machine_assign_relay_parameters - else: - if virtual_machine_assign_relay_parameters is not None: - _json = self._serialize.body( - virtual_machine_assign_relay_parameters, "VirtualMachineAssignRelayParameters" - ) - else: - _json = None - - _request = build_assign_relay_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[_models.VirtualMachineAssignRelayParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Default value is None. - :type virtual_machine_assign_relay_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Default value is None. - :type virtual_machine_assign_relay_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[ - Union[_models.VirtualMachineAssignRelayParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Is either a - VirtualMachineAssignRelayParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_assign_relay_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if virtual_machine_assign_relay_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._assign_relay_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - virtual_machine_assign_relay_parameters=virtual_machine_assign_relay_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _power_off_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[ - Union[_models.VirtualMachinePowerOffParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if virtual_machine_power_off_parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_power_off_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_power_off_parameters, (IOBase, bytes)): - _content = virtual_machine_power_off_parameters - else: - if virtual_machine_power_off_parameters is not None: - _json = self._serialize.body(virtual_machine_power_off_parameters, "VirtualMachinePowerOffParameters") - else: - _json = None - - _request = build_power_off_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[_models.VirtualMachinePowerOffParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Default value is None. - :type virtual_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters - :keyword content_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Default value is None. - :type virtual_machine_power_off_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 OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[ - Union[_models.VirtualMachinePowerOffParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Is either a - VirtualMachinePowerOffParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if virtual_machine_power_off_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - virtual_machine_power_off_parameters=virtual_machine_power_off_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _reimage_initial( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reimage( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Reimage the virtual machine. - - Reimage the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _restart_initial( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Restart the virtual machine. - - Restart the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _start_initial( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Start the virtual machine. - - Start the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_volumes_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_volumes_operations.py deleted file mode 100644 index c81bd8d4409a..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/aio/operations/_volumes_operations.py +++ /dev/null @@ -1,884 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._volumes_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import NetworkCloudMgmtClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VolumesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.aio.NetworkCloudMgmtClient`'s - :attr:`volumes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Volume"]: - """List volumes in the subscription. - - Get a list of volumes in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Volume or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Volume] - :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.VolumeList] = 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, - top=top, - skip_token=skip_token, - 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("VolumeList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Volume"]: - """List volumes in the resource group. - - Get a list of volumes in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Volume or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.networkcloud.models.Volume] - :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.VolumeList] = 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, - top=top, - skip_token=skip_token, - 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("VolumeList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, volume_name: str, **kwargs: Any) -> _models.Volume: - """Retrieve the volume. - - Get properties of the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~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.Volume] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Volume", 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, - volume_name: str, - volume_parameters: Union[_models.Volume, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(volume_parameters, (IOBase, bytes)): - _content = volume_parameters - else: - _json = self._serialize.body(volume_parameters, "Volume") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - volume_name: str, - volume_parameters: _models.Volume, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Required. - :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Volume or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - volume_name: str, - volume_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Required. - :type volume_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Volume or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - volume_name: str, - volume_parameters: Union[_models.Volume, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Is either a Volume type or a IO[bytes] type. - Required. - :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Volume or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.Volume] - :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.Volume] = 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, - volume_name=volume_name, - volume_parameters=volume_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Volume", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Volume].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Volume]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Delete the volume. - - Delete the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - volume_name=volume_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[_models.VolumePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Default value is None. - :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Default value is None. - :type volume_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[Union[_models.VolumePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Is either a VolumePatchParameters type or a - IO[bytes] type. Default value is None. - :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters or - IO[bytes] - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~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)) - content_type = content_type if volume_update_parameters else None - cls: ClsType[_models.Volume] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if volume_update_parameters else None - _json = None - _content = None - if isinstance(volume_update_parameters, (IOBase, bytes)): - _content = volume_update_parameters - else: - if volume_update_parameters is not None: - _json = self._serialize.body(volume_update_parameters, "VolumePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Volume", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/__init__.py index c131a8d2ca73..6e71f11bab4a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/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,7 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AadConfiguration, ActionState, AdministrativeCredentials, @@ -21,9 +21,9 @@ AdministratorConfigurationPatch, AgentOptions, AgentPool, - AgentPoolConfiguration, - AgentPoolList, AgentPoolPatchParameters, + AgentPoolPatchProperties, + AgentPoolProperties, AgentPoolUpgradeSettings, AnalyticsOutputSettings, AttachedNetworkConfiguration, @@ -33,11 +33,13 @@ BareMetalMachineConfigurationData, BareMetalMachineCordonParameters, BareMetalMachineKeySet, - BareMetalMachineKeySetList, BareMetalMachineKeySetPatchParameters, - BareMetalMachineList, + BareMetalMachineKeySetPatchProperties, + BareMetalMachineKeySetProperties, BareMetalMachinePatchParameters, + BareMetalMachinePatchProperties, BareMetalMachinePowerOffParameters, + BareMetalMachineProperties, BareMetalMachineReplaceParameters, BareMetalMachineRunCommandParameters, BareMetalMachineRunDataExtractsParameters, @@ -45,12 +47,14 @@ BgpAdvertisement, BgpServiceLoadBalancerConfiguration, BmcKeySet, - BmcKeySetList, BmcKeySetPatchParameters, + BmcKeySetPatchProperties, + BmcKeySetProperties, CertificateInfo, CloudServicesNetwork, - CloudServicesNetworkList, CloudServicesNetworkPatchParameters, + CloudServicesNetworkPatchProperties, + CloudServicesNetworkProperties, CloudServicesNetworkStorageOptions, CloudServicesNetworkStorageOptionsPatch, CloudServicesNetworkStorageStatus, @@ -60,14 +64,16 @@ ClusterCapacity, ClusterContinueUpdateVersionParameters, ClusterDeployParameters, - ClusterList, ClusterManager, - ClusterManagerList, ClusterManagerPatchParameters, + ClusterManagerProperties, ClusterMetricsConfiguration, - ClusterMetricsConfigurationList, ClusterMetricsConfigurationPatchParameters, + ClusterMetricsConfigurationPatchProperties, + ClusterMetricsConfigurationProperties, ClusterPatchParameters, + ClusterPatchProperties, + ClusterProperties, ClusterScanRuntimeParameters, ClusterSecretArchive, ClusterUpdateStrategy, @@ -75,8 +81,9 @@ CommandOutputOverride, CommandOutputSettings, Console, - ConsoleList, ConsolePatchParameters, + ConsolePatchProperties, + ConsoleProperties, ControlPlaneNodeConfiguration, ControlPlaneNodePatchConfiguration, EgressEndpoint, @@ -97,24 +104,27 @@ KeySetUserStatus, KubernetesCluster, KubernetesClusterFeature, - KubernetesClusterFeatureList, KubernetesClusterFeaturePatchParameters, - KubernetesClusterList, + KubernetesClusterFeaturePatchProperties, + KubernetesClusterFeatureProperties, KubernetesClusterNode, KubernetesClusterPatchParameters, + KubernetesClusterPatchProperties, + KubernetesClusterProperties, KubernetesClusterRestartNodeParameters, KubernetesLabel, L2Network, L2NetworkAttachmentConfiguration, - L2NetworkList, L2NetworkPatchParameters, + L2NetworkProperties, L2ServiceLoadBalancerConfiguration, L3Network, L3NetworkAttachmentConfiguration, - L3NetworkList, L3NetworkPatchParameters, + L3NetworkProperties, LldpNeighbor, MachineDisk, + MachineSkuProperties, MachineSkuSlot, ManagedResourceGroupConfiguration, ManagedServiceIdentity, @@ -125,15 +135,17 @@ NodePoolAdministratorConfigurationPatch, Operation, OperationDisplay, - OperationListResult, OperationStatusResult, + OperationStatusResultProperties, OsDisk, + ProxyResource, Rack, RackDefinition, - RackList, RackPatchParameters, + RackProperties, RackSku, - RackSkuList, + RackSkuProperties, + RacksPatchProperties, Resource, RuntimeProtectionConfiguration, RuntimeProtectionStatus, @@ -148,35 +160,37 @@ StorageApplianceCommandSpecification, StorageApplianceConfigurationData, StorageApplianceEnableRemoteVendorManagementParameters, - StorageApplianceList, StorageAppliancePatchParameters, + StorageAppliancePatchProperties, + StorageApplianceProperties, StorageApplianceRunReadCommandsParameters, + StorageApplianceSkuProperties, StorageApplianceSkuSlot, StorageProfile, StringKeyValuePair, SystemData, - TagsParameter, TrackedResource, TrunkedNetwork, TrunkedNetworkAttachmentConfiguration, - TrunkedNetworkList, TrunkedNetworkPatchParameters, + TrunkedNetworkProperties, UserAssignedIdentity, ValidationThreshold, VirtualMachine, VirtualMachineAssignRelayParameters, - VirtualMachineList, VirtualMachinePatchParameters, + VirtualMachinePatchProperties, VirtualMachinePlacementHint, VirtualMachinePowerOffParameters, + VirtualMachineProperties, Volume, - VolumeList, VolumePatchParameters, + VolumeProperties, VulnerabilityScanningSettings, VulnerabilityScanningSettingsPatch, ) -from ._network_cloud_mgmt_client_enums import ( # type: ignore +from ._enums import ( # type: ignore ActionStateStatus, ActionType, AdvertiseToFabric, @@ -231,6 +245,7 @@ DefaultGateway, DeviceConnectionType, DiskType, + ExtendedLocationType, FabricPeeringEnabled, FeatureDetailedStatus, HugepagesSize, @@ -302,9 +317,9 @@ "AdministratorConfigurationPatch", "AgentOptions", "AgentPool", - "AgentPoolConfiguration", - "AgentPoolList", "AgentPoolPatchParameters", + "AgentPoolPatchProperties", + "AgentPoolProperties", "AgentPoolUpgradeSettings", "AnalyticsOutputSettings", "AttachedNetworkConfiguration", @@ -314,11 +329,13 @@ "BareMetalMachineConfigurationData", "BareMetalMachineCordonParameters", "BareMetalMachineKeySet", - "BareMetalMachineKeySetList", "BareMetalMachineKeySetPatchParameters", - "BareMetalMachineList", + "BareMetalMachineKeySetPatchProperties", + "BareMetalMachineKeySetProperties", "BareMetalMachinePatchParameters", + "BareMetalMachinePatchProperties", "BareMetalMachinePowerOffParameters", + "BareMetalMachineProperties", "BareMetalMachineReplaceParameters", "BareMetalMachineRunCommandParameters", "BareMetalMachineRunDataExtractsParameters", @@ -326,12 +343,14 @@ "BgpAdvertisement", "BgpServiceLoadBalancerConfiguration", "BmcKeySet", - "BmcKeySetList", "BmcKeySetPatchParameters", + "BmcKeySetPatchProperties", + "BmcKeySetProperties", "CertificateInfo", "CloudServicesNetwork", - "CloudServicesNetworkList", "CloudServicesNetworkPatchParameters", + "CloudServicesNetworkPatchProperties", + "CloudServicesNetworkProperties", "CloudServicesNetworkStorageOptions", "CloudServicesNetworkStorageOptionsPatch", "CloudServicesNetworkStorageStatus", @@ -341,14 +360,16 @@ "ClusterCapacity", "ClusterContinueUpdateVersionParameters", "ClusterDeployParameters", - "ClusterList", "ClusterManager", - "ClusterManagerList", "ClusterManagerPatchParameters", + "ClusterManagerProperties", "ClusterMetricsConfiguration", - "ClusterMetricsConfigurationList", "ClusterMetricsConfigurationPatchParameters", + "ClusterMetricsConfigurationPatchProperties", + "ClusterMetricsConfigurationProperties", "ClusterPatchParameters", + "ClusterPatchProperties", + "ClusterProperties", "ClusterScanRuntimeParameters", "ClusterSecretArchive", "ClusterUpdateStrategy", @@ -356,8 +377,9 @@ "CommandOutputOverride", "CommandOutputSettings", "Console", - "ConsoleList", "ConsolePatchParameters", + "ConsolePatchProperties", + "ConsoleProperties", "ControlPlaneNodeConfiguration", "ControlPlaneNodePatchConfiguration", "EgressEndpoint", @@ -378,24 +400,27 @@ "KeySetUserStatus", "KubernetesCluster", "KubernetesClusterFeature", - "KubernetesClusterFeatureList", "KubernetesClusterFeaturePatchParameters", - "KubernetesClusterList", + "KubernetesClusterFeaturePatchProperties", + "KubernetesClusterFeatureProperties", "KubernetesClusterNode", "KubernetesClusterPatchParameters", + "KubernetesClusterPatchProperties", + "KubernetesClusterProperties", "KubernetesClusterRestartNodeParameters", "KubernetesLabel", "L2Network", "L2NetworkAttachmentConfiguration", - "L2NetworkList", "L2NetworkPatchParameters", + "L2NetworkProperties", "L2ServiceLoadBalancerConfiguration", "L3Network", "L3NetworkAttachmentConfiguration", - "L3NetworkList", "L3NetworkPatchParameters", + "L3NetworkProperties", "LldpNeighbor", "MachineDisk", + "MachineSkuProperties", "MachineSkuSlot", "ManagedResourceGroupConfiguration", "ManagedServiceIdentity", @@ -406,15 +431,17 @@ "NodePoolAdministratorConfigurationPatch", "Operation", "OperationDisplay", - "OperationListResult", "OperationStatusResult", + "OperationStatusResultProperties", "OsDisk", + "ProxyResource", "Rack", "RackDefinition", - "RackList", "RackPatchParameters", + "RackProperties", "RackSku", - "RackSkuList", + "RackSkuProperties", + "RacksPatchProperties", "Resource", "RuntimeProtectionConfiguration", "RuntimeProtectionStatus", @@ -429,30 +456,32 @@ "StorageApplianceCommandSpecification", "StorageApplianceConfigurationData", "StorageApplianceEnableRemoteVendorManagementParameters", - "StorageApplianceList", "StorageAppliancePatchParameters", + "StorageAppliancePatchProperties", + "StorageApplianceProperties", "StorageApplianceRunReadCommandsParameters", + "StorageApplianceSkuProperties", "StorageApplianceSkuSlot", "StorageProfile", "StringKeyValuePair", "SystemData", - "TagsParameter", "TrackedResource", "TrunkedNetwork", "TrunkedNetworkAttachmentConfiguration", - "TrunkedNetworkList", "TrunkedNetworkPatchParameters", + "TrunkedNetworkProperties", "UserAssignedIdentity", "ValidationThreshold", "VirtualMachine", "VirtualMachineAssignRelayParameters", - "VirtualMachineList", "VirtualMachinePatchParameters", + "VirtualMachinePatchProperties", "VirtualMachinePlacementHint", "VirtualMachinePowerOffParameters", + "VirtualMachineProperties", "Volume", - "VolumeList", "VolumePatchParameters", + "VolumeProperties", "VulnerabilityScanningSettings", "VulnerabilityScanningSettingsPatch", "ActionStateStatus", @@ -509,6 +538,7 @@ "DefaultGateway", "DeviceConnectionType", "DiskType", + "ExtendedLocationType", "FabricPeeringEnabled", "FeatureDetailedStatus", "HugepagesSize", diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_network_cloud_mgmt_client_enums.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_enums.py similarity index 63% rename from sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_network_cloud_mgmt_client_enums.py rename to sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_enums.py index 001db6431a86..1b6cfa435c8b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_network_cloud_mgmt_client_enums.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_enums.py @@ -1,8 +1,9 @@ +# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,14 +15,20 @@ class ActionStateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the action.""" COMPLETED = "Completed" + """The completed status.""" IN_PROGRESS = "InProgress" + """The in-progress status.""" FAILED = "Failed" + """The failed status.""" class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class AdvertiseToFabric(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -30,15 +37,20 @@ class AdvertiseToFabric(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ TRUE = "True" + """Advertise to fabric.""" FALSE = "False" + """Do not advertise to fabric.""" class AgentPoolDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current status of the agent pool.""" AVAILABLE = "Available" + """The Available status.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -49,118 +61,166 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ SYSTEM = "System" + """System agent pool.""" USER = "User" + """User agent pool.""" NOT_APPLICABLE = "NotApplicable" + """Not applicable.""" class AgentPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the agent pool.""" ACCEPTED = "Accepted" + """The Accepted status.""" CANCELED = "Canceled" + """The Canceled status.""" DELETING = "Deleting" + """The Deleting status.""" FAILED = "Failed" + """The Failed status.""" IN_PROGRESS = "InProgress" + """The InProgress status.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" UPDATING = "Updating" + """The Updating status.""" class AvailabilityLifecycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The version lifecycle indicator.""" PREVIEW = "Preview" + """Preview availability.""" GENERALLY_AVAILABLE = "GenerallyAvailable" + """Generally available.""" class BareMetalMachineCordonStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The cordon status of the bare metal machine.""" CORDONED = "Cordoned" + """The bare metal machine is cordoned.""" UNCORDONED = "Uncordoned" + """The bare metal machine is uncordoned.""" class BareMetalMachineDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the bare metal machine.""" PREPARING = "Preparing" + """The Preparing status.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" PROVISIONED = "Provisioned" + """The Provisioned status.""" DEPROVISIONING = "Deprovisioning" + """The Deprovisioning status.""" class BareMetalMachineEvacuate(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether to evacuate the node workload when the bare metal machine is cordoned.""" TRUE = "True" + """Evacuate workloads from the node when the bare metal machine is cordoned.""" FALSE = "False" + """Do not evacuate workloads from the node when the bare metal machine is cordoned.""" class BareMetalMachineHardwareValidationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outcome of the hardware validation.""" PASS = "Pass" + """The hardware validation passed.""" FAIL = "Fail" - PASS_ENUM = "Pass" + """The hardware validation failed.""" class BareMetalMachineKeySetDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the key set.""" ALL_ACTIVE = "AllActive" + """All users in the key set are active.""" SOME_INVALID = "SomeInvalid" + """Some users in the key set are invalid.""" ALL_INVALID = "AllInvalid" + """All users in the key set are invalid.""" VALIDATING = "Validating" + """Key set is being validated.""" class BareMetalMachineKeySetPrivilegeLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The access level allowed for the users in this key set.""" STANDARD = "Standard" + """Standard access level.""" SUPERUSER = "Superuser" + """Superuser access level.""" OTHER = "Other" + """Other access level.""" class BareMetalMachineKeySetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the bare metal machine key set.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class BareMetalMachineKeySetUserSetupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the user is currently deployed for access.""" ACTIVE = "Active" + """The user is currently active.""" INVALID = "Invalid" + """The user is not valid and has no access.""" class BareMetalMachinePowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The power state derived from the baseboard management controller.""" ON = "On" + """The bare metal machine was marked as powered on in the latest check of the baseboard management + controller.""" OFF = "Off" + """The bare metal machine was marked as powered off in the latest check of the baseboard + management controller.""" class BareMetalMachineProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the bare metal machine.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class BareMetalMachineReadyState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the bare metal machine is ready to receive workloads.""" TRUE = "True" + """The bare metal machine is ready to receive workloads.""" FALSE = "False" + """The bare metal machine is not ready to receive workloads.""" class BareMetalMachineReplaceSafeguardMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -169,14 +229,18 @@ class BareMetalMachineReplaceSafeguardMode(str, Enum, metaclass=CaseInsensitiveE """ ALL = "All" + """All safeguards will be utilized during the replace action.""" NONE = "None" + """No safeguards will be utilized during the replace action.""" class BareMetalMachineReplaceStoragePolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether to bypass clearing storage while replacing a bare metal machine.""" PRESERVE = "Preserve" + """Storage will be preserved and not cleared during the replace action.""" DISCARD_ALL = "DiscardAll" + """Storage will be cleared during the replace action.""" class BareMetalMachineSkipShutdown(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -185,78 +249,108 @@ class BareMetalMachineSkipShutdown(str, Enum, metaclass=CaseInsensitiveEnumMeta) """ TRUE = "True" + """Skip the graceful OS shutdown and power off the bare metal machine immediately.""" FALSE = "False" + """Do not skip the graceful OS shutdown and power off the bare metal machine immediately.""" class BfdEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator to determine if automatic allocation from the pool should occur.""" TRUE = "True" + """BFD is enabled for this BGP peer.""" FALSE = "False" + """BFD is disabled for this BGP peer.""" class BgpMultiHop(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator to enable multi-hop peering support.""" TRUE = "True" + """Enable multi-hop peering support.""" FALSE = "False" + """Disable multi-hop peering support.""" class BmcKeySetDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the key set.""" ALL_ACTIVE = "AllActive" + """The AllActive status.""" SOME_INVALID = "SomeInvalid" + """The SomeInvalid status.""" ALL_INVALID = "AllInvalid" + """The AllInvalid status.""" VALIDATING = "Validating" + """The Validating status.""" class BmcKeySetPrivilegeLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The access level allowed for the users in this key set.""" READ_ONLY = "ReadOnly" + """ReadOnly privilege level.""" ADMINISTRATOR = "Administrator" + """Administrator privilege level.""" class BmcKeySetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the baseboard management controller key set.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class BootstrapProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of bootstrap protocol used.""" PXE = "PXE" + """PXE bootstrap protocol.""" class CloudServicesNetworkDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the cloud services network.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" -class CloudServicesNetworkEnableDefaultEgressEndpoints(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class CloudServicesNetworkEnableDefaultEgressEndpoints( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The indicator of whether the platform default endpoints are allowed for the egress traffic.""" TRUE = "True" + """Enable default egress endpoints.""" FALSE = "False" + """Disable default egress endpoints.""" class CloudServicesNetworkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the cloud services network.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class CloudServicesNetworkStorageMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -265,180 +359,261 @@ class CloudServicesNetworkStorageMode(str, Enum, metaclass=CaseInsensitiveEnumMe """ NONE = "None" + """No shared storage.""" STANDARD = "Standard" + """Standard shared storage.""" class CloudServicesNetworkStorageStatusStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the storage allocation for the cloud services network.""" AVAILABLE = "Available" + """The storage allocation is available.""" EXPANDING_VOLUME = "ExpandingVolume" + """The storage allocation is expanding the volume.""" EXPANSION_FAILED = "ExpansionFailed" + """The expansion of the storage allocation has failed.""" class ClusterConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The latest heartbeat status between the cluster manager and the cluster.""" CONNECTED = "Connected" + """The latest heartbeat status is healthy.""" DISCONNECTED = "Disconnected" + """The latest heartbeat status is unhealthy.""" TIMEOUT = "Timeout" + """Too many of the latest heartbeats were missed.""" UNDEFINED = "Undefined" + """Could not determine the latest heartbeat status.""" -class ClusterContinueUpdateVersionMachineGroupTargetingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class ClusterContinueUpdateVersionMachineGroupTargetingMode( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The mode by which the cluster will target the next grouping of servers to continue the update.""" ALPHA_BY_RACK = "AlphaByRack" + """Racks will be targeted for update in alphabetical order based on the rack name.""" class ClusterDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current detailed status of the cluster.""" PENDING_DEPLOYMENT = "PendingDeployment" + """The PendingDeployment status.""" DEPLOYING = "Deploying" + """The Deploying status.""" RUNNING = "Running" + """The Running status.""" UPDATING = "Updating" + """The Updating status.""" UPDATE_PAUSED = "UpdatePaused" + """The UpdatePaused status.""" DEGRADED = "Degraded" + """The Degraded status.""" DELETING = "Deleting" + """The Deleting status.""" DISCONNECTED = "Disconnected" + """The Disconnected status.""" FAILED = "Failed" + """The Failed status.""" class ClusterManagerConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The latest connectivity status between cluster manager and the cluster.""" CONNECTED = "Connected" + """The latest connectivity status is healthy.""" UNREACHABLE = "Unreachable" + """Connectivity could not be established.""" class ClusterManagerDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The detailed status that provides additional information about the cluster manager.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" PROVISIONING_FAILED = "ProvisioningFailed" + """The ProvisioningFailed status.""" UPDATING = "Updating" + """The Updating status.""" UPDATE_FAILED = "UpdateFailed" + """The UpdateFailed status.""" class ClusterManagerProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the cluster manager.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" UPDATING = "Updating" + """The Updating status.""" -class ClusterMetricsConfigurationDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class ClusterMetricsConfigurationDetailedStatus( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The more detailed status of the metrics configuration.""" PROCESSING = "Processing" + """The Processing status.""" APPLIED = "Applied" + """The Applied status.""" ERROR = "Error" + """The Error status.""" -class ClusterMetricsConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class ClusterMetricsConfigurationProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The provisioning state of the metrics configuration.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class ClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the cluster.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" VALIDATING = "Validating" + """The Validating status.""" UPDATING = "Updating" + """The Updating status.""" class ClusterScanRuntimeParametersScanActivity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The choice of if the scan operation should run the scan.""" SCAN = "Scan" + """Scan the cluster.""" SKIP = "Skip" + """Do not scan the cluster.""" class ClusterSecretArchiveEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator if the specified key vault should be used to archive the secrets of the cluster.""" TRUE = "True" + """Enable the cluster secret archive with the specified key vault.""" FALSE = "False" + """Disable use of the cluster secret archive even if a key vault is specified.""" class ClusterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of rack configuration for the cluster.""" SINGLE_RACK = "SingleRack" + """Single rack configuration.""" MULTI_RACK = "MultiRack" + """Multi-rack configuration.""" class ClusterUpdateStrategyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode of operation for runtime protection.""" RACK = "Rack" + """Update the cluster in rack-by-rack increments.""" PAUSE_AFTER_RACK = "PauseAfterRack" + """Pause after each rack is updated.""" class CommandOutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of command output for the override.""" BARE_METAL_MACHINE_RUN_COMMAND = "BareMetalMachineRunCommand" + """BareMetalMachineRunCommand output type.""" BARE_METAL_MACHINE_RUN_DATA_EXTRACTS = "BareMetalMachineRunDataExtracts" + """BareMetalMachineRunDataExtracts output type.""" BARE_METAL_MACHINE_RUN_READ_COMMANDS = "BareMetalMachineRunReadCommands" + """BareMetalMachineRunReadCommands output type.""" STORAGE_RUN_READ_COMMANDS = "StorageRunReadCommands" + """StorageRunReadCommands output type.""" BARE_METAL_MACHINE_RUN_DATA_EXTRACTS_RESTRICTED = "BareMetalMachineRunDataExtractsRestricted" + """BareMetalMachineRunDataExtractsRestricted output type.""" class ConsoleDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the console.""" READY = "Ready" + """The Ready status.""" ERROR = "Error" + """The Error status.""" class ConsoleEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the console access is enabled.""" TRUE = "True" + """Console access enabled.""" FALSE = "False" + """Console access disabled.""" class ConsoleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the virtual machine console.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" - PROVISIONING = "Provisioning" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" + PROVISIONING = "Provisioning" + """The Provisioning status.""" class ControlImpact(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the control plane will be impacted during the upgrade.""" TRUE = "True" + """The control plane will be impacted during the upgrade.""" FALSE = "False" + """The control plane will not be impacted during the upgrade.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class DefaultGateway(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -447,42 +622,63 @@ class DefaultGateway(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ TRUE = "True" + """This is the default gateway.""" FALSE = "False" + """This is not the default gateway.""" class DeviceConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The connection type of the device.""" PCI = "PCI" + """PCI connection type.""" class DiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The disk type of rack SKU resource.""" HDD = "HDD" + """HDD disk type.""" SSD = "SSD" + """SSD disk type.""" + + +class ExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The supported ExtendedLocation types.""" + + EDGE_ZONE = "EdgeZone" + """Azure Edge Zones location type.""" + CUSTOM_LOCATION = "CustomLocation" + """Azure Custom Locations type.""" class FabricPeeringEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator to specify if the load balancer peers with the network fabric.""" TRUE = "True" + """Enable fabric peering.""" FALSE = "False" + """Disable fabric peering.""" class FeatureDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status representing the state of this feature.""" RUNNING = "Running" + """The Running status.""" FAILED = "Failed" + """The Failed status.""" UNKNOWN = "Unknown" + """The Unknown status.""" class HugepagesSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The size of the hugepages to allocate.""" TWO_M = "2M" + """2M hugepages.""" ONE_G = "1G" + """1G hugepages.""" class HybridAksIpamEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -492,7 +688,9 @@ class HybridAksIpamEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ TRUE = "True" + """Hybrid AKS IPAM allocation is enabled.""" FALSE = "False" + """Hybrid AKS IPAM allocation is disabled.""" class HybridAksPluginType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -501,50 +699,74 @@ class HybridAksPluginType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ DPDK = "DPDK" + """The DPDK plugin type.""" SRIOV = "SRIOV" + """The SRIOV plugin type.""" OS_DEVICE = "OSDevice" + """The OSDevice plugin type.""" class IpAllocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the IP address allocation, defaulted to "DualStack".""" IPV4 = "IPV4" + """The IPV4 address allocation type.""" IPV6 = "IPV6" + """The IPV6 address allocation type.""" DUAL_STACK = "DualStack" + """The DualStack address allocation type.""" class KubernetesClusterDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current status of the Kubernetes cluster.""" AVAILABLE = "Available" + """The Available status.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" -class KubernetesClusterFeatureAvailabilityLifecycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class KubernetesClusterFeatureAvailabilityLifecycle( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The lifecycle indicator of the feature.""" PREVIEW = "Preview" + """Preview availability.""" GENERALLY_AVAILABLE = "GenerallyAvailable" + """Generally available.""" class KubernetesClusterFeatureDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The detailed status of the feature.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" INSTALLED = "Installed" + """The Installed status.""" -class KubernetesClusterFeatureProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class KubernetesClusterFeatureProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The provisioning state of the Kubernetes cluster feature.""" ACCEPTED = "Accepted" + """The Accepted status.""" CANCELED = "Canceled" + """The Canceled status.""" DELETING = "Deleting" + """The Deleting status.""" FAILED = "Failed" + """The Failed status.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" UPDATING = "Updating" + """The Updating status.""" class KubernetesClusterFeatureRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -553,76 +775,112 @@ class KubernetesClusterFeatureRequired(str, Enum, metaclass=CaseInsensitiveEnumM """ TRUE = "True" + """A required feature.""" FALSE = "False" + """An optional feature.""" class KubernetesClusterNodeDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The detailed state of this node.""" AVAILABLE = "Available" + """The Available status.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" RUNNING = "Running" + """The Running status.""" SCHEDULING = "Scheduling" + """The Scheduling status.""" STOPPED = "Stopped" + """The Stopped status.""" TERMINATING = "Terminating" + """The Terminating status.""" UNKNOWN = "Unknown" + """The Unknown status.""" class KubernetesClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the Kubernetes cluster resource.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" ACCEPTED = "Accepted" + """The Accepted status.""" IN_PROGRESS = "InProgress" + """The InProgress status.""" CREATED = "Created" + """The Created status.""" UPDATING = "Updating" + """The Updating status.""" DELETING = "Deleting" + """The Deleting status.""" class KubernetesNodePowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The power state of this node.""" ON = "On" + """The node is powered on.""" OFF = "Off" + """The node is powered off.""" UNKNOWN = "Unknown" + """The node is in an unknown power state.""" class KubernetesNodeRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The role of this node in the cluster.""" CONTROL_PLANE = "ControlPlane" + """Control plane role.""" WORKER = "Worker" + """Worker role.""" class KubernetesPluginType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of how this network will be utilized by the Kubernetes cluster.""" DPDK = "DPDK" + """DPDK plugin type.""" SRIOV = "SRIOV" + """SRIOV plugin type.""" OS_DEVICE = "OSDevice" + """OSDevice plugin type.""" MACVLAN = "MACVLAN" + """MACVLAN plugin type.""" IPVLAN = "IPVLAN" + """IPVLAN plugin type.""" class L2NetworkDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the L2 network.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class L2NetworkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the L2 network.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class L3NetworkConfigurationIpamEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -631,41 +889,57 @@ class L3NetworkConfigurationIpamEnabled(str, Enum, metaclass=CaseInsensitiveEnum """ TRUE = "True" + """IP address management enabled.""" FALSE = "False" + """IP address management disabled.""" class L3NetworkDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the L3 network.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class L3NetworkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the L3 network.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class MachineSkuDiskConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The connection type of the rack SKU resource.""" PCIE = "PCIE" + """PCIE connection type.""" SATA = "SATA" + """SATA connection type.""" RAID = "RAID" + """RAID connection type.""" SAS = "SAS" + """SAS connection type.""" class ManagedServiceIdentitySelectorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of managed identity that is being selected.""" SYSTEM_ASSIGNED_IDENTITY = "SystemAssignedIdentity" + """System assigned identity selection.""" USER_ASSIGNED_IDENTITY = "UserAssignedIdentity" + """User assigned identity selection.""" class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -674,9 +948,13 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ NONE = "None" + """No managed identity.""" SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -685,57 +963,75 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" class OsDiskCreateOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The strategy for creating the OS disk.""" EPHEMERAL = "Ephemeral" - """Utilize the local storage of the host machine.""" + """The Os Disk will be created on ephemeral storage.""" PERSISTENT = "Persistent" - """Utilize a storage appliance backed volume to host the disk.""" + """The Os Disk is on persistent storage.""" class OsDiskDeleteOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The strategy for deleting the OS disk.""" DELETE = "Delete" + """The Os Disk will be deleted when the virtual machine is deleted.""" class RackDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the rack.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class RackProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the rack resource.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class RackSkuProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the rack SKU resource.""" CANCELED = "Canceled" + """The Canceled status.""" FAILED = "Failed" + """The Failed status.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" class RackSkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the rack.""" AGGREGATOR = "Aggregator" + """Aggregator Rack.""" COMPUTE = "Compute" + """Compute Rack.""" SINGLE = "Single" + """Combination of Aggregator Rack and Compute Rack for a single rack cluster.""" class RelayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -745,14 +1041,18 @@ class RelayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ PLATFORM = "Platform" + """Utilize the platform-dedicated relay for Arc services.""" PUBLIC = "Public" + """Utilize the standard public relay for Arc services.""" class RemoteVendorManagementFeature(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the storage appliance supports remote vendor management.""" SUPPORTED = "Supported" + """Remote vendor management is supported.""" UNSUPPORTED = "Unsupported" + """Remote vendor management is unsupported.""" class RemoteVendorManagementStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -761,18 +1061,26 @@ class RemoteVendorManagementStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta) """ ENABLED = "Enabled" + """Remote vendor management is enabled.""" DISABLED = "Disabled" + """Remote vendor management is disabled.""" UNSUPPORTED = "Unsupported" + """Remote vendor management is unsupported.""" class RuntimeProtectionEnforcementLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode of operation for runtime protection.""" AUDIT = "Audit" + """Real-time scans detect but do not remediate detected issues.""" DISABLED = "Disabled" + """Real-time scans are disabled and can not be triggered.""" ON_DEMAND = "OnDemand" + """Real-time scans are disabled but can be triggered to remediate detected issues.""" PASSIVE = "Passive" + """Real-time scans are disabled but can be triggered to detect issues without remediation.""" REAL_TIME = "RealTime" + """Real-time scans detect and remediate detected issues.""" class SkipShutdown(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -781,99 +1089,135 @@ class SkipShutdown(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ TRUE = "True" + """Skip the graceful OS shutdown and power off the virtual machine immediately.""" FALSE = "False" + """Do not skip the graceful OS shutdown.""" class StepStateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the step. A value of Completed or Failed indicates a terminal state for the step.""" COMPLETED = "Completed" + """The completed status.""" IN_PROGRESS = "InProgress" + """The in-progress status.""" FAILED = "Failed" + """The failed status.""" NOT_STARTED = "NotStarted" + """The not started status.""" class StorageApplianceDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The detailed status of the storage appliance.""" AVAILABLE = "Available" + """The Available status.""" DEGRADED = "Degraded" + """The Degraded status.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class StorageApplianceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the storage appliance.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class TrunkedNetworkDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the trunked network.""" ERROR = "Error" + """The Error status.""" AVAILABLE = "Available" + """The Available status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class TrunkedNetworkProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the trunked network.""" SUCCEEDED = "Succeeded" + """The Succeeded status.""" FAILED = "Failed" + """The Failed status.""" CANCELED = "Canceled" + """The Canceled status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" ACCEPTED = "Accepted" + """The Accepted status.""" class ValidationThresholdGrouping(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Selection of how the type evaluation is applied to the cluster calculation.""" PER_CLUSTER = "PerCluster" + """The threshold is calculated for the whole cluster.""" PER_RACK = "PerRack" + """The threshold is calculated for each rack in the cluster.""" class ValidationThresholdType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Selection of how the threshold should be evaluated.""" COUNT_SUCCESS = "CountSuccess" + """The threshold is evaluated based on the count of successful operations.""" PERCENT_SUCCESS = "PercentSuccess" + """The threshold is evaluated based on the percentage of successful operations.""" class VirtualMachineBootMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Selects the boot method for the virtual machine.""" - UEFI = "UEFI" BIOS = "BIOS" + """BIOS boot mode.""" + UEFI = "UEFI" + """UEFI boot mode.""" class VirtualMachineDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the virtual machine.""" AVAILABLE = "Available" + """The Available status.""" ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" RUNNING = "Running" + """The Running status.""" SCHEDULING = "Scheduling" + """The Scheduling status.""" STOPPED = "Stopped" + """The Stopped status.""" TERMINATING = "Terminating" + """The Terminating status.""" UNKNOWN = "Unknown" + """The Unknown status.""" class VirtualMachineDeviceModelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the device model to use.""" T1 = "T1" - """Traditional and most compatible device virtualization interface.""" + """The T1 device model.""" T2 = "T2" - """Modern and enhanced device virtualization interface.""" + """The T2 device model.""" T3 = "T3" - """Improved security and functionality (including TPM and secure boot support). Required for - windows 11 and server 2025.""" + """The T3 device model.""" class VirtualMachineIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -882,8 +1226,11 @@ class VirtualMachineIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumM """ DYNAMIC = "Dynamic" + """Dynamic VM IP allocation.""" STATIC = "Static" + """Static VM IP allocation.""" DISABLED = "Disabled" + """No VM IP allocation.""" class VirtualMachineIsolateEmulatorThread(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -891,17 +1238,23 @@ class VirtualMachineIsolateEmulatorThread(str, Enum, metaclass=CaseInsensitiveEn specified CPU cores is isolated to run the emulator thread for this virtual machine. """ - TRUE = "True" FALSE = "False" + """Do not isolate the emulator thread.""" + TRUE = "True" + """Isolate the emulator thread.""" -class VirtualMachinePlacementHintPodAffinityScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class VirtualMachinePlacementHintPodAffinityScope( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The scope for the virtual machine affinity or anti-affinity placement hint. It should always be "Machine" in the case of node affinity. """ - RACK = "Rack" MACHINE = "Machine" + """The virtual machine placement hint is scoped to the bare metal machine.""" + RACK = "Rack" + """The virtual machine placement hint is scoped to the rack.""" class VirtualMachinePlacementHintType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -910,68 +1263,96 @@ class VirtualMachinePlacementHintType(str, Enum, metaclass=CaseInsensitiveEnumMe """ AFFINITY = "Affinity" + """The virtual machine has affinity with the referenced resources.""" ANTI_AFFINITY = "AntiAffinity" + """The virtual machine has anti-affinity with the referenced resources.""" class VirtualMachinePowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The power state of the virtual machine.""" - ON = "On" OFF = "Off" + """The virtual machine is powered off.""" + ON = "On" + """The virtual machine is powered on.""" UNKNOWN = "Unknown" + """The virtual machine power state is unknown.""" class VirtualMachineProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the virtual machine.""" - SUCCEEDED = "Succeeded" - FAILED = "Failed" + ACCEPTED = "Accepted" + """The Accepted status.""" CANCELED = "Canceled" + """The Canceled status.""" + FAILED = "Failed" + """The Failed status.""" PROVISIONING = "Provisioning" - ACCEPTED = "Accepted" + """The Provisioning status.""" + SUCCEEDED = "Succeeded" + """The Succeeded status.""" class VirtualMachineSchedulingExecution(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the hint is a hard or soft requirement during scheduling.""" HARD = "Hard" + """The hint is a requirement during scheduling.""" SOFT = "Soft" + """The hint is applied using a best-effort approach during scheduling.""" class VirtualMachineVirtioInterfaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Field Deprecated, use virtualizationModel instead. The type of the virtio interface.""" MODERN = "Modern" + """Modern virtio interface.""" TRANSITIONAL = "Transitional" + """Transitional virtio interface.""" class VolumeDetailedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The more detailed status of the volume.""" - ERROR = "Error" ACTIVE = "Active" + """The Active status.""" + ERROR = "Error" + """The Error status.""" PROVISIONING = "Provisioning" + """The Provisioning status.""" class VolumeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the volume.""" - SUCCEEDED = "Succeeded" - FAILED = "Failed" + ACCEPTED = "Accepted" + """The Accepted status.""" CANCELED = "Canceled" + """The Canceled status.""" + FAILED = "Failed" + """The Failed status.""" PROVISIONING = "Provisioning" - ACCEPTED = "Accepted" + """The Provisioning status.""" + SUCCEEDED = "Succeeded" + """The Succeeded status.""" -class VulnerabilityScanningSettingsContainerScan(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class VulnerabilityScanningSettingsContainerScan( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The mode selection for container vulnerability scanning.""" DISABLED = "Disabled" + """Disable container vulnerability scanning for the cluster.""" ENABLED = "Enabled" + """Enable container vulnerability scanning for the cluster.""" class WorkloadImpact(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The indicator of whether the workload will be impacted during the upgrade.""" TRUE = "True" + """The workload will be impacted during the upgrade.""" FALSE = "False" + """The workload will not be impacted during the upgrade.""" diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models.py new file mode 100644 index 000000000000..399060fd413b --- /dev/null +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models.py @@ -0,0 +1,10172 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AadConfiguration(_Model): + """AadConfiguration represents the Azure Active Directory Integration properties. + + :ivar admin_group_object_ids: The list of Azure Active Directory group object IDs that will + have an administrative role on the Kubernetes cluster. Required. + :vartype admin_group_object_ids: list[str] + """ + + admin_group_object_ids: list[str] = rest_field(name="adminGroupObjectIds", visibility=["read", "create"]) + """The list of Azure Active Directory group object IDs that will have an administrative role on + the Kubernetes cluster. Required.""" + + @overload + def __init__( + self, + *, + admin_group_object_ids: list[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 ActionState(_Model): + """ActionState represents the state of an action taken against a resource. This can be used to + represent both explicitly and implicitly defined action types. + + :ivar action_type: The representation of the action for which this is a status. Matches ARM + resource action format when the action is an ARM-based action. + :vartype action_type: str + :ivar correlation_id: The correlation ID for the original action request. Omitted if there is + no related correlation ID. + :vartype correlation_id: str + :ivar end_time: The timestamp of when the action reached its final, terminal state. Uses ISO + 8601 format. + :vartype end_time: str + :ivar message: The description providing additional context for the status value. May be empty + or contain guidance in the case of a failure. + :vartype message: str + :ivar start_time: The timestamp of when the action began, in ISO 8601 format. + :vartype start_time: str + :ivar status: The status of the action. Known values are: "Completed", "InProgress", and + "Failed". + :vartype status: str or ~azure.mgmt.networkcloud.models.ActionStateStatus + :ivar step_states: The ordered list of the individual steps which make up the action. + :vartype step_states: list[~azure.mgmt.networkcloud.models.StepState] + """ + + action_type: Optional[str] = rest_field(name="actionType", visibility=["read"]) + """The representation of the action for which this is a status. Matches ARM resource action format + when the action is an ARM-based action.""" + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """The correlation ID for the original action request. Omitted if there is no related correlation + ID.""" + end_time: Optional[str] = rest_field(name="endTime", visibility=["read"]) + """The timestamp of when the action reached its final, terminal state. Uses ISO 8601 format.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The description providing additional context for the status value. May be empty or contain + guidance in the case of a failure.""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read"]) + """The timestamp of when the action began, in ISO 8601 format.""" + status: Optional[Union[str, "_models.ActionStateStatus"]] = rest_field(visibility=["read"]) + """The status of the action. Known values are: \"Completed\", \"InProgress\", and \"Failed\".""" + step_states: Optional[list["_models.StepState"]] = rest_field(name="stepStates", visibility=["read"]) + """The ordered list of the individual steps which make up the action.""" + + +class AdministrativeCredentials(_Model): + """AdministrativeCredentials represents the admin credentials for the device requiring + password-based authentication. + + :ivar password: The password of the administrator of the device used during initialization. + Required. + :vartype password: str + :ivar username: The username of the administrator of the device used during initialization. + Required. + :vartype username: str + """ + + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password of the administrator of the device used during initialization. Required.""" + username: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The username of the administrator of the device used during initialization. Required.""" + + @overload + def __init__( + self, + *, + password: str, + username: 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 AdministratorConfiguration(_Model): + """AdministratorConfiguration represents the administrative credentials that will be applied to + the control plane and agent pool nodes in Kubernetes clusters. + + :ivar admin_username: The user name for the administrator that will be applied to the operating + systems that run Kubernetes nodes. If not supplied, a user name will be chosen by the service. + :vartype admin_username: str + :ivar ssh_public_keys: The SSH configuration for the operating systems that run the nodes in + the Kubernetes cluster. In some cases, specification of public keys may be required to produce + a working environment. + :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] + """ + + admin_username: Optional[str] = rest_field(name="adminUsername", visibility=["read", "create"]) + """The user name for the administrator that will be applied to the operating systems that run + Kubernetes nodes. If not supplied, a user name will be chosen by the service.""" + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = rest_field( + name="sshPublicKeys", visibility=["read", "create"] + ) + """The SSH configuration for the operating systems that run the nodes in the Kubernetes cluster. + In some cases, specification of public keys may be required to produce a working environment.""" + + @overload + def __init__( + self, + *, + admin_username: Optional[str] = None, + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = 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 AdministratorConfigurationPatch(_Model): + """AdministratorConfigurationPatch represents the patching capabilities for the administrator + configuration. + + :ivar ssh_public_keys: SshPublicKey represents the public key used to authenticate with a + resource through SSH. + :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] + """ + + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = rest_field( + name="sshPublicKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """SshPublicKey represents the public key used to authenticate with a resource through SSH.""" + + @overload + def __init__( + self, + *, + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = 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 AgentOptions(_Model): + """AgentOptions are configurations that will be applied to each agent in an agent pool. + + :ivar hugepages_count: The number of hugepages to allocate. Required. + :vartype hugepages_count: int + :ivar hugepages_size: The size of the hugepages to allocate. Known values are: "2M" and "1G". + :vartype hugepages_size: str or ~azure.mgmt.networkcloud.models.HugepagesSize + """ + + hugepages_count: int = rest_field(name="hugepagesCount", visibility=["read", "create", "update", "delete", "query"]) + """The number of hugepages to allocate. Required.""" + hugepages_size: Optional[Union[str, "_models.HugepagesSize"]] = rest_field( + name="hugepagesSize", visibility=["read", "create"] + ) + """The size of the hugepages to allocate. Known values are: \"2M\" and \"1G\".""" + + @overload + def __init__( + self, + *, + hugepages_count: int, + hugepages_size: Optional[Union[str, "_models.HugepagesSize"]] = 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.networkcloud.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 TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.networkcloud.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AgentPool(TrackedResource): + """AgentPool represents the agent pool of Kubernetes cluster. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.AgentPoolProperties + :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 extended_location: + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.AgentPoolProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create"] + ) + + __flattened_items = [ + "administrator_configuration", + "agent_options", + "attached_network_configuration", + "availability_zones", + "count", + "labels", + "mode", + "taints", + "upgrade_settings", + "vm_sku_name", + "detailed_status", + "detailed_status_message", + "kubernetes_version", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.AgentPoolProperties", + tags: Optional[dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = 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 AgentPoolPatchParameters(_Model): + """AgentPoolPatchParameters represents the body of the request to patch the Kubernetes cluster + agent pool. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.AgentPoolPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.AgentPoolPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["administrator_configuration", "count", "upgrade_settings"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.AgentPoolPatchProperties"] = None, + 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: + _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 AgentPoolPatchProperties(_Model): + """AgentPoolPatchProperties represents the properties of an agent pool that can be modified. + + :ivar administrator_configuration: The configuration of administrator credentials for the + control plane nodes. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.NodePoolAdministratorConfigurationPatch + :ivar count: The number of virtual machines that use this configuration. + :vartype count: int + :ivar upgrade_settings: The configuration of the agent pool. + :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings + """ + + administrator_configuration: Optional["_models.NodePoolAdministratorConfigurationPatch"] = rest_field( + name="administratorConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of administrator credentials for the control plane nodes.""" + count: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of virtual machines that use this configuration.""" + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = rest_field( + name="upgradeSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the agent pool.""" + + @overload + def __init__( + self, + *, + administrator_configuration: Optional["_models.NodePoolAdministratorConfigurationPatch"] = None, + count: Optional[int] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = 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 AgentPoolProperties(_Model): + """AgentPoolProperties represents the properties of the Kubernetes cluster agent pool. + + :ivar administrator_configuration: The administrator credentials to be used for the nodes in + this agent pool. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfiguration + :ivar agent_options: The configurations that will be applied to each agent in this agent pool. + :vartype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions + :ivar attached_network_configuration: The configuration of networks being attached to the agent + pool for use by the workloads that run on this Kubernetes cluster. + :vartype attached_network_configuration: + ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration + :ivar availability_zones: The list of availability zones of the Network Cloud cluster used for + the provisioning of nodes in this agent pool. If not specified, all availability zones will be + used. + :vartype availability_zones: list[str] + :ivar count: The number of virtual machines that use this configuration. Required. + :vartype count: int + :ivar labels: The labels applied to the nodes in this agent pool. + :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar mode: The selection of how this agent pool is utilized, either as a system pool or a user + pool. System pools run the features and critical services for the Kubernetes Cluster, while + user pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one + system node pool with at least one node. Required. Known values are: "System", "User", and + "NotApplicable". + :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode + :ivar taints: The taints applied to the nodes in this agent pool. + :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar upgrade_settings: The configuration of the agent pool. + :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings + :ivar vm_sku_name: The name of the VM SKU that determines the size of resources allocated for + node VMs. Required. + :vartype vm_sku_name: str + :ivar detailed_status: The current status of the agent pool. Known values are: "Available", + "Error", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.AgentPoolDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar kubernetes_version: The Kubernetes version running in this agent pool. + :vartype kubernetes_version: str + :ivar provisioning_state: The provisioning state of the agent pool. Known values are: + "Accepted", "Canceled", "Deleting", "Failed", "InProgress", "Succeeded", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.AgentPoolProvisioningState + """ + + administrator_configuration: Optional["_models.AdministratorConfiguration"] = rest_field( + name="administratorConfiguration", visibility=["read", "create"] + ) + """The administrator credentials to be used for the nodes in this agent pool.""" + agent_options: Optional["_models.AgentOptions"] = rest_field(name="agentOptions", visibility=["read", "create"]) + """The configurations that will be applied to each agent in this agent pool.""" + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = rest_field( + name="attachedNetworkConfiguration", visibility=["read", "create"] + ) + """The configuration of networks being attached to the agent pool for use by the workloads that + run on this Kubernetes cluster.""" + availability_zones: Optional[list[str]] = rest_field(name="availabilityZones", visibility=["read", "create"]) + """The list of availability zones of the Network Cloud cluster used for the provisioning of nodes + in this agent pool. If not specified, all availability zones will be used.""" + count: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of virtual machines that use this configuration. Required.""" + labels: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read", "create"]) + """The labels applied to the nodes in this agent pool.""" + mode: Union[str, "_models.AgentPoolMode"] = rest_field(visibility=["read", "create"]) + """The selection of how this agent pool is utilized, either as a system pool or a user pool. + System pools run the features and critical services for the Kubernetes Cluster, while user + pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one + system node pool with at least one node. Required. Known values are: \"System\", \"User\", and + \"NotApplicable\".""" + taints: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read", "create"]) + """The taints applied to the nodes in this agent pool.""" + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = rest_field( + name="upgradeSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the agent pool.""" + vm_sku_name: str = rest_field(name="vmSkuName", visibility=["read", "create"]) + """The name of the VM SKU that determines the size of resources allocated for node VMs. Required.""" + detailed_status: Optional[Union[str, "_models.AgentPoolDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The current status of the agent pool. Known values are: \"Available\", \"Error\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + kubernetes_version: Optional[str] = rest_field(name="kubernetesVersion", visibility=["read"]) + """The Kubernetes version running in this agent pool.""" + provisioning_state: Optional[Union[str, "_models.AgentPoolProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the agent pool. Known values are: \"Accepted\", \"Canceled\", + \"Deleting\", \"Failed\", \"InProgress\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + count: int, + mode: Union[str, "_models.AgentPoolMode"], + vm_sku_name: str, + administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, + agent_options: Optional["_models.AgentOptions"] = None, + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, + availability_zones: Optional[list[str]] = None, + labels: Optional[list["_models.KubernetesLabel"]] = None, + taints: Optional[list["_models.KubernetesLabel"]] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = 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 AgentPoolUpgradeSettings(_Model): + """AgentPoolUpgradeSettings specifies the upgrade settings for an agent pool. + + :ivar drain_timeout: The maximum time in seconds that is allowed for a node drain to complete + before proceeding with the upgrade of the agent pool. If not specified during creation, a value + of 1800 seconds is used. + :vartype drain_timeout: int + :ivar max_surge: The maximum number or percentage of nodes that are surged during upgrade. This + can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is + specified, it is the percentage of the total agent pool size at the time of the upgrade. For + percentages, fractional nodes are rounded up. If not specified during creation, a value of 1 is + used. One of MaxSurge and MaxUnavailable must be greater than 0. + :vartype max_surge: str + :ivar max_unavailable: The maximum number or percentage of nodes that can be unavailable during + upgrade. This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a + percentage is specified, it is the percentage of the total agent pool size at the time of the + upgrade. For percentages, fractional nodes are rounded up. If not specified during creation, a + value of 0 is used. One of MaxSurge and MaxUnavailable must be greater than 0. + :vartype max_unavailable: str + """ + + drain_timeout: Optional[int] = rest_field( + name="drainTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum time in seconds that is allowed for a node drain to complete before proceeding with + the upgrade of the agent pool. If not specified during creation, a value of 1800 seconds is + used.""" + max_surge: Optional[str] = rest_field(name="maxSurge", visibility=["read", "create", "update", "delete", "query"]) + """The maximum number or percentage of nodes that are surged during upgrade. This can either be + set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is + the percentage of the total agent pool size at the time of the upgrade. For percentages, + fractional nodes are rounded up. If not specified during creation, a value of 1 is used. One of + MaxSurge and MaxUnavailable must be greater than 0.""" + max_unavailable: Optional[str] = rest_field( + name="maxUnavailable", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number or percentage of nodes that can be unavailable during upgrade. This can + either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is + specified, it is the percentage of the total agent pool size at the time of the upgrade. For + percentages, fractional nodes are rounded up. If not specified during creation, a value of 0 is + used. One of MaxSurge and MaxUnavailable must be greater than 0.""" + + @overload + def __init__( + self, + *, + drain_timeout: Optional[int] = None, + max_surge: Optional[str] = None, + max_unavailable: 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 AnalyticsOutputSettings(_Model): + """AnalyticsOutputSettings represents the settings for the log analytics workspace used for output + of logs from this cluster. + + :ivar analytics_workspace_id: The resource ID of the analytics workspace that is to be used by + the specified identity. + :vartype analytics_workspace_id: str + :ivar associated_identity: The selection of the managed identity to use with this analytics + workspace. The identity type must be either system assigned or user assigned. + :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector + """ + + analytics_workspace_id: Optional[str] = rest_field( + name="analyticsWorkspaceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the analytics workspace that is to be used by the specified identity.""" + associated_identity: Optional["_models.IdentitySelector"] = rest_field( + name="associatedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The selection of the managed identity to use with this analytics workspace. The identity type + must be either system assigned or user assigned.""" + + @overload + def __init__( + self, + *, + analytics_workspace_id: Optional[str] = None, + associated_identity: Optional["_models.IdentitySelector"] = 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 AttachedNetworkConfiguration(_Model): + """AttachedNetworkConfiguration represents the set of workload networks to attach to a resource. + + :ivar l2_networks: The list of Layer 2 Networks and related configuration for attachment. + :vartype l2_networks: list[~azure.mgmt.networkcloud.models.L2NetworkAttachmentConfiguration] + :ivar l3_networks: The list of Layer 3 Networks and related configuration for attachment. + :vartype l3_networks: list[~azure.mgmt.networkcloud.models.L3NetworkAttachmentConfiguration] + :ivar trunked_networks: The list of Trunked Networks and related configuration for attachment. + :vartype trunked_networks: + list[~azure.mgmt.networkcloud.models.TrunkedNetworkAttachmentConfiguration] + """ + + l2_networks: Optional[list["_models.L2NetworkAttachmentConfiguration"]] = rest_field( + name="l2Networks", visibility=["read", "create"] + ) + """The list of Layer 2 Networks and related configuration for attachment.""" + l3_networks: Optional[list["_models.L3NetworkAttachmentConfiguration"]] = rest_field( + name="l3Networks", visibility=["read", "create"] + ) + """The list of Layer 3 Networks and related configuration for attachment.""" + trunked_networks: Optional[list["_models.TrunkedNetworkAttachmentConfiguration"]] = rest_field( + name="trunkedNetworks", visibility=["read", "create"] + ) + """The list of Trunked Networks and related configuration for attachment.""" + + @overload + def __init__( + self, + *, + l2_networks: Optional[list["_models.L2NetworkAttachmentConfiguration"]] = None, + l3_networks: Optional[list["_models.L3NetworkAttachmentConfiguration"]] = None, + trunked_networks: Optional[list["_models.TrunkedNetworkAttachmentConfiguration"]] = 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 AvailableUpgrade(_Model): + """AvailableUpgrade represents an upgrade available for a Kubernetes cluster. + + :ivar availability_lifecycle: The version lifecycle indicator. Known values are: "Preview" and + "GenerallyAvailable". + :vartype availability_lifecycle: str or ~azure.mgmt.networkcloud.models.AvailabilityLifecycle + :ivar version: The version available for upgrading. + :vartype version: str + """ + + availability_lifecycle: Optional[Union[str, "_models.AvailabilityLifecycle"]] = rest_field( + name="availabilityLifecycle", visibility=["read"] + ) + """The version lifecycle indicator. Known values are: \"Preview\" and \"GenerallyAvailable\".""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version available for upgrading.""" + + +class BareMetalMachine(TrackedResource): + """BareMetalMachine represents the physical machine in the rack. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.BareMetalMachineProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.BareMetalMachineProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "bmc_connection_string", + "bmc_credentials", + "bmc_mac_address", + "boot_mac_address", + "machine_details", + "machine_name", + "machine_sku_id", + "rack_id", + "rack_slot", + "serial_number", + "action_states", + "associated_resource_ids", + "ca_certificate", + "cluster_id", + "cordon_status", + "detailed_status", + "detailed_status_message", + "hardware_inventory", + "hardware_validation_status", + "hybrid_aks_clusters_associated_ids", + "kubernetes_node_name", + "kubernetes_version", + "machine_cluster_version", + "machine_roles", + "oam_ipv4_address", + "oam_ipv6_address", + "os_image", + "power_state", + "ready_state", + "runtime_protection_status", + "secret_rotation_status", + "service_tag", + "virtual_machines_associated_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.BareMetalMachineProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 BareMetalMachineCommandSpecification(_Model): + """BareMetalMachineCommandSpecification represents the command and optional arguments to exercise + against the bare metal machine. + + :ivar arguments: The list of string arguments that will be passed to the script in order as + separate arguments. + :vartype arguments: list[str] + :ivar command: The command to execute against the bare metal machine. Required. + :vartype command: str + """ + + arguments: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of string arguments that will be passed to the script in order as separate arguments.""" + command: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command to execute against the bare metal machine. Required.""" + + @overload + def __init__( + self, + *, + command: str, + arguments: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BareMetalMachineConfigurationData(_Model): + """BareMetalMachineConfigurationData represents configuration for the bare metal machine. + + :ivar bmc_connection_string: The connection string for the baseboard management controller + including IP address and protocol. + :vartype bmc_connection_string: str + :ivar bmc_credentials: The credentials of the baseboard management controller on this bare + metal machine. The password field is expected to be an Azure Key Vault key URL. Until the + cluster is converted to utilize managed identity by setting the secret archive settings, the + actual password value should be provided instead. Required. + :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials + :ivar bmc_mac_address: The MAC address of the BMC for this machine. Required. + :vartype bmc_mac_address: str + :ivar boot_mac_address: The MAC address associated with the PXE NIC card. Required. + :vartype boot_mac_address: str + :ivar machine_details: The free-form additional information about the machine, e.g. an asset + tag. + :vartype machine_details: str + :ivar machine_name: The user-provided name for the bare metal machine created from this + specification. If not provided, the machine name will be generated programmatically. + :vartype machine_name: str + :ivar rack_slot: The slot the physical machine is in the rack based on the BOM configuration. + Required. + :vartype rack_slot: int + :ivar serial_number: The serial number of the machine. Hardware suppliers may use an alternate + value. For example, service tag. Required. + :vartype serial_number: str + """ + + bmc_connection_string: Optional[str] = rest_field(name="bmcConnectionString", visibility=["read"]) + """The connection string for the baseboard management controller including IP address and + protocol.""" + bmc_credentials: "_models.AdministrativeCredentials" = rest_field( + name="bmcCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials of the baseboard management controller on this bare metal machine. The password + field is expected to be an Azure Key Vault key URL. Until the cluster is converted to utilize + managed identity by setting the secret archive settings, the actual password value should be + provided instead. Required.""" + bmc_mac_address: str = rest_field(name="bmcMacAddress", visibility=["read", "create", "update", "delete", "query"]) + """The MAC address of the BMC for this machine. Required.""" + boot_mac_address: str = rest_field( + name="bootMacAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The MAC address associated with the PXE NIC card. Required.""" + machine_details: Optional[str] = rest_field( + name="machineDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The free-form additional information about the machine, e.g. an asset tag.""" + machine_name: Optional[str] = rest_field( + name="machineName", visibility=["read", "create", "update", "delete", "query"] + ) + """The user-provided name for the bare metal machine created from this specification. If not + provided, the machine name will be generated programmatically.""" + rack_slot: int = rest_field(name="rackSlot", visibility=["read", "create", "update", "delete", "query"]) + """The slot the physical machine is in the rack based on the BOM configuration. Required.""" + serial_number: str = rest_field(name="serialNumber", visibility=["read", "create", "update", "delete", "query"]) + """The serial number of the machine. Hardware suppliers may use an alternate value. For example, + service tag. Required.""" + + @overload + def __init__( + self, + *, + bmc_credentials: "_models.AdministrativeCredentials", + bmc_mac_address: str, + boot_mac_address: str, + rack_slot: int, + serial_number: str, + machine_details: Optional[str] = None, + machine_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 BareMetalMachineCordonParameters(_Model): + """BareMetalMachineCordonParameters represents the body of the request to evacuate workloads from + node on a bare metal machine. + + :ivar evacuate: The indicator of whether to evacuate the node workload when the bare metal + machine is cordoned. Known values are: "True" and "False". + :vartype evacuate: str or ~azure.mgmt.networkcloud.models.BareMetalMachineEvacuate + """ + + evacuate: Optional[Union[str, "_models.BareMetalMachineEvacuate"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether to evacuate the node workload when the bare metal machine is cordoned. + Known values are: \"True\" and \"False\".""" + + @overload + def __init__( + self, + *, + evacuate: Optional[Union[str, "_models.BareMetalMachineEvacuate"]] = 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 BareMetalMachineKeySet(TrackedResource): + """BareMetalMachineKeySet represents the bare metal machine key set. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.BareMetalMachineKeySetProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "azure_group_id", + "expiration", + "jump_hosts_allowed", + "os_group_name", + "privilege_level", + "privilege_level_name", + "user_list", + "detailed_status", + "detailed_status_message", + "last_validation", + "user_list_status", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.BareMetalMachineKeySetProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 BareMetalMachineKeySetPatchParameters(_Model): + """BareMetalMachineKeySetPatchParameters represents the body of the request to patch the bare + metal machine key set. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.BareMetalMachineKeySetPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["expiration", "jump_hosts_allowed", "user_list"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.BareMetalMachineKeySetPatchProperties"] = None, + 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: + _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 BareMetalMachineKeySetPatchProperties(_Model): + """BareMetalMachineKeySetPatchProperties represents the properties of bare metal machine key set + that can be patched. + + :ivar expiration: The date and time after which the users in this key set will be removed from + the bare metal machines. + :vartype expiration: ~datetime.datetime + :ivar jump_hosts_allowed: The list of IP addresses of jump hosts with management network access + from which a login will be allowed for the users. + :vartype jump_hosts_allowed: list[str] + :ivar user_list: The unique list of permitted users. + :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] + """ + + expiration: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the users in this key set will be removed from the bare metal + machines.""" + jump_hosts_allowed: Optional[list[str]] = rest_field( + name="jumpHostsAllowed", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP addresses of jump hosts with management network access from which a login will + be allowed for the users.""" + user_list: Optional[list["_models.KeySetUser"]] = rest_field( + name="userList", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique list of permitted users.""" + + @overload + def __init__( + self, + *, + expiration: Optional[datetime.datetime] = None, + jump_hosts_allowed: Optional[list[str]] = None, + user_list: Optional[list["_models.KeySetUser"]] = 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 BareMetalMachineKeySetProperties(_Model): + """BareMetalMachineKeySetProperties represents the properties of bare metal machine key set. + + :ivar azure_group_id: The object ID of Azure Active Directory group that all users in the list + must be in for access to be granted. Users that are not in the group will not have access. + Required. + :vartype azure_group_id: str + :ivar expiration: The date and time after which the users in this key set will be removed from + the bare metal machines. Required. + :vartype expiration: ~datetime.datetime + :ivar jump_hosts_allowed: The list of IP addresses of jump hosts with management network access + from which a login will be allowed for the users. Required. + :vartype jump_hosts_allowed: list[str] + :ivar os_group_name: The name of the group that users will be assigned to on the operating + system of the machines. + :vartype os_group_name: str + :ivar privilege_level: The access level allowed for the users in this key set. Required. Known + values are: "Standard", "Superuser", and "Other". + :vartype privilege_level: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPrivilegeLevel + :ivar privilege_level_name: The name of the access level to apply when the privilege level is + set to Other. + :vartype privilege_level_name: str + :ivar user_list: The unique list of permitted users. Required. + :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] + :ivar detailed_status: The more detailed status of the key set. Known values are: "AllActive", + "SomeInvalid", "AllInvalid", and "Validating". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar last_validation: The last time this key set was validated. + :vartype last_validation: ~datetime.datetime + :ivar user_list_status: The status evaluation of each user. + :vartype user_list_status: list[~azure.mgmt.networkcloud.models.KeySetUserStatus] + :ivar provisioning_state: The provisioning state of the bare metal machine key set. Known + values are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetProvisioningState + """ + + azure_group_id: str = rest_field(name="azureGroupId", visibility=["read", "create"]) + """The object ID of Azure Active Directory group that all users in the list must be in for access + to be granted. Users that are not in the group will not have access. Required.""" + expiration: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the users in this key set will be removed from the bare metal + machines. Required.""" + jump_hosts_allowed: list[str] = rest_field( + name="jumpHostsAllowed", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP addresses of jump hosts with management network access from which a login will + be allowed for the users. Required.""" + os_group_name: Optional[str] = rest_field(name="osGroupName", visibility=["read", "create"]) + """The name of the group that users will be assigned to on the operating system of the machines.""" + privilege_level: Union[str, "_models.BareMetalMachineKeySetPrivilegeLevel"] = rest_field( + name="privilegeLevel", visibility=["read", "create"] + ) + """The access level allowed for the users in this key set. Required. Known values are: + \"Standard\", \"Superuser\", and \"Other\".""" + privilege_level_name: Optional[str] = rest_field(name="privilegeLevelName", visibility=["read", "create"]) + """The name of the access level to apply when the privilege level is set to Other.""" + user_list: list["_models.KeySetUser"] = rest_field( + name="userList", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique list of permitted users. Required.""" + detailed_status: Optional[Union[str, "_models.BareMetalMachineKeySetDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the key set. Known values are: \"AllActive\", \"SomeInvalid\", + \"AllInvalid\", and \"Validating\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + last_validation: Optional[datetime.datetime] = rest_field( + name="lastValidation", visibility=["read"], format="rfc3339" + ) + """The last time this key set was validated.""" + user_list_status: Optional[list["_models.KeySetUserStatus"]] = rest_field( + name="userListStatus", visibility=["read"] + ) + """The status evaluation of each user.""" + provisioning_state: Optional[Union[str, "_models.BareMetalMachineKeySetProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the bare metal machine key set. Known values are: \"Succeeded\", + \"Failed\", \"Canceled\", \"Accepted\", and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + azure_group_id: str, + expiration: datetime.datetime, + jump_hosts_allowed: list[str], + privilege_level: Union[str, "_models.BareMetalMachineKeySetPrivilegeLevel"], + user_list: list["_models.KeySetUser"], + os_group_name: Optional[str] = None, + privilege_level_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 BareMetalMachinePatchParameters(_Model): + """BareMetalMachinePatchParameters represents the body of the request to patch bare metal machine + properties. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.BareMetalMachinePatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.BareMetalMachinePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["machine_details"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.BareMetalMachinePatchProperties"] = None, + 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: + _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 BareMetalMachinePatchProperties(_Model): + """BareMetalMachinePatchProperties represents the properties of the bare metal machine that can be + patched. + + :ivar machine_details: The details provided by the customer during the creation of rack + manifests that allows for custom data to be associated with this machine. + :vartype machine_details: str + """ + + machine_details: Optional[str] = rest_field( + name="machineDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The details provided by the customer during the creation of rack manifests that allows for + custom data to be associated with this machine.""" + + @overload + def __init__( + self, + *, + machine_details: 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 BareMetalMachinePowerOffParameters(_Model): + """BareMetalMachinePowerOffParameters represents the body of the request to power off bare metal + machine. + + :ivar skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off + the bare metal machine immediately. Known values are: "True" and "False". + :vartype skip_shutdown: str or ~azure.mgmt.networkcloud.models.BareMetalMachineSkipShutdown + """ + + skip_shutdown: Optional[Union[str, "_models.BareMetalMachineSkipShutdown"]] = rest_field( + name="skipShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether to skip the graceful OS shutdown and power off the bare metal machine + immediately. Known values are: \"True\" and \"False\".""" + + @overload + def __init__( + self, + *, + skip_shutdown: Optional[Union[str, "_models.BareMetalMachineSkipShutdown"]] = 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 BareMetalMachineProperties(_Model): + """BareMetalMachineProperties represents the properties of a bare metal machine. + + :ivar bmc_connection_string: The connection string for the baseboard management controller + including IP address and protocol. Required. + :vartype bmc_connection_string: str + :ivar bmc_credentials: The credentials of the baseboard management controller on this bare + metal machine. Required. + :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials + :ivar bmc_mac_address: The MAC address of the BMC device. Required. + :vartype bmc_mac_address: str + :ivar boot_mac_address: The MAC address of a NIC connected to the PXE network. Required. + :vartype boot_mac_address: str + :ivar machine_details: The custom details provided by the customer. Required. + :vartype machine_details: str + :ivar machine_name: The OS-level hostname assigned to this machine. Required. + :vartype machine_name: str + :ivar machine_sku_id: The unique internal identifier of the bare metal machine SKU. Required. + :vartype machine_sku_id: str + :ivar rack_id: The resource ID of the rack where this bare metal machine resides. Required. + :vartype rack_id: str + :ivar rack_slot: The rack slot in which this bare metal machine is located, ordered from the + bottom up i.e. the lowest slot is 1. Required. + :vartype rack_slot: int + :ivar serial_number: The serial number of the bare metal machine. Required. + :vartype serial_number: str + :ivar action_states: The current state of any in progress or completed actions. The most recent + known instance of each action type is shown. + :vartype action_states: list[~azure.mgmt.networkcloud.models.ActionState] + :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud + resources that have attached this network. + :vartype associated_resource_ids: list[str] + :ivar ca_certificate: The CA certificate information issued by the platform for connecting to + TLS interfaces for the bare metal machine. Callers add this certificate to the trusted CA store + on the Kubernetes control plane nodes to allow secure communication with the bare metal + machine. + :vartype ca_certificate: ~azure.mgmt.networkcloud.models.CertificateInfo + :ivar cluster_id: The resource ID of the cluster this bare metal machine is associated with. + :vartype cluster_id: str + :ivar cordon_status: The cordon status of the bare metal machine. Known values are: "Cordoned" + and "Uncordoned". + :vartype cordon_status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineCordonStatus + :ivar detailed_status: The more detailed status of the bare metal machine. Known values are: + "Preparing", "Error", "Available", "Provisioning", "Provisioned", and "Deprovisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar hardware_inventory: The hardware inventory, including information acquired from the + model/sku information and from the ironic inspector. + :vartype hardware_inventory: ~azure.mgmt.networkcloud.models.HardwareInventory + :ivar hardware_validation_status: The details of the latest hardware validation performed for + this bare metal machine. + :vartype hardware_validation_status: ~azure.mgmt.networkcloud.models.HardwareValidationStatus + :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of the resource IDs for the HybridAksClusters that have nodes hosted on this bare + metal machine. + :vartype hybrid_aks_clusters_associated_ids: list[str] + :ivar kubernetes_node_name: The name of this machine represented by the host object in the + Cluster's Kubernetes control plane. + :vartype kubernetes_node_name: str + :ivar kubernetes_version: The version of Kubernetes running on this machine. + :vartype kubernetes_version: str + :ivar machine_cluster_version: The cluster version that has been applied to this machine during + deployment or a version update. + :vartype machine_cluster_version: str + :ivar machine_roles: The list of roles that are assigned to the cluster node running on this + machine. + :vartype machine_roles: list[str] + :ivar oam_ipv4_address: The IPv4 address that is assigned to the bare metal machine during the + cluster deployment. + :vartype oam_ipv4_address: str + :ivar oam_ipv6_address: The IPv6 address that is assigned to the bare metal machine during the + cluster deployment. + :vartype oam_ipv6_address: str + :ivar os_image: The image that is currently provisioned to the OS disk. + :vartype os_image: str + :ivar power_state: The power state derived from the baseboard management controller. Known + values are: "On" and "Off". + :vartype power_state: str or ~azure.mgmt.networkcloud.models.BareMetalMachinePowerState + :ivar ready_state: The indicator of whether the bare metal machine is ready to receive + workloads. Known values are: "True" and "False". + :vartype ready_state: str or ~azure.mgmt.networkcloud.models.BareMetalMachineReadyState + :ivar runtime_protection_status: The runtime protection status of the bare metal machine. + :vartype runtime_protection_status: ~azure.mgmt.networkcloud.models.RuntimeProtectionStatus + :ivar secret_rotation_status: The list of statuses that represent secret rotation activity. + :vartype secret_rotation_status: list[~azure.mgmt.networkcloud.models.SecretRotationStatus] + :ivar service_tag: The discovered value of the machine's service tag. + :vartype service_tag: str + :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of the resource IDs for the VirtualMachines that are hosted on this bare metal + machine. + :vartype virtual_machines_associated_ids: list[str] + :ivar provisioning_state: The provisioning state of the bare metal machine. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineProvisioningState + """ + + bmc_connection_string: str = rest_field( + name="bmcConnectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """The connection string for the baseboard management controller including IP address and + protocol. Required.""" + bmc_credentials: "_models.AdministrativeCredentials" = rest_field( + name="bmcCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials of the baseboard management controller on this bare metal machine. Required.""" + bmc_mac_address: str = rest_field(name="bmcMacAddress", visibility=["read", "create", "update", "delete", "query"]) + """The MAC address of the BMC device. Required.""" + boot_mac_address: str = rest_field( + name="bootMacAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The MAC address of a NIC connected to the PXE network. Required.""" + machine_details: str = rest_field(name="machineDetails", visibility=["read", "create", "update", "delete", "query"]) + """The custom details provided by the customer. Required.""" + machine_name: str = rest_field(name="machineName", visibility=["read", "create", "update", "delete", "query"]) + """The OS-level hostname assigned to this machine. Required.""" + machine_sku_id: str = rest_field(name="machineSkuId", visibility=["read", "create", "update", "delete", "query"]) + """The unique internal identifier of the bare metal machine SKU. Required.""" + rack_id: str = rest_field(name="rackId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the rack where this bare metal machine resides. Required.""" + rack_slot: int = rest_field(name="rackSlot", visibility=["read", "create", "update", "delete", "query"]) + """The rack slot in which this bare metal machine is located, ordered from the bottom up i.e. the + lowest slot is 1. Required.""" + serial_number: str = rest_field(name="serialNumber", visibility=["read", "create", "update", "delete", "query"]) + """The serial number of the bare metal machine. Required.""" + action_states: Optional[list["_models.ActionState"]] = rest_field(name="actionStates", visibility=["read"]) + """The current state of any in progress or completed actions. The most recent known instance of + each action type is shown.""" + associated_resource_ids: Optional[list[str]] = rest_field(name="associatedResourceIds", visibility=["read"]) + """The list of resource IDs for the other Microsoft.NetworkCloud resources that have attached this + network.""" + ca_certificate: Optional["_models.CertificateInfo"] = rest_field(name="caCertificate", visibility=["read"]) + """The CA certificate information issued by the platform for connecting to TLS interfaces for the + bare metal machine. Callers add this certificate to the trusted CA store on the Kubernetes + control plane nodes to allow secure communication with the bare metal machine.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the cluster this bare metal machine is associated with.""" + cordon_status: Optional[Union[str, "_models.BareMetalMachineCordonStatus"]] = rest_field( + name="cordonStatus", visibility=["read"] + ) + """The cordon status of the bare metal machine. Known values are: \"Cordoned\" and \"Uncordoned\".""" + detailed_status: Optional[Union[str, "_models.BareMetalMachineDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the bare metal machine. Known values are: \"Preparing\", \"Error\", + \"Available\", \"Provisioning\", \"Provisioned\", and \"Deprovisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + hardware_inventory: Optional["_models.HardwareInventory"] = rest_field( + name="hardwareInventory", visibility=["read"] + ) + """The hardware inventory, including information acquired from the model/sku information and from + the ironic inspector.""" + hardware_validation_status: Optional["_models.HardwareValidationStatus"] = rest_field( + name="hardwareValidationStatus", visibility=["read"] + ) + """The details of the latest hardware validation performed for this bare metal machine.""" + hybrid_aks_clusters_associated_ids: Optional[list[str]] = rest_field( + name="hybridAksClustersAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of the resource IDs for the + HybridAksClusters that have nodes hosted on this bare metal machine.""" + kubernetes_node_name: Optional[str] = rest_field(name="kubernetesNodeName", visibility=["read"]) + """The name of this machine represented by the host object in the Cluster's Kubernetes control + plane.""" + kubernetes_version: Optional[str] = rest_field(name="kubernetesVersion", visibility=["read"]) + """The version of Kubernetes running on this machine.""" + machine_cluster_version: Optional[str] = rest_field( + name="machineClusterVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster version that has been applied to this machine during deployment or a version + update.""" + machine_roles: Optional[list[str]] = rest_field(name="machineRoles", visibility=["read"]) + """The list of roles that are assigned to the cluster node running on this machine.""" + oam_ipv4_address: Optional[str] = rest_field(name="oamIpv4Address", visibility=["read"]) + """The IPv4 address that is assigned to the bare metal machine during the cluster deployment.""" + oam_ipv6_address: Optional[str] = rest_field(name="oamIpv6Address", visibility=["read"]) + """The IPv6 address that is assigned to the bare metal machine during the cluster deployment.""" + os_image: Optional[str] = rest_field(name="osImage", visibility=["read"]) + """The image that is currently provisioned to the OS disk.""" + power_state: Optional[Union[str, "_models.BareMetalMachinePowerState"]] = rest_field( + name="powerState", visibility=["read"] + ) + """The power state derived from the baseboard management controller. Known values are: \"On\" and + \"Off\".""" + ready_state: Optional[Union[str, "_models.BareMetalMachineReadyState"]] = rest_field( + name="readyState", visibility=["read"] + ) + """The indicator of whether the bare metal machine is ready to receive workloads. Known values + are: \"True\" and \"False\".""" + runtime_protection_status: Optional["_models.RuntimeProtectionStatus"] = rest_field( + name="runtimeProtectionStatus", visibility=["read"] + ) + """The runtime protection status of the bare metal machine.""" + secret_rotation_status: Optional[list["_models.SecretRotationStatus"]] = rest_field( + name="secretRotationStatus", visibility=["read"] + ) + """The list of statuses that represent secret rotation activity.""" + service_tag: Optional[str] = rest_field(name="serviceTag", visibility=["read"]) + """The discovered value of the machine's service tag.""" + virtual_machines_associated_ids: Optional[list[str]] = rest_field( + name="virtualMachinesAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of the resource IDs for the + VirtualMachines that are hosted on this bare metal machine.""" + provisioning_state: Optional[Union[str, "_models.BareMetalMachineProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the bare metal machine. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + bmc_connection_string: str, + bmc_credentials: "_models.AdministrativeCredentials", + bmc_mac_address: str, + boot_mac_address: str, + machine_details: str, + machine_name: str, + machine_sku_id: str, + rack_id: str, + rack_slot: int, + serial_number: str, + machine_cluster_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BareMetalMachineReplaceParameters(_Model): + """BareMetalMachineReplaceParameters represents the body of the request to physically swap a bare + metal machine for another. + + :ivar bmc_credentials: The credentials of the baseboard management controller on this bare + metal machine. The password field is expected to be an Azure Key Vault key URL. Until the + cluster is converted to utilize managed identity by setting the secret archive settings, the + actual password value should be provided instead. + :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials + :ivar bmc_mac_address: The MAC address of the BMC device. + :vartype bmc_mac_address: str + :ivar boot_mac_address: The MAC address of a NIC connected to the PXE network. + :vartype boot_mac_address: str + :ivar machine_name: The OS-level hostname assigned to this machine. + :vartype machine_name: str + :ivar safeguard_mode: The safeguard mode to use for the replace action, where None indicates to + bypass safeguards and All indicates to utilize all safeguards. Known values are: "All" and + "None". + :vartype safeguard_mode: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceSafeguardMode + :ivar serial_number: The serial number of the bare metal machine. + :vartype serial_number: str + :ivar storage_policy: The indicator of whether to bypass clearing storage while replacing a + bare metal machine. Known values are: "Preserve" and "DiscardAll". + :vartype storage_policy: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceStoragePolicy + """ + + bmc_credentials: Optional["_models.AdministrativeCredentials"] = rest_field( + name="bmcCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials of the baseboard management controller on this bare metal machine. The password + field is expected to be an Azure Key Vault key URL. Until the cluster is converted to utilize + managed identity by setting the secret archive settings, the actual password value should be + provided instead.""" + bmc_mac_address: Optional[str] = rest_field( + name="bmcMacAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The MAC address of the BMC device.""" + boot_mac_address: Optional[str] = rest_field( + name="bootMacAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The MAC address of a NIC connected to the PXE network.""" + machine_name: Optional[str] = rest_field( + name="machineName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS-level hostname assigned to this machine.""" + safeguard_mode: Optional[Union[str, "_models.BareMetalMachineReplaceSafeguardMode"]] = rest_field( + name="safeguardMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The safeguard mode to use for the replace action, where None indicates to bypass safeguards and + All indicates to utilize all safeguards. Known values are: \"All\" and \"None\".""" + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The serial number of the bare metal machine.""" + storage_policy: Optional[Union[str, "_models.BareMetalMachineReplaceStoragePolicy"]] = rest_field( + name="storagePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether to bypass clearing storage while replacing a bare metal machine. Known + values are: \"Preserve\" and \"DiscardAll\".""" + + @overload + def __init__( + self, + *, + bmc_credentials: Optional["_models.AdministrativeCredentials"] = None, + bmc_mac_address: Optional[str] = None, + boot_mac_address: Optional[str] = None, + machine_name: Optional[str] = None, + safeguard_mode: Optional[Union[str, "_models.BareMetalMachineReplaceSafeguardMode"]] = None, + serial_number: Optional[str] = None, + storage_policy: Optional[Union[str, "_models.BareMetalMachineReplaceStoragePolicy"]] = 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 BareMetalMachineRunCommandParameters(_Model): + """BareMetalMachineRunCommandParameters represents the body of the request to execute a script on + the bare metal machine. + + :ivar arguments: The list of string arguments that will be passed to the script in order as + separate arguments. + :vartype arguments: list[str] + :ivar limit_time_seconds: The maximum time the script is allowed to run. If the execution time + exceeds the maximum, the script will be stopped, any output produced until then will be + captured, and the exit code matching a timeout will be returned (252). Required. + :vartype limit_time_seconds: int + :ivar script: The base64 encoded script to execute on the bare metal machine. Required. + :vartype script: str + """ + + arguments: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of string arguments that will be passed to the script in order as separate arguments.""" + limit_time_seconds: int = rest_field( + name="limitTimeSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum time the script is allowed to run. If the execution time exceeds the maximum, the + script will be stopped, any output produced until then will be captured, and the exit code + matching a timeout will be returned (252). Required.""" + script: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The base64 encoded script to execute on the bare metal machine. Required.""" + + @overload + def __init__( + self, + *, + limit_time_seconds: int, + script: str, + arguments: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BareMetalMachineRunDataExtractsParameters(_Model): # pylint: disable=name-too-long + """BareMetalMachineRunDataExtractsParameters represents the body of request containing list of + curated data extraction commands to run on the bare metal machine. + + :ivar commands: The list of curated data extraction commands to be executed directly against + the target machine. Required. + :vartype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] + :ivar limit_time_seconds: The maximum time the commands are allowed to run. If the execution + time exceeds the maximum, the script will be stopped, any output produced until then will be + captured, and the exit code matching a timeout will be returned (252). Required. + :vartype limit_time_seconds: int + """ + + commands: list["_models.BareMetalMachineCommandSpecification"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of curated data extraction commands to be executed directly against the target + machine. Required.""" + limit_time_seconds: int = rest_field( + name="limitTimeSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum time the commands are allowed to run. If the execution time exceeds the maximum, + the script will be stopped, any output produced until then will be captured, and the exit code + matching a timeout will be returned (252). Required.""" + + @overload + def __init__( + self, + *, + commands: list["_models.BareMetalMachineCommandSpecification"], + limit_time_seconds: 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 BareMetalMachineRunReadCommandsParameters(_Model): # pylint: disable=name-too-long + """BareMetalMachineRunReadCommandsParameters represents the body of request containing list of + read-only commands to run on the bare metal machine. + + :ivar commands: The list of read-only commands to be executed directly against the target + machine. Required. + :vartype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] + :ivar limit_time_seconds: The maximum time the commands are allowed to run. If the execution + time exceeds the maximum, the script will be stopped, any output produced until then will be + captured, and the exit code matching a timeout will be returned (252). Required. + :vartype limit_time_seconds: int + """ + + commands: list["_models.BareMetalMachineCommandSpecification"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of read-only commands to be executed directly against the target machine. Required.""" + limit_time_seconds: int = rest_field( + name="limitTimeSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum time the commands are allowed to run. If the execution time exceeds the maximum, + the script will be stopped, any output produced until then will be captured, and the exit code + matching a timeout will be returned (252). Required.""" + + @overload + def __init__( + self, + *, + commands: list["_models.BareMetalMachineCommandSpecification"], + limit_time_seconds: 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 BgpAdvertisement(_Model): + """BgpAdvertisement represents the association of IP address pools to the communities and peers. + + :ivar advertise_to_fabric: The indicator of if this advertisement is also made to the network + fabric associated with the Network Cloud Cluster. This field is ignored if fabricPeeringEnabled + is set to False. Known values are: "True" and "False". + :vartype advertise_to_fabric: str or ~azure.mgmt.networkcloud.models.AdvertiseToFabric + :ivar communities: The names of the BGP communities to be associated with the announcement, + utilizing a BGP community string in 1234:1234 format. + :vartype communities: list[str] + :ivar ip_address_pools: The names of the IP address pools associated with this announcement. + Required. + :vartype ip_address_pools: list[str] + :ivar peers: The names of the BGP peers to limit this advertisement to. If no values are + specified, all BGP peers will receive this advertisement. + :vartype peers: list[str] + """ + + advertise_to_fabric: Optional[Union[str, "_models.AdvertiseToFabric"]] = rest_field( + name="advertiseToFabric", visibility=["read", "create"] + ) + """The indicator of if this advertisement is also made to the network fabric associated with the + Network Cloud Cluster. This field is ignored if fabricPeeringEnabled is set to False. Known + values are: \"True\" and \"False\".""" + communities: Optional[list[str]] = rest_field(visibility=["read", "create"]) + """The names of the BGP communities to be associated with the announcement, utilizing a BGP + community string in 1234:1234 format.""" + ip_address_pools: list[str] = rest_field(name="ipAddressPools", visibility=["read", "create"]) + """The names of the IP address pools associated with this announcement. Required.""" + peers: Optional[list[str]] = rest_field(visibility=["read", "create"]) + """The names of the BGP peers to limit this advertisement to. If no values are specified, all BGP + peers will receive this advertisement.""" + + @overload + def __init__( + self, + *, + ip_address_pools: list[str], + advertise_to_fabric: Optional[Union[str, "_models.AdvertiseToFabric"]] = None, + communities: Optional[list[str]] = None, + peers: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BgpServiceLoadBalancerConfiguration(_Model): + """BgpServiceLoadBalancerConfiguration represents the configuration of a BGP service load + balancer. + + :ivar bgp_advertisements: The association of IP address pools to the communities and peers, + allowing for announcement of IPs. + :vartype bgp_advertisements: list[~azure.mgmt.networkcloud.models.BgpAdvertisement] + :ivar bgp_peers: The list of additional BgpPeer entities that the Kubernetes cluster will peer + with. All peering must be explicitly defined. + :vartype bgp_peers: list[~azure.mgmt.networkcloud.models.ServiceLoadBalancerBgpPeer] + :ivar fabric_peering_enabled: The indicator to specify if the load balancer peers with the + network fabric. Known values are: "True" and "False". + :vartype fabric_peering_enabled: str or ~azure.mgmt.networkcloud.models.FabricPeeringEnabled + :ivar ip_address_pools: The list of pools of IP addresses that can be allocated to load + balancer services. + :vartype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] + """ + + bgp_advertisements: Optional[list["_models.BgpAdvertisement"]] = rest_field( + name="bgpAdvertisements", visibility=["read", "create"] + ) + """The association of IP address pools to the communities and peers, allowing for announcement of + IPs.""" + bgp_peers: Optional[list["_models.ServiceLoadBalancerBgpPeer"]] = rest_field( + name="bgpPeers", visibility=["read", "create"] + ) + """The list of additional BgpPeer entities that the Kubernetes cluster will peer with. All peering + must be explicitly defined.""" + fabric_peering_enabled: Optional[Union[str, "_models.FabricPeeringEnabled"]] = rest_field( + name="fabricPeeringEnabled", visibility=["read", "create"] + ) + """The indicator to specify if the load balancer peers with the network fabric. Known values are: + \"True\" and \"False\".""" + ip_address_pools: Optional[list["_models.IpAddressPool"]] = rest_field( + name="ipAddressPools", visibility=["read", "create"] + ) + """The list of pools of IP addresses that can be allocated to load balancer services.""" + + @overload + def __init__( + self, + *, + bgp_advertisements: Optional[list["_models.BgpAdvertisement"]] = None, + bgp_peers: Optional[list["_models.ServiceLoadBalancerBgpPeer"]] = None, + fabric_peering_enabled: Optional[Union[str, "_models.FabricPeeringEnabled"]] = None, + ip_address_pools: Optional[list["_models.IpAddressPool"]] = 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 BmcKeySet(TrackedResource): + """BmcKeySet represents the baseboard management controller key set. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.BmcKeySetProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.BmcKeySetProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "azure_group_id", + "expiration", + "privilege_level", + "user_list", + "detailed_status", + "detailed_status_message", + "last_validation", + "user_list_status", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.BmcKeySetProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 BmcKeySetPatchParameters(_Model): + """BmcKeySetPatchParameters represents the body of the request to patch the baseboard management + controller key set. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.BmcKeySetPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.BmcKeySetPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["expiration", "user_list"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.BmcKeySetPatchProperties"] = None, + 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: + _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 BmcKeySetPatchProperties(_Model): + """BmcKeySetPatchProperties represents the properties of baseboard management controller key set + that are patchable. + + :ivar expiration: The date and time after which the users in this key set will be removed from + the baseboard management controllers. + :vartype expiration: ~datetime.datetime + :ivar user_list: The unique list of permitted users. + :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] + """ + + expiration: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the users in this key set will be removed from the baseboard + management controllers.""" + user_list: Optional[list["_models.KeySetUser"]] = rest_field( + name="userList", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique list of permitted users.""" + + @overload + def __init__( + self, + *, + expiration: Optional[datetime.datetime] = None, + user_list: Optional[list["_models.KeySetUser"]] = 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 BmcKeySetProperties(_Model): + """BmcKeySetProperties represents the properties of baseboard management controller key set. + + :ivar azure_group_id: The object ID of Azure Active Directory group that all users in the list + must be in for access to be granted. Users that are not in the group will not have access. + Required. + :vartype azure_group_id: str + :ivar expiration: The date and time after which the users in this key set will be removed from + the baseboard management controllers. Required. + :vartype expiration: ~datetime.datetime + :ivar privilege_level: The access level allowed for the users in this key set. Required. Known + values are: "ReadOnly" and "Administrator". + :vartype privilege_level: str or ~azure.mgmt.networkcloud.models.BmcKeySetPrivilegeLevel + :ivar user_list: The unique list of permitted users. Required. + :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] + :ivar detailed_status: The more detailed status of the key set. Known values are: "AllActive", + "SomeInvalid", "AllInvalid", and "Validating". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.BmcKeySetDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar last_validation: The last time this key set was validated. + :vartype last_validation: ~datetime.datetime + :ivar user_list_status: The status evaluation of each user. + :vartype user_list_status: list[~azure.mgmt.networkcloud.models.KeySetUserStatus] + :ivar provisioning_state: The provisioning state of the baseboard management controller key + set. Known values are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.BmcKeySetProvisioningState + """ + + azure_group_id: str = rest_field(name="azureGroupId", visibility=["read", "create"]) + """The object ID of Azure Active Directory group that all users in the list must be in for access + to be granted. Users that are not in the group will not have access. Required.""" + expiration: datetime.datetime = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the users in this key set will be removed from the baseboard + management controllers. Required.""" + privilege_level: Union[str, "_models.BmcKeySetPrivilegeLevel"] = rest_field( + name="privilegeLevel", visibility=["read", "create"] + ) + """The access level allowed for the users in this key set. Required. Known values are: + \"ReadOnly\" and \"Administrator\".""" + user_list: list["_models.KeySetUser"] = rest_field( + name="userList", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique list of permitted users. Required.""" + detailed_status: Optional[Union[str, "_models.BmcKeySetDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the key set. Known values are: \"AllActive\", \"SomeInvalid\", + \"AllInvalid\", and \"Validating\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + last_validation: Optional[datetime.datetime] = rest_field( + name="lastValidation", visibility=["read"], format="rfc3339" + ) + """The last time this key set was validated.""" + user_list_status: Optional[list["_models.KeySetUserStatus"]] = rest_field( + name="userListStatus", visibility=["read"] + ) + """The status evaluation of each user.""" + provisioning_state: Optional[Union[str, "_models.BmcKeySetProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the baseboard management controller key set. Known values are: + \"Succeeded\", \"Failed\", \"Canceled\", \"Accepted\", and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + azure_group_id: str, + expiration: datetime.datetime, + privilege_level: Union[str, "_models.BmcKeySetPrivilegeLevel"], + user_list: list["_models.KeySetUser"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 CertificateInfo(_Model): + """CertificateInfo represents the non-private information of an X.509 Certificate. + + :ivar hash: The hash value of the X.509 Certificate. + :vartype hash: str + :ivar value: The textual value of the X.509 Certificate. + :vartype value: str + """ + + hash: Optional[str] = rest_field(visibility=["read"]) + """The hash value of the X.509 Certificate.""" + value: Optional[str] = rest_field(visibility=["read"]) + """The textual value of the X.509 Certificate.""" + + +class CloudServicesNetwork(TrackedResource): + """Upon creation, the additional services that are provided by the platform will be allocated and + represented in the status of this resource. All resources associated with this cloud services + network will be part of the same layer 2 (L2) isolation domain. At least one service network + must be created but may be reused across many virtual machines and/or Hybrid AKS clusters. + + :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.networkcloud.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 list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.CloudServicesNetworkProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: Optional["_models.CloudServicesNetworkProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "additional_egress_endpoints", + "enable_default_egress_endpoints", + "storage_options", + "associated_resource_ids", + "cluster_id", + "detailed_status", + "detailed_status_message", + "enabled_egress_endpoints", + "hybrid_aks_clusters_associated_ids", + "interface_name", + "storage_status", + "virtual_machines_associated_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + extended_location: "_models.ExtendedLocation", + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.CloudServicesNetworkProperties"] = 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 CloudServicesNetworkPatchParameters(_Model): + """CloudServicesNetworkPatchParameters represents the body of the request to patch the cloud + services network. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.CloudServicesNetworkPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["additional_egress_endpoints", "enable_default_egress_endpoints", "storage_options"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CloudServicesNetworkPatchProperties"] = None, + 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: + _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 CloudServicesNetworkPatchProperties(_Model): + """CloudServicesNetworkPatchProperties represents the properties of the cloud services network + that can be updated using a patch request. + + :ivar additional_egress_endpoints: The list of egress endpoints. This allows for connection + from a Hybrid AKS cluster to the specified endpoint. + :vartype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] + :ivar enable_default_egress_endpoints: The indicator of whether the platform default endpoints + are allowed for the egress traffic. Known values are: "True" and "False". + :vartype enable_default_egress_endpoints: str or + ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints + :ivar storage_options: The storage options for the cloud services network. + :vartype storage_options: + ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptionsPatch + """ + + additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = rest_field( + name="additionalEgressEndpoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the + specified endpoint.""" + enable_default_egress_endpoints: Optional[ + Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] + ] = rest_field(name="enableDefaultEgressEndpoints", visibility=["read", "create", "update", "delete", "query"]) + """The indicator of whether the platform default endpoints are allowed for the egress traffic. + Known values are: \"True\" and \"False\".""" + storage_options: Optional["_models.CloudServicesNetworkStorageOptionsPatch"] = rest_field( + name="storageOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage options for the cloud services network.""" + + @overload + def __init__( + self, + *, + additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = None, + enable_default_egress_endpoints: Optional[ + Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] + ] = None, + storage_options: Optional["_models.CloudServicesNetworkStorageOptionsPatch"] = 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 CloudServicesNetworkProperties(_Model): + """CloudServicesNetworkProperties represents properties of the cloud services network. + + :ivar additional_egress_endpoints: The list of egress endpoints. This allows for connection + from a Hybrid AKS cluster to the specified endpoint. + :vartype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] + :ivar enable_default_egress_endpoints: The indicator of whether the platform default endpoints + are allowed for the egress traffic. Known values are: "True" and "False". + :vartype enable_default_egress_endpoints: str or + ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints + :ivar storage_options: The storage options for the cloud services network. + :vartype storage_options: ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptions + :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud + resources that have attached this network. + :vartype associated_resource_ids: list[str] + :ivar cluster_id: The resource ID of the Network Cloud cluster this cloud services network is + associated with. + :vartype cluster_id: str + :ivar detailed_status: The more detailed status of the cloud services network. Known values + are: "Error", "Available", and "Provisioning". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.CloudServicesNetworkDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar enabled_egress_endpoints: The full list of additional and default egress endpoints that + are currently enabled. + :vartype enabled_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] + :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of Hybrid AKS cluster resource IDs that are associated with this cloud services + network. + :vartype hybrid_aks_clusters_associated_ids: list[str] + :ivar interface_name: The name of the interface that will be present in the virtual machine to + represent this network. + :vartype interface_name: str + :ivar storage_status: The storage status for the cloud services network. + :vartype storage_status: ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatus + :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are + currently using this cloud services network. + :vartype virtual_machines_associated_ids: list[str] + :ivar provisioning_state: The provisioning state of the cloud services network. Known values + are: "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.CloudServicesNetworkProvisioningState + """ + + additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = rest_field( + name="additionalEgressEndpoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the + specified endpoint.""" + enable_default_egress_endpoints: Optional[ + Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] + ] = rest_field(name="enableDefaultEgressEndpoints", visibility=["read", "create", "update", "delete", "query"]) + """The indicator of whether the platform default endpoints are allowed for the egress traffic. + Known values are: \"True\" and \"False\".""" + storage_options: Optional["_models.CloudServicesNetworkStorageOptions"] = rest_field( + name="storageOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage options for the cloud services network.""" + associated_resource_ids: Optional[list[str]] = rest_field(name="associatedResourceIds", visibility=["read"]) + """The list of resource IDs for the other Microsoft.NetworkCloud resources that have attached this + network.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the Network Cloud cluster this cloud services network is associated with.""" + detailed_status: Optional[Union[str, "_models.CloudServicesNetworkDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the cloud services network. Known values are: \"Error\", + \"Available\", and \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + enabled_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = rest_field( + name="enabledEgressEndpoints", visibility=["read"] + ) + """The full list of additional and default egress endpoints that are currently enabled.""" + hybrid_aks_clusters_associated_ids: Optional[list[str]] = rest_field( + name="hybridAksClustersAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of Hybrid AKS cluster resource + IDs that are associated with this cloud services network.""" + interface_name: Optional[str] = rest_field(name="interfaceName", visibility=["read"]) + """The name of the interface that will be present in the virtual machine to represent this + network.""" + storage_status: Optional["_models.CloudServicesNetworkStorageStatus"] = rest_field( + name="storageStatus", visibility=["read"] + ) + """The storage status for the cloud services network.""" + virtual_machines_associated_ids: Optional[list[str]] = rest_field( + name="virtualMachinesAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of virtual machine resource IDs, + excluding any Hybrid AKS virtual machines, that are currently using this cloud services + network.""" + provisioning_state: Optional[Union[str, "_models.CloudServicesNetworkProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the cloud services network. Known values are: \"Succeeded\", + \"Failed\", \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = None, + enable_default_egress_endpoints: Optional[ + Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] + ] = None, + storage_options: Optional["_models.CloudServicesNetworkStorageOptions"] = 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 CloudServicesNetworkStorageOptions(_Model): + """CloudServicesNetworkStorageOptions represents the storage options for the cloud services + network. + + :ivar mode: The indicator to enable shared storage on the cloud services network. If not + specified, the allocation will align with the standard storage enablement. Known values are: + "None" and "Standard". + :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode + :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. + :vartype size_mi_b: int + :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the storage. + :vartype storage_appliance_id: str + """ + + mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator to enable shared storage on the cloud services network. If not specified, the + allocation will align with the standard storage enablement. Known values are: \"None\" and + \"Standard\".""" + size_mi_b: Optional[int] = rest_field(name="sizeMiB", visibility=["read", "create", "update", "delete", "query"]) + """The requested storage allocation for the volume in Mebibytes.""" + storage_appliance_id: Optional[str] = rest_field( + name="storageApplianceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the storage appliance that hosts the storage.""" + + @overload + def __init__( + self, + *, + mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = None, + size_mi_b: Optional[int] = None, + storage_appliance_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 CloudServicesNetworkStorageOptionsPatch(_Model): + """CloudServicesNetworkStorageOptionsPatch represents the patchable storage options for the cloud + services network. + + :ivar mode: The indicator to enable shared storage on the cloud services network. Known values + are: "None" and "Standard". + :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode + :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. + :vartype size_mi_b: int + :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the storage. + :vartype storage_appliance_id: str + """ + + mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator to enable shared storage on the cloud services network. Known values are: + \"None\" and \"Standard\".""" + size_mi_b: Optional[int] = rest_field(name="sizeMiB", visibility=["read", "create", "update", "delete", "query"]) + """The requested storage allocation for the volume in Mebibytes.""" + storage_appliance_id: Optional[str] = rest_field( + name="storageApplianceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the storage appliance that hosts the storage.""" + + @overload + def __init__( + self, + *, + mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = None, + size_mi_b: Optional[int] = None, + storage_appliance_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 CloudServicesNetworkStorageStatus(_Model): + """CloudServicesNetworkStorageStatus represents the storage status of the cloud services network. + + :ivar mode: The indicator of if shared storage is enabled on the cloud services network. Known + values are: "None" and "Standard". + :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode + :ivar size_mi_b: The size in Mebibytes of the storage allocation. + :vartype size_mi_b: int + :ivar status: The status of the storage allocation for the cloud services network. Known values + are: "Available", "ExpandingVolume", and "ExpansionFailed". + :vartype status: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatusStatus + :ivar status_message: The description for the status of the shared storage. + :vartype status_message: str + :ivar volume_id: The resource ID of the volume created to host the shared storage. + :vartype volume_id: str + """ + + mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = rest_field(visibility=["read"]) + """The indicator of if shared storage is enabled on the cloud services network. Known values are: + \"None\" and \"Standard\".""" + size_mi_b: Optional[int] = rest_field(name="sizeMiB", visibility=["read"]) + """The size in Mebibytes of the storage allocation.""" + status: Optional[Union[str, "_models.CloudServicesNetworkStorageStatusStatus"]] = rest_field(visibility=["read"]) + """The status of the storage allocation for the cloud services network. Known values are: + \"Available\", \"ExpandingVolume\", and \"ExpansionFailed\".""" + status_message: Optional[str] = rest_field(name="statusMessage", visibility=["read"]) + """The description for the status of the shared storage.""" + volume_id: Optional[str] = rest_field(name="volumeId", visibility=["read"]) + """The resource ID of the volume created to host the shared storage.""" + + +class Cluster(TrackedResource): + """Cluster represents the on-premises Network Cloud cluster. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.ClusterProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + """ + + properties: "_models.ClusterProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "aggregator_or_single_rack_definition", + "analytics_output_settings", + "analytics_workspace_id", + "cluster_location", + "cluster_service_principal", + "cluster_type", + "cluster_version", + "command_output_settings", + "compute_deployment_threshold", + "compute_rack_definitions", + "managed_resource_group_configuration", + "network_fabric_id", + "runtime_protection_configuration", + "secret_archive", + "secret_archive_settings", + "update_strategy", + "vulnerability_scanning_settings", + "action_states", + "available_upgrade_versions", + "cluster_capacity", + "cluster_connection_status", + "cluster_extended_location", + "cluster_manager_connection_status", + "cluster_manager_id", + "detailed_status", + "detailed_status_message", + "hybrid_aks_extended_location", + "manual_action_count", + "support_expiry_date", + "workload_resource_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.ClusterProperties", + extended_location: "_models.ExtendedLocation", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 ClusterAvailableUpgradeVersion(_Model): + """ClusterAvailableUpgradeVersion represents the various cluster upgrade parameters. + + :ivar control_impact: The indicator of whether the control plane will be impacted during the + upgrade. Known values are: "True" and "False". + :vartype control_impact: str or ~azure.mgmt.networkcloud.models.ControlImpact + :ivar expected_duration: The expected duration needed for this upgrade. + :vartype expected_duration: str + :ivar impact_description: The impact description including the specific details and release + notes. + :vartype impact_description: str + :ivar support_expiry_date: The last date the version of the platform is supported. + :vartype support_expiry_date: str + :ivar target_cluster_version: The target version this cluster will be upgraded to. + :vartype target_cluster_version: str + :ivar workload_impact: The indicator of whether the workload will be impacted during the + upgrade. Known values are: "True" and "False". + :vartype workload_impact: str or ~azure.mgmt.networkcloud.models.WorkloadImpact + """ + + control_impact: Optional[Union[str, "_models.ControlImpact"]] = rest_field( + name="controlImpact", visibility=["read"] + ) + """The indicator of whether the control plane will be impacted during the upgrade. Known values + are: \"True\" and \"False\".""" + expected_duration: Optional[str] = rest_field(name="expectedDuration", visibility=["read"]) + """The expected duration needed for this upgrade.""" + impact_description: Optional[str] = rest_field(name="impactDescription", visibility=["read"]) + """The impact description including the specific details and release notes.""" + support_expiry_date: Optional[str] = rest_field(name="supportExpiryDate", visibility=["read"]) + """The last date the version of the platform is supported.""" + target_cluster_version: Optional[str] = rest_field(name="targetClusterVersion", visibility=["read"]) + """The target version this cluster will be upgraded to.""" + workload_impact: Optional[Union[str, "_models.WorkloadImpact"]] = rest_field( + name="workloadImpact", visibility=["read"] + ) + """The indicator of whether the workload will be impacted during the upgrade. Known values are: + \"True\" and \"False\".""" + + +class ClusterAvailableVersion(_Model): + """ClusterAvailableVersion represents the cluster version that the cluster manager can be asked to + create and manage. + + :ivar support_expiry_date: The last date the version of the platform is supported. + :vartype support_expiry_date: str + :ivar target_cluster_version: The version of the cluster to be deployed. + :vartype target_cluster_version: str + """ + + support_expiry_date: Optional[str] = rest_field(name="supportExpiryDate", visibility=["read"]) + """The last date the version of the platform is supported.""" + target_cluster_version: Optional[str] = rest_field(name="targetClusterVersion", visibility=["read"]) + """The version of the cluster to be deployed.""" + + +class ClusterCapacity(_Model): + """ClusterCapacity represents various details regarding compute capacity. + + :ivar available_appliance_storage_gb: The remaining appliance-based storage in GB available for + workload use. Measured in gibibytes. + :vartype available_appliance_storage_gb: int + :ivar available_core_count: The remaining number of cores that are available in this cluster + for workload use. + :vartype available_core_count: int + :ivar available_host_storage_gb: The remaining machine or host-based storage in GB available + for workload use. Measured in gibibytes. + :vartype available_host_storage_gb: int + :ivar available_memory_gb: The remaining memory in GB that are available in this cluster for + workload use. Measured in gibibytes. + :vartype available_memory_gb: int + :ivar total_appliance_storage_gb: The total appliance-based storage in GB supported by this + cluster for workload use. Measured in gibibytes. + :vartype total_appliance_storage_gb: int + :ivar total_core_count: The total number of cores that are supported by this cluster for + workload use. + :vartype total_core_count: int + :ivar total_host_storage_gb: The total machine or host-based storage in GB supported by this + cluster for workload use. Measured in gibibytes. + :vartype total_host_storage_gb: int + :ivar total_memory_gb: The total memory supported by this cluster for workload use. Measured in + gibibytes. + :vartype total_memory_gb: int + """ + + available_appliance_storage_gb: Optional[int] = rest_field( + name="availableApplianceStorageGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The remaining appliance-based storage in GB available for workload use. Measured in gibibytes.""" + available_core_count: Optional[int] = rest_field( + name="availableCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The remaining number of cores that are available in this cluster for workload use.""" + available_host_storage_gb: Optional[int] = rest_field( + name="availableHostStorageGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The remaining machine or host-based storage in GB available for workload use. Measured in + gibibytes.""" + available_memory_gb: Optional[int] = rest_field( + name="availableMemoryGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The remaining memory in GB that are available in this cluster for workload use. Measured in + gibibytes.""" + total_appliance_storage_gb: Optional[int] = rest_field( + name="totalApplianceStorageGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The total appliance-based storage in GB supported by this cluster for workload use. Measured in + gibibytes.""" + total_core_count: Optional[int] = rest_field( + name="totalCoreCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The total number of cores that are supported by this cluster for workload use.""" + total_host_storage_gb: Optional[int] = rest_field( + name="totalHostStorageGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The total machine or host-based storage in GB supported by this cluster for workload use. + Measured in gibibytes.""" + total_memory_gb: Optional[int] = rest_field( + name="totalMemoryGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The total memory supported by this cluster for workload use. Measured in gibibytes.""" + + @overload + def __init__( + self, + *, + available_appliance_storage_gb: Optional[int] = None, + available_core_count: Optional[int] = None, + available_host_storage_gb: Optional[int] = None, + available_memory_gb: Optional[int] = None, + total_appliance_storage_gb: Optional[int] = None, + total_core_count: Optional[int] = None, + total_host_storage_gb: Optional[int] = None, + total_memory_gb: 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 ClusterContinueUpdateVersionParameters(_Model): + """ClusterContinueUpdateVersionParameters represents the body of the request to continue the + update of a cluster version. + + :ivar machine_group_targeting_mode: The mode by which the cluster will target the next grouping + of servers to continue the update. "AlphaByRack" + :vartype machine_group_targeting_mode: str or + ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionMachineGroupTargetingMode + """ + + machine_group_targeting_mode: Optional[ + Union[str, "_models.ClusterContinueUpdateVersionMachineGroupTargetingMode"] + ] = rest_field(name="machineGroupTargetingMode", visibility=["read", "create", "update", "delete", "query"]) + """The mode by which the cluster will target the next grouping of servers to continue the update. + \"AlphaByRack\"""" + + @overload + def __init__( + self, + *, + machine_group_targeting_mode: Optional[ + Union[str, "_models.ClusterContinueUpdateVersionMachineGroupTargetingMode"] + ] = 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 ClusterDeployParameters(_Model): + """ClusterDeployParameters represents the body of the request to deploy cluster. + + :ivar skip_validations_for_machines: The names of bare metal machines in the cluster that + should be skipped during environment validation. + :vartype skip_validations_for_machines: list[str] + """ + + skip_validations_for_machines: Optional[list[str]] = rest_field( + name="skipValidationsForMachines", visibility=["read", "create", "update", "delete", "query"] + ) + """The names of bare metal machines in the cluster that should be skipped during environment + validation.""" + + @overload + def __init__( + self, + *, + skip_validations_for_machines: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ClusterManager(TrackedResource): + """ClusterManager represents a control-plane to manage one or more on-premises clusters. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.ClusterManagerProperties + :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 identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + """ + + properties: "_models.ClusterManagerProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "analytics_workspace_id", + "availability_zones", + "cluster_versions", + "detailed_status", + "detailed_status_message", + "fabric_controller_id", + "managed_resource_group_configuration", + "manager_extended_location", + "provisioning_state", + "vm_size", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.ClusterManagerProperties", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 ClusterManagerPatchParameters(_Model): + """ClusterManagerPatchParameters represents the body of the request to patch the cluster + properties. + + :ivar identity: The identity for the resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity for the resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + 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 ClusterManagerProperties(_Model): + """ClusterManagerProperties represents the properties of a cluster manager. + + :ivar analytics_workspace_id: The resource ID of the Log Analytics workspace that is used for + the logs collection. + :vartype analytics_workspace_id: str + :ivar availability_zones: The Azure availability zones within the region that will be used to + support the cluster manager resource. + :vartype availability_zones: list[str] + :ivar cluster_versions: The list of the cluster versions the manager supports. It is used as + input in clusterVersion property of a cluster resource. + :vartype cluster_versions: list[~azure.mgmt.networkcloud.models.ClusterAvailableVersion] + :ivar detailed_status: The detailed status that provides additional information about the + cluster manager. Known values are: "Error", "Available", "Provisioning", "ProvisioningFailed", + "Updating", and "UpdateFailed". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ClusterManagerDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar fabric_controller_id: The resource ID of the fabric controller that has one to one + mapping with the cluster manager. Required. + :vartype fabric_controller_id: str + :ivar managed_resource_group_configuration: The configuration of the managed resource group + associated with the resource. + :vartype managed_resource_group_configuration: + ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration + :ivar manager_extended_location: The extended location (custom location) that represents the + cluster manager's control plane location. This extended location is used when creating cluster + and rack manifest resources. + :vartype manager_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar provisioning_state: The provisioning state of the cluster manager. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", "Accepted", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.ClusterManagerProvisioningState + :ivar vm_size: The size of the Azure virtual machines to use for hosting the cluster manager + resource. + :vartype vm_size: str + """ + + analytics_workspace_id: Optional[str] = rest_field(name="analyticsWorkspaceId", visibility=["read", "create"]) + """The resource ID of the Log Analytics workspace that is used for the logs collection.""" + availability_zones: Optional[list[str]] = rest_field(name="availabilityZones", visibility=["read", "create"]) + """The Azure availability zones within the region that will be used to support the cluster manager + resource.""" + cluster_versions: Optional[list["_models.ClusterAvailableVersion"]] = rest_field( + name="clusterVersions", visibility=["read"] + ) + """The list of the cluster versions the manager supports. It is used as input in clusterVersion + property of a cluster resource.""" + detailed_status: Optional[Union[str, "_models.ClusterManagerDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The detailed status that provides additional information about the cluster manager. Known + values are: \"Error\", \"Available\", \"Provisioning\", \"ProvisioningFailed\", \"Updating\", + and \"UpdateFailed\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + fabric_controller_id: str = rest_field(name="fabricControllerId", visibility=["read", "create"]) + """The resource ID of the fabric controller that has one to one mapping with the cluster manager. + Required.""" + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = rest_field( + name="managedResourceGroupConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the managed resource group associated with the resource.""" + manager_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="managerExtendedLocation", visibility=["read"] + ) + """The extended location (custom location) that represents the cluster manager's control plane + location. This extended location is used when creating cluster and rack manifest resources.""" + provisioning_state: Optional[Union[str, "_models.ClusterManagerProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the cluster manager. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", \"Accepted\", and \"Updating\".""" + vm_size: Optional[str] = rest_field(name="vmSize", visibility=["read", "create"]) + """The size of the Azure virtual machines to use for hosting the cluster manager resource.""" + + @overload + def __init__( + self, + *, + fabric_controller_id: str, + analytics_workspace_id: Optional[str] = None, + availability_zones: Optional[list[str]] = None, + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, + vm_size: 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 ClusterMetricsConfiguration(TrackedResource): + """ClusterMetricsConfiguration represents the metrics configuration of an on-premises Network + Cloud cluster. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.ClusterMetricsConfigurationProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "enabled_metrics", + "collection_interval", + "detailed_status", + "detailed_status_message", + "disabled_metrics", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.ClusterMetricsConfigurationProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 ClusterMetricsConfigurationPatchParameters(_Model): # pylint: disable=name-too-long + """ClusterMetricsConfigurationPatchParameters represents the body of the request to patch the + metrics configuration of cluster. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.ClusterMetricsConfigurationPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["collection_interval", "enabled_metrics"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ClusterMetricsConfigurationPatchProperties"] = None, + 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: + _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 ClusterMetricsConfigurationPatchProperties(_Model): # pylint: disable=name-too-long + """ClusterMetricsConfigurationPatchProperties represents the properties of metrics configuration + for the cluster for patching. + + :ivar collection_interval: The interval in minutes by which metrics will be collected. + :vartype collection_interval: int + :ivar enabled_metrics: The list of metric names that have been chosen to be enabled in addition + to the core set of enabled metrics. + :vartype enabled_metrics: list[str] + """ + + collection_interval: Optional[int] = rest_field( + name="collectionInterval", visibility=["read", "create", "update", "delete", "query"] + ) + """The interval in minutes by which metrics will be collected.""" + enabled_metrics: Optional[list[str]] = rest_field( + name="enabledMetrics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of metric names that have been chosen to be enabled in addition to the core set of + enabled metrics.""" + + @overload + def __init__( + self, + *, + collection_interval: Optional[int] = None, + enabled_metrics: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ClusterMetricsConfigurationProperties(_Model): + """ClusterMetricsConfigurationProperties represents the properties of metrics configuration for + the cluster. + + :ivar enabled_metrics: The list of metric names that have been chosen to be enabled in addition + to the core set of enabled metrics. + :vartype enabled_metrics: list[str] + :ivar collection_interval: The interval in minutes by which metrics will be collected. + Required. + :vartype collection_interval: int + :ivar detailed_status: The more detailed status of the metrics configuration. Known values are: + "Processing", "Applied", and "Error". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar disabled_metrics: The list of metrics that are available for the cluster but disabled at + the moment. + :vartype disabled_metrics: list[str] + :ivar provisioning_state: The provisioning state of the metrics configuration. Known values + are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProvisioningState + """ + + enabled_metrics: Optional[list[str]] = rest_field( + name="enabledMetrics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of metric names that have been chosen to be enabled in addition to the core set of + enabled metrics.""" + collection_interval: int = rest_field( + name="collectionInterval", visibility=["read", "create", "update", "delete", "query"] + ) + """The interval in minutes by which metrics will be collected. Required.""" + detailed_status: Optional[Union[str, "_models.ClusterMetricsConfigurationDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the metrics configuration. Known values are: \"Processing\", + \"Applied\", and \"Error\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + disabled_metrics: Optional[list[str]] = rest_field(name="disabledMetrics", visibility=["read"]) + """The list of metrics that are available for the cluster but disabled at the moment.""" + provisioning_state: Optional[Union[str, "_models.ClusterMetricsConfigurationProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the metrics configuration. Known values are: \"Succeeded\", + \"Failed\", \"Canceled\", \"Accepted\", and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + collection_interval: int, + enabled_metrics: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ClusterPatchParameters(_Model): + """ClusterPatchParameters represents the body of the request to patch the cluster properties. + + :ivar identity: The identity for the resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.ClusterPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity for the resource.""" + properties: Optional["_models.ClusterPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = [ + "aggregator_or_single_rack_definition", + "analytics_output_settings", + "cluster_location", + "cluster_service_principal", + "command_output_settings", + "compute_deployment_threshold", + "compute_rack_definitions", + "runtime_protection_configuration", + "secret_archive", + "secret_archive_settings", + "update_strategy", + "vulnerability_scanning_settings", + ] + + @overload + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.ClusterPatchProperties"] = None, + 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: + _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 ClusterPatchProperties(_Model): + """ClusterPatchProperties represents the properties of the cluster for patching. + + :ivar aggregator_or_single_rack_definition: The rack definition that is intended to reflect + only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. + :vartype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition + :ivar analytics_output_settings: The settings for the log analytics workspace used for output + of logs from this cluster. + :vartype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings + :ivar cluster_location: The customer-provided location information to identify where the + cluster resides. + :vartype cluster_location: str + :ivar cluster_service_principal: Field Deprecated: Use managed identity to provide cluster + privileges. The service principal to be used by the cluster during Arc Appliance installation. + :vartype cluster_service_principal: ~azure.mgmt.networkcloud.models.ServicePrincipalInformation + :ivar command_output_settings: The settings for commands run in this cluster, such as bare + metal machine run read only commands and data extracts. + :vartype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings + :ivar compute_deployment_threshold: The validation threshold indicating the allowable failures + of compute machines during environment validation and deployment. + :vartype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold + :ivar compute_rack_definitions: The list of rack definitions for the compute racks in a + multi-rack cluster, or an empty list in a single-rack cluster. + :vartype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] + :ivar runtime_protection_configuration: The settings for cluster runtime protection. + :vartype runtime_protection_configuration: + ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration + :ivar secret_archive: The configuration for use of a key vault to store secrets for later + retrieval by the operator. + :vartype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive + :ivar secret_archive_settings: The settings for the secret archive used to hold credentials for + the cluster. + :vartype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings + :ivar update_strategy: The strategy for updating the cluster. + :vartype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy + :ivar vulnerability_scanning_settings: The settings for how security vulnerability scanning is + applied to the cluster. + :vartype vulnerability_scanning_settings: + ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsPatch + """ + + aggregator_or_single_rack_definition: Optional["_models.RackDefinition"] = rest_field( + name="aggregatorOrSingleRackDefinition", visibility=["read", "create", "update", "delete", "query"] + ) + """The rack definition that is intended to reflect only a single rack in a single rack cluster, or + an aggregator rack in a multi-rack cluster.""" + analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = rest_field( + name="analyticsOutputSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for the log analytics workspace used for output of logs from this cluster.""" + cluster_location: Optional[str] = rest_field( + name="clusterLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The customer-provided location information to identify where the cluster resides.""" + cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = rest_field( + name="clusterServicePrincipal", visibility=["read", "create", "update", "delete", "query"] + ) + """Field Deprecated: Use managed identity to provide cluster privileges. The service principal to + be used by the cluster during Arc Appliance installation.""" + command_output_settings: Optional["_models.CommandOutputSettings"] = rest_field( + name="commandOutputSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for commands run in this cluster, such as bare metal machine run read only + commands and data extracts.""" + compute_deployment_threshold: Optional["_models.ValidationThreshold"] = rest_field( + name="computeDeploymentThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The validation threshold indicating the allowable failures of compute machines during + environment validation and deployment.""" + compute_rack_definitions: Optional[list["_models.RackDefinition"]] = rest_field( + name="computeRackDefinitions", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in + a single-rack cluster.""" + runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = rest_field( + name="runtimeProtectionConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for cluster runtime protection.""" + secret_archive: Optional["_models.ClusterSecretArchive"] = rest_field( + name="secretArchive", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for use of a key vault to store secrets for later retrieval by the operator.""" + secret_archive_settings: Optional["_models.SecretArchiveSettings"] = rest_field( + name="secretArchiveSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for the secret archive used to hold credentials for the cluster.""" + update_strategy: Optional["_models.ClusterUpdateStrategy"] = rest_field( + name="updateStrategy", visibility=["read", "create", "update", "delete", "query"] + ) + """The strategy for updating the cluster.""" + vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettingsPatch"] = rest_field( + name="vulnerabilityScanningSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for how security vulnerability scanning is applied to the cluster.""" + + @overload + def __init__( + self, + *, + aggregator_or_single_rack_definition: Optional["_models.RackDefinition"] = None, + analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = None, + cluster_location: Optional[str] = None, + cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = None, + command_output_settings: Optional["_models.CommandOutputSettings"] = None, + compute_deployment_threshold: Optional["_models.ValidationThreshold"] = None, + compute_rack_definitions: Optional[list["_models.RackDefinition"]] = None, + runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = None, + secret_archive: Optional["_models.ClusterSecretArchive"] = None, + secret_archive_settings: Optional["_models.SecretArchiveSettings"] = None, + update_strategy: Optional["_models.ClusterUpdateStrategy"] = None, + vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettingsPatch"] = 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 ClusterProperties(_Model): + """ClusterProperties represents the properties of a cluster. + + :ivar aggregator_or_single_rack_definition: The rack definition that is intended to reflect + only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. + Required. + :vartype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition + :ivar analytics_output_settings: The settings for the log analytics workspace used for output + of logs from this cluster. + :vartype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings + :ivar analytics_workspace_id: Field Deprecated. The resource ID of the Log Analytics Workspace + that will be used for storing relevant logs. + :vartype analytics_workspace_id: str + :ivar cluster_location: The customer-provided location information to identify where the + cluster resides. + :vartype cluster_location: str + :ivar cluster_service_principal: Field Deprecated: Use managed identity to provide cluster + privileges. The service principal to be used by the cluster during Arc Appliance installation. + :vartype cluster_service_principal: ~azure.mgmt.networkcloud.models.ServicePrincipalInformation + :ivar cluster_type: The type of rack configuration for the cluster. Required. Known values are: + "SingleRack" and "MultiRack". + :vartype cluster_type: str or ~azure.mgmt.networkcloud.models.ClusterType + :ivar cluster_version: The current runtime version of the cluster. Required. + :vartype cluster_version: str + :ivar command_output_settings: The settings for commands run in this cluster, such as bare + metal machine run read only commands and data extracts. + :vartype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings + :ivar compute_deployment_threshold: The validation threshold indicating the allowable failures + of compute machines during environment validation and deployment. + :vartype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold + :ivar compute_rack_definitions: The list of rack definitions for the compute racks in a + multi-rack cluster, or an empty list in a single-rack cluster. + :vartype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] + :ivar managed_resource_group_configuration: The configuration of the managed resource group + associated with the resource. + :vartype managed_resource_group_configuration: + ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration + :ivar network_fabric_id: The resource ID of the Network Fabric associated with the cluster. + Required. + :vartype network_fabric_id: str + :ivar runtime_protection_configuration: The settings for cluster runtime protection. + :vartype runtime_protection_configuration: + ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration + :ivar secret_archive: The configuration for use of a key vault to store secrets for later + retrieval by the operator. + :vartype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive + :ivar secret_archive_settings: The settings for the secret archive used to hold credentials for + the cluster. + :vartype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings + :ivar update_strategy: The strategy for updating the cluster. + :vartype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy + :ivar vulnerability_scanning_settings: The settings for how security vulnerability scanning is + applied to the cluster. + :vartype vulnerability_scanning_settings: + ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettings + :ivar action_states: The current state of any in progress or completed actions. The most recent + known instance of each action type is shown. + :vartype action_states: list[~azure.mgmt.networkcloud.models.ActionState] + :ivar available_upgrade_versions: The list of cluster runtime version upgrades available for + this cluster. + :vartype available_upgrade_versions: + list[~azure.mgmt.networkcloud.models.ClusterAvailableUpgradeVersion] + :ivar cluster_capacity: The capacity supported by this cluster. + :vartype cluster_capacity: ~azure.mgmt.networkcloud.models.ClusterCapacity + :ivar cluster_connection_status: The latest heartbeat status between the cluster manager and + the cluster. Known values are: "Connected", "Disconnected", "Timeout", and "Undefined". + :vartype cluster_connection_status: str or + ~azure.mgmt.networkcloud.models.ClusterConnectionStatus + :ivar cluster_extended_location: The extended location (custom location) that represents the + cluster's control plane location. This extended location is used to route the requests of child + objects of the cluster that are handled by the platform operator. + :vartype cluster_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar cluster_manager_connection_status: The latest connectivity status between cluster manager + and the cluster. Known values are: "Connected" and "Unreachable". + :vartype cluster_manager_connection_status: str or + ~azure.mgmt.networkcloud.models.ClusterManagerConnectionStatus + :ivar cluster_manager_id: The resource ID of the cluster manager that manages this cluster. + This is set by the Cluster Manager when the cluster is created. + :vartype cluster_manager_id: str + :ivar detailed_status: The current detailed status of the cluster. Known values are: + "PendingDeployment", "Deploying", "Running", "Updating", "UpdatePaused", "Degraded", + "Deleting", "Disconnected", and "Failed". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ClusterDetailedStatus + :ivar detailed_status_message: The descriptive message about the detailed status. + :vartype detailed_status_message: str + :ivar hybrid_aks_extended_location: Field Deprecated. This field will not be populated in an + upcoming version. The extended location (custom location) that represents the Hybrid AKS + control plane location. This extended location is used when creating provisioned clusters + (Hybrid AKS clusters). + :vartype hybrid_aks_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar manual_action_count: The count of Manual Action Taken (MAT) events that have not been + validated. + :vartype manual_action_count: int + :ivar support_expiry_date: The support end date of the runtime version of the cluster. + :vartype support_expiry_date: str + :ivar workload_resource_ids: The list of workload resource IDs that are hosted within this + cluster. + :vartype workload_resource_ids: list[str] + :ivar provisioning_state: The provisioning state of the cluster. Known values are: "Succeeded", + "Failed", "Canceled", "Accepted", "Validating", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.ClusterProvisioningState + """ + + aggregator_or_single_rack_definition: "_models.RackDefinition" = rest_field( + name="aggregatorOrSingleRackDefinition", visibility=["read", "create", "update", "delete", "query"] + ) + """The rack definition that is intended to reflect only a single rack in a single rack cluster, or + an aggregator rack in a multi-rack cluster. Required.""" + analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = rest_field( + name="analyticsOutputSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for the log analytics workspace used for output of logs from this cluster.""" + analytics_workspace_id: Optional[str] = rest_field(name="analyticsWorkspaceId", visibility=["read", "create"]) + """Field Deprecated. The resource ID of the Log Analytics Workspace that will be used for storing + relevant logs.""" + cluster_location: Optional[str] = rest_field( + name="clusterLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The customer-provided location information to identify where the cluster resides.""" + cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = rest_field( + name="clusterServicePrincipal", visibility=["read", "create", "update", "delete", "query"] + ) + """Field Deprecated: Use managed identity to provide cluster privileges. The service principal to + be used by the cluster during Arc Appliance installation.""" + cluster_type: Union[str, "_models.ClusterType"] = rest_field( + name="clusterType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of rack configuration for the cluster. Required. Known values are: \"SingleRack\" and + \"MultiRack\".""" + cluster_version: str = rest_field(name="clusterVersion", visibility=["read", "create", "update", "delete", "query"]) + """The current runtime version of the cluster. Required.""" + command_output_settings: Optional["_models.CommandOutputSettings"] = rest_field( + name="commandOutputSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for commands run in this cluster, such as bare metal machine run read only + commands and data extracts.""" + compute_deployment_threshold: Optional["_models.ValidationThreshold"] = rest_field( + name="computeDeploymentThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The validation threshold indicating the allowable failures of compute machines during + environment validation and deployment.""" + compute_rack_definitions: Optional[list["_models.RackDefinition"]] = rest_field( + name="computeRackDefinitions", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in + a single-rack cluster.""" + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = rest_field( + name="managedResourceGroupConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the managed resource group associated with the resource.""" + network_fabric_id: str = rest_field(name="networkFabricId", visibility=["read", "create"]) + """The resource ID of the Network Fabric associated with the cluster. Required.""" + runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = rest_field( + name="runtimeProtectionConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for cluster runtime protection.""" + secret_archive: Optional["_models.ClusterSecretArchive"] = rest_field( + name="secretArchive", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for use of a key vault to store secrets for later retrieval by the operator.""" + secret_archive_settings: Optional["_models.SecretArchiveSettings"] = rest_field( + name="secretArchiveSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for the secret archive used to hold credentials for the cluster.""" + update_strategy: Optional["_models.ClusterUpdateStrategy"] = rest_field( + name="updateStrategy", visibility=["read", "create", "update", "delete", "query"] + ) + """The strategy for updating the cluster.""" + vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettings"] = rest_field( + name="vulnerabilityScanningSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The settings for how security vulnerability scanning is applied to the cluster.""" + action_states: Optional[list["_models.ActionState"]] = rest_field(name="actionStates", visibility=["read"]) + """The current state of any in progress or completed actions. The most recent known instance of + each action type is shown.""" + available_upgrade_versions: Optional[list["_models.ClusterAvailableUpgradeVersion"]] = rest_field( + name="availableUpgradeVersions", visibility=["read"] + ) + """The list of cluster runtime version upgrades available for this cluster.""" + cluster_capacity: Optional["_models.ClusterCapacity"] = rest_field(name="clusterCapacity", visibility=["read"]) + """The capacity supported by this cluster.""" + cluster_connection_status: Optional[Union[str, "_models.ClusterConnectionStatus"]] = rest_field( + name="clusterConnectionStatus", visibility=["read"] + ) + """The latest heartbeat status between the cluster manager and the cluster. Known values are: + \"Connected\", \"Disconnected\", \"Timeout\", and \"Undefined\".""" + cluster_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="clusterExtendedLocation", visibility=["read"] + ) + """The extended location (custom location) that represents the cluster's control plane location. + This extended location is used to route the requests of child objects of the cluster that are + handled by the platform operator.""" + cluster_manager_connection_status: Optional[Union[str, "_models.ClusterManagerConnectionStatus"]] = rest_field( + name="clusterManagerConnectionStatus", visibility=["read"] + ) + """The latest connectivity status between cluster manager and the cluster. Known values are: + \"Connected\" and \"Unreachable\".""" + cluster_manager_id: Optional[str] = rest_field(name="clusterManagerId", visibility=["read"]) + """The resource ID of the cluster manager that manages this cluster. This is set by the Cluster + Manager when the cluster is created.""" + detailed_status: Optional[Union[str, "_models.ClusterDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The current detailed status of the cluster. Known values are: \"PendingDeployment\", + \"Deploying\", \"Running\", \"Updating\", \"UpdatePaused\", \"Degraded\", \"Deleting\", + \"Disconnected\", and \"Failed\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the detailed status.""" + hybrid_aks_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="hybridAksExtendedLocation", visibility=["read"] + ) + """Field Deprecated. This field will not be populated in an upcoming version. The extended + location (custom location) that represents the Hybrid AKS control plane location. This extended + location is used when creating provisioned clusters (Hybrid AKS clusters).""" + manual_action_count: Optional[int] = rest_field(name="manualActionCount", visibility=["read"]) + """The count of Manual Action Taken (MAT) events that have not been validated.""" + support_expiry_date: Optional[str] = rest_field(name="supportExpiryDate", visibility=["read"]) + """The support end date of the runtime version of the cluster.""" + workload_resource_ids: Optional[list[str]] = rest_field(name="workloadResourceIds", visibility=["read"]) + """The list of workload resource IDs that are hosted within this cluster.""" + provisioning_state: Optional[Union[str, "_models.ClusterProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the cluster. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Accepted\", \"Validating\", and \"Updating\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + aggregator_or_single_rack_definition: "_models.RackDefinition", + cluster_type: Union[str, "_models.ClusterType"], + cluster_version: str, + network_fabric_id: str, + analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = None, + analytics_workspace_id: Optional[str] = None, + cluster_location: Optional[str] = None, + cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = None, + command_output_settings: Optional["_models.CommandOutputSettings"] = None, + compute_deployment_threshold: Optional["_models.ValidationThreshold"] = None, + compute_rack_definitions: Optional[list["_models.RackDefinition"]] = None, + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, + runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = None, + secret_archive: Optional["_models.ClusterSecretArchive"] = None, + secret_archive_settings: Optional["_models.SecretArchiveSettings"] = None, + update_strategy: Optional["_models.ClusterUpdateStrategy"] = None, + vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettings"] = 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 ClusterScanRuntimeParameters(_Model): + """ClusterScanRuntimeParameters defines the parameters for the cluster scan runtime operation. + + :ivar scan_activity: The choice of if the scan operation should run the scan. Known values are: + "Scan" and "Skip". + :vartype scan_activity: str or + ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParametersScanActivity + """ + + scan_activity: Optional[Union[str, "_models.ClusterScanRuntimeParametersScanActivity"]] = rest_field( + name="scanActivity", visibility=["read", "create", "update", "delete", "query"] + ) + """The choice of if the scan operation should run the scan. Known values are: \"Scan\" and + \"Skip\".""" + + @overload + def __init__( + self, + *, + scan_activity: Optional[Union[str, "_models.ClusterScanRuntimeParametersScanActivity"]] = 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 ClusterSecretArchive(_Model): + """ClusterSecretArchive configures the key vault to archive the secrets of the cluster for later + retrieval. + + :ivar key_vault_id: The resource ID of the key vault to archive the secrets of the cluster. + Required. + :vartype key_vault_id: str + :ivar use_key_vault: The indicator if the specified key vault should be used to archive the + secrets of the cluster. Known values are: "True" and "False". + :vartype use_key_vault: str or ~azure.mgmt.networkcloud.models.ClusterSecretArchiveEnabled + """ + + key_vault_id: str = rest_field(name="keyVaultId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the key vault to archive the secrets of the cluster. Required.""" + use_key_vault: Optional[Union[str, "_models.ClusterSecretArchiveEnabled"]] = rest_field( + name="useKeyVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator if the specified key vault should be used to archive the secrets of the cluster. + Known values are: \"True\" and \"False\".""" + + @overload + def __init__( + self, + *, + key_vault_id: str, + use_key_vault: Optional[Union[str, "_models.ClusterSecretArchiveEnabled"]] = 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 ClusterUpdateStrategy(_Model): + """ClusterUpdateStrategy represents the strategy for updating the cluster. + + :ivar max_unavailable: The maximum number of worker nodes that can be offline within the + increment of update, e.g., rack-by-rack. Limited by the maximum number of machines in the + increment. Defaults to the whole increment size. + :vartype max_unavailable: int + :ivar strategy_type: The mode of operation for runtime protection. Required. Known values are: + "Rack" and "PauseAfterRack". + :vartype strategy_type: str or ~azure.mgmt.networkcloud.models.ClusterUpdateStrategyType + :ivar threshold_type: Selection of how the threshold should be evaluated. Required. Known + values are: "CountSuccess" and "PercentSuccess". + :vartype threshold_type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType + :ivar threshold_value: The numeric threshold value. Required. + :vartype threshold_value: int + :ivar wait_time_minutes: The time to wait between the increments of update defined by the + strategy. + :vartype wait_time_minutes: int + """ + + max_unavailable: Optional[int] = rest_field( + name="maxUnavailable", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of worker nodes that can be offline within the increment of update, e.g., + rack-by-rack. Limited by the maximum number of machines in the increment. Defaults to the whole + increment size.""" + strategy_type: Union[str, "_models.ClusterUpdateStrategyType"] = rest_field( + name="strategyType", visibility=["read", "create", "update", "delete", "query"] + ) + """The mode of operation for runtime protection. Required. Known values are: \"Rack\" and + \"PauseAfterRack\".""" + threshold_type: Union[str, "_models.ValidationThresholdType"] = rest_field( + name="thresholdType", visibility=["read", "create", "update", "delete", "query"] + ) + """Selection of how the threshold should be evaluated. Required. Known values are: + \"CountSuccess\" and \"PercentSuccess\".""" + threshold_value: int = rest_field(name="thresholdValue", visibility=["read", "create", "update", "delete", "query"]) + """The numeric threshold value. Required.""" + wait_time_minutes: Optional[int] = rest_field( + name="waitTimeMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The time to wait between the increments of update defined by the strategy.""" + + @overload + def __init__( + self, + *, + strategy_type: Union[str, "_models.ClusterUpdateStrategyType"], + threshold_type: Union[str, "_models.ValidationThresholdType"], + threshold_value: int, + max_unavailable: Optional[int] = None, + wait_time_minutes: 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 ClusterUpdateVersionParameters(_Model): + """ClusterUpdateVersionParameters represents the body of the request to update cluster version. + + :ivar target_cluster_version: The version to be applied to the cluster during update. Required. + :vartype target_cluster_version: str + """ + + target_cluster_version: str = rest_field( + name="targetClusterVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version to be applied to the cluster during update. Required.""" + + @overload + def __init__( + self, + *, + target_cluster_version: 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 CommandOutputOverride(_Model): + """CommandOutputOverride represents an overridden value for the command output settings. + + :ivar associated_identity: The selection of the managed identity to use with this storage + account container. The identity type must be either system assigned or user assigned. + :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector + :ivar command_output_type: The type of command output for the override. Known values are: + "BareMetalMachineRunCommand", "BareMetalMachineRunDataExtracts", + "BareMetalMachineRunReadCommands", "StorageRunReadCommands", and + "BareMetalMachineRunDataExtractsRestricted". + :vartype command_output_type: str or ~azure.mgmt.networkcloud.models.CommandOutputType + :ivar container_url: The URL of the storage account container that is to be used by the + specified identities. + :vartype container_url: str + """ + + associated_identity: Optional["_models.IdentitySelector"] = rest_field( + name="associatedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The selection of the managed identity to use with this storage account container. The identity + type must be either system assigned or user assigned.""" + command_output_type: Optional[Union[str, "_models.CommandOutputType"]] = rest_field( + name="commandOutputType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of command output for the override. Known values are: \"BareMetalMachineRunCommand\", + \"BareMetalMachineRunDataExtracts\", \"BareMetalMachineRunReadCommands\", + \"StorageRunReadCommands\", and \"BareMetalMachineRunDataExtractsRestricted\".""" + container_url: Optional[str] = rest_field( + name="containerUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the storage account container that is to be used by the specified identities.""" + + @overload + def __init__( + self, + *, + associated_identity: Optional["_models.IdentitySelector"] = None, + command_output_type: Optional[Union[str, "_models.CommandOutputType"]] = None, + container_url: 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 CommandOutputSettings(_Model): + """CommandOutputSettings represents the settings for commands run within the cluster such as bare + metal machine run read-only commands. + + :ivar associated_identity: The selection of the managed identity to use with this storage + account container. The identity type must be either system assigned or user assigned. + :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector + :ivar container_url: The URL of the storage account container that is to be used by the + specified identities. + :vartype container_url: str + :ivar overrides: The list of optional overrides allowing for association of storage containers + and identities to specific types of command output. If a type is not overridden, the default + identity and storage container will be utilized. + :vartype overrides: list[~azure.mgmt.networkcloud.models.CommandOutputOverride] + """ + + associated_identity: Optional["_models.IdentitySelector"] = rest_field( + name="associatedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The selection of the managed identity to use with this storage account container. The identity + type must be either system assigned or user assigned.""" + container_url: Optional[str] = rest_field( + name="containerUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL of the storage account container that is to be used by the specified identities.""" + overrides: Optional[list["_models.CommandOutputOverride"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of optional overrides allowing for association of storage containers and identities to + specific types of command output. If a type is not overridden, the default identity and storage + container will be utilized.""" + + @overload + def __init__( + self, + *, + associated_identity: Optional["_models.IdentitySelector"] = None, + container_url: Optional[str] = None, + overrides: Optional[list["_models.CommandOutputOverride"]] = 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 Console(TrackedResource): + """Console represents the console of an on-premises Network Cloud virtual machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.ConsoleProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.ConsoleProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "enabled", + "expiration", + "ssh_public_key", + "detailed_status", + "detailed_status_message", + "private_link_service_id", + "virtual_machine_access_id", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.ConsoleProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 ConsolePatchParameters(_Model): + """ConsolePatchParameters represents the body of the request to patch the virtual machine console. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.ConsolePatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.ConsolePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["enabled", "expiration", "ssh_public_key"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConsolePatchProperties"] = None, + 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: + _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 ConsolePatchProperties(_Model): + """ConsolePatchProperties represents the properties of the virtual machine console that can be + patched. + + :ivar enabled: The indicator of whether the console access is enabled. Known values are: "True" + and "False". + :vartype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled + :ivar expiration: The date and time after which the key will be disallowed access. + :vartype expiration: ~datetime.datetime + :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is + expected to have the corresponding SSH private key for logging in. + :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey + """ + + enabled: Optional[Union[str, "_models.ConsoleEnabled"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether the console access is enabled. Known values are: \"True\" and + \"False\".""" + expiration: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the key will be disallowed access.""" + ssh_public_key: Optional["_models.SshPublicKey"] = rest_field( + name="sshPublicKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The SSH public key that will be provisioned for user access. The user is expected to have the + corresponding SSH private key for logging in.""" + + @overload + def __init__( + self, + *, + enabled: Optional[Union[str, "_models.ConsoleEnabled"]] = None, + expiration: Optional[datetime.datetime] = None, + ssh_public_key: Optional["_models.SshPublicKey"] = 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 ConsoleProperties(_Model): + """ConsoleProperties represents the properties of the virtual machine console. + + :ivar enabled: The indicator of whether the console access is enabled. Required. Known values + are: "True" and "False". + :vartype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled + :ivar expiration: The date and time after which the key will be disallowed access. + :vartype expiration: ~datetime.datetime + :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is + expected to have the corresponding SSH private key for logging in. Required. + :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey + :ivar detailed_status: The more detailed status of the console. Known values are: "Ready" and + "Error". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ConsoleDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar private_link_service_id: The resource ID of the private link service that is used to + provide virtual machine console access. + :vartype private_link_service_id: str + :ivar virtual_machine_access_id: The unique identifier for the virtual machine that is used to + access the console. + :vartype virtual_machine_access_id: str + :ivar provisioning_state: The provisioning state of the virtual machine console. Known values + are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.ConsoleProvisioningState + """ + + enabled: Union[str, "_models.ConsoleEnabled"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether the console access is enabled. Required. Known values are: \"True\" + and \"False\".""" + expiration: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date and time after which the key will be disallowed access.""" + ssh_public_key: "_models.SshPublicKey" = rest_field( + name="sshPublicKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The SSH public key that will be provisioned for user access. The user is expected to have the + corresponding SSH private key for logging in. Required.""" + detailed_status: Optional[Union[str, "_models.ConsoleDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the console. Known values are: \"Ready\" and \"Error\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + private_link_service_id: Optional[str] = rest_field(name="privateLinkServiceId", visibility=["read"]) + """The resource ID of the private link service that is used to provide virtual machine console + access.""" + virtual_machine_access_id: Optional[str] = rest_field(name="virtualMachineAccessId", visibility=["read"]) + """The unique identifier for the virtual machine that is used to access the console.""" + provisioning_state: Optional[Union[str, "_models.ConsoleProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the virtual machine console. Known values are: \"Succeeded\", + \"Failed\", \"Canceled\", \"Accepted\", and \"Provisioning\".""" + + @overload + def __init__( + self, + *, + enabled: Union[str, "_models.ConsoleEnabled"], + ssh_public_key: "_models.SshPublicKey", + expiration: 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 ControlPlaneNodeConfiguration(_Model): + """ControlPlaneNodeConfiguration represents the selection of virtual machines and size of the + control plane for a Kubernetes cluster. + + :ivar administrator_configuration: The administrator credentials to be used for the nodes in + the control plane. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfiguration + :ivar availability_zones: The list of availability zones of the Network Cloud cluster to be + used for the provisioning of nodes in the control plane. If not specified, all availability + zones will be used. + :vartype availability_zones: list[str] + :ivar count: The number of virtual machines that use this configuration. Required. + :vartype count: int + :ivar vm_sku_name: The name of the VM SKU supplied during creation. Required. + :vartype vm_sku_name: str + """ + + administrator_configuration: Optional["_models.AdministratorConfiguration"] = rest_field( + name="administratorConfiguration", visibility=["read", "create"] + ) + """The administrator credentials to be used for the nodes in the control plane.""" + availability_zones: Optional[list[str]] = rest_field(name="availabilityZones", visibility=["read", "create"]) + """The list of availability zones of the Network Cloud cluster to be used for the provisioning of + nodes in the control plane. If not specified, all availability zones will be used.""" + count: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of virtual machines that use this configuration. Required.""" + vm_sku_name: str = rest_field(name="vmSkuName", visibility=["read", "create"]) + """The name of the VM SKU supplied during creation. Required.""" + + @overload + def __init__( + self, + *, + count: int, + vm_sku_name: str, + administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, + availability_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, **kwargs) + + +class ControlPlaneNodePatchConfiguration(_Model): + """ControlPlaneNodePatchConfiguration represents the properties of the control plane that can be + patched for this Kubernetes cluster. + + :ivar administrator_configuration: The configuration of administrator credentials for the + control plane nodes. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch + :ivar count: The number of virtual machines that use this configuration. + :vartype count: int + """ + + administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = rest_field( + name="administratorConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of administrator credentials for the control plane nodes.""" + count: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of virtual machines that use this configuration.""" + + @overload + def __init__( + self, + *, + administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = None, + count: 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 EgressEndpoint(_Model): + """EgressEndpoint represents the connection from a cloud services network to the specified + endpoint for a common purpose. + + :ivar category: The descriptive category name of endpoints accessible by the AKS agent node. + For example, azure-resource-management, API server, etc. The platform egress endpoints provided + by default will use the category 'default'. Required. + :vartype category: str + :ivar endpoints: The list of endpoint dependencies. Required. + :vartype endpoints: list[~azure.mgmt.networkcloud.models.EndpointDependency] + """ + + category: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The descriptive category name of endpoints accessible by the AKS agent node. For example, + azure-resource-management, API server, etc. The platform egress endpoints provided by default + will use the category 'default'. Required.""" + endpoints: list["_models.EndpointDependency"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of endpoint dependencies. Required.""" + + @overload + def __init__( + self, + *, + category: str, + endpoints: list["_models.EndpointDependency"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 EndpointDependency(_Model): + """EndpointDependency represents the definition of an endpoint, including the domain and details. + + :ivar domain_name: The domain name of the dependency. Required. + :vartype domain_name: str + :ivar port: The port of this endpoint. + :vartype port: int + """ + + domain_name: str = rest_field(name="domainName", visibility=["read", "create", "update", "delete", "query"]) + """The domain name of the dependency. Required.""" + port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The port of this endpoint.""" + + @overload + def __init__( + self, + *, + domain_name: str, + port: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.networkcloud.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.networkcloud.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.networkcloud.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 ExtendedLocation(_Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. Required. + :vartype name: str + :ivar type: The type of the extended location. Required. Known values are: "EdgeZone" and + "CustomLocation". + :vartype type: str or ~azure.mgmt.networkcloud.models.ExtendedLocationType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extended location. Required.""" + type: Union[str, "_models.ExtendedLocationType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the extended location. Required. Known values are: \"EdgeZone\" and + \"CustomLocation\".""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.ExtendedLocationType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 FeatureStatus(_Model): + """FeatureStatus contains information regarding a Kubernetes cluster feature. + + :ivar detailed_status: The status representing the state of this feature. Known values are: + "Running", "Failed", and "Unknown". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.FeatureDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar name: The name of the feature. + :vartype name: str + :ivar version: The version of the feature. + :vartype version: str + """ + + detailed_status: Optional[Union[str, "_models.FeatureDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The status representing the state of this feature. Known values are: \"Running\", \"Failed\", + and \"Unknown\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the feature.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version of the feature.""" + + +class HardwareInventory(_Model): + """HardwareInventory represents the hardware configuration of this machine as exposed to the + customer, including information acquired from the model/sku information and from the ironic + inspector. + + :ivar additional_host_information: Freeform data extracted from the environment about this + machine. This information varies depending on the specific hardware and configuration. + :vartype additional_host_information: str + :ivar interfaces: The list of network interfaces and associated details for the bare metal + machine. + :vartype interfaces: list[~azure.mgmt.networkcloud.models.HardwareInventoryNetworkInterface] + :ivar nics: Field Deprecated. Will be removed in an upcoming version. The list of network + interface cards and associated details for the bare metal machine. + :vartype nics: list[~azure.mgmt.networkcloud.models.Nic] + """ + + additional_host_information: Optional[str] = rest_field(name="additionalHostInformation", visibility=["read"]) + """Freeform data extracted from the environment about this machine. This information varies + depending on the specific hardware and configuration.""" + interfaces: Optional[list["_models.HardwareInventoryNetworkInterface"]] = rest_field(visibility=["read"]) + """The list of network interfaces and associated details for the bare metal machine.""" + nics: Optional[list["_models.Nic"]] = rest_field(visibility=["read"]) + """Field Deprecated. Will be removed in an upcoming version. The list of network interface cards + and associated details for the bare metal machine.""" + + +class HardwareInventoryNetworkInterface(_Model): + """HardwareInventoryNetworkInterface represents the network interface details as part of a + hardware inventory. + + :ivar link_status: The current status of the link. + :vartype link_status: str + :ivar mac_address: The MAC address associated with this interface. + :vartype mac_address: str + :ivar name: The name of the interface. + :vartype name: str + :ivar network_interface_id: The resource ID of the network interface for the port on the switch + that this machine's interface is connected to. + :vartype network_interface_id: str + """ + + link_status: Optional[str] = rest_field(name="linkStatus", visibility=["read"]) + """The current status of the link.""" + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """The MAC address associated with this interface.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the interface.""" + network_interface_id: Optional[str] = rest_field(name="networkInterfaceId", visibility=["read"]) + """The resource ID of the network interface for the port on the switch that this machine's + interface is connected to.""" + + +class HardwareValidationStatus(_Model): + """HardwareValidationStatus represents the latest hardware validation details performed for this + bare metal machine. + + :ivar last_validation_time: The timestamp of the hardware validation execution. + :vartype last_validation_time: ~datetime.datetime + :ivar result: The outcome of the hardware validation. Known values are: "Pass" and "Fail". + :vartype result: str or + ~azure.mgmt.networkcloud.models.BareMetalMachineHardwareValidationResult + """ + + last_validation_time: Optional[datetime.datetime] = rest_field( + name="lastValidationTime", visibility=["read"], format="rfc3339" + ) + """The timestamp of the hardware validation execution.""" + result: Optional[Union[str, "_models.BareMetalMachineHardwareValidationResult"]] = rest_field(visibility=["read"]) + """The outcome of the hardware validation. Known values are: \"Pass\" and \"Fail\".""" + + +class IdentitySelector(_Model): + """IdentitySelector represents the selection of a managed identity for use. + + :ivar identity_type: The type of managed identity that is being selected. Known values are: + "SystemAssignedIdentity" and "UserAssignedIdentity". + :vartype identity_type: str or + ~azure.mgmt.networkcloud.models.ManagedServiceIdentitySelectorType + :ivar user_assigned_identity_resource_id: The user assigned managed identity resource ID to + use. Mutually exclusive with a system assigned identity type. + :vartype user_assigned_identity_resource_id: str + """ + + identity_type: Optional[Union[str, "_models.ManagedServiceIdentitySelectorType"]] = rest_field( + name="identityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity that is being selected. Known values are: + \"SystemAssignedIdentity\" and \"UserAssignedIdentity\".""" + user_assigned_identity_resource_id: Optional[str] = rest_field( + name="userAssignedIdentityResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The user assigned managed identity resource ID to use. Mutually exclusive with a system + assigned identity type.""" + + @overload + def __init__( + self, + *, + identity_type: Optional[Union[str, "_models.ManagedServiceIdentitySelectorType"]] = None, + user_assigned_identity_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageRepositoryCredentials(_Model): + """ImageRepositoryCredentials represents the credentials used to login to the image repository. + + :ivar password: The password or token used to access an image in the target repository. + Required. + :vartype password: str + :ivar registry_url: The URL of the authentication server used to validate the repository + credentials. Required. + :vartype registry_url: str + :ivar username: The username used to access an image in the target repository. Required. + :vartype username: str + """ + + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password or token used to access an image in the target repository. Required.""" + registry_url: str = rest_field(name="registryUrl", visibility=["read", "create", "update", "delete", "query"]) + """The URL of the authentication server used to validate the repository credentials. Required.""" + username: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The username used to access an image in the target repository. Required.""" + + @overload + def __init__( + self, + *, + password: str, + registry_url: str, + username: 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 InitialAgentPoolConfiguration(_Model): + """InitialAgentPoolConfiguration specifies the configuration of a pool of virtual machines that + are initially defined with a Kubernetes cluster. + + :ivar administrator_configuration: The administrator credentials to be used for the nodes in + this agent pool. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfiguration + :ivar agent_options: The configurations that will be applied to each agent in this agent pool. + :vartype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions + :ivar attached_network_configuration: The configuration of networks being attached to the agent + pool for use by the workloads that run on this Kubernetes cluster. + :vartype attached_network_configuration: + ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration + :ivar availability_zones: The list of availability zones of the Network Cloud cluster used for + the provisioning of nodes in this agent pool. If not specified, all availability zones will be + used. + :vartype availability_zones: list[str] + :ivar count: The number of virtual machines that use this configuration. Required. + :vartype count: int + :ivar labels: The labels applied to the nodes in this agent pool. + :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar mode: The selection of how this agent pool is utilized, either as a system pool or a user + pool. System pools run the features and critical services for the Kubernetes Cluster, while + user pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one + system node pool with at least one node. Required. Known values are: "System", "User", and + "NotApplicable". + :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode + :ivar taints: The taints applied to the nodes in this agent pool. + :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar upgrade_settings: The configuration of the agent pool. + :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings + :ivar vm_sku_name: The name of the VM SKU that determines the size of resources allocated for + node VMs. Required. + :vartype vm_sku_name: str + :ivar name: The name that will be used for the agent pool resource representing this agent + pool. Required. + :vartype name: str + """ + + administrator_configuration: Optional["_models.AdministratorConfiguration"] = rest_field( + name="administratorConfiguration", visibility=["read", "create"] + ) + """The administrator credentials to be used for the nodes in this agent pool.""" + agent_options: Optional["_models.AgentOptions"] = rest_field(name="agentOptions", visibility=["read", "create"]) + """The configurations that will be applied to each agent in this agent pool.""" + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = rest_field( + name="attachedNetworkConfiguration", visibility=["read", "create"] + ) + """The configuration of networks being attached to the agent pool for use by the workloads that + run on this Kubernetes cluster.""" + availability_zones: Optional[list[str]] = rest_field(name="availabilityZones", visibility=["read", "create"]) + """The list of availability zones of the Network Cloud cluster used for the provisioning of nodes + in this agent pool. If not specified, all availability zones will be used.""" + count: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of virtual machines that use this configuration. Required.""" + labels: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read", "create"]) + """The labels applied to the nodes in this agent pool.""" + mode: Union[str, "_models.AgentPoolMode"] = rest_field(visibility=["read", "create"]) + """The selection of how this agent pool is utilized, either as a system pool or a user pool. + System pools run the features and critical services for the Kubernetes Cluster, while user + pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one + system node pool with at least one node. Required. Known values are: \"System\", \"User\", and + \"NotApplicable\".""" + taints: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read", "create"]) + """The taints applied to the nodes in this agent pool.""" + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = rest_field( + name="upgradeSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the agent pool.""" + vm_sku_name: str = rest_field(name="vmSkuName", visibility=["read", "create"]) + """The name of the VM SKU that determines the size of resources allocated for node VMs. Required.""" + name: str = rest_field(visibility=["read", "create"]) + """The name that will be used for the agent pool resource representing this agent pool. Required.""" + + @overload + def __init__( + self, + *, + count: int, + mode: Union[str, "_models.AgentPoolMode"], + vm_sku_name: str, + name: str, + administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, + agent_options: Optional["_models.AgentOptions"] = None, + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, + availability_zones: Optional[list[str]] = None, + labels: Optional[list["_models.KubernetesLabel"]] = None, + taints: Optional[list["_models.KubernetesLabel"]] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = 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 IpAddressPool(_Model): + """IpAddressPool represents a pool of IP addresses that can be allocated to a service. + + :ivar addresses: The list of IP address ranges. Each range can be a either a subnet in CIDR + format or an explicit start-end range of IP addresses. For a BGP service load balancer + configuration, only CIDR format is supported and excludes /32 (IPv4) and /128 (IPv6) prefixes. + Required. + :vartype addresses: list[str] + :ivar auto_assign: The indicator to determine if automatic allocation from the pool should + occur. Known values are: "True" and "False". + :vartype auto_assign: str or ~azure.mgmt.networkcloud.models.BfdEnabled + :ivar name: The name used to identify this IP address pool for association with a BGP + advertisement. Required. + :vartype name: str + :ivar only_use_host_ips: The indicator to prevent the use of IP addresses ending with .0 and + .255 for this pool. Enabling this option will only use IP addresses between .1 and .254 + inclusive. Known values are: "True" and "False". + :vartype only_use_host_ips: str or ~azure.mgmt.networkcloud.models.BfdEnabled + """ + + addresses: list[str] = rest_field(visibility=["read", "create"]) + """The list of IP address ranges. Each range can be a either a subnet in CIDR format or an + explicit start-end range of IP addresses. For a BGP service load balancer configuration, only + CIDR format is supported and excludes /32 (IPv4) and /128 (IPv6) prefixes. Required.""" + auto_assign: Optional[Union[str, "_models.BfdEnabled"]] = rest_field( + name="autoAssign", visibility=["read", "create"] + ) + """The indicator to determine if automatic allocation from the pool should occur. Known values + are: \"True\" and \"False\".""" + name: str = rest_field(visibility=["read", "create"]) + """The name used to identify this IP address pool for association with a BGP advertisement. + Required.""" + only_use_host_ips: Optional[Union[str, "_models.BfdEnabled"]] = rest_field( + name="onlyUseHostIps", visibility=["read", "create"] + ) + """The indicator to prevent the use of IP addresses ending with .0 and .255 for this pool. + Enabling this option will only use IP addresses between .1 and .254 inclusive. Known values + are: \"True\" and \"False\".""" + + @overload + def __init__( + self, + *, + addresses: list[str], + name: str, + auto_assign: Optional[Union[str, "_models.BfdEnabled"]] = None, + only_use_host_ips: Optional[Union[str, "_models.BfdEnabled"]] = 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 KeySetUser(_Model): + """KeySetUser represents the properties of the user in the key set. + + :ivar azure_user_name: The user name that will be used for access. Required. + :vartype azure_user_name: str + :ivar description: The free-form description for this user. + :vartype description: str + :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is + expected to have the corresponding SSH private key for logging in. Required. + :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey + :ivar user_principal_name: The user principal name (email format) used to validate this user's + group membership. + :vartype user_principal_name: str + """ + + azure_user_name: str = rest_field(name="azureUserName", visibility=["read", "create", "update", "delete", "query"]) + """The user name that will be used for access. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The free-form description for this user.""" + ssh_public_key: "_models.SshPublicKey" = rest_field( + name="sshPublicKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The SSH public key that will be provisioned for user access. The user is expected to have the + corresponding SSH private key for logging in. Required.""" + user_principal_name: Optional[str] = rest_field( + name="userPrincipalName", visibility=["read", "create", "update", "delete", "query"] + ) + """The user principal name (email format) used to validate this user's group membership.""" + + @overload + def __init__( + self, + *, + azure_user_name: str, + ssh_public_key: "_models.SshPublicKey", + description: Optional[str] = None, + user_principal_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 KeySetUserStatus(_Model): + """KeySetUserStatus represents the status of the key set user. + + :ivar azure_user_name: The user name that will be used for access. + :vartype azure_user_name: str + :ivar status: The indicator of whether the user is currently deployed for access. Known values + are: "Active" and "Invalid". + :vartype status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetUserSetupStatus + :ivar status_message: The additional information describing the current status of this user, if + any available. + :vartype status_message: str + """ + + azure_user_name: Optional[str] = rest_field(name="azureUserName", visibility=["read"]) + """The user name that will be used for access.""" + status: Optional[Union[str, "_models.BareMetalMachineKeySetUserSetupStatus"]] = rest_field(visibility=["read"]) + """The indicator of whether the user is currently deployed for access. Known values are: + \"Active\" and \"Invalid\".""" + status_message: Optional[str] = rest_field(name="statusMessage", visibility=["read"]) + """The additional information describing the current status of this user, if any available.""" + + +class KubernetesCluster(TrackedResource): + """KubernetesCluster represents the Kubernetes cluster hosted on Network Cloud. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.KubernetesClusterProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.KubernetesClusterProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "aad_configuration", + "administrator_configuration", + "control_plane_node_configuration", + "initial_agent_pool_configurations", + "kubernetes_version", + "managed_resource_group_configuration", + "network_configuration", + "attached_network_ids", + "available_upgrades", + "cluster_id", + "connected_cluster_id", + "control_plane_kubernetes_version", + "detailed_status", + "detailed_status_message", + "feature_statuses", + "nodes", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.KubernetesClusterProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 KubernetesClusterFeature(TrackedResource): + """KubernetesClusterFeature represents the feature of a Kubernetes cluster. + + :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.networkcloud.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 list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureProperties + :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 + """ + + properties: Optional["_models.KubernetesClusterFeatureProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the 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.\").""" + + __flattened_items = [ + "options", + "availability_lifecycle", + "detailed_status", + "detailed_status_message", + "required", + "version", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.KubernetesClusterFeatureProperties"] = 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 KubernetesClusterFeaturePatchParameters(_Model): + """KubernetesClusterFeaturePatchParameters represents the body of the request to patch the + Kubernetes cluster feature. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.KubernetesClusterFeaturePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["options"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.KubernetesClusterFeaturePatchProperties"] = None, + 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: + _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 KubernetesClusterFeaturePatchProperties(_Model): + """KubernetesClusterFeaturePatchProperties represents the Kubernetes cluster feature properties + for patching. + + :ivar options: The configured options for the feature. + :vartype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] + """ + + options: Optional[list["_models.StringKeyValuePair"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The configured options for the feature.""" + + @overload + def __init__( + self, + *, + options: Optional[list["_models.StringKeyValuePair"]] = 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 KubernetesClusterFeatureProperties(_Model): + """KubernetesClusterFeatureProperties represents the properties of a Kubernetes cluster feature. + + :ivar options: The configured options for the feature. + :vartype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] + :ivar availability_lifecycle: The lifecycle indicator of the feature. Known values are: + "Preview" and "GenerallyAvailable". + :vartype availability_lifecycle: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureAvailabilityLifecycle + :ivar detailed_status: The detailed status of the feature. Known values are: "Error", + "Provisioning", and "Installed". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureDetailedStatus + :ivar detailed_status_message: The descriptive message for the detailed status of the feature. + :vartype detailed_status_message: str + :ivar required: The indicator of if the feature is required or optional. Optional features may + be deleted by the user, while required features are managed with the kubernetes cluster + lifecycle. Known values are: "True" and "False". + :vartype required: str or ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureRequired + :ivar version: The version of the feature. + :vartype version: str + :ivar provisioning_state: The provisioning state of the Kubernetes cluster feature. Known + values are: "Accepted", "Canceled", "Deleting", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureProvisioningState + """ + + options: Optional[list["_models.StringKeyValuePair"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The configured options for the feature.""" + availability_lifecycle: Optional[Union[str, "_models.KubernetesClusterFeatureAvailabilityLifecycle"]] = rest_field( + name="availabilityLifecycle", visibility=["read"] + ) + """The lifecycle indicator of the feature. Known values are: \"Preview\" and + \"GenerallyAvailable\".""" + detailed_status: Optional[Union[str, "_models.KubernetesClusterFeatureDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The detailed status of the feature. Known values are: \"Error\", \"Provisioning\", and + \"Installed\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message for the detailed status of the feature.""" + required: Optional[Union[str, "_models.KubernetesClusterFeatureRequired"]] = rest_field(visibility=["read"]) + """The indicator of if the feature is required or optional. Optional features may be deleted by + the user, while required features are managed with the kubernetes cluster lifecycle. Known + values are: \"True\" and \"False\".""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version of the feature.""" + provisioning_state: Optional[Union[str, "_models.KubernetesClusterFeatureProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the Kubernetes cluster feature. Known values are: \"Accepted\", + \"Canceled\", \"Deleting\", \"Failed\", \"Succeeded\", and \"Updating\".""" + + @overload + def __init__( + self, + *, + options: Optional[list["_models.StringKeyValuePair"]] = 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 KubernetesClusterNode(_Model): + """KubernetesClusterNode represents the details of a node in a Kubernetes cluster. + + :ivar agent_pool_id: The resource ID of the agent pool that this node belongs to. This value is + not represented on control plane nodes. + :vartype agent_pool_id: str + :ivar availability_zone: The availability zone this node is running within. + :vartype availability_zone: str + :ivar bare_metal_machine_id: The resource ID of the bare metal machine that hosts this node. + :vartype bare_metal_machine_id: str + :ivar cpu_cores: The number of CPU cores configured for this node, derived from the VM SKU + specified. + :vartype cpu_cores: int + :ivar detailed_status: The detailed state of this node. Known values are: "Available", "Error", + "Provisioning", "Running", "Scheduling", "Stopped", "Terminating", and "Unknown". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterNodeDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar disk_size_gb: The size of the disk configured for this node. Allocations are measured in + gibibytes. + :vartype disk_size_gb: int + :ivar image: The machine image used to deploy this node. + :vartype image: str + :ivar kubernetes_version: The currently running version of Kubernetes and bundled features + running on this node. + :vartype kubernetes_version: str + :ivar labels: The list of labels on this node that have been assigned to the agent pool + containing this node. + :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar memory_size_gb: The amount of memory configured for this node, derived from the vm SKU + specified. Allocations are measured in gibibytes. + :vartype memory_size_gb: int + :ivar mode: The mode of the agent pool containing this node. Not applicable for control plane + nodes. Known values are: "System", "User", and "NotApplicable". + :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode + :ivar name: The name of this node, as realized in the Kubernetes cluster. + :vartype name: str + :ivar network_attachments: The NetworkAttachments made to this node. + :vartype network_attachments: list[~azure.mgmt.networkcloud.models.NetworkAttachment] + :ivar power_state: The power state of this node. Known values are: "On", "Off", and "Unknown". + :vartype power_state: str or ~azure.mgmt.networkcloud.models.KubernetesNodePowerState + :ivar role: The role of this node in the cluster. Known values are: "ControlPlane" and + "Worker". + :vartype role: str or ~azure.mgmt.networkcloud.models.KubernetesNodeRole + :ivar taints: The list of taints that have been assigned to the agent pool containing this + node. + :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] + :ivar vm_sku_name: The VM SKU name that was used to create this cluster node. + :vartype vm_sku_name: str + """ + + agent_pool_id: Optional[str] = rest_field(name="agentPoolId", visibility=["read"]) + """The resource ID of the agent pool that this node belongs to. This value is not represented on + control plane nodes.""" + availability_zone: Optional[str] = rest_field(name="availabilityZone", visibility=["read"]) + """The availability zone this node is running within.""" + bare_metal_machine_id: Optional[str] = rest_field(name="bareMetalMachineId", visibility=["read"]) + """The resource ID of the bare metal machine that hosts this node.""" + cpu_cores: Optional[int] = rest_field(name="cpuCores", visibility=["read"]) + """The number of CPU cores configured for this node, derived from the VM SKU specified.""" + detailed_status: Optional[Union[str, "_models.KubernetesClusterNodeDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The detailed state of this node. Known values are: \"Available\", \"Error\", \"Provisioning\", + \"Running\", \"Scheduling\", \"Stopped\", \"Terminating\", and \"Unknown\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + disk_size_gb: Optional[int] = rest_field(name="diskSizeGB", visibility=["read"]) + """The size of the disk configured for this node. Allocations are measured in gibibytes.""" + image: Optional[str] = rest_field(visibility=["read"]) + """The machine image used to deploy this node.""" + kubernetes_version: Optional[str] = rest_field(name="kubernetesVersion", visibility=["read"]) + """The currently running version of Kubernetes and bundled features running on this node.""" + labels: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read"]) + """The list of labels on this node that have been assigned to the agent pool containing this node.""" + memory_size_gb: Optional[int] = rest_field(name="memorySizeGB", visibility=["read"]) + """The amount of memory configured for this node, derived from the vm SKU specified. Allocations + are measured in gibibytes.""" + mode: Optional[Union[str, "_models.AgentPoolMode"]] = rest_field(visibility=["read"]) + """The mode of the agent pool containing this node. Not applicable for control plane nodes. Known + values are: \"System\", \"User\", and \"NotApplicable\".""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of this node, as realized in the Kubernetes cluster.""" + network_attachments: Optional[list["_models.NetworkAttachment"]] = rest_field( + name="networkAttachments", visibility=["read"] + ) + """The NetworkAttachments made to this node.""" + power_state: Optional[Union[str, "_models.KubernetesNodePowerState"]] = rest_field( + name="powerState", visibility=["read"] + ) + """The power state of this node. Known values are: \"On\", \"Off\", and \"Unknown\".""" + role: Optional[Union[str, "_models.KubernetesNodeRole"]] = rest_field(visibility=["read"]) + """The role of this node in the cluster. Known values are: \"ControlPlane\" and \"Worker\".""" + taints: Optional[list["_models.KubernetesLabel"]] = rest_field(visibility=["read"]) + """The list of taints that have been assigned to the agent pool containing this node.""" + vm_sku_name: Optional[str] = rest_field(name="vmSkuName", visibility=["read"]) + """The VM SKU name that was used to create this cluster node.""" + + +class KubernetesClusterPatchParameters(_Model): + """KubernetesClusterPatchParameters represents the body of the request to patch the Hybrid AKS + cluster. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.KubernetesClusterPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.KubernetesClusterPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["administrator_configuration", "control_plane_node_configuration", "kubernetes_version"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.KubernetesClusterPatchProperties"] = None, + 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: + _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 KubernetesClusterPatchProperties(_Model): + """KubernetesClusterPatchProperties represents the properties of the Kubernetes cluster that can + be patched. + + :ivar administrator_configuration: The configuration of the default administrator credentials. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch + :ivar control_plane_node_configuration: The defining characteristics of the control plane that + can be patched for this Kubernetes cluster. + :vartype control_plane_node_configuration: + ~azure.mgmt.networkcloud.models.ControlPlaneNodePatchConfiguration + :ivar kubernetes_version: The Kubernetes version for this cluster. + :vartype kubernetes_version: str + """ + + administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = rest_field( + name="administratorConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the default administrator credentials.""" + control_plane_node_configuration: Optional["_models.ControlPlaneNodePatchConfiguration"] = rest_field( + name="controlPlaneNodeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The defining characteristics of the control plane that can be patched for this Kubernetes + cluster.""" + kubernetes_version: Optional[str] = rest_field( + name="kubernetesVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Kubernetes version for this cluster.""" + + @overload + def __init__( + self, + *, + administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = None, + control_plane_node_configuration: Optional["_models.ControlPlaneNodePatchConfiguration"] = None, + kubernetes_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KubernetesClusterProperties(_Model): + """KubernetesClusterProperties represents the properties of Kubernetes cluster resource. + + :ivar aad_configuration: The Azure Active Directory Integration properties. + :vartype aad_configuration: ~azure.mgmt.networkcloud.models.AadConfiguration + :ivar administrator_configuration: The administrative credentials that will be applied to the + control plane and agent pool nodes that do not specify their own values. + :vartype administrator_configuration: + ~azure.mgmt.networkcloud.models.AdministratorConfiguration + :ivar control_plane_node_configuration: The defining characteristics of the control plane for + this Kubernetes Cluster. Required. + :vartype control_plane_node_configuration: + ~azure.mgmt.networkcloud.models.ControlPlaneNodeConfiguration + :ivar initial_agent_pool_configurations: The agent pools that are created with this Kubernetes + cluster for running critical system services and workloads. This data in this field is only + used during creation, and the field will be empty following the creation of the Kubernetes + Cluster. After creation, the management of agent pools is done using the agentPools + sub-resource. Required. + :vartype initial_agent_pool_configurations: + list[~azure.mgmt.networkcloud.models.InitialAgentPoolConfiguration] + :ivar kubernetes_version: The Kubernetes version for this cluster. Required. + :vartype kubernetes_version: str + :ivar managed_resource_group_configuration: The configuration of the managed resource group + associated with the resource. + :vartype managed_resource_group_configuration: + ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration + :ivar network_configuration: The configuration of the Kubernetes cluster networking, including + the attachment of networks that span the cluster. Required. + :vartype network_configuration: ~azure.mgmt.networkcloud.models.NetworkConfiguration + :ivar attached_network_ids: The full list of network resource IDs that are attached to this + cluster, including those attached only to specific agent pools. + :vartype attached_network_ids: list[str] + :ivar available_upgrades: The list of versions that this Kubernetes cluster can be upgraded to. + :vartype available_upgrades: list[~azure.mgmt.networkcloud.models.AvailableUpgrade] + :ivar cluster_id: The resource ID of the Network Cloud cluster. + :vartype cluster_id: str + :ivar connected_cluster_id: The resource ID of the connected cluster set up when this + Kubernetes cluster is created. + :vartype connected_cluster_id: str + :ivar control_plane_kubernetes_version: The current running version of Kubernetes on the + control plane. + :vartype control_plane_kubernetes_version: str + :ivar detailed_status: The current status of the Kubernetes cluster. Known values are: + "Available", "Error", and "Provisioning". + :vartype detailed_status: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar feature_statuses: The current feature settings. + :vartype feature_statuses: list[~azure.mgmt.networkcloud.models.FeatureStatus] + :ivar nodes: The details of the nodes in this cluster. + :vartype nodes: list[~azure.mgmt.networkcloud.models.KubernetesClusterNode] + :ivar provisioning_state: The provisioning state of the Kubernetes cluster resource. Known + values are: "Succeeded", "Failed", "Canceled", "Accepted", "InProgress", "Created", "Updating", + and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.KubernetesClusterProvisioningState + """ + + aad_configuration: Optional["_models.AadConfiguration"] = rest_field( + name="aadConfiguration", visibility=["read", "create"] + ) + """The Azure Active Directory Integration properties.""" + administrator_configuration: Optional["_models.AdministratorConfiguration"] = rest_field( + name="administratorConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The administrative credentials that will be applied to the control plane and agent pool nodes + that do not specify their own values.""" + control_plane_node_configuration: "_models.ControlPlaneNodeConfiguration" = rest_field( + name="controlPlaneNodeConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The defining characteristics of the control plane for this Kubernetes Cluster. Required.""" + initial_agent_pool_configurations: list["_models.InitialAgentPoolConfiguration"] = rest_field( + name="initialAgentPoolConfigurations", visibility=["read", "create"] + ) + """The agent pools that are created with this Kubernetes cluster for running critical system + services and workloads. This data in this field is only used during creation, and the field + will be empty following the creation of the Kubernetes Cluster. After creation, the management + of agent pools is done using the agentPools sub-resource. Required.""" + kubernetes_version: str = rest_field( + name="kubernetesVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Kubernetes version for this cluster. Required.""" + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = rest_field( + name="managedResourceGroupConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the managed resource group associated with the resource.""" + network_configuration: "_models.NetworkConfiguration" = rest_field( + name="networkConfiguration", visibility=["read", "create"] + ) + """The configuration of the Kubernetes cluster networking, including the attachment of networks + that span the cluster. Required.""" + attached_network_ids: Optional[list[str]] = rest_field(name="attachedNetworkIds", visibility=["read"]) + """The full list of network resource IDs that are attached to this cluster, including those + attached only to specific agent pools.""" + available_upgrades: Optional[list["_models.AvailableUpgrade"]] = rest_field( + name="availableUpgrades", visibility=["read"] + ) + """The list of versions that this Kubernetes cluster can be upgraded to.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the Network Cloud cluster.""" + connected_cluster_id: Optional[str] = rest_field(name="connectedClusterId", visibility=["read"]) + """The resource ID of the connected cluster set up when this Kubernetes cluster is created.""" + control_plane_kubernetes_version: Optional[str] = rest_field( + name="controlPlaneKubernetesVersion", visibility=["read"] + ) + """The current running version of Kubernetes on the control plane.""" + detailed_status: Optional[Union[str, "_models.KubernetesClusterDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The current status of the Kubernetes cluster. Known values are: \"Available\", \"Error\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + feature_statuses: Optional[list["_models.FeatureStatus"]] = rest_field(name="featureStatuses", visibility=["read"]) + """The current feature settings.""" + nodes: Optional[list["_models.KubernetesClusterNode"]] = rest_field(visibility=["read"]) + """The details of the nodes in this cluster.""" + provisioning_state: Optional[Union[str, "_models.KubernetesClusterProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the Kubernetes cluster resource. Known values are: \"Succeeded\", + \"Failed\", \"Canceled\", \"Accepted\", \"InProgress\", \"Created\", \"Updating\", and + \"Deleting\".""" + + @overload + def __init__( + self, + *, + control_plane_node_configuration: "_models.ControlPlaneNodeConfiguration", + initial_agent_pool_configurations: list["_models.InitialAgentPoolConfiguration"], + kubernetes_version: str, + network_configuration: "_models.NetworkConfiguration", + aad_configuration: Optional["_models.AadConfiguration"] = None, + administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, + managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = 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 KubernetesClusterRestartNodeParameters(_Model): + """KubernetesClusterRestartNodeParameters represents the body of the request to restart the node + of a Kubernetes cluster. + + :ivar node_name: The name of the node to restart. Required. + :vartype node_name: str + """ + + node_name: str = rest_field(name="nodeName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the node to restart. Required.""" + + @overload + def __init__( + self, + *, + node_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 KubernetesLabel(_Model): + """KubernetesLabel represents a single entry for a Kubernetes label or taint such as those used on + a node or pod. + + :ivar key: The name of the label or taint. Required. + :vartype key: str + :ivar value: The value of the label or taint. Required. + :vartype value: str + """ + + key: str = rest_field(visibility=["read", "create"]) + """The name of the label or taint. Required.""" + value: str = rest_field(visibility=["read", "create"]) + """The value of the label or taint. Required.""" + + @overload + def __init__( + self, + *, + key: str, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class L2Network(TrackedResource): + """L2Network represents a network that utilizes a single isolation domain set up for layer-2 + resources. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.L2NetworkProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.L2NetworkProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "hybrid_aks_plugin_type", + "interface_name", + "l2_isolation_domain_id", + "associated_resource_ids", + "cluster_id", + "detailed_status", + "detailed_status_message", + "hybrid_aks_clusters_associated_ids", + "virtual_machines_associated_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.L2NetworkProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 L2NetworkAttachmentConfiguration(_Model): + """L2NetworkAttachmentConfiguration represents the configuration of the attachment of a Layer 2 + network. + + :ivar network_id: The resource ID of the network that is being configured for attachment. + Required. + :vartype network_id: str + :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes + cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". + :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType + """ + + network_id: str = rest_field(name="networkId", visibility=["read", "create"]) + """The resource ID of the network that is being configured for attachment. Required.""" + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = rest_field( + name="pluginType", visibility=["read", "create"] + ) + """The indicator of how this network will be utilized by the Kubernetes cluster. Known values are: + \"DPDK\", \"SRIOV\", \"OSDevice\", \"MACVLAN\", and \"IPVLAN\".""" + + @overload + def __init__( + self, + *, + network_id: str, + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = 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 L2NetworkPatchParameters(_Model): + """L2NetworkPatchParameters represents the body of the request to patch the L2 network. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class L2NetworkProperties(_Model): + """L2NetworkProperties represents properties of the L2 network. + + :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will + have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known + values are: "DPDK", "SRIOV", and "OSDevice". + :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType + :ivar interface_name: The default interface name for this L2 network in the virtual machine. + This name can be overridden by the name supplied in the network attachment configuration of + that virtual machine. + :vartype interface_name: str + :ivar l2_isolation_domain_id: The resource ID of the Network Fabric l2IsolationDomain. + Required. + :vartype l2_isolation_domain_id: str + :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud + resources that have attached this network. + :vartype associated_resource_ids: list[str] + :ivar cluster_id: The resource ID of the Network Cloud cluster this L2 network is associated + with. + :vartype cluster_id: str + :ivar detailed_status: The more detailed status of the L2 network. Known values are: "Error", + "Available", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.L2NetworkDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of Hybrid AKS cluster resource ID(s) that are associated with this L2 network. + :vartype hybrid_aks_clusters_associated_ids: list[str] + :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of virtual machine resource ID(s), excluding any Hybrid AKS virtual machines, that are + currently using this L2 network. + :vartype virtual_machines_associated_ids: list[str] + :ivar provisioning_state: The provisioning state of the L2 network. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.L2NetworkProvisioningState + """ + + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = rest_field( + name="hybridAksPluginType", visibility=["read", "create"] + ) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The network plugin type for Hybrid AKS. Known values are: \"DPDK\", \"SRIOV\", + and \"OSDevice\".""" + interface_name: Optional[str] = rest_field(name="interfaceName", visibility=["read", "create"]) + """The default interface name for this L2 network in the virtual machine. This name can be + overridden by the name supplied in the network attachment configuration of that virtual + machine.""" + l2_isolation_domain_id: str = rest_field(name="l2IsolationDomainId", visibility=["read", "create"]) + """The resource ID of the Network Fabric l2IsolationDomain. Required.""" + associated_resource_ids: Optional[list[str]] = rest_field(name="associatedResourceIds", visibility=["read"]) + """The list of resource IDs for the other Microsoft.NetworkCloud resources that have attached this + network.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the Network Cloud cluster this L2 network is associated with.""" + detailed_status: Optional[Union[str, "_models.L2NetworkDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the L2 network. Known values are: \"Error\", \"Available\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + hybrid_aks_clusters_associated_ids: Optional[list[str]] = rest_field( + name="hybridAksClustersAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of Hybrid AKS cluster resource + ID(s) that are associated with this L2 network.""" + virtual_machines_associated_ids: Optional[list[str]] = rest_field( + name="virtualMachinesAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of virtual machine resource + ID(s), excluding any Hybrid AKS virtual machines, that are currently using this L2 network.""" + provisioning_state: Optional[Union[str, "_models.L2NetworkProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the L2 network. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + l2_isolation_domain_id: str, + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, + interface_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 L2ServiceLoadBalancerConfiguration(_Model): + """L2ServiceLoadBalancerConfiguration represents the configuration of a layer 2 service load + balancer. + + :ivar ip_address_pools: The list of pools of IP addresses that can be allocated to load + balancer services. + :vartype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] + """ + + ip_address_pools: Optional[list["_models.IpAddressPool"]] = rest_field( + name="ipAddressPools", visibility=["read", "create"] + ) + """The list of pools of IP addresses that can be allocated to load balancer services.""" + + @overload + def __init__( + self, + *, + ip_address_pools: Optional[list["_models.IpAddressPool"]] = 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 L3Network(TrackedResource): + """L3Network represents a network that utilizes a single isolation domain set up for layer-3 + resources. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.L3NetworkProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.L3NetworkProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "hybrid_aks_ipam_enabled", + "hybrid_aks_plugin_type", + "interface_name", + "ip_allocation_type", + "ipv4_connected_prefix", + "ipv6_connected_prefix", + "l3_isolation_domain_id", + "vlan", + "associated_resource_ids", + "cluster_id", + "detailed_status", + "detailed_status_message", + "hybrid_aks_clusters_associated_ids", + "virtual_machines_associated_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.L3NetworkProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 L3NetworkAttachmentConfiguration(_Model): + """L3NetworkAttachmentConfiguration represents the configuration of the attachment of a Layer 3 + network. + + :ivar ipam_enabled: The indication of whether this network will or will not perform IP address + management and allocate IP addresses when attached. Known values are: "True" and "False". + :vartype ipam_enabled: str or ~azure.mgmt.networkcloud.models.L3NetworkConfigurationIpamEnabled + :ivar network_id: The resource ID of the network that is being configured for attachment. + Required. + :vartype network_id: str + :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes + cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". + :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType + """ + + ipam_enabled: Optional[Union[str, "_models.L3NetworkConfigurationIpamEnabled"]] = rest_field( + name="ipamEnabled", visibility=["read", "create"] + ) + """The indication of whether this network will or will not perform IP address management and + allocate IP addresses when attached. Known values are: \"True\" and \"False\".""" + network_id: str = rest_field(name="networkId", visibility=["read", "create"]) + """The resource ID of the network that is being configured for attachment. Required.""" + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = rest_field( + name="pluginType", visibility=["read", "create"] + ) + """The indicator of how this network will be utilized by the Kubernetes cluster. Known values are: + \"DPDK\", \"SRIOV\", \"OSDevice\", \"MACVLAN\", and \"IPVLAN\".""" + + @overload + def __init__( + self, + *, + network_id: str, + ipam_enabled: Optional[Union[str, "_models.L3NetworkConfigurationIpamEnabled"]] = None, + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = 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 L3NetworkPatchParameters(_Model): + """L3NetworkPatchParameters represents the body of the request to patch the cloud services + network. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class L3NetworkProperties(_Model): + """L3NetworkProperties represents properties of the L3 network. + + :ivar hybrid_aks_ipam_enabled: Field Deprecated. The field was previously optional, now it will + have no defined behavior and will be ignored. The indicator of whether or not to disable IPAM + allocation on the network attachment definition injected into the Hybrid AKS Cluster. Known + values are: "True" and "False". + :vartype hybrid_aks_ipam_enabled: str or ~azure.mgmt.networkcloud.models.HybridAksIpamEnabled + :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will + have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known + values are: "DPDK", "SRIOV", and "OSDevice". + :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType + :ivar interface_name: The default interface name for this L3 network in the virtual machine. + This name can be overridden by the name supplied in the network attachment configuration of + that virtual machine. + :vartype interface_name: str + :ivar ip_allocation_type: The type of the IP address allocation, defaulted to "DualStack". + Known values are: "IPV4", "IPV6", and "DualStack". + :vartype ip_allocation_type: str or ~azure.mgmt.networkcloud.models.IpAllocationType + :ivar ipv4_connected_prefix: The IPV4 prefix (CIDR) assigned to this L3 network. Required when + the IP allocation type is IPV4 or DualStack. + :vartype ipv4_connected_prefix: str + :ivar ipv6_connected_prefix: The IPV6 prefix (CIDR) assigned to this L3 network. Required when + the IP allocation type is IPV6 or DualStack. + :vartype ipv6_connected_prefix: str + :ivar l3_isolation_domain_id: The resource ID of the Network Fabric l3IsolationDomain. + Required. + :vartype l3_isolation_domain_id: str + :ivar vlan: The VLAN from the l3IsolationDomain that is used for this network. Required. + :vartype vlan: int + :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud + resources that have attached this network. + :vartype associated_resource_ids: list[str] + :ivar cluster_id: The resource ID of the Network Cloud cluster this L3 network is associated + with. + :vartype cluster_id: str + :ivar detailed_status: The more detailed status of the L3 network. Known values are: "Error", + "Available", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.L3NetworkDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of Hybrid AKS cluster resource IDs that are associated with this L3 network. + :vartype hybrid_aks_clusters_associated_ids: list[str] + :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are + currently using this L3 network. + :vartype virtual_machines_associated_ids: list[str] + :ivar provisioning_state: The provisioning state of the L3 network. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.L3NetworkProvisioningState + """ + + hybrid_aks_ipam_enabled: Optional[Union[str, "_models.HybridAksIpamEnabled"]] = rest_field( + name="hybridAksIpamEnabled", visibility=["read", "create"] + ) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The indicator of whether or not to disable IPAM allocation on the network + attachment definition injected into the Hybrid AKS Cluster. Known values are: \"True\" and + \"False\".""" + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = rest_field( + name="hybridAksPluginType", visibility=["read", "create"] + ) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The network plugin type for Hybrid AKS. Known values are: \"DPDK\", \"SRIOV\", + and \"OSDevice\".""" + interface_name: Optional[str] = rest_field(name="interfaceName", visibility=["read", "create"]) + """The default interface name for this L3 network in the virtual machine. This name can be + overridden by the name supplied in the network attachment configuration of that virtual + machine.""" + ip_allocation_type: Optional[Union[str, "_models.IpAllocationType"]] = rest_field( + name="ipAllocationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the IP address allocation, defaulted to \"DualStack\". Known values are: \"IPV4\", + \"IPV6\", and \"DualStack\".""" + ipv4_connected_prefix: Optional[str] = rest_field(name="ipv4ConnectedPrefix", visibility=["read", "create"]) + """The IPV4 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is + IPV4 or DualStack.""" + ipv6_connected_prefix: Optional[str] = rest_field(name="ipv6ConnectedPrefix", visibility=["read", "create"]) + """The IPV6 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is + IPV6 or DualStack.""" + l3_isolation_domain_id: str = rest_field(name="l3IsolationDomainId", visibility=["read", "create"]) + """The resource ID of the Network Fabric l3IsolationDomain. Required.""" + vlan: int = rest_field(visibility=["read", "create"]) + """The VLAN from the l3IsolationDomain that is used for this network. Required.""" + associated_resource_ids: Optional[list[str]] = rest_field(name="associatedResourceIds", visibility=["read"]) + """The list of resource IDs for the other Microsoft.NetworkCloud resources that have attached this + network.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the Network Cloud cluster this L3 network is associated with.""" + detailed_status: Optional[Union[str, "_models.L3NetworkDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the L3 network. Known values are: \"Error\", \"Available\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + hybrid_aks_clusters_associated_ids: Optional[list[str]] = rest_field( + name="hybridAksClustersAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of Hybrid AKS cluster resource + IDs that are associated with this L3 network.""" + virtual_machines_associated_ids: Optional[list[str]] = rest_field( + name="virtualMachinesAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of virtual machine resource IDs, + excluding any Hybrid AKS virtual machines, that are currently using this L3 network.""" + provisioning_state: Optional[Union[str, "_models.L3NetworkProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the L3 network. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + l3_isolation_domain_id: str, + vlan: int, + hybrid_aks_ipam_enabled: Optional[Union[str, "_models.HybridAksIpamEnabled"]] = None, + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, + interface_name: Optional[str] = None, + ip_allocation_type: Optional[Union[str, "_models.IpAllocationType"]] = None, + ipv4_connected_prefix: Optional[str] = None, + ipv6_connected_prefix: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LldpNeighbor(_Model): + """Type Deprecated. Will be removed in an upcoming version. LldpNeighbor represents the details + about the device connected to the NIC. + + :ivar port_description: The descriptive information about the port on the connected device. + :vartype port_description: str + :ivar port_name: The system-assigned name of the port on the connected device. + :vartype port_name: str + :ivar system_description: The descriptive information about the connected device. + :vartype system_description: str + :ivar system_name: The system-assigned name of the connected device. + :vartype system_name: str + """ + + port_description: Optional[str] = rest_field(name="portDescription", visibility=["read"]) + """The descriptive information about the port on the connected device.""" + port_name: Optional[str] = rest_field(name="portName", visibility=["read"]) + """The system-assigned name of the port on the connected device.""" + system_description: Optional[str] = rest_field(name="systemDescription", visibility=["read"]) + """The descriptive information about the connected device.""" + system_name: Optional[str] = rest_field(name="systemName", visibility=["read"]) + """The system-assigned name of the connected device.""" + + +class MachineDisk(_Model): + """MachineDisk represents the properties of the disk. + + :ivar capacity_gb: The maximum amount of storage. Measured in gibibytes. + :vartype capacity_gb: int + :ivar connection: The connection type of the rack SKU resource. Known values are: "PCIE", + "SATA", "RAID", and "SAS". + :vartype connection: str or ~azure.mgmt.networkcloud.models.MachineSkuDiskConnectionType + :ivar type: The disk type of rack SKU resource. Known values are: "HDD" and "SSD". + :vartype type: str or ~azure.mgmt.networkcloud.models.DiskType + """ + + capacity_gb: Optional[int] = rest_field(name="capacityGB", visibility=["read"]) + """The maximum amount of storage. Measured in gibibytes.""" + connection: Optional[Union[str, "_models.MachineSkuDiskConnectionType"]] = rest_field(visibility=["read"]) + """The connection type of the rack SKU resource. Known values are: \"PCIE\", \"SATA\", \"RAID\", + and \"SAS\".""" + type: Optional[Union[str, "_models.DiskType"]] = rest_field(visibility=["read"]) + """The disk type of rack SKU resource. Known values are: \"HDD\" and \"SSD\".""" + + +class MachineSkuProperties(_Model): + """MachineSkuProperties represents the properties of the machine SKU. + + :ivar bootstrap_protocol: The type of bootstrap protocol used. "PXE" + :vartype bootstrap_protocol: str or ~azure.mgmt.networkcloud.models.BootstrapProtocol + :ivar cpu_cores: The count of CPU cores for this machine. + :vartype cpu_cores: int + :ivar cpu_sockets: The count of CPU sockets for this machine. + :vartype cpu_sockets: int + :ivar disks: The list of disks. + :vartype disks: list[~azure.mgmt.networkcloud.models.MachineDisk] + :ivar generation: The generation of the architecture. + :vartype generation: str + :ivar hardware_version: The hardware version of the machine. + :vartype hardware_version: str + :ivar memory_capacity_gb: The maximum amount of memory. Measured in gibibytes. + :vartype memory_capacity_gb: int + :ivar model: The model of the machine. + :vartype model: str + :ivar network_interfaces: The list of network interfaces. + :vartype network_interfaces: list[~azure.mgmt.networkcloud.models.NetworkInterface] + :ivar total_threads: The count of SMT and physical core threads for this machine. + :vartype total_threads: int + :ivar vendor: The make of the machine. + :vartype vendor: str + """ + + bootstrap_protocol: Optional[Union[str, "_models.BootstrapProtocol"]] = rest_field( + name="bootstrapProtocol", visibility=["read"] + ) + """The type of bootstrap protocol used. \"PXE\"""" + cpu_cores: Optional[int] = rest_field(name="cpuCores", visibility=["read"]) + """The count of CPU cores for this machine.""" + cpu_sockets: Optional[int] = rest_field(name="cpuSockets", visibility=["read"]) + """The count of CPU sockets for this machine.""" + disks: Optional[list["_models.MachineDisk"]] = rest_field(visibility=["read"]) + """The list of disks.""" + generation: Optional[str] = rest_field(visibility=["read"]) + """The generation of the architecture.""" + hardware_version: Optional[str] = rest_field(name="hardwareVersion", visibility=["read"]) + """The hardware version of the machine.""" + memory_capacity_gb: Optional[int] = rest_field(name="memoryCapacityGB", visibility=["read"]) + """The maximum amount of memory. Measured in gibibytes.""" + model: Optional[str] = rest_field(visibility=["read"]) + """The model of the machine.""" + network_interfaces: Optional[list["_models.NetworkInterface"]] = rest_field( + name="networkInterfaces", visibility=["read"] + ) + """The list of network interfaces.""" + total_threads: Optional[int] = rest_field(name="totalThreads", visibility=["read"]) + """The count of SMT and physical core threads for this machine.""" + vendor: Optional[str] = rest_field(visibility=["read"]) + """The make of the machine.""" + + +class MachineSkuSlot(_Model): + """MachineSkuSlot represents a single SKU and rack slot associated with the machine. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.MachineSkuProperties + :ivar rack_slot: The position in the rack for the machine. + :vartype rack_slot: int + """ + + properties: Optional["_models.MachineSkuProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + rack_slot: Optional[int] = rest_field(name="rackSlot", visibility=["read"]) + """The position in the rack for the machine.""" + + __flattened_items = [ + "bootstrap_protocol", + "cpu_cores", + "cpu_sockets", + "disks", + "generation", + "hardware_version", + "memory_capacity_gb", + "model", + "network_interfaces", + "total_threads", + "vendor", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.MachineSkuProperties"] = 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 ManagedResourceGroupConfiguration(_Model): + """ManagedResourceGroupConfiguration represents the configuration of the resource group managed by + Azure. + + :ivar location: The location of the managed resource group. If not specified, the location of + the parent resource is chosen. + :vartype location: str + :ivar name: The name for the managed resource group. If not specified, the unique name is + automatically generated. + :vartype name: str + """ + + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The location of the managed resource group. If not specified, the location of the parent + resource is chosen.""" + name: Optional[str] = rest_field(visibility=["read", "create"]) + """The name for the managed resource group. If not specified, the unique name is automatically + generated.""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + 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 ManagedServiceIdentity(_Model): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.networkcloud.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.networkcloud.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned 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 system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. 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 identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + 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 NetworkAttachment(_Model): + """NetworkAttachment represents the single network attachment. + + :ivar attached_network_id: The resource ID of the associated network attached to the virtual + machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork + resources. Required. + :vartype attached_network_id: str + :ivar default_gateway: The indicator of whether this is the default gateway. Only one of the + attached networks (including the CloudServicesNetwork attachment) for a single machine may be + specified as True. Known values are: "True" and "False". + :vartype default_gateway: str or ~azure.mgmt.networkcloud.models.DefaultGateway + :ivar ip_allocation_method: The IP allocation mechanism for the virtual machine. Dynamic and + Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the + only permitted value. Required. Known values are: "Dynamic", "Static", and "Disabled". + :vartype ip_allocation_method: str or + ~azure.mgmt.networkcloud.models.VirtualMachineIPAllocationMethod + :ivar ipv4_address: The IPv4 address of the virtual machine. This field is used only if the + attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - + this field must contain a user specified IPv4 address from within the subnet specified in the + attached network. Dynamic - this field is read-only, but will be populated with an address from + within the subnet specified in the attached network. Disabled - this field will be empty. + :vartype ipv4_address: str + :ivar ipv6_address: The IPv6 address of the virtual machine. This field is used only if the + attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - + this field must contain an IPv6 address range from within the range specified in the attached + network. Dynamic - this field is read-only, but will be populated with an range from within the + subnet specified in the attached network. Disabled - this field will be empty. + :vartype ipv6_address: str + :ivar mac_address: The MAC address of the interface for the virtual machine that corresponds to + this network attachment. + :vartype mac_address: str + :ivar network_attachment_name: The associated network's interface name. If specified, the + network attachment name has a maximum length of 15 characters and must be unique to this + virtual machine. If the user doesn’t specify this value, the default interface name of the + network resource will be used. For a CloudServicesNetwork resource, this name will be ignored. + :vartype network_attachment_name: str + """ + + attached_network_id: str = rest_field(name="attachedNetworkId", visibility=["read", "create"]) + """The resource ID of the associated network attached to the virtual machine. It can be one of + cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources. Required.""" + default_gateway: Optional[Union[str, "_models.DefaultGateway"]] = rest_field( + name="defaultGateway", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether this is the default gateway. Only one of the attached networks + (including the CloudServicesNetwork attachment) for a single machine may be specified as True. + Known values are: \"True\" and \"False\".""" + ip_allocation_method: Union[str, "_models.VirtualMachineIPAllocationMethod"] = rest_field( + name="ipAllocationMethod", visibility=["read", "create"] + ) + """The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for + l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value. + Required. Known values are: \"Dynamic\", \"Static\", and \"Disabled\".""" + ipv4_address: Optional[str] = rest_field(name="ipv4Address", visibility=["read", "create"]) + """The IPv4 address of the virtual machine. This field is used only if the attached network has + IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - this field must + contain a user specified IPv4 address from within the subnet specified in the attached network. + Dynamic - this field is read-only, but will be populated with an address from within the subnet + specified in the attached network. Disabled - this field will be empty.""" + ipv6_address: Optional[str] = rest_field(name="ipv6Address", visibility=["read", "create"]) + """The IPv6 address of the virtual machine. This field is used only if the attached network has + IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - this field must + contain an IPv6 address range from within the range specified in the attached network. Dynamic + - this field is read-only, but will be populated with an range from within the subnet specified + in the attached network. Disabled - this field will be empty.""" + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """The MAC address of the interface for the virtual machine that corresponds to this network + attachment.""" + network_attachment_name: Optional[str] = rest_field(name="networkAttachmentName", visibility=["read", "create"]) + """The associated network's interface name. If specified, the network attachment name has a + maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t + specify this value, the default interface name of the network resource will be used. For a + CloudServicesNetwork resource, this name will be ignored.""" + + @overload + def __init__( + self, + *, + attached_network_id: str, + ip_allocation_method: Union[str, "_models.VirtualMachineIPAllocationMethod"], + default_gateway: Optional[Union[str, "_models.DefaultGateway"]] = None, + ipv4_address: Optional[str] = None, + ipv6_address: Optional[str] = None, + network_attachment_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 NetworkConfiguration(_Model): + """NetworkConfiguration specifies the Kubernetes cluster network related configuration. + + :ivar attached_network_configuration: The configuration of networks being attached to the + cluster for use by the workloads that run on this Kubernetes cluster. + :vartype attached_network_configuration: + ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration + :ivar bgp_service_load_balancer_configuration: The configuration of the BGP service load + balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, + either Layer 2 or BGP. + :vartype bgp_service_load_balancer_configuration: + ~azure.mgmt.networkcloud.models.BgpServiceLoadBalancerConfiguration + :ivar cloud_services_network_id: The resource ID of the associated Cloud Services network. + Required. + :vartype cloud_services_network_id: str + :ivar cni_network_id: The resource ID of the Layer 3 network that is used for creation of the + Container Networking Interface network. Required. + :vartype cni_network_id: str + :ivar dns_service_ip: The IP address assigned to the Kubernetes DNS service. It must be within + the Kubernetes service address range specified in service CIDR. + :vartype dns_service_ip: str + :ivar l2_service_load_balancer_configuration: The configuration of the Layer 2 service load + balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, + either Layer 2 or BGP. + :vartype l2_service_load_balancer_configuration: + ~azure.mgmt.networkcloud.models.L2ServiceLoadBalancerConfiguration + :ivar pod_cidrs: The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is + expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is + expected for dual-stack networking. + :vartype pod_cidrs: list[str] + :ivar service_cidrs: The CIDR notation IP ranges from which to assign service IPs. One IPv4 + CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is + expected for dual-stack networking. + :vartype service_cidrs: list[str] + """ + + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = rest_field( + name="attachedNetworkConfiguration", visibility=["read", "create"] + ) + """The configuration of networks being attached to the cluster for use by the workloads that run + on this Kubernetes cluster.""" + bgp_service_load_balancer_configuration: Optional["_models.BgpServiceLoadBalancerConfiguration"] = rest_field( + name="bgpServiceLoadBalancerConfiguration", visibility=["read", "create"] + ) + """The configuration of the BGP service load balancer for this Kubernetes cluster. A maximum of + one service load balancer may be specified, either Layer 2 or BGP.""" + cloud_services_network_id: str = rest_field(name="cloudServicesNetworkId", visibility=["read", "create"]) + """The resource ID of the associated Cloud Services network. Required.""" + cni_network_id: str = rest_field(name="cniNetworkId", visibility=["read", "create"]) + """The resource ID of the Layer 3 network that is used for creation of the Container Networking + Interface network. Required.""" + dns_service_ip: Optional[str] = rest_field(name="dnsServiceIp", visibility=["read", "create"]) + """The IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service + address range specified in service CIDR.""" + l2_service_load_balancer_configuration: Optional["_models.L2ServiceLoadBalancerConfiguration"] = rest_field( + name="l2ServiceLoadBalancerConfiguration", visibility=["read", "create"] + ) + """The configuration of the Layer 2 service load balancer for this Kubernetes cluster. A maximum + of one service load balancer may be specified, either Layer 2 or BGP.""" + pod_cidrs: Optional[list[str]] = rest_field(name="podCidrs", visibility=["read", "create"]) + """The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is expected for + single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for + dual-stack networking.""" + service_cidrs: Optional[list[str]] = rest_field(name="serviceCidrs", visibility=["read", "create"]) + """The CIDR notation IP ranges from which to assign service IPs. One IPv4 CIDR is expected for + single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for + dual-stack networking.""" + + @overload + def __init__( + self, + *, + cloud_services_network_id: str, + cni_network_id: str, + attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, + bgp_service_load_balancer_configuration: Optional["_models.BgpServiceLoadBalancerConfiguration"] = None, + dns_service_ip: Optional[str] = None, + l2_service_load_balancer_configuration: Optional["_models.L2ServiceLoadBalancerConfiguration"] = None, + pod_cidrs: Optional[list[str]] = None, + service_cidrs: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkInterface(_Model): + """NetworkInterface represents properties of the network interface. + + :ivar address: The partial address of Peripheral Component Interconnect (PCI). + :vartype address: str + :ivar device_connection_type: The connection type of the device. "PCI" + :vartype device_connection_type: str or ~azure.mgmt.networkcloud.models.DeviceConnectionType + :ivar model: The model name of the device. + :vartype model: str + :ivar physical_slot: The physical slot for this device. + :vartype physical_slot: int + :ivar port_count: The number of ports on the device. + :vartype port_count: int + :ivar port_speed: The maximum amount of data in gigabits that the line card transmits through a + port at any given second. + :vartype port_speed: int + :ivar vendor: The vendor name of the device. + :vartype vendor: str + """ + + address: Optional[str] = rest_field(visibility=["read"]) + """The partial address of Peripheral Component Interconnect (PCI).""" + device_connection_type: Optional[Union[str, "_models.DeviceConnectionType"]] = rest_field( + name="deviceConnectionType", visibility=["read"] + ) + """The connection type of the device. \"PCI\"""" + model: Optional[str] = rest_field(visibility=["read"]) + """The model name of the device.""" + physical_slot: Optional[int] = rest_field(name="physicalSlot", visibility=["read"]) + """The physical slot for this device.""" + port_count: Optional[int] = rest_field(name="portCount", visibility=["read"]) + """The number of ports on the device.""" + port_speed: Optional[int] = rest_field(name="portSpeed", visibility=["read"]) + """The maximum amount of data in gigabits that the line card transmits through a port at any given + second.""" + vendor: Optional[str] = rest_field(visibility=["read"]) + """The vendor name of the device.""" + + +class Nic(_Model): + """Type Deprecated. Will be removed in an upcoming version. Nic represents the network interface + card details. + + :ivar lldp_neighbor: The information about the device connected to this NIC. + :vartype lldp_neighbor: ~azure.mgmt.networkcloud.models.LldpNeighbor + :ivar mac_address: The MAC address associated with this NIC. + :vartype mac_address: str + :ivar name: The name of the NIC/interface. + :vartype name: str + """ + + lldp_neighbor: Optional["_models.LldpNeighbor"] = rest_field(name="lldpNeighbor", visibility=["read"]) + """The information about the device connected to this NIC.""" + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """The MAC address associated with this NIC.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the NIC/interface.""" + + +class NodePoolAdministratorConfigurationPatch(_Model): + """NodePoolAdministratorConfigurationPatch represents the patching capabilities for the + administrator configuration. + + :ivar ssh_public_keys: SshPublicKey represents the public key used to authenticate with a + resource through SSH. + :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] + """ + + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = rest_field( + name="sshPublicKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """SshPublicKey represents the public key used to authenticate with a resource through SSH.""" + + @overload + def __init__( + self, + *, + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = 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 Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.networkcloud.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.networkcloud.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.networkcloud.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = 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 OperationDisplay(_Model): + """Localized display information for an operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OperationStatusResult(_Model): + """The current status of an async operation. + + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.networkcloud.models.ErrorDetail + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.networkcloud.models.OperationStatusResult] + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar properties: The additional properties of the operation status result. + :vartype properties: ~azure.mgmt.networkcloud.models.OperationStatusResultProperties + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar status: Operation status. Required. + :vartype status: str + """ + + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time of the operation.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read"]) + """If present, details of the operation error.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified ID for the async operation.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the async operation.""" + operations: Optional[list["_models.OperationStatusResult"]] = rest_field(visibility=["read"]) + """The operations list.""" + percent_complete: Optional[float] = rest_field(name="percentComplete", visibility=["read"]) + """Percent of the operation that is complete.""" + properties: Optional["_models.OperationStatusResultProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The additional properties of the operation status result.""" + resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"]) + """Fully qualified ID of the resource against which the original async operation was started.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the operation.""" + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation status. Required.""" + + __flattened_items = ["exit_code", "output_head", "result_ref", "result_url"] + + @overload + def __init__( + self, + *, + status: str, + properties: Optional["_models.OperationStatusResultProperties"] = 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 OperationStatusResultProperties(_Model): + """OperationStatusResultProperties represents additional properties of the operation status + result. + + :ivar exit_code: For actions that run commands or scripts, the exit code of the script + execution. + :vartype exit_code: str + :ivar output_head: For actions that run commands or scripts, the leading bytes of the output of + the script execution. + :vartype output_head: str + :ivar result_ref: For actions that run commands or scripts, a reference to the location of the + result. + :vartype result_ref: str + :ivar result_url: For actions that run commands or scripts, the URL where the full output of + the script output can be retrieved. + :vartype result_url: str + """ + + exit_code: Optional[str] = rest_field(name="exitCode", visibility=["read"]) + """For actions that run commands or scripts, the exit code of the script execution.""" + output_head: Optional[str] = rest_field(name="outputHead", visibility=["read"]) + """For actions that run commands or scripts, the leading bytes of the output of the script + execution.""" + result_ref: Optional[str] = rest_field(name="resultRef", visibility=["read"]) + """For actions that run commands or scripts, a reference to the location of the result.""" + result_url: Optional[str] = rest_field(name="resultUrl", visibility=["read"]) + """For actions that run commands or scripts, the URL where the full output of the script output + can be retrieved.""" + + +class OsDisk(_Model): + """OsDisk represents configuration of the boot disk. + + :ivar create_option: The strategy for creating the OS disk. Known values are: "Ephemeral" and + "Persistent". + :vartype create_option: str or ~azure.mgmt.networkcloud.models.OsDiskCreateOption + :ivar delete_option: The strategy for deleting the OS disk. "Delete" + :vartype delete_option: str or ~azure.mgmt.networkcloud.models.OsDiskDeleteOption + :ivar disk_size_gb: The size of the disk. Required if the createOption is Ephemeral. + Allocations are measured in gibibytes. Required. + :vartype disk_size_gb: int + """ + + create_option: Optional[Union[str, "_models.OsDiskCreateOption"]] = rest_field( + name="createOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The strategy for creating the OS disk. Known values are: \"Ephemeral\" and \"Persistent\".""" + delete_option: Optional[Union[str, "_models.OsDiskDeleteOption"]] = rest_field( + name="deleteOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The strategy for deleting the OS disk. \"Delete\"""" + disk_size_gb: int = rest_field(name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"]) + """The size of the disk. Required if the createOption is Ephemeral. Allocations are measured in + gibibytes. Required.""" + + @overload + def __init__( + self, + *, + disk_size_gb: int, + create_option: Optional[Union[str, "_models.OsDiskCreateOption"]] = None, + delete_option: Optional[Union[str, "_models.OsDiskDeleteOption"]] = 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 ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.networkcloud.models.SystemData + """ + + +class Rack(TrackedResource): + """Rack represents the hardware of the rack and is dependent upon the cluster for lifecycle. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.RackProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.RackProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "availability_zone", + "rack_location", + "rack_serial_number", + "rack_sku_id", + "cluster_id", + "detailed_status", + "detailed_status_message", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.RackProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 RackDefinition(_Model): + """RackDefinition represents details regarding the rack. + + :ivar availability_zone: The zone name used for this rack when created. Availability zones are + used for workload placement. + :vartype availability_zone: str + :ivar bare_metal_machine_configuration_data: The unordered list of bare metal machine + configuration. + :vartype bare_metal_machine_configuration_data: + list[~azure.mgmt.networkcloud.models.BareMetalMachineConfigurationData] + :ivar network_rack_id: The resource ID of the network rack that matches this rack definition. + Required. + :vartype network_rack_id: str + :ivar rack_location: The free-form description of the rack's location. + :vartype rack_location: str + :ivar rack_serial_number: The unique identifier for the rack within Network Cloud cluster. An + alternate unique alphanumeric value other than a serial number may be provided if desired. + Required. + :vartype rack_serial_number: str + :ivar rack_sku_id: The resource ID of the sku for the rack being added. Required. + :vartype rack_sku_id: str + :ivar storage_appliance_configuration_data: The list of storage appliance configuration data + for this rack. + :vartype storage_appliance_configuration_data: + list[~azure.mgmt.networkcloud.models.StorageApplianceConfigurationData] + """ + + availability_zone: Optional[str] = rest_field( + name="availabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The zone name used for this rack when created. Availability zones are used for workload + placement.""" + bare_metal_machine_configuration_data: Optional[list["_models.BareMetalMachineConfigurationData"]] = rest_field( + name="bareMetalMachineConfigurationData", visibility=["read", "create", "update", "delete", "query"] + ) + """The unordered list of bare metal machine configuration.""" + network_rack_id: str = rest_field(name="networkRackId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the network rack that matches this rack definition. Required.""" + rack_location: Optional[str] = rest_field( + name="rackLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The free-form description of the rack's location.""" + rack_serial_number: str = rest_field( + name="rackSerialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique identifier for the rack within Network Cloud cluster. An alternate unique + alphanumeric value other than a serial number may be provided if desired. Required.""" + rack_sku_id: str = rest_field(name="rackSkuId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the sku for the rack being added. Required.""" + storage_appliance_configuration_data: Optional[list["_models.StorageApplianceConfigurationData"]] = rest_field( + name="storageApplianceConfigurationData", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of storage appliance configuration data for this rack.""" + + @overload + def __init__( + self, + *, + network_rack_id: str, + rack_serial_number: str, + rack_sku_id: str, + availability_zone: Optional[str] = None, + bare_metal_machine_configuration_data: Optional[list["_models.BareMetalMachineConfigurationData"]] = None, + rack_location: Optional[str] = None, + storage_appliance_configuration_data: Optional[list["_models.StorageApplianceConfigurationData"]] = 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 RackPatchParameters(_Model): + """RackPatchParameters represents the body of the request to patch the rack properties. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.RacksPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.RacksPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["rack_location", "rack_serial_number"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RacksPatchProperties"] = None, + 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: + _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 RackProperties(_Model): + """RackProperties represents the properties of the rack. + + :ivar availability_zone: The value that will be used for machines in this rack to represent the + availability zones that can be referenced by Hybrid AKS Clusters for node arrangement. + Required. + :vartype availability_zone: str + :ivar rack_location: The free-form description of the rack location. (e.g. "DTN Datacenter, + Floor 3, Isle 9, Rack 2B"). Required. + :vartype rack_location: str + :ivar rack_serial_number: The unique identifier for the rack within Network Cloud cluster. An + alternate unique alphanumeric value other than a serial number may be provided if desired. + Required. + :vartype rack_serial_number: str + :ivar rack_sku_id: The SKU for the rack. Required. + :vartype rack_sku_id: str + :ivar cluster_id: The resource ID of the cluster the rack is created for. This value is set + when the rack is created by the cluster. + :vartype cluster_id: str + :ivar detailed_status: The more detailed status of the rack. Known values are: "Error", + "Available", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.RackDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar provisioning_state: The provisioning state of the rack resource. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.RackProvisioningState + """ + + availability_zone: str = rest_field( + name="availabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The value that will be used for machines in this rack to represent the availability zones that + can be referenced by Hybrid AKS Clusters for node arrangement. Required.""" + rack_location: str = rest_field(name="rackLocation", visibility=["read", "create", "update", "delete", "query"]) + """The free-form description of the rack location. (e.g. \"DTN Datacenter, Floor 3, Isle 9, Rack + 2B\"). Required.""" + rack_serial_number: str = rest_field( + name="rackSerialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique identifier for the rack within Network Cloud cluster. An alternate unique + alphanumeric value other than a serial number may be provided if desired. Required.""" + rack_sku_id: str = rest_field(name="rackSkuId", visibility=["read", "create", "update", "delete", "query"]) + """The SKU for the rack. Required.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the cluster the rack is created for. This value is set when the rack is + created by the cluster.""" + detailed_status: Optional[Union[str, "_models.RackDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the rack. Known values are: \"Error\", \"Available\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + provisioning_state: Optional[Union[str, "_models.RackProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the rack resource. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + availability_zone: str, + rack_location: str, + rack_serial_number: str, + rack_sku_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 RackSku(ProxyResource): + """RackSku represents the SKU information of the rack. + + :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.networkcloud.models.SystemData + :ivar properties: The list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.RackSkuProperties + """ + + properties: "_models.RackSkuProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + + __flattened_items = [ + "compute_machines", + "controller_machines", + "description", + "max_cluster_slots", + "provisioning_state", + "rack_type", + "storage_appliances", + "supported_rack_sku_ids", + ] + + @overload + def __init__( + self, + *, + properties: "_models.RackSkuProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 RackSkuProperties(_Model): + """RackSkuProperties represents the properties of compute-related hardware for a rack. This + supports both aggregator and compute racks. + + :ivar compute_machines: The list of machine SKUs and associated rack slot for the + compute-dedicated machines in this rack model. + :vartype compute_machines: list[~azure.mgmt.networkcloud.models.MachineSkuSlot] + :ivar controller_machines: The list of machine SKUs and associated rack slot for the + control-plane dedicated machines in this rack model. + :vartype controller_machines: list[~azure.mgmt.networkcloud.models.MachineSkuSlot] + :ivar description: The free-form text describing the rack. + :vartype description: str + :ivar max_cluster_slots: The maximum number of compute racks supported by an aggregator rack. 0 + if this is a compute rack or a rack for a single rack cluster(rackType="Single"). + :vartype max_cluster_slots: int + :ivar provisioning_state: The provisioning state of the rack SKU resource. Known values are: + "Canceled", "Failed", and "Succeeded". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.RackSkuProvisioningState + :ivar rack_type: The type of the rack. Known values are: "Aggregator", "Compute", and "Single". + :vartype rack_type: str or ~azure.mgmt.networkcloud.models.RackSkuType + :ivar storage_appliances: The list of appliance SKUs and associated rack slot for the storage + appliance(s) in this rack model. + :vartype storage_appliances: list[~azure.mgmt.networkcloud.models.StorageApplianceSkuSlot] + :ivar supported_rack_sku_ids: The list of supported SKUs if the rack is an aggregator. + :vartype supported_rack_sku_ids: list[str] + """ + + compute_machines: Optional[list["_models.MachineSkuSlot"]] = rest_field(name="computeMachines", visibility=["read"]) + """The list of machine SKUs and associated rack slot for the compute-dedicated machines in this + rack model.""" + controller_machines: Optional[list["_models.MachineSkuSlot"]] = rest_field( + name="controllerMachines", visibility=["read"] + ) + """The list of machine SKUs and associated rack slot for the control-plane dedicated machines in + this rack model.""" + description: Optional[str] = rest_field(visibility=["read"]) + """The free-form text describing the rack.""" + max_cluster_slots: Optional[int] = rest_field(name="maxClusterSlots", visibility=["read"]) + """The maximum number of compute racks supported by an aggregator rack. 0 if this is a compute + rack or a rack for a single rack cluster(rackType=\"Single\").""" + provisioning_state: Optional[Union[str, "_models.RackSkuProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the rack SKU resource. Known values are: \"Canceled\", \"Failed\", + and \"Succeeded\".""" + rack_type: Optional[Union[str, "_models.RackSkuType"]] = rest_field(name="rackType", visibility=["read"]) + """The type of the rack. Known values are: \"Aggregator\", \"Compute\", and \"Single\".""" + storage_appliances: Optional[list["_models.StorageApplianceSkuSlot"]] = rest_field( + name="storageAppliances", visibility=["read"] + ) + """The list of appliance SKUs and associated rack slot for the storage appliance(s) in this rack + model.""" + supported_rack_sku_ids: Optional[list[str]] = rest_field(name="supportedRackSkuIds", visibility=["read"]) + """The list of supported SKUs if the rack is an aggregator.""" + + +class RacksPatchProperties(_Model): + """RacksPatchProperties represents the properties of the rack during patching. + + :ivar rack_location: The free-form description of the rack location. (e.g. "DTN Datacenter, + Floor 3, Isle 9, Rack 2B"). + :vartype rack_location: str + :ivar rack_serial_number: The globally unique identifier for the rack. + :vartype rack_serial_number: str + """ + + rack_location: Optional[str] = rest_field( + name="rackLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The free-form description of the rack location. (e.g. \"DTN Datacenter, Floor 3, Isle 9, Rack + 2B\").""" + rack_serial_number: Optional[str] = rest_field( + name="rackSerialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The globally unique identifier for the rack.""" + + @overload + def __init__( + self, + *, + rack_location: Optional[str] = None, + rack_serial_number: 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 RuntimeProtectionConfiguration(_Model): + """RuntimeProtectionConfiguration represents the runtime protection configuration for the cluster. + + :ivar enforcement_level: The mode of operation for runtime protection. Known values are: + "Audit", "Disabled", "OnDemand", "Passive", and "RealTime". + :vartype enforcement_level: str or + ~azure.mgmt.networkcloud.models.RuntimeProtectionEnforcementLevel + """ + + enforcement_level: Optional[Union[str, "_models.RuntimeProtectionEnforcementLevel"]] = rest_field( + name="enforcementLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """The mode of operation for runtime protection. Known values are: \"Audit\", \"Disabled\", + \"OnDemand\", \"Passive\", and \"RealTime\".""" + + @overload + def __init__( + self, + *, + enforcement_level: Optional[Union[str, "_models.RuntimeProtectionEnforcementLevel"]] = 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 RuntimeProtectionStatus(_Model): + """RuntimeProtectionStatus represents the runtime protection status of the bare metal machine. + + :ivar definitions_last_updated: The timestamp when the malware definitions were last updated. + :vartype definitions_last_updated: ~datetime.datetime + :ivar definitions_version: The version of the malware definitions. + :vartype definitions_version: str + :ivar scan_completed_time: The timestamp of the most recently completed scan, or empty if there + has never been a scan. + :vartype scan_completed_time: ~datetime.datetime + :ivar scan_scheduled_time: The timestamp of the most recently scheduled scan, or empty if no + scan has been scheduled. + :vartype scan_scheduled_time: ~datetime.datetime + :ivar scan_started_time: The timestamp of the most recently started scan, or empty if there has + never been a scan. + :vartype scan_started_time: ~datetime.datetime + """ + + definitions_last_updated: Optional[datetime.datetime] = rest_field( + name="definitionsLastUpdated", visibility=["read"], format="rfc3339" + ) + """The timestamp when the malware definitions were last updated.""" + definitions_version: Optional[str] = rest_field(name="definitionsVersion", visibility=["read"]) + """The version of the malware definitions.""" + scan_completed_time: Optional[datetime.datetime] = rest_field( + name="scanCompletedTime", visibility=["read"], format="rfc3339" + ) + """The timestamp of the most recently completed scan, or empty if there has never been a scan.""" + scan_scheduled_time: Optional[datetime.datetime] = rest_field( + name="scanScheduledTime", visibility=["read"], format="rfc3339" + ) + """The timestamp of the most recently scheduled scan, or empty if no scan has been scheduled.""" + scan_started_time: Optional[datetime.datetime] = rest_field( + name="scanStartedTime", visibility=["read"], format="rfc3339" + ) + """The timestamp of the most recently started scan, or empty if there has never been a scan.""" + + +class SecretArchiveReference(_Model): + """SecretArchiveReference represents the reference to a secret in a key vault. + + :ivar key_vault_id: The resource ID of the key vault containing the secret. + :vartype key_vault_id: str + :ivar key_vault_uri: The URI of the key containing the secret. + :vartype key_vault_uri: str + :ivar secret_name: The name of the secret in the key vault. + :vartype secret_name: str + :ivar secret_version: The version of the secret in the key vault. + :vartype secret_version: str + """ + + key_vault_id: Optional[str] = rest_field(name="keyVaultId", visibility=["read"]) + """The resource ID of the key vault containing the secret.""" + key_vault_uri: Optional[str] = rest_field(name="keyVaultUri", visibility=["read"]) + """The URI of the key containing the secret.""" + secret_name: Optional[str] = rest_field(name="secretName", visibility=["read"]) + """The name of the secret in the key vault.""" + secret_version: Optional[str] = rest_field(name="secretVersion", visibility=["read"]) + """The version of the secret in the key vault.""" + + +class SecretArchiveSettings(_Model): + """SecretArchiveSettings represents the settings for the secret archive used to hold credentials + for the cluster. + + :ivar associated_identity: The selection of the managed identity to use with this vault URI. + The identity type must be either system assigned or user assigned. + :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector + :ivar vault_uri: The URI for the key vault used as the secret archive. + :vartype vault_uri: str + """ + + associated_identity: Optional["_models.IdentitySelector"] = rest_field( + name="associatedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The selection of the managed identity to use with this vault URI. The identity type must be + either system assigned or user assigned.""" + vault_uri: Optional[str] = rest_field(name="vaultUri", visibility=["read", "create", "update", "delete", "query"]) + """The URI for the key vault used as the secret archive.""" + + @overload + def __init__( + self, + *, + associated_identity: Optional["_models.IdentitySelector"] = None, + vault_uri: 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 SecretRotationStatus(_Model): + """SecretRotationStatus represents the status of a secret rotation. + + :ivar expire_period_days: The maximum number of days the secret may be used before it must be + changed. + :vartype expire_period_days: int + :ivar last_rotation_time: The date and time when the secret was last changed. + :vartype last_rotation_time: ~datetime.datetime + :ivar rotation_period_days: The number of days a secret exists before rotations will be + attempted. + :vartype rotation_period_days: int + :ivar secret_archive_reference: The reference to the secret in a key vault. + :vartype secret_archive_reference: ~azure.mgmt.networkcloud.models.SecretArchiveReference + :ivar secret_type: The type name used to identify the purpose of the secret. + :vartype secret_type: str + """ + + expire_period_days: Optional[int] = rest_field(name="expirePeriodDays", visibility=["read"]) + """The maximum number of days the secret may be used before it must be changed.""" + last_rotation_time: Optional[datetime.datetime] = rest_field( + name="lastRotationTime", visibility=["read"], format="rfc3339" + ) + """The date and time when the secret was last changed.""" + rotation_period_days: Optional[int] = rest_field(name="rotationPeriodDays", visibility=["read"]) + """The number of days a secret exists before rotations will be attempted.""" + secret_archive_reference: Optional["_models.SecretArchiveReference"] = rest_field( + name="secretArchiveReference", visibility=["read"] + ) + """The reference to the secret in a key vault.""" + secret_type: Optional[str] = rest_field(name="secretType", visibility=["read"]) + """The type name used to identify the purpose of the secret.""" + + +class ServiceLoadBalancerBgpPeer(_Model): + """ServiceLoadBalancerBgpPeer represents the configuration of the BGP service load balancer for + the Kubernetes cluster. + + :ivar bfd_enabled: The indicator of BFD enablement for this BgpPeer. Known values are: "True" + and "False". + :vartype bfd_enabled: str or ~azure.mgmt.networkcloud.models.BfdEnabled + :ivar bgp_multi_hop: The indicator to enable multi-hop peering support. Known values are: + "True" and "False". + :vartype bgp_multi_hop: str or ~azure.mgmt.networkcloud.models.BgpMultiHop + :ivar hold_time: Field Deprecated. The field was previously optional, now it will have no + defined behavior and will be ignored. The requested BGP hold time value. This field uses ISO + 8601 duration format, for example P1H. + :vartype hold_time: str + :ivar keep_alive_time: Field Deprecated. The field was previously optional, now it will have no + defined behavior and will be ignored. The requested BGP keepalive time value. This field uses + ISO 8601 duration format, for example P1H. + :vartype keep_alive_time: str + :ivar my_asn: The autonomous system number used for the local end of the BGP session. + :vartype my_asn: int + :ivar name: The name used to identify this BGP peer for association with a BGP advertisement. + Required. + :vartype name: str + :ivar password: The authentication password for routers enforcing TCP MD5 authenticated + sessions. + :vartype password: str + :ivar peer_address: The IPv4 or IPv6 address used to connect this BGP session. Required. + :vartype peer_address: str + :ivar peer_asn: The autonomous system number expected from the remote end of the BGP session. + Required. + :vartype peer_asn: int + :ivar peer_port: The port used to connect this BGP session. + :vartype peer_port: int + """ + + bfd_enabled: Optional[Union[str, "_models.BfdEnabled"]] = rest_field( + name="bfdEnabled", visibility=["read", "create"] + ) + """The indicator of BFD enablement for this BgpPeer. Known values are: \"True\" and \"False\".""" + bgp_multi_hop: Optional[Union[str, "_models.BgpMultiHop"]] = rest_field( + name="bgpMultiHop", visibility=["read", "create"] + ) + """The indicator to enable multi-hop peering support. Known values are: \"True\" and \"False\".""" + hold_time: Optional[str] = rest_field(name="holdTime", visibility=["read", "create"]) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The requested BGP hold time value. This field uses ISO 8601 duration format, + for example P1H.""" + keep_alive_time: Optional[str] = rest_field(name="keepAliveTime", visibility=["read", "create"]) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The requested BGP keepalive time value. This field uses ISO 8601 duration + format, for example P1H.""" + my_asn: Optional[int] = rest_field(name="myAsn", visibility=["read", "create"]) + """The autonomous system number used for the local end of the BGP session.""" + name: str = rest_field(visibility=["read", "create"]) + """The name used to identify this BGP peer for association with a BGP advertisement. Required.""" + password: Optional[str] = rest_field(visibility=["create"]) + """The authentication password for routers enforcing TCP MD5 authenticated sessions.""" + peer_address: str = rest_field(name="peerAddress", visibility=["read", "create"]) + """The IPv4 or IPv6 address used to connect this BGP session. Required.""" + peer_asn: int = rest_field(name="peerAsn", visibility=["read", "create"]) + """The autonomous system number expected from the remote end of the BGP session. Required.""" + peer_port: Optional[int] = rest_field(name="peerPort", visibility=["read", "create"]) + """The port used to connect this BGP session.""" + + @overload + def __init__( + self, + *, + name: str, + peer_address: str, + peer_asn: int, + bfd_enabled: Optional[Union[str, "_models.BfdEnabled"]] = None, + bgp_multi_hop: Optional[Union[str, "_models.BgpMultiHop"]] = None, + hold_time: Optional[str] = None, + keep_alive_time: Optional[str] = None, + my_asn: Optional[int] = None, + password: Optional[str] = None, + peer_port: 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 ServicePrincipalInformation(_Model): + """ServicePrincipalInformation represents the details of the service principal to be used by the + cluster during Arc Appliance installation. + + :ivar application_id: The application ID, also known as client ID, of the service principal. + Required. + :vartype application_id: str + :ivar password: The password of the service principal. Required. + :vartype password: str + :ivar principal_id: The principal ID, also known as the object ID, of the service principal. + Required. + :vartype principal_id: str + :ivar tenant_id: The tenant ID, also known as the directory ID, of the tenant in which the + service principal is created. Required. + :vartype tenant_id: str + """ + + application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) + """The application ID, also known as client ID, of the service principal. Required.""" + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password of the service principal. Required.""" + principal_id: str = rest_field(name="principalId", visibility=["read", "create", "update", "delete", "query"]) + """The principal ID, also known as the object ID, of the service principal. Required.""" + tenant_id: str = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant ID, also known as the directory ID, of the tenant in which the service principal is + created. Required.""" + + @overload + def __init__( + self, + *, + application_id: str, + password: str, + principal_id: str, + tenant_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 SshPublicKey(_Model): + """SshPublicKey represents the public key used to authenticate with a resource through SSH. + + :ivar key_data: The SSH public key data. Required. + :vartype key_data: str + """ + + key_data: str = rest_field(name="keyData", visibility=["read", "create", "update", "delete", "query"]) + """The SSH public key data. Required.""" + + @overload + def __init__( + self, + *, + key_data: 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 StepState(_Model): + """StepState represents the state of a step in an action. + + :ivar end_time: The timestamp for when processing of the step reached its terminal state, in + ISO 8601 format. + :vartype end_time: str + :ivar message: The message providing additional context for the status value. May be empty, or + contain diagnostic information in the case of a failure. + :vartype message: str + :ivar start_time: The timestamp for when processing of the step began, in ISO 8601 format. + :vartype start_time: str + :ivar status: The status of the step. A value of Completed or Failed indicates a terminal state + for the step. Known values are: "Completed", "InProgress", "Failed", and "NotStarted". + :vartype status: str or ~azure.mgmt.networkcloud.models.StepStateStatus + :ivar step_name: The name for the step. + :vartype step_name: str + """ + + end_time: Optional[str] = rest_field(name="endTime", visibility=["read"]) + """The timestamp for when processing of the step reached its terminal state, in ISO 8601 format.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The message providing additional context for the status value. May be empty, or contain + diagnostic information in the case of a failure.""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read"]) + """The timestamp for when processing of the step began, in ISO 8601 format.""" + status: Optional[Union[str, "_models.StepStateStatus"]] = rest_field(visibility=["read"]) + """The status of the step. A value of Completed or Failed indicates a terminal state for the step. + Known values are: \"Completed\", \"InProgress\", \"Failed\", and \"NotStarted\".""" + step_name: Optional[str] = rest_field(name="stepName", visibility=["read"]) + """The name for the step.""" + + +class StorageAppliance(TrackedResource): + """StorageAppliance represents on-premises Network Cloud storage appliance. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.StorageApplianceProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.StorageApplianceProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "rack_id", + "storage_appliance_sku_id", + "rack_slot", + "serial_number", + "administrator_credentials", + "ca_certificate", + "capacity", + "capacity_used", + "cluster_id", + "detailed_status", + "detailed_status_message", + "management_ipv4_address", + "manufacturer", + "model", + "remote_vendor_management_feature", + "remote_vendor_management_status", + "secret_rotation_status", + "version", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.StorageApplianceProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 StorageApplianceCommandSpecification(_Model): + """StorageApplianceCommandSpecification represents the command and optional arguments to run. + + :ivar arguments: The list of strings that will be passed to the script in order as separate + arguments. + :vartype arguments: list[str] + :ivar command: The command to execute. Required. + :vartype command: str + """ + + arguments: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of strings that will be passed to the script in order as separate arguments.""" + command: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command to execute. Required.""" + + @overload + def __init__( + self, + *, + command: str, + arguments: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageApplianceConfigurationData(_Model): + """StorageApplianceConfigurationData represents configuration for the storage application. + + :ivar admin_credentials: The credentials of the administrative interface on this storage + appliance. The password field is expected to be an Azure Key Vault key URL. Until the cluster + is converted to utilize managed identity by setting the secret archive settings, the actual + password value should be provided instead. Required. + :vartype admin_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials + :ivar rack_slot: The slot that storage appliance is in the rack based on the BOM configuration. + Required. + :vartype rack_slot: int + :ivar serial_number: The serial number of the appliance. Required. + :vartype serial_number: str + :ivar storage_appliance_name: The user-provided name for the storage appliance that will be + created from this specification. + :vartype storage_appliance_name: str + """ + + admin_credentials: "_models.AdministrativeCredentials" = rest_field( + name="adminCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials of the administrative interface on this storage appliance. The password field + is expected to be an Azure Key Vault key URL. Until the cluster is converted to utilize managed + identity by setting the secret archive settings, the actual password value should be provided + instead. Required.""" + rack_slot: int = rest_field(name="rackSlot", visibility=["read", "create", "update", "delete", "query"]) + """The slot that storage appliance is in the rack based on the BOM configuration. Required.""" + serial_number: str = rest_field(name="serialNumber", visibility=["read", "create", "update", "delete", "query"]) + """The serial number of the appliance. Required.""" + storage_appliance_name: Optional[str] = rest_field( + name="storageApplianceName", visibility=["read", "create", "update", "delete", "query"] + ) + """The user-provided name for the storage appliance that will be created from this specification.""" + + @overload + def __init__( + self, + *, + admin_credentials: "_models.AdministrativeCredentials", + rack_slot: int, + serial_number: str, + storage_appliance_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 StorageApplianceEnableRemoteVendorManagementParameters(_Model): # pylint: disable=name-too-long + """StorageApplianceEnableRemoteVendorManagementParameters represents the body of the request to + enable remote vendor management of a storage appliance. + + :ivar support_endpoints: Field Deprecated. This field is not used and will be rejected if + provided. The list of IPv4 subnets (in CIDR format), IPv6 subnets (in CIDR format), or + hostnames that the storage appliance needs accessible in order to turn on the remote vendor + management. + :vartype support_endpoints: list[str] + """ + + support_endpoints: Optional[list[str]] = rest_field( + name="supportEndpoints", visibility=["read", "create", "update", "delete", "query"] + ) + """Field Deprecated. This field is not used and will be rejected if provided. The list of IPv4 + subnets (in CIDR format), IPv6 subnets (in CIDR format), or hostnames that the storage + appliance needs accessible in order to turn on the remote vendor management.""" + + @overload + def __init__( + self, + *, + support_endpoints: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageAppliancePatchParameters(_Model): + """StorageAppliancePatchParameters represents the body of the request to patch storage appliance + properties. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.StorageAppliancePatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.StorageAppliancePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["serial_number"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.StorageAppliancePatchProperties"] = None, + 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: + _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 StorageAppliancePatchProperties(_Model): + """StorageAppliancePatchProperties represents the properties of the storage appliance that can be + patched. + + :ivar serial_number: The serial number for the storage appliance. + :vartype serial_number: str + """ + + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The serial number for the storage appliance.""" + + @overload + def __init__( + self, + *, + serial_number: 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 StorageApplianceProperties(_Model): + """StorageApplianceProperties represents the properties of the storage appliance. + + :ivar rack_id: The resource ID of the rack where this storage appliance resides. Required. + :vartype rack_id: str + :ivar storage_appliance_sku_id: The SKU for the storage appliance. Required. + :vartype storage_appliance_sku_id: str + :ivar rack_slot: The slot the storage appliance is in the rack based on the BOM configuration. + Required. + :vartype rack_slot: int + :ivar serial_number: The serial number for the storage appliance. Required. + :vartype serial_number: str + :ivar administrator_credentials: The credentials of the administrative interface on this + storage appliance. Required. + :vartype administrator_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials + :ivar ca_certificate: The CA certificate information issued by the platform for connecting to + TLS interfaces for the storage appliance. Callers add this certificate to their trusted CA + store to allow secure communication with the storage appliance. + :vartype ca_certificate: ~azure.mgmt.networkcloud.models.CertificateInfo + :ivar capacity: The total capacity of the storage appliance. Measured in GiB. + :vartype capacity: int + :ivar capacity_used: The amount of storage consumed. Measured in GiB. + :vartype capacity_used: int + :ivar cluster_id: The resource ID of the cluster this storage appliance is associated with. + :vartype cluster_id: str + :ivar detailed_status: The detailed status of the storage appliance. Known values are: + "Available", "Degraded", "Error", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.StorageApplianceDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar management_ipv4_address: The endpoint for the management interface of the storage + appliance. + :vartype management_ipv4_address: str + :ivar manufacturer: The manufacturer of the storage appliance. + :vartype manufacturer: str + :ivar model: The model of the storage appliance. + :vartype model: str + :ivar remote_vendor_management_feature: The indicator of whether the storage appliance supports + remote vendor management. Known values are: "Supported" and "Unsupported". + :vartype remote_vendor_management_feature: str or + ~azure.mgmt.networkcloud.models.RemoteVendorManagementFeature + :ivar remote_vendor_management_status: The indicator of whether the remote vendor management + feature is enabled or disabled, or unsupported if it is an unsupported feature. Known values + are: "Enabled", "Disabled", and "Unsupported". + :vartype remote_vendor_management_status: str or + ~azure.mgmt.networkcloud.models.RemoteVendorManagementStatus + :ivar secret_rotation_status: The list of statuses that represent secret rotation activity. + :vartype secret_rotation_status: list[~azure.mgmt.networkcloud.models.SecretRotationStatus] + :ivar version: The version of the storage appliance. + :vartype version: str + :ivar provisioning_state: The provisioning state of the storage appliance. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.StorageApplianceProvisioningState + """ + + rack_id: str = rest_field(name="rackId", visibility=["read", "create"]) + """The resource ID of the rack where this storage appliance resides. Required.""" + storage_appliance_sku_id: str = rest_field(name="storageApplianceSkuId", visibility=["read", "create"]) + """The SKU for the storage appliance. Required.""" + rack_slot: int = rest_field(name="rackSlot", visibility=["read", "create"]) + """The slot the storage appliance is in the rack based on the BOM configuration. Required.""" + serial_number: str = rest_field(name="serialNumber", visibility=["read", "create", "update", "delete", "query"]) + """The serial number for the storage appliance. Required.""" + administrator_credentials: "_models.AdministrativeCredentials" = rest_field( + name="administratorCredentials", visibility=["read", "create"] + ) + """The credentials of the administrative interface on this storage appliance. Required.""" + ca_certificate: Optional["_models.CertificateInfo"] = rest_field(name="caCertificate", visibility=["read"]) + """The CA certificate information issued by the platform for connecting to TLS interfaces for the + storage appliance. Callers add this certificate to their trusted CA store to allow secure + communication with the storage appliance.""" + capacity: Optional[int] = rest_field(visibility=["read"]) + """The total capacity of the storage appliance. Measured in GiB.""" + capacity_used: Optional[int] = rest_field(name="capacityUsed", visibility=["read"]) + """The amount of storage consumed. Measured in GiB.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the cluster this storage appliance is associated with.""" + detailed_status: Optional[Union[str, "_models.StorageApplianceDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The detailed status of the storage appliance. Known values are: \"Available\", \"Degraded\", + \"Error\", and \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + management_ipv4_address: Optional[str] = rest_field(name="managementIpv4Address", visibility=["read"]) + """The endpoint for the management interface of the storage appliance.""" + manufacturer: Optional[str] = rest_field(visibility=["read"]) + """The manufacturer of the storage appliance.""" + model: Optional[str] = rest_field(visibility=["read"]) + """The model of the storage appliance.""" + remote_vendor_management_feature: Optional[Union[str, "_models.RemoteVendorManagementFeature"]] = rest_field( + name="remoteVendorManagementFeature", visibility=["read"] + ) + """The indicator of whether the storage appliance supports remote vendor management. Known values + are: \"Supported\" and \"Unsupported\".""" + remote_vendor_management_status: Optional[Union[str, "_models.RemoteVendorManagementStatus"]] = rest_field( + name="remoteVendorManagementStatus", visibility=["read"] + ) + """The indicator of whether the remote vendor management feature is enabled or disabled, or + unsupported if it is an unsupported feature. Known values are: \"Enabled\", \"Disabled\", and + \"Unsupported\".""" + secret_rotation_status: Optional[list["_models.SecretRotationStatus"]] = rest_field( + name="secretRotationStatus", visibility=["read"] + ) + """The list of statuses that represent secret rotation activity.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version of the storage appliance.""" + provisioning_state: Optional[Union[str, "_models.StorageApplianceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the storage appliance. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + rack_id: str, + storage_appliance_sku_id: str, + rack_slot: int, + serial_number: str, + administrator_credentials: "_models.AdministrativeCredentials", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 StorageApplianceRunReadCommandsParameters(_Model): # pylint: disable=name-too-long + """StorageApplianceRunReadCommandsParameters represents the body of request containing list of + read-only commands to run on the storage appliance. + + :ivar commands: The list of read-only commands to be executed directly against the target + storage appliance. Required. + :vartype commands: list[~azure.mgmt.networkcloud.models.StorageApplianceCommandSpecification] + :ivar limit_time_seconds: The maximum time the commands are allowed to run. Required. + :vartype limit_time_seconds: int + """ + + commands: list["_models.StorageApplianceCommandSpecification"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of read-only commands to be executed directly against the target storage appliance. + Required.""" + limit_time_seconds: int = rest_field( + name="limitTimeSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum time the commands are allowed to run. Required.""" + + @overload + def __init__( + self, + *, + commands: list["_models.StorageApplianceCommandSpecification"], + limit_time_seconds: 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 StorageApplianceSkuProperties(_Model): + """StorageApplianceSkuProperties represents the properties of the storage appliance SKU. + + :ivar capacity_gb: The maximum capacity of the storage appliance. Measured in gibibytes. + :vartype capacity_gb: int + :ivar model: The model of the storage appliance. + :vartype model: str + """ + + capacity_gb: Optional[int] = rest_field(name="capacityGB", visibility=["read"]) + """The maximum capacity of the storage appliance. Measured in gibibytes.""" + model: Optional[str] = rest_field(visibility=["read"]) + """The model of the storage appliance.""" + + +class StorageApplianceSkuSlot(_Model): + """StorageApplianceSkuSlot represents the single SKU and rack slot associated with the storage + appliance. + + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.StorageApplianceSkuProperties + :ivar rack_slot: The position in the rack for the storage appliance. + :vartype rack_slot: int + """ + + properties: Optional["_models.StorageApplianceSkuProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + rack_slot: Optional[int] = rest_field(name="rackSlot", visibility=["read"]) + """The position in the rack for the storage appliance.""" + + __flattened_items = ["capacity_gb", "model"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.StorageApplianceSkuProperties"] = 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 StorageProfile(_Model): + """StorageProfile represents information about a disk. + + :ivar os_disk: The disk to use with this virtual machine. Required. + :vartype os_disk: ~azure.mgmt.networkcloud.models.OsDisk + :ivar volume_attachments: The resource IDs of volumes that are requested to be attached to the + virtual machine. + :vartype volume_attachments: list[str] + """ + + os_disk: "_models.OsDisk" = rest_field(name="osDisk", visibility=["read", "create", "update", "delete", "query"]) + """The disk to use with this virtual machine. Required.""" + volume_attachments: Optional[list[str]] = rest_field( + name="volumeAttachments", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource IDs of volumes that are requested to be attached to the virtual machine.""" + + @overload + def __init__( + self, + *, + os_disk: "_models.OsDisk", + volume_attachments: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StringKeyValuePair(_Model): + """StringKeyValuePair represents a single entry in a mapping of keys to values. + + :ivar key: The key to the mapped value. Required. + :vartype key: str + :ivar value: The value of the mapping key. Required. + :vartype value: str + """ + + key: str = rest_field(visibility=["read", "create"]) + """The key to the mapped value. Required.""" + value: str = rest_field(visibility=["read", "create"]) + """The value of the mapping key. Required.""" + + @overload + def __init__( + self, + *, + key: str, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.networkcloud.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.networkcloud.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 TrunkedNetwork(TrackedResource): + """TrunkedNetwork represents a network that utilizes multiple isolation domains and specified + VLANs to create a trunked network. + + :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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.TrunkedNetworkProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.TrunkedNetworkProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "hybrid_aks_plugin_type", + "interface_name", + "isolation_domain_ids", + "vlans", + "associated_resource_ids", + "cluster_id", + "detailed_status", + "detailed_status_message", + "hybrid_aks_clusters_associated_ids", + "virtual_machines_associated_ids", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.TrunkedNetworkProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 TrunkedNetworkAttachmentConfiguration(_Model): + """TrunkedNetworkAttachmentConfiguration represents the configuration of the attachment of a + trunked network. + + :ivar network_id: The resource ID of the network that is being configured for attachment. + Required. + :vartype network_id: str + :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes + cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". + :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType + """ + + network_id: str = rest_field(name="networkId", visibility=["read", "create"]) + """The resource ID of the network that is being configured for attachment. Required.""" + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = rest_field( + name="pluginType", visibility=["read", "create"] + ) + """The indicator of how this network will be utilized by the Kubernetes cluster. Known values are: + \"DPDK\", \"SRIOV\", \"OSDevice\", \"MACVLAN\", and \"IPVLAN\".""" + + @overload + def __init__( + self, + *, + network_id: str, + plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = 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 TrunkedNetworkPatchParameters(_Model): + """TrunkedNetworkPatchParameters represents the body of the request to patch the Trunked network. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrunkedNetworkProperties(_Model): + """TrunkedNetworkProperties represents properties of the trunked network. + + :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will + have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known + values are: "DPDK", "SRIOV", and "OSDevice". + :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType + :ivar interface_name: The default interface name for this trunked network in the virtual + machine. This name can be overridden by the name supplied in the network attachment + configuration of that virtual machine. + :vartype interface_name: str + :ivar isolation_domain_ids: The list of resource IDs representing the Network Fabric isolation + domains. It can be any combination of l2IsolationDomain and l3IsolationDomain resources. + Required. + :vartype isolation_domain_ids: list[str] + :ivar vlans: The list of vlans that are selected from the isolation domains for trunking. + Required. + :vartype vlans: list[int] + :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud + resources that have attached this network. + :vartype associated_resource_ids: list[str] + :ivar cluster_id: The resource ID of the Network Cloud cluster this trunked network is + associated with. + :vartype cluster_id: str + :ivar detailed_status: The more detailed status of the trunked network. Known values are: + "Error", "Available", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.TrunkedNetworkDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of Hybrid AKS cluster resource IDs that are associated with this trunked network. + :vartype hybrid_aks_clusters_associated_ids: list[str] + :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. + The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are + currently using this trunked network. + :vartype virtual_machines_associated_ids: list[str] + :ivar provisioning_state: The provisioning state of the trunked network. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.TrunkedNetworkProvisioningState + """ + + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = rest_field( + name="hybridAksPluginType", visibility=["read", "create"] + ) + """Field Deprecated. The field was previously optional, now it will have no defined behavior and + will be ignored. The network plugin type for Hybrid AKS. Known values are: \"DPDK\", \"SRIOV\", + and \"OSDevice\".""" + interface_name: Optional[str] = rest_field(name="interfaceName", visibility=["read", "create"]) + """The default interface name for this trunked network in the virtual machine. This name can be + overridden by the name supplied in the network attachment configuration of that virtual + machine.""" + isolation_domain_ids: list[str] = rest_field(name="isolationDomainIds", visibility=["read", "create"]) + """The list of resource IDs representing the Network Fabric isolation domains. It can be any + combination of l2IsolationDomain and l3IsolationDomain resources. Required.""" + vlans: list[int] = rest_field(visibility=["read", "create"]) + """The list of vlans that are selected from the isolation domains for trunking. Required.""" + associated_resource_ids: Optional[list[str]] = rest_field(name="associatedResourceIds", visibility=["read"]) + """The list of resource IDs for the other Microsoft.NetworkCloud resources that have attached this + network.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the Network Cloud cluster this trunked network is associated with.""" + detailed_status: Optional[Union[str, "_models.TrunkedNetworkDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the trunked network. Known values are: \"Error\", \"Available\", + and \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + hybrid_aks_clusters_associated_ids: Optional[list[str]] = rest_field( + name="hybridAksClustersAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of Hybrid AKS cluster resource + IDs that are associated with this trunked network.""" + virtual_machines_associated_ids: Optional[list[str]] = rest_field( + name="virtualMachinesAssociatedIds", visibility=["read"] + ) + """Field Deprecated. These fields will be empty/omitted. The list of virtual machine resource IDs, + excluding any Hybrid AKS virtual machines, that are currently using this trunked network.""" + provisioning_state: Optional[Union[str, "_models.TrunkedNetworkProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the trunked network. Known values are: \"Succeeded\", \"Failed\", + \"Canceled\", \"Provisioning\", and \"Accepted\".""" + + @overload + def __init__( + self, + *, + isolation_domain_ids: list[str], + vlans: list[int], + hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, + interface_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 UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class ValidationThreshold(_Model): + """ValidationThreshold indicates allowed machine and node hardware and deployment failures. + + :ivar grouping: Selection of how the type evaluation is applied to the cluster calculation. + Required. Known values are: "PerCluster" and "PerRack". + :vartype grouping: str or ~azure.mgmt.networkcloud.models.ValidationThresholdGrouping + :ivar type: Selection of how the threshold should be evaluated. Required. Known values are: + "CountSuccess" and "PercentSuccess". + :vartype type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType + :ivar value: The numeric threshold value. Required. + :vartype value: int + """ + + grouping: Union[str, "_models.ValidationThresholdGrouping"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Selection of how the type evaluation is applied to the cluster calculation. Required. Known + values are: \"PerCluster\" and \"PerRack\".""" + type: Union[str, "_models.ValidationThresholdType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Selection of how the threshold should be evaluated. Required. Known values are: + \"CountSuccess\" and \"PercentSuccess\".""" + value: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The numeric threshold value. Required.""" + + @overload + def __init__( + self, + *, + grouping: Union[str, "_models.ValidationThresholdGrouping"], + type: Union[str, "_models.ValidationThresholdType"], + value: 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 VirtualMachine(TrackedResource): + """VirtualMachine represents the on-premises Network Cloud virtual machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.VirtualMachineProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + """ + + properties: "_models.VirtualMachineProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "admin_username", + "boot_method", + "cloud_services_network_attachment", + "cpu_cores", + "isolate_emulator_thread", + "memory_size_gb", + "network_attachments", + "network_data", + "network_data_content", + "placement_hints", + "ssh_public_keys", + "storage_profile", + "user_data", + "user_data_content", + "virtio_interface", + "vm_device_model", + "vm_image", + "vm_image_repository_credentials", + "availability_zone", + "bare_metal_machine_id", + "cluster_id", + "console_extended_location", + "detailed_status", + "detailed_status_message", + "power_state", + "volumes", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.VirtualMachineProperties", + extended_location: "_models.ExtendedLocation", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 VirtualMachineAssignRelayParameters(_Model): + """VirtualMachineAssignRelayParameters represents the body of the request to update the relay used + for a Microsoft.HybridCompute machine associated with the virtual machine. + + :ivar machine_id: The resourceId of the Microsoft.HybridCompute machine resource to assign + relay usage. Required. + :vartype machine_id: str + :ivar relay_type: The indicator of which relay type the machine should be assigned to use. + Platform indicates the use of a platform-dedicated relay. Public indicates the use of the + standard public relay for Arc services. Known values are: "Platform" and "Public". + :vartype relay_type: str or ~azure.mgmt.networkcloud.models.RelayType + """ + + machine_id: str = rest_field(name="machineId", visibility=["read", "create"]) + """The resourceId of the Microsoft.HybridCompute machine resource to assign relay usage. Required.""" + relay_type: Optional[Union[str, "_models.RelayType"]] = rest_field( + name="relayType", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of which relay type the machine should be assigned to use. Platform indicates the + use of a platform-dedicated relay. Public indicates the use of the standard public relay for + Arc services. Known values are: \"Platform\" and \"Public\".""" + + @overload + def __init__( + self, + *, + machine_id: str, + relay_type: Optional[Union[str, "_models.RelayType"]] = 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 VirtualMachinePatchParameters(_Model): + """VirtualMachinePatchParameters represents the body of the request to patch the virtual machine. + + :ivar identity: The identity for the resource. + :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity + :ivar properties: The list of the resource properties. + :vartype properties: ~azure.mgmt.networkcloud.models.VirtualMachinePatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity for the resource.""" + properties: Optional["_models.VirtualMachinePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + __flattened_items = ["vm_image_repository_credentials"] + + @overload + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.VirtualMachinePatchProperties"] = None, + 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: + _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 VirtualMachinePatchProperties(_Model): + """VirtualMachinePatchProperties represents the properties of the virtual machine that can be + patched. + + :ivar vm_image_repository_credentials: The credentials used to login to the image repository + that has access to the specified image. + :vartype vm_image_repository_credentials: + ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials + """ + + vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = rest_field( + name="vmImageRepositoryCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials used to login to the image repository that has access to the specified image.""" + + @overload + def __init__( + self, + *, + vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = 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 VirtualMachinePlacementHint(_Model): + """VirtualMachinePlacementHint represents a single scheduling hint of the virtual machine. + + :ivar hint_type: The specification of whether this hint supports affinity or anti-affinity with + the referenced resources. Required. Known values are: "Affinity" and "AntiAffinity". + :vartype hint_type: str or ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintType + :ivar resource_id: The resource ID of the target object that the placement hints will be + checked against, e.g., the bare metal node to host the virtual machine. Required. + :vartype resource_id: str + :ivar scheduling_execution: The indicator of whether the hint is a hard or soft requirement + during scheduling. Required. Known values are: "Hard" and "Soft". + :vartype scheduling_execution: str or + ~azure.mgmt.networkcloud.models.VirtualMachineSchedulingExecution + :ivar scope: The scope for the virtual machine affinity or anti-affinity placement hint. It + should always be "Machine" in the case of node affinity. Required. Known values are: "Machine" + and "Rack". + :vartype scope: str or + ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope + """ + + hint_type: Union[str, "_models.VirtualMachinePlacementHintType"] = rest_field( + name="hintType", visibility=["read", "create"] + ) + """The specification of whether this hint supports affinity or anti-affinity with the referenced + resources. Required. Known values are: \"Affinity\" and \"AntiAffinity\".""" + resource_id: str = rest_field(name="resourceId", visibility=["read", "create"]) + """The resource ID of the target object that the placement hints will be checked against, e.g., + the bare metal node to host the virtual machine. Required.""" + scheduling_execution: Union[str, "_models.VirtualMachineSchedulingExecution"] = rest_field( + name="schedulingExecution", visibility=["read", "create"] + ) + """The indicator of whether the hint is a hard or soft requirement during scheduling. Required. + Known values are: \"Hard\" and \"Soft\".""" + scope: Union[str, "_models.VirtualMachinePlacementHintPodAffinityScope"] = rest_field(visibility=["read", "create"]) + """The scope for the virtual machine affinity or anti-affinity placement hint. It should always be + \"Machine\" in the case of node affinity. Required. Known values are: \"Machine\" and \"Rack\".""" + + @overload + def __init__( + self, + *, + hint_type: Union[str, "_models.VirtualMachinePlacementHintType"], + resource_id: str, + scheduling_execution: Union[str, "_models.VirtualMachineSchedulingExecution"], + scope: Union[str, "_models.VirtualMachinePlacementHintPodAffinityScope"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[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 VirtualMachinePowerOffParameters(_Model): + """VirtualMachinePowerOffParameters represents the body of the request to power off virtual + machine. + + :ivar skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off + the virtual machine immediately. Known values are: "True" and "False". + :vartype skip_shutdown: str or ~azure.mgmt.networkcloud.models.SkipShutdown + """ + + skip_shutdown: Optional[Union[str, "_models.SkipShutdown"]] = rest_field( + name="skipShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """The indicator of whether to skip the graceful OS shutdown and power off the virtual machine + immediately. Known values are: \"True\" and \"False\".""" + + @overload + def __init__( + self, + *, + skip_shutdown: Optional[Union[str, "_models.SkipShutdown"]] = 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 VirtualMachineProperties(_Model): + """VirtualMachineProperties represents the properties of the virtual machine. + + :ivar admin_username: The name of the administrator to which the ssh public keys will be added + into the authorized keys. Required. + :vartype admin_username: str + :ivar boot_method: Selects the boot method for the virtual machine. Known values are: "BIOS" + and "UEFI". + :vartype boot_method: str or ~azure.mgmt.networkcloud.models.VirtualMachineBootMethod + :ivar cloud_services_network_attachment: The cloud service network that provides platform-level + services for the virtual machine. Required. + :vartype cloud_services_network_attachment: ~azure.mgmt.networkcloud.models.NetworkAttachment + :ivar cpu_cores: The number of CPU cores in the virtual machine. Required. + :vartype cpu_cores: int + :ivar isolate_emulator_thread: Field Deprecated, the value will be ignored if provided. The + indicator of whether one of the specified CPU cores is isolated to run the emulator thread for + this virtual machine. Known values are: "False" and "True". + :vartype isolate_emulator_thread: str or + ~azure.mgmt.networkcloud.models.VirtualMachineIsolateEmulatorThread + :ivar memory_size_gb: The memory size of the virtual machine. Allocations are measured in + gibibytes. Required. + :vartype memory_size_gb: int + :ivar network_attachments: The list of network attachments to the virtual machine. + :vartype network_attachments: list[~azure.mgmt.networkcloud.models.NetworkAttachment] + :ivar network_data: Field Deprecated: The Base64 encoded cloud-init network data. The + networkDataContent property will be used in preference to this property. + :vartype network_data: str + :ivar network_data_content: The Base64 encoded cloud-init network data. + :vartype network_data_content: str + :ivar placement_hints: The scheduling hints for the virtual machine. + :vartype placement_hints: list[~azure.mgmt.networkcloud.models.VirtualMachinePlacementHint] + :ivar ssh_public_keys: The list of ssh public keys. Each key will be added to the virtual + machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername. + :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] + :ivar storage_profile: The storage profile that specifies size and other parameters about the + disks related to the virtual machine. Required. + :vartype storage_profile: ~azure.mgmt.networkcloud.models.StorageProfile + :ivar user_data: Field Deprecated: The Base64 encoded cloud-init user data. The userDataContent + property will be used in preference to this property. + :vartype user_data: str + :ivar user_data_content: The Base64 encoded cloud-init user data. + :vartype user_data_content: str + :ivar virtio_interface: Field Deprecated, use virtualizationModel instead. The type of the + virtio interface. Known values are: "Modern" and "Transitional". + :vartype virtio_interface: str or + ~azure.mgmt.networkcloud.models.VirtualMachineVirtioInterfaceType + :ivar vm_device_model: The type of the device model to use. Known values are: "T1", "T2", and + "T3". + :vartype vm_device_model: str or ~azure.mgmt.networkcloud.models.VirtualMachineDeviceModelType + :ivar vm_image: The virtual machine image that is currently provisioned to the OS disk, using + the full url and tag notation used to pull the image. Required. + :vartype vm_image: str + :ivar vm_image_repository_credentials: The credentials used to login to the image repository + that has access to the specified image. + :vartype vm_image_repository_credentials: + ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials + :ivar availability_zone: The cluster availability zone containing this virtual machine. + :vartype availability_zone: str + :ivar bare_metal_machine_id: The resource ID of the bare metal machine that hosts the virtual + machine. + :vartype bare_metal_machine_id: str + :ivar cluster_id: The resource ID of the cluster the virtual machine is created for. + :vartype cluster_id: str + :ivar console_extended_location: The extended location to use for creation of a VM console + resource. + :vartype console_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + :ivar detailed_status: The more detailed status of the virtual machine. Known values are: + "Available", "Error", "Provisioning", "Running", "Scheduling", "Stopped", "Terminating", and + "Unknown". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.VirtualMachineDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar power_state: The power state of the virtual machine. Known values are: "Off", "On", and + "Unknown". + :vartype power_state: str or ~azure.mgmt.networkcloud.models.VirtualMachinePowerState + :ivar volumes: The resource IDs of volumes that are attached to the virtual machine. + :vartype volumes: list[str] + :ivar provisioning_state: The provisioning state of the virtual machine. Known values are: + "Accepted", "Canceled", "Failed", "Provisioning", and "Succeeded". + :vartype provisioning_state: str or + ~azure.mgmt.networkcloud.models.VirtualMachineProvisioningState + """ + + admin_username: str = rest_field(name="adminUsername", visibility=["read", "create"]) + """The name of the administrator to which the ssh public keys will be added into the authorized + keys. Required.""" + boot_method: Optional[Union[str, "_models.VirtualMachineBootMethod"]] = rest_field( + name="bootMethod", visibility=["read", "create"] + ) + """Selects the boot method for the virtual machine. Known values are: \"BIOS\" and \"UEFI\".""" + cloud_services_network_attachment: "_models.NetworkAttachment" = rest_field( + name="cloudServicesNetworkAttachment", visibility=["read", "create"] + ) + """The cloud service network that provides platform-level services for the virtual machine. + Required.""" + cpu_cores: int = rest_field(name="cpuCores", visibility=["read", "create"]) + """The number of CPU cores in the virtual machine. Required.""" + isolate_emulator_thread: Optional[Union[str, "_models.VirtualMachineIsolateEmulatorThread"]] = rest_field( + name="isolateEmulatorThread", visibility=["read", "create"] + ) + """Field Deprecated, the value will be ignored if provided. The indicator of whether one of the + specified CPU cores is isolated to run the emulator thread for this virtual machine. Known + values are: \"False\" and \"True\".""" + memory_size_gb: int = rest_field(name="memorySizeGB", visibility=["read", "create"]) + """The memory size of the virtual machine. Allocations are measured in gibibytes. Required.""" + network_attachments: Optional[list["_models.NetworkAttachment"]] = rest_field( + name="networkAttachments", visibility=["read", "create"] + ) + """The list of network attachments to the virtual machine.""" + network_data: Optional[str] = rest_field(name="networkData", visibility=["read", "create"]) + """Field Deprecated: The Base64 encoded cloud-init network data. The networkDataContent property + will be used in preference to this property.""" + network_data_content: Optional[str] = rest_field(name="networkDataContent", visibility=["read", "create"]) + """The Base64 encoded cloud-init network data.""" + placement_hints: Optional[list["_models.VirtualMachinePlacementHint"]] = rest_field( + name="placementHints", visibility=["read", "create"] + ) + """The scheduling hints for the virtual machine.""" + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = rest_field( + name="sshPublicKeys", visibility=["read", "create"] + ) + """The list of ssh public keys. Each key will be added to the virtual machine using the cloud-init + ssh_authorized_keys mechanism for the adminUsername.""" + storage_profile: "_models.StorageProfile" = rest_field(name="storageProfile", visibility=["read", "create"]) + """The storage profile that specifies size and other parameters about the disks related to the + virtual machine. Required.""" + user_data: Optional[str] = rest_field(name="userData", visibility=["read", "create"]) + """Field Deprecated: The Base64 encoded cloud-init user data. The userDataContent property will be + used in preference to this property.""" + user_data_content: Optional[str] = rest_field(name="userDataContent", visibility=["read", "create"]) + """The Base64 encoded cloud-init user data.""" + virtio_interface: Optional[Union[str, "_models.VirtualMachineVirtioInterfaceType"]] = rest_field( + name="virtioInterface", visibility=["read", "create"] + ) + """Field Deprecated, use virtualizationModel instead. The type of the virtio interface. Known + values are: \"Modern\" and \"Transitional\".""" + vm_device_model: Optional[Union[str, "_models.VirtualMachineDeviceModelType"]] = rest_field( + name="vmDeviceModel", visibility=["read", "create"] + ) + """The type of the device model to use. Known values are: \"T1\", \"T2\", and \"T3\".""" + vm_image: str = rest_field(name="vmImage", visibility=["read", "create"]) + """The virtual machine image that is currently provisioned to the OS disk, using the full url and + tag notation used to pull the image. Required.""" + vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = rest_field( + name="vmImageRepositoryCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials used to login to the image repository that has access to the specified image.""" + availability_zone: Optional[str] = rest_field(name="availabilityZone", visibility=["read"]) + """The cluster availability zone containing this virtual machine.""" + bare_metal_machine_id: Optional[str] = rest_field(name="bareMetalMachineId", visibility=["read"]) + """The resource ID of the bare metal machine that hosts the virtual machine.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """The resource ID of the cluster the virtual machine is created for.""" + console_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="consoleExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location to use for creation of a VM console resource.""" + detailed_status: Optional[Union[str, "_models.VirtualMachineDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the virtual machine. Known values are: \"Available\", \"Error\", + \"Provisioning\", \"Running\", \"Scheduling\", \"Stopped\", \"Terminating\", and \"Unknown\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + power_state: Optional[Union[str, "_models.VirtualMachinePowerState"]] = rest_field( + name="powerState", visibility=["read"] + ) + """The power state of the virtual machine. Known values are: \"Off\", \"On\", and \"Unknown\".""" + volumes: Optional[list[str]] = rest_field(visibility=["read"]) + """The resource IDs of volumes that are attached to the virtual machine.""" + provisioning_state: Optional[Union[str, "_models.VirtualMachineProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the virtual machine. Known values are: \"Accepted\", \"Canceled\", + \"Failed\", \"Provisioning\", and \"Succeeded\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + admin_username: str, + cloud_services_network_attachment: "_models.NetworkAttachment", + cpu_cores: int, + memory_size_gb: int, + storage_profile: "_models.StorageProfile", + vm_image: str, + boot_method: Optional[Union[str, "_models.VirtualMachineBootMethod"]] = None, + isolate_emulator_thread: Optional[Union[str, "_models.VirtualMachineIsolateEmulatorThread"]] = None, + network_attachments: Optional[list["_models.NetworkAttachment"]] = None, + network_data: Optional[str] = None, + network_data_content: Optional[str] = None, + placement_hints: Optional[list["_models.VirtualMachinePlacementHint"]] = None, + ssh_public_keys: Optional[list["_models.SshPublicKey"]] = None, + user_data: Optional[str] = None, + user_data_content: Optional[str] = None, + virtio_interface: Optional[Union[str, "_models.VirtualMachineVirtioInterfaceType"]] = None, + vm_device_model: Optional[Union[str, "_models.VirtualMachineDeviceModelType"]] = None, + vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = None, + console_extended_location: Optional["_models.ExtendedLocation"] = 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 Volume(TrackedResource): + """Volume represents storage made available for use by resources running on 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: 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.networkcloud.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 list of the resource properties. Required. + :vartype properties: ~azure.mgmt.networkcloud.models.VolumeProperties + :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 extended_location: The extended location of the resource. This property is required when + creating the resource. Required. + :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation + """ + + properties: "_models.VolumeProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of the resource properties. Required.""" + 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.\").""" + extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) + """The extended location of the resource. This property is required when creating the resource. + Required.""" + + __flattened_items = [ + "size_mi_b", + "storage_appliance_id", + "allocated_size_mi_b", + "attached_to", + "detailed_status", + "detailed_status_message", + "serial_number", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.VolumeProperties", + extended_location: "_models.ExtendedLocation", + 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: + _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 VolumePatchParameters(_Model): + """VolumePatchParameters represents the body of the request to patch the volume resource. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VolumeProperties(_Model): + """VolumeProperties represents properties of the volume resource. + + :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. Required. + :vartype size_mi_b: int + :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the volume. + :vartype storage_appliance_id: str + :ivar allocated_size_mi_b: The allocated size of the volume in Mebibytes. + :vartype allocated_size_mi_b: int + :ivar attached_to: The list of resource IDs that attach the volume. It may include virtual + machines and Hybrid AKS clusters. + :vartype attached_to: list[str] + :ivar detailed_status: The more detailed status of the volume. Known values are: "Active", + "Error", and "Provisioning". + :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.VolumeDetailedStatus + :ivar detailed_status_message: The descriptive message about the current detailed status. + :vartype detailed_status_message: str + :ivar serial_number: The unique identifier of the volume. + :vartype serial_number: str + :ivar provisioning_state: The provisioning state of the volume. Known values are: "Accepted", + "Canceled", "Failed", "Provisioning", and "Succeeded". + :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.VolumeProvisioningState + """ + + size_mi_b: int = rest_field(name="sizeMiB", visibility=["read", "create", "update", "delete", "query"]) + """The requested storage allocation for the volume in Mebibytes. Required.""" + storage_appliance_id: Optional[str] = rest_field( + name="storageApplianceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the storage appliance that hosts the volume.""" + allocated_size_mi_b: Optional[int] = rest_field(name="allocatedSizeMiB", visibility=["read"]) + """The allocated size of the volume in Mebibytes.""" + attached_to: Optional[list[str]] = rest_field(name="attachedTo", visibility=["read"]) + """The list of resource IDs that attach the volume. It may include virtual machines and Hybrid AKS + clusters.""" + detailed_status: Optional[Union[str, "_models.VolumeDetailedStatus"]] = rest_field( + name="detailedStatus", visibility=["read"] + ) + """The more detailed status of the volume. Known values are: \"Active\", \"Error\", and + \"Provisioning\".""" + detailed_status_message: Optional[str] = rest_field(name="detailedStatusMessage", visibility=["read"]) + """The descriptive message about the current detailed status.""" + serial_number: Optional[str] = rest_field(name="serialNumber", visibility=["read"]) + """The unique identifier of the volume.""" + provisioning_state: Optional[Union[str, "_models.VolumeProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the volume. Known values are: \"Accepted\", \"Canceled\", \"Failed\", + \"Provisioning\", and \"Succeeded\".""" + + @overload + def __init__( + self, + *, + size_mi_b: int, + storage_appliance_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 VulnerabilityScanningSettings(_Model): + """VulnerabilityScanningSettings represents the settings for how security vulnerability scanning + is applied to the cluster. + + :ivar container_scan: The mode selection for container vulnerability scanning. Known values + are: "Disabled" and "Enabled". + :vartype container_scan: str or + ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan + """ + + container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = rest_field( + name="containerScan", visibility=["read", "create", "update", "delete", "query"] + ) + """The mode selection for container vulnerability scanning. Known values are: \"Disabled\" and + \"Enabled\".""" + + @overload + def __init__( + self, + *, + container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = 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 VulnerabilityScanningSettingsPatch(_Model): + """VulnerabilityScanningSettingsPatch represents the settings for how security vulnerability + scanning is applied to the cluster. + + :ivar container_scan: The mode selection for container vulnerability scanning. Known values + are: "Disabled" and "Enabled". + :vartype container_scan: str or + ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan + """ + + container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = rest_field( + name="containerScan", visibility=["read", "create", "update", "delete", "query"] + ) + """The mode selection for container vulnerability scanning. Known values are: \"Disabled\" and + \"Enabled\".""" + + @overload + def __init__( + self, + *, + container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models_py3.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models_py3.py deleted file mode 100644 index 049f06dcef2b..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_models_py3.py +++ /dev/null @@ -1,9763 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class AadConfiguration(_serialization.Model): - """AadConfiguration represents the Azure Active Directory Integration properties. - - All required parameters must be populated in order to send to server. - - :ivar admin_group_object_ids: The list of Azure Active Directory group object IDs that will - have an administrative role on the Kubernetes cluster. Required. - :vartype admin_group_object_ids: list[str] - """ - - _validation = { - "admin_group_object_ids": {"required": True, "min_items": 1}, - } - - _attribute_map = { - "admin_group_object_ids": {"key": "adminGroupObjectIds", "type": "[str]"}, - } - - def __init__(self, *, admin_group_object_ids: list[str], **kwargs: Any) -> None: - """ - :keyword admin_group_object_ids: The list of Azure Active Directory group object IDs that will - have an administrative role on the Kubernetes cluster. Required. - :paramtype admin_group_object_ids: list[str] - """ - super().__init__(**kwargs) - self.admin_group_object_ids = admin_group_object_ids - - -class ActionState(_serialization.Model): - """ActionState represents the state of an action taken against a resource. This can be used to - represent both explicitly and implicitly defined action types. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar action_type: The representation of the action for which this is a status. Matches ARM - resource action format when the action is an ARM-based action. - :vartype action_type: str - :ivar correlation_id: The correlation ID for the original action request. Omitted if there is - no related correlation ID. - :vartype correlation_id: str - :ivar end_time: The timestamp of when the action reached its final, terminal state. Uses ISO - 8601 format. - :vartype end_time: str - :ivar message: The description providing additional context for the status value. May be empty - or contain guidance in the case of a failure. - :vartype message: str - :ivar start_time: The timestamp of when the action began, in ISO 8601 format. - :vartype start_time: str - :ivar status: The status of the action. Known values are: "Completed", "InProgress", and - "Failed". - :vartype status: str or ~azure.mgmt.networkcloud.models.ActionStateStatus - :ivar step_states: The ordered list of the individual steps which make up the action. - :vartype step_states: list[~azure.mgmt.networkcloud.models.StepState] - """ - - _validation = { - "action_type": {"readonly": True}, - "correlation_id": {"readonly": True}, - "end_time": {"readonly": True}, - "message": {"readonly": True}, - "start_time": {"readonly": True}, - "status": {"readonly": True}, - "step_states": {"readonly": True}, - } - - _attribute_map = { - "action_type": {"key": "actionType", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "end_time": {"key": "endTime", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "step_states": {"key": "stepStates", "type": "[StepState]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.action_type: Optional[str] = None - self.correlation_id: Optional[str] = None - self.end_time: Optional[str] = None - self.message: Optional[str] = None - self.start_time: Optional[str] = None - self.status: Optional[Union[str, "_models.ActionStateStatus"]] = None - self.step_states: Optional[list["_models.StepState"]] = None - - -class AdministrativeCredentials(_serialization.Model): - """AdministrativeCredentials represents the admin credentials for the device requiring - password-based authentication. - - All required parameters must be populated in order to send to server. - - :ivar password: The password of the administrator of the device used during initialization. - Required. - :vartype password: str - :ivar username: The username of the administrator of the device used during initialization. - Required. - :vartype username: str - """ - - _validation = { - "password": {"required": True, "min_length": 1}, - "username": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "password": {"key": "password", "type": "str"}, - "username": {"key": "username", "type": "str"}, - } - - def __init__(self, *, password: str, username: str, **kwargs: Any) -> None: - """ - :keyword password: The password of the administrator of the device used during initialization. - Required. - :paramtype password: str - :keyword username: The username of the administrator of the device used during initialization. - Required. - :paramtype username: str - """ - super().__init__(**kwargs) - self.password = password - self.username = username - - -class AdministratorConfiguration(_serialization.Model): - """AdministratorConfiguration represents the administrative credentials that will be applied to - the control plane and agent pool nodes in Kubernetes clusters. - - :ivar admin_username: The user name for the administrator that will be applied to the operating - systems that run Kubernetes nodes. If not supplied, a user name will be chosen by the service. - :vartype admin_username: str - :ivar ssh_public_keys: The SSH configuration for the operating systems that run the nodes in - the Kubernetes cluster. In some cases, specification of public keys may be required to produce - a working environment. - :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - - _attribute_map = { - "admin_username": {"key": "adminUsername", "type": "str"}, - "ssh_public_keys": {"key": "sshPublicKeys", "type": "[SshPublicKey]"}, - } - - def __init__( - self, - *, - admin_username: Optional[str] = None, - ssh_public_keys: Optional[list["_models.SshPublicKey"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword admin_username: The user name for the administrator that will be applied to the - operating systems that run Kubernetes nodes. If not supplied, a user name will be chosen by the - service. - :paramtype admin_username: str - :keyword ssh_public_keys: The SSH configuration for the operating systems that run the nodes in - the Kubernetes cluster. In some cases, specification of public keys may be required to produce - a working environment. - :paramtype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - super().__init__(**kwargs) - self.admin_username = admin_username - self.ssh_public_keys = ssh_public_keys - - -class AdministratorConfigurationPatch(_serialization.Model): - """AdministratorConfigurationPatch represents the patching capabilities for the administrator - configuration. - - :ivar ssh_public_keys: SshPublicKey represents the public key used to authenticate with a - resource through SSH. - :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - - _attribute_map = { - "ssh_public_keys": {"key": "sshPublicKeys", "type": "[SshPublicKey]"}, - } - - def __init__(self, *, ssh_public_keys: Optional[list["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: - """ - :keyword ssh_public_keys: SshPublicKey represents the public key used to authenticate with a - resource through SSH. - :paramtype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - super().__init__(**kwargs) - self.ssh_public_keys = ssh_public_keys - - -class AgentOptions(_serialization.Model): - """AgentOptions are configurations that will be applied to each agent in an agent pool. - - All required parameters must be populated in order to send to server. - - :ivar hugepages_count: The number of hugepages to allocate. Required. - :vartype hugepages_count: int - :ivar hugepages_size: The size of the hugepages to allocate. Known values are: "2M" and "1G". - :vartype hugepages_size: str or ~azure.mgmt.networkcloud.models.HugepagesSize - """ - - _validation = { - "hugepages_count": {"required": True}, - } - - _attribute_map = { - "hugepages_count": {"key": "hugepagesCount", "type": "int"}, - "hugepages_size": {"key": "hugepagesSize", "type": "str"}, - } - - def __init__( - self, *, hugepages_count: int, hugepages_size: Union[str, "_models.HugepagesSize"] = "2M", **kwargs: Any - ) -> None: - """ - :keyword hugepages_count: The number of hugepages to allocate. Required. - :paramtype hugepages_count: int - :keyword hugepages_size: The size of the hugepages to allocate. Known values are: "2M" and - "1G". - :paramtype hugepages_size: str or ~azure.mgmt.networkcloud.models.HugepagesSize - """ - super().__init__(**kwargs) - self.hugepages_count = hugepages_count - self.hugepages_size = hugepages_size - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class AgentPool(TrackedResource): - """AgentPool represents the agent pool of Kubernetes cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :ivar agent_options: The configurations that will be applied to each agent in this agent pool. - :vartype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :ivar attached_network_configuration: The configuration of networks being attached to the agent - pool for use by the workloads that run on this Kubernetes cluster. - :vartype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :ivar availability_zones: The list of availability zones of the Network Cloud cluster used for - the provisioning of nodes in this agent pool. If not specified, all availability zones will be - used. - :vartype availability_zones: list[str] - :ivar count: The number of virtual machines that use this configuration. Required. - :vartype count: int - :ivar detailed_status: The current status of the agent pool. Known values are: "Available", - "Error", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.AgentPoolDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar kubernetes_version: The Kubernetes version running in this agent pool. - :vartype kubernetes_version: str - :ivar labels: The labels applied to the nodes in this agent pool. - :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar mode: The selection of how this agent pool is utilized, either as a system pool or a user - pool. System pools run the features and critical services for the Kubernetes Cluster, while - user pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one - system node pool with at least one node. Required. Known values are: "System", "User", and - "NotApplicable". - :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :ivar provisioning_state: The provisioning state of the agent pool. Known values are: - "Accepted", "Canceled", "Deleting", "Failed", "InProgress", "Succeeded", and "Updating". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.AgentPoolProvisioningState - :ivar taints: The taints applied to the nodes in this agent pool. - :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar upgrade_settings: The configuration of the agent pool. - :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :ivar vm_sku_name: The name of the VM SKU that determines the size of resources allocated for - node VMs. Required. - :vartype vm_sku_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "count": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "mode": {"required": True}, - "provisioning_state": {"readonly": True}, - "vm_sku_name": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "administrator_configuration": { - "key": "properties.administratorConfiguration", - "type": "AdministratorConfiguration", - }, - "agent_options": {"key": "properties.agentOptions", "type": "AgentOptions"}, - "attached_network_configuration": { - "key": "properties.attachedNetworkConfiguration", - "type": "AttachedNetworkConfiguration", - }, - "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, - "count": {"key": "properties.count", "type": "int"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, - "labels": {"key": "properties.labels", "type": "[KubernetesLabel]"}, - "mode": {"key": "properties.mode", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "taints": {"key": "properties.taints", "type": "[KubernetesLabel]"}, - "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, - "vm_sku_name": {"key": "properties.vmSkuName", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - count: int, - mode: Union[str, "_models.AgentPoolMode"], - vm_sku_name: str, - tags: Optional[dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, - agent_options: Optional["_models.AgentOptions"] = None, - attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, - availability_zones: Optional[list[str]] = None, - labels: Optional[list["_models.KubernetesLabel"]] = None, - taints: Optional[list["_models.KubernetesLabel"]] = None, - upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :keyword agent_options: The configurations that will be applied to each agent in this agent - pool. - :paramtype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :keyword attached_network_configuration: The configuration of networks being attached to the - agent pool for use by the workloads that run on this Kubernetes cluster. - :paramtype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :keyword availability_zones: The list of availability zones of the Network Cloud cluster used - for the provisioning of nodes in this agent pool. If not specified, all availability zones will - be used. - :paramtype availability_zones: list[str] - :keyword count: The number of virtual machines that use this configuration. Required. - :paramtype count: int - :keyword labels: The labels applied to the nodes in this agent pool. - :paramtype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword mode: The selection of how this agent pool is utilized, either as a system pool or a - user pool. System pools run the features and critical services for the Kubernetes Cluster, - while user pools are dedicated to user workloads. Every Kubernetes cluster must contain at - least one system node pool with at least one node. Required. Known values are: "System", - "User", and "NotApplicable". - :paramtype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :keyword taints: The taints applied to the nodes in this agent pool. - :paramtype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword upgrade_settings: The configuration of the agent pool. - :paramtype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :keyword vm_sku_name: The name of the VM SKU that determines the size of resources allocated - for node VMs. Required. - :paramtype vm_sku_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.administrator_configuration = administrator_configuration - self.agent_options = agent_options - self.attached_network_configuration = attached_network_configuration - self.availability_zones = availability_zones - self.count = count - self.detailed_status: Optional[Union[str, "_models.AgentPoolDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.kubernetes_version: Optional[str] = None - self.labels = labels - self.mode = mode - self.provisioning_state: Optional[Union[str, "_models.AgentPoolProvisioningState"]] = None - self.taints = taints - self.upgrade_settings = upgrade_settings - self.vm_sku_name = vm_sku_name - - -class AgentPoolConfiguration(_serialization.Model): - """AgentPoolConfiguration specifies the configuration of a pool of nodes. - - All required parameters must be populated in order to send to server. - - :ivar administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :ivar agent_options: The configurations that will be applied to each agent in this agent pool. - :vartype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :ivar attached_network_configuration: The configuration of networks being attached to the agent - pool for use by the workloads that run on this Kubernetes cluster. - :vartype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :ivar availability_zones: The list of availability zones of the Network Cloud cluster used for - the provisioning of nodes in this agent pool. If not specified, all availability zones will be - used. - :vartype availability_zones: list[str] - :ivar count: The number of virtual machines that use this configuration. Required. - :vartype count: int - :ivar labels: The labels applied to the nodes in this agent pool. - :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar mode: The selection of how this agent pool is utilized, either as a system pool or a user - pool. System pools run the features and critical services for the Kubernetes Cluster, while - user pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one - system node pool with at least one node. Required. Known values are: "System", "User", and - "NotApplicable". - :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :ivar taints: The taints applied to the nodes in this agent pool. - :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar upgrade_settings: The configuration of the agent pool. - :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :ivar vm_sku_name: The name of the VM SKU that determines the size of resources allocated for - node VMs. Required. - :vartype vm_sku_name: str - """ - - _validation = { - "count": {"required": True}, - "mode": {"required": True}, - "vm_sku_name": {"required": True}, - } - - _attribute_map = { - "administrator_configuration": {"key": "administratorConfiguration", "type": "AdministratorConfiguration"}, - "agent_options": {"key": "agentOptions", "type": "AgentOptions"}, - "attached_network_configuration": { - "key": "attachedNetworkConfiguration", - "type": "AttachedNetworkConfiguration", - }, - "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "count": {"key": "count", "type": "int"}, - "labels": {"key": "labels", "type": "[KubernetesLabel]"}, - "mode": {"key": "mode", "type": "str"}, - "taints": {"key": "taints", "type": "[KubernetesLabel]"}, - "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, - "vm_sku_name": {"key": "vmSkuName", "type": "str"}, - } - - def __init__( - self, - *, - count: int, - mode: Union[str, "_models.AgentPoolMode"], - vm_sku_name: str, - administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, - agent_options: Optional["_models.AgentOptions"] = None, - attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, - availability_zones: Optional[list[str]] = None, - labels: Optional[list["_models.KubernetesLabel"]] = None, - taints: Optional[list["_models.KubernetesLabel"]] = None, - upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :keyword agent_options: The configurations that will be applied to each agent in this agent - pool. - :paramtype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :keyword attached_network_configuration: The configuration of networks being attached to the - agent pool for use by the workloads that run on this Kubernetes cluster. - :paramtype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :keyword availability_zones: The list of availability zones of the Network Cloud cluster used - for the provisioning of nodes in this agent pool. If not specified, all availability zones will - be used. - :paramtype availability_zones: list[str] - :keyword count: The number of virtual machines that use this configuration. Required. - :paramtype count: int - :keyword labels: The labels applied to the nodes in this agent pool. - :paramtype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword mode: The selection of how this agent pool is utilized, either as a system pool or a - user pool. System pools run the features and critical services for the Kubernetes Cluster, - while user pools are dedicated to user workloads. Every Kubernetes cluster must contain at - least one system node pool with at least one node. Required. Known values are: "System", - "User", and "NotApplicable". - :paramtype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :keyword taints: The taints applied to the nodes in this agent pool. - :paramtype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword upgrade_settings: The configuration of the agent pool. - :paramtype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :keyword vm_sku_name: The name of the VM SKU that determines the size of resources allocated - for node VMs. Required. - :paramtype vm_sku_name: str - """ - super().__init__(**kwargs) - self.administrator_configuration = administrator_configuration - self.agent_options = agent_options - self.attached_network_configuration = attached_network_configuration - self.availability_zones = availability_zones - self.count = count - self.labels = labels - self.mode = mode - self.taints = taints - self.upgrade_settings = upgrade_settings - self.vm_sku_name = vm_sku_name - - -class AgentPoolList(_serialization.Model): - """AgentPoolList represents a list of Kubernetes cluster agent pools. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of agent pools. - :vartype value: list[~azure.mgmt.networkcloud.models.AgentPool] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[AgentPool]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.AgentPool"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of agent pools. - :paramtype value: list[~azure.mgmt.networkcloud.models.AgentPool] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class AgentPoolPatchParameters(_serialization.Model): - """AgentPoolPatchParameters represents the body of the request to patch the Kubernetes cluster - agent pool. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar administrator_configuration: The configuration of administrator credentials for the - control plane nodes. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.NodePoolAdministratorConfigurationPatch - :ivar count: The number of virtual machines that use this configuration. - :vartype count: int - :ivar upgrade_settings: The configuration of the agent pool. - :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "administrator_configuration": { - "key": "properties.administratorConfiguration", - "type": "NodePoolAdministratorConfigurationPatch", - }, - "count": {"key": "properties.count", "type": "int"}, - "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - administrator_configuration: Optional["_models.NodePoolAdministratorConfigurationPatch"] = None, - count: Optional[int] = None, - upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword administrator_configuration: The configuration of administrator credentials for the - control plane nodes. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.NodePoolAdministratorConfigurationPatch - :keyword count: The number of virtual machines that use this configuration. - :paramtype count: int - :keyword upgrade_settings: The configuration of the agent pool. - :paramtype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - """ - super().__init__(**kwargs) - self.tags = tags - self.administrator_configuration = administrator_configuration - self.count = count - self.upgrade_settings = upgrade_settings - - -class AgentPoolUpgradeSettings(_serialization.Model): - """AgentPoolUpgradeSettings specifies the upgrade settings for an agent pool. - - :ivar drain_timeout: The maximum time in seconds that is allowed for a node drain to complete - before proceeding with the upgrade of the agent pool. If not specified during creation, a value - of 1800 seconds is used. - :vartype drain_timeout: int - :ivar max_surge: The maximum number or percentage of nodes that are surged during upgrade. This - can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is - specified, it is the percentage of the total agent pool size at the time of the upgrade. For - percentages, fractional nodes are rounded up. If not specified during creation, a value of 1 is - used. One of MaxSurge and MaxUnavailable must be greater than 0. - :vartype max_surge: str - :ivar max_unavailable: The maximum number or percentage of nodes that can be unavailable during - upgrade. This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a - percentage is specified, it is the percentage of the total agent pool size at the time of the - upgrade. For percentages, fractional nodes are rounded up. If not specified during creation, a - value of 0 is used. One of MaxSurge and MaxUnavailable must be greater than 0. - :vartype max_unavailable: str - """ - - _validation = { - "drain_timeout": {"maximum": 86400, "minimum": 60}, - } - - _attribute_map = { - "drain_timeout": {"key": "drainTimeout", "type": "int"}, - "max_surge": {"key": "maxSurge", "type": "str"}, - "max_unavailable": {"key": "maxUnavailable", "type": "str"}, - } - - def __init__( - self, - *, - drain_timeout: Optional[int] = None, - max_surge: Optional[str] = None, - max_unavailable: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword drain_timeout: The maximum time in seconds that is allowed for a node drain to - complete before proceeding with the upgrade of the agent pool. If not specified during - creation, a value of 1800 seconds is used. - :paramtype drain_timeout: int - :keyword max_surge: The maximum number or percentage of nodes that are surged during upgrade. - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage - is specified, it is the percentage of the total agent pool size at the time of the upgrade. For - percentages, fractional nodes are rounded up. If not specified during creation, a value of 1 is - used. One of MaxSurge and MaxUnavailable must be greater than 0. - :paramtype max_surge: str - :keyword max_unavailable: The maximum number or percentage of nodes that can be unavailable - during upgrade. This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). - If a percentage is specified, it is the percentage of the total agent pool size at the time of - the upgrade. For percentages, fractional nodes are rounded up. If not specified during - creation, a value of 0 is used. One of MaxSurge and MaxUnavailable must be greater than 0. - :paramtype max_unavailable: str - """ - super().__init__(**kwargs) - self.drain_timeout = drain_timeout - self.max_surge = max_surge - self.max_unavailable = max_unavailable - - -class AnalyticsOutputSettings(_serialization.Model): - """AnalyticsOutputSettings represents the settings for the log analytics workspace used for output - of logs from this cluster. - - :ivar analytics_workspace_id: The resource ID of the analytics workspace that is to be used by - the specified identity. - :vartype analytics_workspace_id: str - :ivar associated_identity: The selection of the managed identity to use with this analytics - workspace. The identity type must be either system assigned or user assigned. - :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - """ - - _attribute_map = { - "analytics_workspace_id": {"key": "analyticsWorkspaceId", "type": "str"}, - "associated_identity": {"key": "associatedIdentity", "type": "IdentitySelector"}, - } - - def __init__( - self, - *, - analytics_workspace_id: Optional[str] = None, - associated_identity: Optional["_models.IdentitySelector"] = None, - **kwargs: Any - ) -> None: - """ - :keyword analytics_workspace_id: The resource ID of the analytics workspace that is to be used - by the specified identity. - :paramtype analytics_workspace_id: str - :keyword associated_identity: The selection of the managed identity to use with this analytics - workspace. The identity type must be either system assigned or user assigned. - :paramtype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - """ - super().__init__(**kwargs) - self.analytics_workspace_id = analytics_workspace_id - self.associated_identity = associated_identity - - -class AttachedNetworkConfiguration(_serialization.Model): - """AttachedNetworkConfiguration represents the set of workload networks to attach to a resource. - - :ivar l2_networks: The list of Layer 2 Networks and related configuration for attachment. - :vartype l2_networks: list[~azure.mgmt.networkcloud.models.L2NetworkAttachmentConfiguration] - :ivar l3_networks: The list of Layer 3 Networks and related configuration for attachment. - :vartype l3_networks: list[~azure.mgmt.networkcloud.models.L3NetworkAttachmentConfiguration] - :ivar trunked_networks: The list of Trunked Networks and related configuration for attachment. - :vartype trunked_networks: - list[~azure.mgmt.networkcloud.models.TrunkedNetworkAttachmentConfiguration] - """ - - _attribute_map = { - "l2_networks": {"key": "l2Networks", "type": "[L2NetworkAttachmentConfiguration]"}, - "l3_networks": {"key": "l3Networks", "type": "[L3NetworkAttachmentConfiguration]"}, - "trunked_networks": {"key": "trunkedNetworks", "type": "[TrunkedNetworkAttachmentConfiguration]"}, - } - - def __init__( - self, - *, - l2_networks: Optional[list["_models.L2NetworkAttachmentConfiguration"]] = None, - l3_networks: Optional[list["_models.L3NetworkAttachmentConfiguration"]] = None, - trunked_networks: Optional[list["_models.TrunkedNetworkAttachmentConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword l2_networks: The list of Layer 2 Networks and related configuration for attachment. - :paramtype l2_networks: list[~azure.mgmt.networkcloud.models.L2NetworkAttachmentConfiguration] - :keyword l3_networks: The list of Layer 3 Networks and related configuration for attachment. - :paramtype l3_networks: list[~azure.mgmt.networkcloud.models.L3NetworkAttachmentConfiguration] - :keyword trunked_networks: The list of Trunked Networks and related configuration for - attachment. - :paramtype trunked_networks: - list[~azure.mgmt.networkcloud.models.TrunkedNetworkAttachmentConfiguration] - """ - super().__init__(**kwargs) - self.l2_networks = l2_networks - self.l3_networks = l3_networks - self.trunked_networks = trunked_networks - - -class AvailableUpgrade(_serialization.Model): - """AvailableUpgrade represents an upgrade available for a Kubernetes cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar availability_lifecycle: The version lifecycle indicator. Known values are: "Preview" and - "GenerallyAvailable". - :vartype availability_lifecycle: str or ~azure.mgmt.networkcloud.models.AvailabilityLifecycle - :ivar version: The version available for upgrading. - :vartype version: str - """ - - _validation = { - "availability_lifecycle": {"readonly": True}, - "version": {"readonly": True}, - } - - _attribute_map = { - "availability_lifecycle": {"key": "availabilityLifecycle", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.availability_lifecycle: Optional[Union[str, "_models.AvailabilityLifecycle"]] = None - self.version: Optional[str] = None - - -class BareMetalMachine(TrackedResource): - """BareMetalMachine represents the physical machine in the rack. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar action_states: The current state of any in progress or completed actions. The most recent - known instance of each action type is shown. - :vartype action_states: list[~azure.mgmt.networkcloud.models.ActionState] - :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud - resources that have attached this network. - :vartype associated_resource_ids: list[str] - :ivar bmc_connection_string: The connection string for the baseboard management controller - including IP address and protocol. Required. - :vartype bmc_connection_string: str - :ivar bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. Required. - :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :ivar bmc_mac_address: The MAC address of the BMC device. Required. - :vartype bmc_mac_address: str - :ivar boot_mac_address: The MAC address of a NIC connected to the PXE network. Required. - :vartype boot_mac_address: str - :ivar ca_certificate: The CA certificate information issued by the platform for connecting to - TLS interfaces for the bare metal machine. Callers add this certificate to the trusted CA store - on the Kubernetes control plane nodes to allow secure communication with the bare metal - machine. - :vartype ca_certificate: ~azure.mgmt.networkcloud.models.CertificateInfo - :ivar cluster_id: The resource ID of the cluster this bare metal machine is associated with. - :vartype cluster_id: str - :ivar cordon_status: The cordon status of the bare metal machine. Known values are: "Cordoned" - and "Uncordoned". - :vartype cordon_status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineCordonStatus - :ivar detailed_status: The more detailed status of the bare metal machine. Known values are: - "Preparing", "Error", "Available", "Provisioning", "Provisioned", and "Deprovisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar hardware_inventory: The hardware inventory, including information acquired from the - model/sku information and from the ironic inspector. - :vartype hardware_inventory: ~azure.mgmt.networkcloud.models.HardwareInventory - :ivar hardware_validation_status: The details of the latest hardware validation performed for - this bare metal machine. - :vartype hardware_validation_status: ~azure.mgmt.networkcloud.models.HardwareValidationStatus - :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of the resource IDs for the HybridAksClusters that have nodes hosted on this bare - metal machine. - :vartype hybrid_aks_clusters_associated_ids: list[str] - :ivar kubernetes_node_name: The name of this machine represented by the host object in the - Cluster's Kubernetes control plane. - :vartype kubernetes_node_name: str - :ivar kubernetes_version: The version of Kubernetes running on this machine. - :vartype kubernetes_version: str - :ivar machine_cluster_version: The cluster version that has been applied to this machine during - deployment or a version update. - :vartype machine_cluster_version: str - :ivar machine_details: The custom details provided by the customer. Required. - :vartype machine_details: str - :ivar machine_name: The OS-level hostname assigned to this machine. Required. - :vartype machine_name: str - :ivar machine_roles: The list of roles that are assigned to the cluster node running on this - machine. - :vartype machine_roles: list[str] - :ivar machine_sku_id: The unique internal identifier of the bare metal machine SKU. Required. - :vartype machine_sku_id: str - :ivar oam_ipv4_address: The IPv4 address that is assigned to the bare metal machine during the - cluster deployment. - :vartype oam_ipv4_address: str - :ivar oam_ipv6_address: The IPv6 address that is assigned to the bare metal machine during the - cluster deployment. - :vartype oam_ipv6_address: str - :ivar os_image: The image that is currently provisioned to the OS disk. - :vartype os_image: str - :ivar power_state: The power state derived from the baseboard management controller. Known - values are: "On" and "Off". - :vartype power_state: str or ~azure.mgmt.networkcloud.models.BareMetalMachinePowerState - :ivar provisioning_state: The provisioning state of the bare metal machine. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineProvisioningState - :ivar rack_id: The resource ID of the rack where this bare metal machine resides. Required. - :vartype rack_id: str - :ivar rack_slot: The rack slot in which this bare metal machine is located, ordered from the - bottom up i.e. the lowest slot is 1. Required. - :vartype rack_slot: int - :ivar ready_state: The indicator of whether the bare metal machine is ready to receive - workloads. Known values are: "True" and "False". - :vartype ready_state: str or ~azure.mgmt.networkcloud.models.BareMetalMachineReadyState - :ivar runtime_protection_status: The runtime protection status of the bare metal machine. - :vartype runtime_protection_status: ~azure.mgmt.networkcloud.models.RuntimeProtectionStatus - :ivar secret_rotation_status: The list of statuses that represent secret rotation activity. - :vartype secret_rotation_status: list[~azure.mgmt.networkcloud.models.SecretRotationStatus] - :ivar serial_number: The serial number of the bare metal machine. Required. - :vartype serial_number: str - :ivar service_tag: The discovered value of the machine's service tag. - :vartype service_tag: str - :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of the resource IDs for the VirtualMachines that are hosted on this bare metal - machine. - :vartype virtual_machines_associated_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "action_states": {"readonly": True}, - "associated_resource_ids": {"readonly": True}, - "bmc_connection_string": {"required": True}, - "bmc_credentials": {"required": True}, - "bmc_mac_address": {"required": True, "pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "boot_mac_address": {"required": True, "pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "ca_certificate": {"readonly": True}, - "cluster_id": {"readonly": True}, - "cordon_status": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "hardware_inventory": {"readonly": True}, - "hardware_validation_status": {"readonly": True}, - "hybrid_aks_clusters_associated_ids": {"readonly": True}, - "kubernetes_node_name": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "machine_details": {"required": True, "max_length": 256}, - "machine_name": {"required": True, "pattern": r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$"}, - "machine_roles": {"readonly": True}, - "machine_sku_id": {"required": True}, - "oam_ipv4_address": {"readonly": True}, - "oam_ipv6_address": {"readonly": True}, - "os_image": {"readonly": True}, - "power_state": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "rack_id": {"required": True}, - "rack_slot": {"required": True, "maximum": 256, "minimum": 1}, - "ready_state": {"readonly": True}, - "runtime_protection_status": {"readonly": True}, - "secret_rotation_status": {"readonly": True}, - "serial_number": {"required": True, "max_length": 64, "min_length": 1}, - "service_tag": {"readonly": True}, - "virtual_machines_associated_ids": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "action_states": {"key": "properties.actionStates", "type": "[ActionState]"}, - "associated_resource_ids": {"key": "properties.associatedResourceIds", "type": "[str]"}, - "bmc_connection_string": {"key": "properties.bmcConnectionString", "type": "str"}, - "bmc_credentials": {"key": "properties.bmcCredentials", "type": "AdministrativeCredentials"}, - "bmc_mac_address": {"key": "properties.bmcMacAddress", "type": "str"}, - "boot_mac_address": {"key": "properties.bootMacAddress", "type": "str"}, - "ca_certificate": {"key": "properties.caCertificate", "type": "CertificateInfo"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "cordon_status": {"key": "properties.cordonStatus", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "hardware_inventory": {"key": "properties.hardwareInventory", "type": "HardwareInventory"}, - "hardware_validation_status": { - "key": "properties.hardwareValidationStatus", - "type": "HardwareValidationStatus", - }, - "hybrid_aks_clusters_associated_ids": {"key": "properties.hybridAksClustersAssociatedIds", "type": "[str]"}, - "kubernetes_node_name": {"key": "properties.kubernetesNodeName", "type": "str"}, - "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, - "machine_cluster_version": {"key": "properties.machineClusterVersion", "type": "str"}, - "machine_details": {"key": "properties.machineDetails", "type": "str"}, - "machine_name": {"key": "properties.machineName", "type": "str"}, - "machine_roles": {"key": "properties.machineRoles", "type": "[str]"}, - "machine_sku_id": {"key": "properties.machineSkuId", "type": "str"}, - "oam_ipv4_address": {"key": "properties.oamIpv4Address", "type": "str"}, - "oam_ipv6_address": {"key": "properties.oamIpv6Address", "type": "str"}, - "os_image": {"key": "properties.osImage", "type": "str"}, - "power_state": {"key": "properties.powerState", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "rack_id": {"key": "properties.rackId", "type": "str"}, - "rack_slot": {"key": "properties.rackSlot", "type": "int"}, - "ready_state": {"key": "properties.readyState", "type": "str"}, - "runtime_protection_status": {"key": "properties.runtimeProtectionStatus", "type": "RuntimeProtectionStatus"}, - "secret_rotation_status": {"key": "properties.secretRotationStatus", "type": "[SecretRotationStatus]"}, - "serial_number": {"key": "properties.serialNumber", "type": "str"}, - "service_tag": {"key": "properties.serviceTag", "type": "str"}, - "virtual_machines_associated_ids": {"key": "properties.virtualMachinesAssociatedIds", "type": "[str]"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - bmc_connection_string: str, - bmc_credentials: "_models.AdministrativeCredentials", - bmc_mac_address: str, - boot_mac_address: str, - machine_details: str, - machine_name: str, - machine_sku_id: str, - rack_id: str, - rack_slot: int, - serial_number: str, - tags: Optional[dict[str, str]] = None, - machine_cluster_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword bmc_connection_string: The connection string for the baseboard management controller - including IP address and protocol. Required. - :paramtype bmc_connection_string: str - :keyword bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. Required. - :paramtype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :keyword bmc_mac_address: The MAC address of the BMC device. Required. - :paramtype bmc_mac_address: str - :keyword boot_mac_address: The MAC address of a NIC connected to the PXE network. Required. - :paramtype boot_mac_address: str - :keyword machine_cluster_version: The cluster version that has been applied to this machine - during deployment or a version update. - :paramtype machine_cluster_version: str - :keyword machine_details: The custom details provided by the customer. Required. - :paramtype machine_details: str - :keyword machine_name: The OS-level hostname assigned to this machine. Required. - :paramtype machine_name: str - :keyword machine_sku_id: The unique internal identifier of the bare metal machine SKU. - Required. - :paramtype machine_sku_id: str - :keyword rack_id: The resource ID of the rack where this bare metal machine resides. Required. - :paramtype rack_id: str - :keyword rack_slot: The rack slot in which this bare metal machine is located, ordered from the - bottom up i.e. the lowest slot is 1. Required. - :paramtype rack_slot: int - :keyword serial_number: The serial number of the bare metal machine. Required. - :paramtype serial_number: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.action_states: Optional[list["_models.ActionState"]] = None - self.associated_resource_ids: Optional[list[str]] = None - self.bmc_connection_string = bmc_connection_string - self.bmc_credentials = bmc_credentials - self.bmc_mac_address = bmc_mac_address - self.boot_mac_address = boot_mac_address - self.ca_certificate: Optional["_models.CertificateInfo"] = None - self.cluster_id: Optional[str] = None - self.cordon_status: Optional[Union[str, "_models.BareMetalMachineCordonStatus"]] = None - self.detailed_status: Optional[Union[str, "_models.BareMetalMachineDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.hardware_inventory: Optional["_models.HardwareInventory"] = None - self.hardware_validation_status: Optional["_models.HardwareValidationStatus"] = None - self.hybrid_aks_clusters_associated_ids: Optional[list[str]] = None - self.kubernetes_node_name: Optional[str] = None - self.kubernetes_version: Optional[str] = None - self.machine_cluster_version = machine_cluster_version - self.machine_details = machine_details - self.machine_name = machine_name - self.machine_roles: Optional[list[str]] = None - self.machine_sku_id = machine_sku_id - self.oam_ipv4_address: Optional[str] = None - self.oam_ipv6_address: Optional[str] = None - self.os_image: Optional[str] = None - self.power_state: Optional[Union[str, "_models.BareMetalMachinePowerState"]] = None - self.provisioning_state: Optional[Union[str, "_models.BareMetalMachineProvisioningState"]] = None - self.rack_id = rack_id - self.rack_slot = rack_slot - self.ready_state: Optional[Union[str, "_models.BareMetalMachineReadyState"]] = None - self.runtime_protection_status: Optional["_models.RuntimeProtectionStatus"] = None - self.secret_rotation_status: Optional[list["_models.SecretRotationStatus"]] = None - self.serial_number = serial_number - self.service_tag: Optional[str] = None - self.virtual_machines_associated_ids: Optional[list[str]] = None - - -class BareMetalMachineCommandSpecification(_serialization.Model): - """BareMetalMachineCommandSpecification represents the command and optional arguments to exercise - against the bare metal machine. - - All required parameters must be populated in order to send to server. - - :ivar arguments: The list of string arguments that will be passed to the script in order as - separate arguments. - :vartype arguments: list[str] - :ivar command: The command to execute against the bare metal machine. Required. - :vartype command: str - """ - - _validation = { - "command": {"required": True}, - } - - _attribute_map = { - "arguments": {"key": "arguments", "type": "[str]"}, - "command": {"key": "command", "type": "str"}, - } - - def __init__(self, *, command: str, arguments: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword arguments: The list of string arguments that will be passed to the script in order as - separate arguments. - :paramtype arguments: list[str] - :keyword command: The command to execute against the bare metal machine. Required. - :paramtype command: str - """ - super().__init__(**kwargs) - self.arguments = arguments - self.command = command - - -class BareMetalMachineConfigurationData(_serialization.Model): - """BareMetalMachineConfigurationData represents configuration for the bare metal machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar bmc_connection_string: The connection string for the baseboard management controller - including IP address and protocol. - :vartype bmc_connection_string: str - :ivar bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. The password field is expected to be an Azure Key Vault key URL. Until the - cluster is converted to utilize managed identity by setting the secret archive settings, the - actual password value should be provided instead. Required. - :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :ivar bmc_mac_address: The MAC address of the BMC for this machine. Required. - :vartype bmc_mac_address: str - :ivar boot_mac_address: The MAC address associated with the PXE NIC card. Required. - :vartype boot_mac_address: str - :ivar machine_details: The free-form additional information about the machine, e.g. an asset - tag. - :vartype machine_details: str - :ivar machine_name: The user-provided name for the bare metal machine created from this - specification. If not provided, the machine name will be generated programmatically. - :vartype machine_name: str - :ivar rack_slot: The slot the physical machine is in the rack based on the BOM configuration. - Required. - :vartype rack_slot: int - :ivar serial_number: The serial number of the machine. Hardware suppliers may use an alternate - value. For example, service tag. Required. - :vartype serial_number: str - """ - - _validation = { - "bmc_connection_string": {"readonly": True}, - "bmc_credentials": {"required": True}, - "bmc_mac_address": {"required": True, "pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "boot_mac_address": {"required": True, "pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "machine_details": {"max_length": 256}, - "machine_name": {"pattern": r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$"}, - "rack_slot": {"required": True, "maximum": 256, "minimum": 1}, - "serial_number": {"required": True, "max_length": 64}, - } - - _attribute_map = { - "bmc_connection_string": {"key": "bmcConnectionString", "type": "str"}, - "bmc_credentials": {"key": "bmcCredentials", "type": "AdministrativeCredentials"}, - "bmc_mac_address": {"key": "bmcMacAddress", "type": "str"}, - "boot_mac_address": {"key": "bootMacAddress", "type": "str"}, - "machine_details": {"key": "machineDetails", "type": "str"}, - "machine_name": {"key": "machineName", "type": "str"}, - "rack_slot": {"key": "rackSlot", "type": "int"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - } - - def __init__( - self, - *, - bmc_credentials: "_models.AdministrativeCredentials", - bmc_mac_address: str, - boot_mac_address: str, - rack_slot: int, - serial_number: str, - machine_details: Optional[str] = None, - machine_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. The password field is expected to be an Azure Key Vault key URL. Until the - cluster is converted to utilize managed identity by setting the secret archive settings, the - actual password value should be provided instead. Required. - :paramtype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :keyword bmc_mac_address: The MAC address of the BMC for this machine. Required. - :paramtype bmc_mac_address: str - :keyword boot_mac_address: The MAC address associated with the PXE NIC card. Required. - :paramtype boot_mac_address: str - :keyword machine_details: The free-form additional information about the machine, e.g. an asset - tag. - :paramtype machine_details: str - :keyword machine_name: The user-provided name for the bare metal machine created from this - specification. If not provided, the machine name will be generated programmatically. - :paramtype machine_name: str - :keyword rack_slot: The slot the physical machine is in the rack based on the BOM - configuration. Required. - :paramtype rack_slot: int - :keyword serial_number: The serial number of the machine. Hardware suppliers may use an - alternate value. For example, service tag. Required. - :paramtype serial_number: str - """ - super().__init__(**kwargs) - self.bmc_connection_string: Optional[str] = None - self.bmc_credentials = bmc_credentials - self.bmc_mac_address = bmc_mac_address - self.boot_mac_address = boot_mac_address - self.machine_details = machine_details - self.machine_name = machine_name - self.rack_slot = rack_slot - self.serial_number = serial_number - - -class BareMetalMachineCordonParameters(_serialization.Model): - """BareMetalMachineCordonParameters represents the body of the request to evacuate workloads from - node on a bare metal machine. - - :ivar evacuate: The indicator of whether to evacuate the node workload when the bare metal - machine is cordoned. Known values are: "True" and "False". - :vartype evacuate: str or ~azure.mgmt.networkcloud.models.BareMetalMachineEvacuate - """ - - _attribute_map = { - "evacuate": {"key": "evacuate", "type": "str"}, - } - - def __init__(self, *, evacuate: Union[str, "_models.BareMetalMachineEvacuate"] = "False", **kwargs: Any) -> None: - """ - :keyword evacuate: The indicator of whether to evacuate the node workload when the bare metal - machine is cordoned. Known values are: "True" and "False". - :paramtype evacuate: str or ~azure.mgmt.networkcloud.models.BareMetalMachineEvacuate - """ - super().__init__(**kwargs) - self.evacuate = evacuate - - -class BareMetalMachineKeySet(TrackedResource): - """BareMetalMachineKeySet represents the bare metal machine key set. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar azure_group_id: The object ID of Azure Active Directory group that all users in the list - must be in for access to be granted. Users that are not in the group will not have access. - Required. - :vartype azure_group_id: str - :ivar detailed_status: The more detailed status of the key set. Known values are: "AllActive", - "SomeInvalid", "AllInvalid", and "Validating". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar expiration: The date and time after which the users in this key set will be removed from - the bare metal machines. Required. - :vartype expiration: ~datetime.datetime - :ivar jump_hosts_allowed: The list of IP addresses of jump hosts with management network access - from which a login will be allowed for the users. Required. - :vartype jump_hosts_allowed: list[str] - :ivar last_validation: The last time this key set was validated. - :vartype last_validation: ~datetime.datetime - :ivar os_group_name: The name of the group that users will be assigned to on the operating - system of the machines. - :vartype os_group_name: str - :ivar privilege_level: The access level allowed for the users in this key set. Required. Known - values are: "Standard", "Superuser", and "Other". - :vartype privilege_level: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPrivilegeLevel - :ivar privilege_level_name: The name of the access level to apply when the privilege level is - set to Other. - :vartype privilege_level_name: str - :ivar provisioning_state: The provisioning state of the bare metal machine key set. Known - values are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetProvisioningState - :ivar user_list: The unique list of permitted users. Required. - :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - :ivar user_list_status: The status evaluation of each user. - :vartype user_list_status: list[~azure.mgmt.networkcloud.models.KeySetUserStatus] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "azure_group_id": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "expiration": {"required": True}, - "jump_hosts_allowed": {"required": True}, - "last_validation": {"readonly": True}, - "os_group_name": {"max_length": 32, "pattern": r"^([A-Za-z]([A-Za-z0-9]*))$"}, - "privilege_level": {"required": True}, - "provisioning_state": {"readonly": True}, - "user_list": {"required": True}, - "user_list_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "azure_group_id": {"key": "properties.azureGroupId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "jump_hosts_allowed": {"key": "properties.jumpHostsAllowed", "type": "[str]"}, - "last_validation": {"key": "properties.lastValidation", "type": "iso-8601"}, - "os_group_name": {"key": "properties.osGroupName", "type": "str"}, - "privilege_level": {"key": "properties.privilegeLevel", "type": "str"}, - "privilege_level_name": {"key": "properties.privilegeLevelName", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "user_list": {"key": "properties.userList", "type": "[KeySetUser]"}, - "user_list_status": {"key": "properties.userListStatus", "type": "[KeySetUserStatus]"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - azure_group_id: str, - expiration: datetime.datetime, - jump_hosts_allowed: list[str], - privilege_level: Union[str, "_models.BareMetalMachineKeySetPrivilegeLevel"], - user_list: list["_models.KeySetUser"], - tags: Optional[dict[str, str]] = None, - os_group_name: Optional[str] = None, - privilege_level_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword azure_group_id: The object ID of Azure Active Directory group that all users in the - list must be in for access to be granted. Users that are not in the group will not have access. - Required. - :paramtype azure_group_id: str - :keyword expiration: The date and time after which the users in this key set will be removed - from the bare metal machines. Required. - :paramtype expiration: ~datetime.datetime - :keyword jump_hosts_allowed: The list of IP addresses of jump hosts with management network - access from which a login will be allowed for the users. Required. - :paramtype jump_hosts_allowed: list[str] - :keyword os_group_name: The name of the group that users will be assigned to on the operating - system of the machines. - :paramtype os_group_name: str - :keyword privilege_level: The access level allowed for the users in this key set. Required. - Known values are: "Standard", "Superuser", and "Other". - :paramtype privilege_level: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPrivilegeLevel - :keyword privilege_level_name: The name of the access level to apply when the privilege level - is set to Other. - :paramtype privilege_level_name: str - :keyword user_list: The unique list of permitted users. Required. - :paramtype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.azure_group_id = azure_group_id - self.detailed_status: Optional[Union[str, "_models.BareMetalMachineKeySetDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.expiration = expiration - self.jump_hosts_allowed = jump_hosts_allowed - self.last_validation: Optional[datetime.datetime] = None - self.os_group_name = os_group_name - self.privilege_level = privilege_level - self.privilege_level_name = privilege_level_name - self.provisioning_state: Optional[Union[str, "_models.BareMetalMachineKeySetProvisioningState"]] = None - self.user_list = user_list - self.user_list_status: Optional[list["_models.KeySetUserStatus"]] = None - - -class BareMetalMachineKeySetList(_serialization.Model): - """BareMetalMachineKeySetList represents a list of bare metal machine key sets. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of bare metal machine key sets. - :vartype value: list[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BareMetalMachineKeySet]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.BareMetalMachineKeySet"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of bare metal machine key sets. - :paramtype value: list[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class BareMetalMachineKeySetPatchParameters(_serialization.Model): - """BareMetalMachineKeySetPatchParameters represents the body of the request to patch the bare - metal machine key set. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar expiration: The date and time after which the users in this key set will be removed from - the bare metal machines. - :vartype expiration: ~datetime.datetime - :ivar jump_hosts_allowed: The list of IP addresses of jump hosts with management network access - from which a login will be allowed for the users. - :vartype jump_hosts_allowed: list[str] - :ivar user_list: The unique list of permitted users. - :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "jump_hosts_allowed": {"key": "properties.jumpHostsAllowed", "type": "[str]"}, - "user_list": {"key": "properties.userList", "type": "[KeySetUser]"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - expiration: Optional[datetime.datetime] = None, - jump_hosts_allowed: Optional[list[str]] = None, - user_list: Optional[list["_models.KeySetUser"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword expiration: The date and time after which the users in this key set will be removed - from the bare metal machines. - :paramtype expiration: ~datetime.datetime - :keyword jump_hosts_allowed: The list of IP addresses of jump hosts with management network - access from which a login will be allowed for the users. - :paramtype jump_hosts_allowed: list[str] - :keyword user_list: The unique list of permitted users. - :paramtype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - super().__init__(**kwargs) - self.tags = tags - self.expiration = expiration - self.jump_hosts_allowed = jump_hosts_allowed - self.user_list = user_list - - -class BareMetalMachineList(_serialization.Model): - """BareMetalMachineList represents a list of bare metal machines. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of bare metal machines. - :vartype value: list[~azure.mgmt.networkcloud.models.BareMetalMachine] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BareMetalMachine]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.BareMetalMachine"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of bare metal machines. - :paramtype value: list[~azure.mgmt.networkcloud.models.BareMetalMachine] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class BareMetalMachinePatchParameters(_serialization.Model): - """BareMetalMachinePatchParameters represents the body of the request to patch bare metal machine - properties. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar machine_details: The details provided by the customer during the creation of rack - manifests that allows for custom data to be associated with this machine. - :vartype machine_details: str - """ - - _validation = { - "machine_details": {"max_length": 256}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "machine_details": {"key": "properties.machineDetails", "type": "str"}, - } - - def __init__( - self, *, tags: Optional[dict[str, str]] = None, machine_details: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword machine_details: The details provided by the customer during the creation of rack - manifests that allows for custom data to be associated with this machine. - :paramtype machine_details: str - """ - super().__init__(**kwargs) - self.tags = tags - self.machine_details = machine_details - - -class BareMetalMachinePowerOffParameters(_serialization.Model): - """BareMetalMachinePowerOffParameters represents the body of the request to power off bare metal - machine. - - :ivar skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off - the bare metal machine immediately. Known values are: "True" and "False". - :vartype skip_shutdown: str or ~azure.mgmt.networkcloud.models.BareMetalMachineSkipShutdown - """ - - _attribute_map = { - "skip_shutdown": {"key": "skipShutdown", "type": "str"}, - } - - def __init__( - self, *, skip_shutdown: Union[str, "_models.BareMetalMachineSkipShutdown"] = "False", **kwargs: Any - ) -> None: - """ - :keyword skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off - the bare metal machine immediately. Known values are: "True" and "False". - :paramtype skip_shutdown: str or ~azure.mgmt.networkcloud.models.BareMetalMachineSkipShutdown - """ - super().__init__(**kwargs) - self.skip_shutdown = skip_shutdown - - -class BareMetalMachineReplaceParameters(_serialization.Model): - """BareMetalMachineReplaceParameters represents the body of the request to physically swap a bare - metal machine for another. - - :ivar bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. The password field is expected to be an Azure Key Vault key URL. Until the - cluster is converted to utilize managed identity by setting the secret archive settings, the - actual password value should be provided instead. - :vartype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :ivar bmc_mac_address: The MAC address of the BMC device. - :vartype bmc_mac_address: str - :ivar boot_mac_address: The MAC address of a NIC connected to the PXE network. - :vartype boot_mac_address: str - :ivar machine_name: The OS-level hostname assigned to this machine. - :vartype machine_name: str - :ivar safeguard_mode: The safeguard mode to use for the replace action, where None indicates to - bypass safeguards and All indicates to utilize all safeguards. Known values are: "All" and - "None". - :vartype safeguard_mode: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceSafeguardMode - :ivar serial_number: The serial number of the bare metal machine. - :vartype serial_number: str - :ivar storage_policy: The indicator of whether to bypass clearing storage while replacing a - bare metal machine. Known values are: "Preserve" and "DiscardAll". - :vartype storage_policy: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceStoragePolicy - """ - - _validation = { - "bmc_mac_address": {"pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "boot_mac_address": {"pattern": r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"}, - "machine_name": {"pattern": r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$"}, - "serial_number": {"max_length": 64, "min_length": 1}, - } - - _attribute_map = { - "bmc_credentials": {"key": "bmcCredentials", "type": "AdministrativeCredentials"}, - "bmc_mac_address": {"key": "bmcMacAddress", "type": "str"}, - "boot_mac_address": {"key": "bootMacAddress", "type": "str"}, - "machine_name": {"key": "machineName", "type": "str"}, - "safeguard_mode": {"key": "safeguardMode", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - "storage_policy": {"key": "storagePolicy", "type": "str"}, - } - - def __init__( - self, - *, - bmc_credentials: Optional["_models.AdministrativeCredentials"] = None, - bmc_mac_address: Optional[str] = None, - boot_mac_address: Optional[str] = None, - machine_name: Optional[str] = None, - safeguard_mode: Union[str, "_models.BareMetalMachineReplaceSafeguardMode"] = "All", - serial_number: Optional[str] = None, - storage_policy: Union[str, "_models.BareMetalMachineReplaceStoragePolicy"] = "DiscardAll", - **kwargs: Any - ) -> None: - """ - :keyword bmc_credentials: The credentials of the baseboard management controller on this bare - metal machine. The password field is expected to be an Azure Key Vault key URL. Until the - cluster is converted to utilize managed identity by setting the secret archive settings, the - actual password value should be provided instead. - :paramtype bmc_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :keyword bmc_mac_address: The MAC address of the BMC device. - :paramtype bmc_mac_address: str - :keyword boot_mac_address: The MAC address of a NIC connected to the PXE network. - :paramtype boot_mac_address: str - :keyword machine_name: The OS-level hostname assigned to this machine. - :paramtype machine_name: str - :keyword safeguard_mode: The safeguard mode to use for the replace action, where None indicates - to bypass safeguards and All indicates to utilize all safeguards. Known values are: "All" and - "None". - :paramtype safeguard_mode: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceSafeguardMode - :keyword serial_number: The serial number of the bare metal machine. - :paramtype serial_number: str - :keyword storage_policy: The indicator of whether to bypass clearing storage while replacing a - bare metal machine. Known values are: "Preserve" and "DiscardAll". - :paramtype storage_policy: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceStoragePolicy - """ - super().__init__(**kwargs) - self.bmc_credentials = bmc_credentials - self.bmc_mac_address = bmc_mac_address - self.boot_mac_address = boot_mac_address - self.machine_name = machine_name - self.safeguard_mode = safeguard_mode - self.serial_number = serial_number - self.storage_policy = storage_policy - - -class BareMetalMachineRunCommandParameters(_serialization.Model): - """BareMetalMachineRunCommandParameters represents the body of the request to execute a script on - the bare metal machine. - - All required parameters must be populated in order to send to server. - - :ivar arguments: The list of string arguments that will be passed to the script in order as - separate arguments. - :vartype arguments: list[str] - :ivar limit_time_seconds: The maximum time the script is allowed to run. If the execution time - exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :vartype limit_time_seconds: int - :ivar script: The base64 encoded script to execute on the bare metal machine. Required. - :vartype script: str - """ - - _validation = { - "limit_time_seconds": {"required": True, "maximum": 14400, "minimum": 60}, - "script": {"required": True}, - } - - _attribute_map = { - "arguments": {"key": "arguments", "type": "[str]"}, - "limit_time_seconds": {"key": "limitTimeSeconds", "type": "int"}, - "script": {"key": "script", "type": "str"}, - } - - def __init__( - self, *, limit_time_seconds: int, script: str, arguments: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword arguments: The list of string arguments that will be passed to the script in order as - separate arguments. - :paramtype arguments: list[str] - :keyword limit_time_seconds: The maximum time the script is allowed to run. If the execution - time exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :paramtype limit_time_seconds: int - :keyword script: The base64 encoded script to execute on the bare metal machine. Required. - :paramtype script: str - """ - super().__init__(**kwargs) - self.arguments = arguments - self.limit_time_seconds = limit_time_seconds - self.script = script - - -class BareMetalMachineRunDataExtractsParameters(_serialization.Model): # pylint: disable=name-too-long - """BareMetalMachineRunDataExtractsParameters represents the body of request containing list of - curated data extraction commands to run on the bare metal machine. - - All required parameters must be populated in order to send to server. - - :ivar commands: The list of curated data extraction commands to be executed directly against - the target machine. Required. - :vartype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] - :ivar limit_time_seconds: The maximum time the commands are allowed to run. If the execution - time exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :vartype limit_time_seconds: int - """ - - _validation = { - "commands": {"required": True, "min_items": 1}, - "limit_time_seconds": {"required": True, "maximum": 14400, "minimum": 60}, - } - - _attribute_map = { - "commands": {"key": "commands", "type": "[BareMetalMachineCommandSpecification]"}, - "limit_time_seconds": {"key": "limitTimeSeconds", "type": "int"}, - } - - def __init__( - self, *, commands: list["_models.BareMetalMachineCommandSpecification"], limit_time_seconds: int, **kwargs: Any - ) -> None: - """ - :keyword commands: The list of curated data extraction commands to be executed directly against - the target machine. Required. - :paramtype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] - :keyword limit_time_seconds: The maximum time the commands are allowed to run. If the execution - time exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :paramtype limit_time_seconds: int - """ - super().__init__(**kwargs) - self.commands = commands - self.limit_time_seconds = limit_time_seconds - - -class BareMetalMachineRunReadCommandsParameters(_serialization.Model): # pylint: disable=name-too-long - """BareMetalMachineRunReadCommandsParameters represents the body of request containing list of - read-only commands to run on the bare metal machine. - - All required parameters must be populated in order to send to server. - - :ivar commands: The list of read-only commands to be executed directly against the target - machine. Required. - :vartype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] - :ivar limit_time_seconds: The maximum time the commands are allowed to run. If the execution - time exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :vartype limit_time_seconds: int - """ - - _validation = { - "commands": {"required": True, "min_items": 1}, - "limit_time_seconds": {"required": True, "maximum": 14400, "minimum": 60}, - } - - _attribute_map = { - "commands": {"key": "commands", "type": "[BareMetalMachineCommandSpecification]"}, - "limit_time_seconds": {"key": "limitTimeSeconds", "type": "int"}, - } - - def __init__( - self, *, commands: list["_models.BareMetalMachineCommandSpecification"], limit_time_seconds: int, **kwargs: Any - ) -> None: - """ - :keyword commands: The list of read-only commands to be executed directly against the target - machine. Required. - :paramtype commands: list[~azure.mgmt.networkcloud.models.BareMetalMachineCommandSpecification] - :keyword limit_time_seconds: The maximum time the commands are allowed to run. If the execution - time exceeds the maximum, the script will be stopped, any output produced until then will be - captured, and the exit code matching a timeout will be returned (252). Required. - :paramtype limit_time_seconds: int - """ - super().__init__(**kwargs) - self.commands = commands - self.limit_time_seconds = limit_time_seconds - - -class BgpAdvertisement(_serialization.Model): - """BgpAdvertisement represents the association of IP address pools to the communities and peers. - - All required parameters must be populated in order to send to server. - - :ivar advertise_to_fabric: The indicator of if this advertisement is also made to the network - fabric associated with the Network Cloud Cluster. This field is ignored if fabricPeeringEnabled - is set to False. Known values are: "True" and "False". - :vartype advertise_to_fabric: str or ~azure.mgmt.networkcloud.models.AdvertiseToFabric - :ivar communities: The names of the BGP communities to be associated with the announcement, - utilizing a BGP community string in 1234:1234 format. - :vartype communities: list[str] - :ivar ip_address_pools: The names of the IP address pools associated with this announcement. - Required. - :vartype ip_address_pools: list[str] - :ivar peers: The names of the BGP peers to limit this advertisement to. If no values are - specified, all BGP peers will receive this advertisement. - :vartype peers: list[str] - """ - - _validation = { - "ip_address_pools": {"required": True}, - } - - _attribute_map = { - "advertise_to_fabric": {"key": "advertiseToFabric", "type": "str"}, - "communities": {"key": "communities", "type": "[str]"}, - "ip_address_pools": {"key": "ipAddressPools", "type": "[str]"}, - "peers": {"key": "peers", "type": "[str]"}, - } - - def __init__( - self, - *, - ip_address_pools: list[str], - advertise_to_fabric: Union[str, "_models.AdvertiseToFabric"] = "True", - communities: Optional[list[str]] = None, - peers: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword advertise_to_fabric: The indicator of if this advertisement is also made to the - network fabric associated with the Network Cloud Cluster. This field is ignored if - fabricPeeringEnabled is set to False. Known values are: "True" and "False". - :paramtype advertise_to_fabric: str or ~azure.mgmt.networkcloud.models.AdvertiseToFabric - :keyword communities: The names of the BGP communities to be associated with the announcement, - utilizing a BGP community string in 1234:1234 format. - :paramtype communities: list[str] - :keyword ip_address_pools: The names of the IP address pools associated with this announcement. - Required. - :paramtype ip_address_pools: list[str] - :keyword peers: The names of the BGP peers to limit this advertisement to. If no values are - specified, all BGP peers will receive this advertisement. - :paramtype peers: list[str] - """ - super().__init__(**kwargs) - self.advertise_to_fabric = advertise_to_fabric - self.communities = communities - self.ip_address_pools = ip_address_pools - self.peers = peers - - -class BgpServiceLoadBalancerConfiguration(_serialization.Model): - """BgpServiceLoadBalancerConfiguration represents the configuration of a BGP service load - balancer. - - :ivar bgp_advertisements: The association of IP address pools to the communities and peers, - allowing for announcement of IPs. - :vartype bgp_advertisements: list[~azure.mgmt.networkcloud.models.BgpAdvertisement] - :ivar bgp_peers: The list of additional BgpPeer entities that the Kubernetes cluster will peer - with. All peering must be explicitly defined. - :vartype bgp_peers: list[~azure.mgmt.networkcloud.models.ServiceLoadBalancerBgpPeer] - :ivar fabric_peering_enabled: The indicator to specify if the load balancer peers with the - network fabric. Known values are: "True" and "False". - :vartype fabric_peering_enabled: str or ~azure.mgmt.networkcloud.models.FabricPeeringEnabled - :ivar ip_address_pools: The list of pools of IP addresses that can be allocated to load - balancer services. - :vartype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] - """ - - _attribute_map = { - "bgp_advertisements": {"key": "bgpAdvertisements", "type": "[BgpAdvertisement]"}, - "bgp_peers": {"key": "bgpPeers", "type": "[ServiceLoadBalancerBgpPeer]"}, - "fabric_peering_enabled": {"key": "fabricPeeringEnabled", "type": "str"}, - "ip_address_pools": {"key": "ipAddressPools", "type": "[IpAddressPool]"}, - } - - def __init__( - self, - *, - bgp_advertisements: Optional[list["_models.BgpAdvertisement"]] = None, - bgp_peers: Optional[list["_models.ServiceLoadBalancerBgpPeer"]] = None, - fabric_peering_enabled: Union[str, "_models.FabricPeeringEnabled"] = "True", - ip_address_pools: Optional[list["_models.IpAddressPool"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword bgp_advertisements: The association of IP address pools to the communities and peers, - allowing for announcement of IPs. - :paramtype bgp_advertisements: list[~azure.mgmt.networkcloud.models.BgpAdvertisement] - :keyword bgp_peers: The list of additional BgpPeer entities that the Kubernetes cluster will - peer with. All peering must be explicitly defined. - :paramtype bgp_peers: list[~azure.mgmt.networkcloud.models.ServiceLoadBalancerBgpPeer] - :keyword fabric_peering_enabled: The indicator to specify if the load balancer peers with the - network fabric. Known values are: "True" and "False". - :paramtype fabric_peering_enabled: str or ~azure.mgmt.networkcloud.models.FabricPeeringEnabled - :keyword ip_address_pools: The list of pools of IP addresses that can be allocated to load - balancer services. - :paramtype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] - """ - super().__init__(**kwargs) - self.bgp_advertisements = bgp_advertisements - self.bgp_peers = bgp_peers - self.fabric_peering_enabled = fabric_peering_enabled - self.ip_address_pools = ip_address_pools - - -class BmcKeySet(TrackedResource): - """BmcKeySet represents the baseboard management controller key set. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar azure_group_id: The object ID of Azure Active Directory group that all users in the list - must be in for access to be granted. Users that are not in the group will not have access. - Required. - :vartype azure_group_id: str - :ivar detailed_status: The more detailed status of the key set. Known values are: "AllActive", - "SomeInvalid", "AllInvalid", and "Validating". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.BmcKeySetDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar expiration: The date and time after which the users in this key set will be removed from - the baseboard management controllers. Required. - :vartype expiration: ~datetime.datetime - :ivar last_validation: The last time this key set was validated. - :vartype last_validation: ~datetime.datetime - :ivar privilege_level: The access level allowed for the users in this key set. Required. Known - values are: "ReadOnly" and "Administrator". - :vartype privilege_level: str or ~azure.mgmt.networkcloud.models.BmcKeySetPrivilegeLevel - :ivar provisioning_state: The provisioning state of the baseboard management controller key - set. Known values are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.BmcKeySetProvisioningState - :ivar user_list: The unique list of permitted users. Required. - :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - :ivar user_list_status: The status evaluation of each user. - :vartype user_list_status: list[~azure.mgmt.networkcloud.models.KeySetUserStatus] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "azure_group_id": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "expiration": {"required": True}, - "last_validation": {"readonly": True}, - "privilege_level": {"required": True}, - "provisioning_state": {"readonly": True}, - "user_list": {"required": True}, - "user_list_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "azure_group_id": {"key": "properties.azureGroupId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "last_validation": {"key": "properties.lastValidation", "type": "iso-8601"}, - "privilege_level": {"key": "properties.privilegeLevel", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "user_list": {"key": "properties.userList", "type": "[KeySetUser]"}, - "user_list_status": {"key": "properties.userListStatus", "type": "[KeySetUserStatus]"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - azure_group_id: str, - expiration: datetime.datetime, - privilege_level: Union[str, "_models.BmcKeySetPrivilegeLevel"], - user_list: list["_models.KeySetUser"], - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword azure_group_id: The object ID of Azure Active Directory group that all users in the - list must be in for access to be granted. Users that are not in the group will not have access. - Required. - :paramtype azure_group_id: str - :keyword expiration: The date and time after which the users in this key set will be removed - from the baseboard management controllers. Required. - :paramtype expiration: ~datetime.datetime - :keyword privilege_level: The access level allowed for the users in this key set. Required. - Known values are: "ReadOnly" and "Administrator". - :paramtype privilege_level: str or ~azure.mgmt.networkcloud.models.BmcKeySetPrivilegeLevel - :keyword user_list: The unique list of permitted users. Required. - :paramtype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.azure_group_id = azure_group_id - self.detailed_status: Optional[Union[str, "_models.BmcKeySetDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.expiration = expiration - self.last_validation: Optional[datetime.datetime] = None - self.privilege_level = privilege_level - self.provisioning_state: Optional[Union[str, "_models.BmcKeySetProvisioningState"]] = None - self.user_list = user_list - self.user_list_status: Optional[list["_models.KeySetUserStatus"]] = None - - -class BmcKeySetList(_serialization.Model): - """BmcKeySetList represents a list of baseboard management controller key sets. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of baseboard management controller key sets. - :vartype value: list[~azure.mgmt.networkcloud.models.BmcKeySet] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BmcKeySet]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.BmcKeySet"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of baseboard management controller key sets. - :paramtype value: list[~azure.mgmt.networkcloud.models.BmcKeySet] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class BmcKeySetPatchParameters(_serialization.Model): - """BmcKeySetPatchParameters represents the body of the request to patch the baseboard management - controller key set. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar expiration: The date and time after which the users in this key set will be removed from - the baseboard management controllers. - :vartype expiration: ~datetime.datetime - :ivar user_list: The unique list of permitted users. - :vartype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "user_list": {"key": "properties.userList", "type": "[KeySetUser]"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - expiration: Optional[datetime.datetime] = None, - user_list: Optional[list["_models.KeySetUser"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword expiration: The date and time after which the users in this key set will be removed - from the baseboard management controllers. - :paramtype expiration: ~datetime.datetime - :keyword user_list: The unique list of permitted users. - :paramtype user_list: list[~azure.mgmt.networkcloud.models.KeySetUser] - """ - super().__init__(**kwargs) - self.tags = tags - self.expiration = expiration - self.user_list = user_list - - -class CertificateInfo(_serialization.Model): - """CertificateInfo represents the non-private information of an X.509 Certificate. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar hash: The hash value of the X.509 Certificate. - :vartype hash: str - :ivar value: The textual value of the X.509 Certificate. - :vartype value: str - """ - - _validation = { - "hash": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "hash": {"key": "hash", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.hash: Optional[str] = None - self.value: Optional[str] = None - - -class CloudServicesNetwork(TrackedResource): - """Upon creation, the additional services that are provided by the platform will be allocated and - represented in the status of this resource. All resources associated with this cloud services - network will be part of the same layer 2 (L2) isolation domain. At least one service network - must be created but may be reused across many virtual machines and/or Hybrid AKS clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar additional_egress_endpoints: The list of egress endpoints. This allows for connection - from a Hybrid AKS cluster to the specified endpoint. - :vartype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] - :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud - resources that have attached this network. - :vartype associated_resource_ids: list[str] - :ivar cluster_id: The resource ID of the Network Cloud cluster this cloud services network is - associated with. - :vartype cluster_id: str - :ivar detailed_status: The more detailed status of the cloud services network. Known values - are: "Error", "Available", and "Provisioning". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar enable_default_egress_endpoints: The indicator of whether the platform default endpoints - are allowed for the egress traffic. Known values are: "True" and "False". - :vartype enable_default_egress_endpoints: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints - :ivar enabled_egress_endpoints: The full list of additional and default egress endpoints that - are currently enabled. - :vartype enabled_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] - :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of Hybrid AKS cluster resource IDs that are associated with this cloud services - network. - :vartype hybrid_aks_clusters_associated_ids: list[str] - :ivar interface_name: The name of the interface that will be present in the virtual machine to - represent this network. - :vartype interface_name: str - :ivar provisioning_state: The provisioning state of the cloud services network. Known values - are: "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkProvisioningState - :ivar storage_options: The storage options for the cloud services network. - :vartype storage_options: ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptions - :ivar storage_status: The storage status for the cloud services network. - :vartype storage_status: ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatus - :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are - currently using this cloud services network. - :vartype virtual_machines_associated_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "associated_resource_ids": {"readonly": True}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "enabled_egress_endpoints": {"readonly": True}, - "hybrid_aks_clusters_associated_ids": {"readonly": True}, - "interface_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "storage_status": {"readonly": True}, - "virtual_machines_associated_ids": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "additional_egress_endpoints": {"key": "properties.additionalEgressEndpoints", "type": "[EgressEndpoint]"}, - "associated_resource_ids": {"key": "properties.associatedResourceIds", "type": "[str]"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "enable_default_egress_endpoints": {"key": "properties.enableDefaultEgressEndpoints", "type": "str"}, - "enabled_egress_endpoints": {"key": "properties.enabledEgressEndpoints", "type": "[EgressEndpoint]"}, - "hybrid_aks_clusters_associated_ids": {"key": "properties.hybridAksClustersAssociatedIds", "type": "[str]"}, - "interface_name": {"key": "properties.interfaceName", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "storage_options": {"key": "properties.storageOptions", "type": "CloudServicesNetworkStorageOptions"}, - "storage_status": {"key": "properties.storageStatus", "type": "CloudServicesNetworkStorageStatus"}, - "virtual_machines_associated_ids": {"key": "properties.virtualMachinesAssociatedIds", "type": "[str]"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[dict[str, str]] = None, - additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = None, - enable_default_egress_endpoints: Optional[ - Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] - ] = None, - storage_options: Optional["_models.CloudServicesNetworkStorageOptions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword additional_egress_endpoints: The list of egress endpoints. This allows for connection - from a Hybrid AKS cluster to the specified endpoint. - :paramtype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] - :keyword enable_default_egress_endpoints: The indicator of whether the platform default - endpoints are allowed for the egress traffic. Known values are: "True" and "False". - :paramtype enable_default_egress_endpoints: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints - :keyword storage_options: The storage options for the cloud services network. - :paramtype storage_options: ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptions - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.additional_egress_endpoints = additional_egress_endpoints - self.associated_resource_ids: Optional[list[str]] = None - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.CloudServicesNetworkDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.enable_default_egress_endpoints = enable_default_egress_endpoints - self.enabled_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = None - self.hybrid_aks_clusters_associated_ids: Optional[list[str]] = None - self.interface_name: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.CloudServicesNetworkProvisioningState"]] = None - self.storage_options = storage_options - self.storage_status: Optional["_models.CloudServicesNetworkStorageStatus"] = None - self.virtual_machines_associated_ids: Optional[list[str]] = None - - -class CloudServicesNetworkList(_serialization.Model): - """CloudServicesNetworkList represents a list of cloud services networks. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of cloud services networks. - :vartype value: list[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CloudServicesNetwork]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.CloudServicesNetwork"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of cloud services networks. - :paramtype value: list[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class CloudServicesNetworkPatchParameters(_serialization.Model): - """CloudServicesNetworkPatchParameters represents the body of the request to patch the cloud - services network. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar additional_egress_endpoints: The list of egress endpoints. This allows for connection - from a Hybrid AKS cluster to the specified endpoint. - :vartype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] - :ivar enable_default_egress_endpoints: The indicator of whether the platform default endpoints - are allowed for the egress traffic. Known values are: "True" and "False". - :vartype enable_default_egress_endpoints: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints - :ivar storage_options: The storage options for the cloud services network. - :vartype storage_options: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptionsPatch - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "additional_egress_endpoints": {"key": "properties.additionalEgressEndpoints", "type": "[EgressEndpoint]"}, - "enable_default_egress_endpoints": {"key": "properties.enableDefaultEgressEndpoints", "type": "str"}, - "storage_options": {"key": "properties.storageOptions", "type": "CloudServicesNetworkStorageOptionsPatch"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - additional_egress_endpoints: Optional[list["_models.EgressEndpoint"]] = None, - enable_default_egress_endpoints: Optional[ - Union[str, "_models.CloudServicesNetworkEnableDefaultEgressEndpoints"] - ] = None, - storage_options: Optional["_models.CloudServicesNetworkStorageOptionsPatch"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword additional_egress_endpoints: The list of egress endpoints. This allows for connection - from a Hybrid AKS cluster to the specified endpoint. - :paramtype additional_egress_endpoints: list[~azure.mgmt.networkcloud.models.EgressEndpoint] - :keyword enable_default_egress_endpoints: The indicator of whether the platform default - endpoints are allowed for the egress traffic. Known values are: "True" and "False". - :paramtype enable_default_egress_endpoints: str or - ~azure.mgmt.networkcloud.models.CloudServicesNetworkEnableDefaultEgressEndpoints - :keyword storage_options: The storage options for the cloud services network. - :paramtype storage_options: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageOptionsPatch - """ - super().__init__(**kwargs) - self.tags = tags - self.additional_egress_endpoints = additional_egress_endpoints - self.enable_default_egress_endpoints = enable_default_egress_endpoints - self.storage_options = storage_options - - -class CloudServicesNetworkStorageOptions(_serialization.Model): - """CloudServicesNetworkStorageOptions represents the storage options for the cloud services - network. - - :ivar mode: The indicator to enable shared storage on the cloud services network. If not - specified, the allocation will align with the standard storage enablement. Known values are: - "None" and "Standard". - :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode - :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. - :vartype size_mi_b: int - :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the storage. - :vartype storage_appliance_id: str - """ - - _validation = { - "size_mi_b": {"minimum": 1}, - } - - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "size_mi_b": {"key": "sizeMiB", "type": "int"}, - "storage_appliance_id": {"key": "storageApplianceId", "type": "str"}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = None, - size_mi_b: Optional[int] = None, - storage_appliance_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mode: The indicator to enable shared storage on the cloud services network. If not - specified, the allocation will align with the standard storage enablement. Known values are: - "None" and "Standard". - :paramtype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode - :keyword size_mi_b: The requested storage allocation for the volume in Mebibytes. - :paramtype size_mi_b: int - :keyword storage_appliance_id: The resource ID of the storage appliance that hosts the storage. - :paramtype storage_appliance_id: str - """ - super().__init__(**kwargs) - self.mode = mode - self.size_mi_b = size_mi_b - self.storage_appliance_id = storage_appliance_id - - -class CloudServicesNetworkStorageOptionsPatch(_serialization.Model): - """CloudServicesNetworkStorageOptionsPatch represents the patchable storage options for the cloud - services network. - - :ivar mode: The indicator to enable shared storage on the cloud services network. Known values - are: "None" and "Standard". - :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode - :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. - :vartype size_mi_b: int - :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the storage. - :vartype storage_appliance_id: str - """ - - _validation = { - "size_mi_b": {"minimum": 1}, - } - - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "size_mi_b": {"key": "sizeMiB", "type": "int"}, - "storage_appliance_id": {"key": "storageApplianceId", "type": "str"}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = None, - size_mi_b: Optional[int] = None, - storage_appliance_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mode: The indicator to enable shared storage on the cloud services network. Known - values are: "None" and "Standard". - :paramtype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode - :keyword size_mi_b: The requested storage allocation for the volume in Mebibytes. - :paramtype size_mi_b: int - :keyword storage_appliance_id: The resource ID of the storage appliance that hosts the storage. - :paramtype storage_appliance_id: str - """ - super().__init__(**kwargs) - self.mode = mode - self.size_mi_b = size_mi_b - self.storage_appliance_id = storage_appliance_id - - -class CloudServicesNetworkStorageStatus(_serialization.Model): - """CloudServicesNetworkStorageStatus represents the storage status of the cloud services network. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mode: The indicator of if shared storage is enabled on the cloud services network. Known - values are: "None" and "Standard". - :vartype mode: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageMode - :ivar size_mi_b: The size in Mebibytes of the storage allocation. - :vartype size_mi_b: int - :ivar status: The status of the storage allocation for the cloud services network. Known values - are: "Available", "ExpandingVolume", and "ExpansionFailed". - :vartype status: str or ~azure.mgmt.networkcloud.models.CloudServicesNetworkStorageStatusStatus - :ivar status_message: The description for the status of the shared storage. - :vartype status_message: str - :ivar volume_id: The resource ID of the volume created to host the shared storage. - :vartype volume_id: str - """ - - _validation = { - "mode": {"readonly": True}, - "size_mi_b": {"readonly": True, "minimum": 0}, - "status": {"readonly": True}, - "status_message": {"readonly": True}, - "volume_id": {"readonly": True}, - } - - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "size_mi_b": {"key": "sizeMiB", "type": "int"}, - "status": {"key": "status", "type": "str"}, - "status_message": {"key": "statusMessage", "type": "str"}, - "volume_id": {"key": "volumeId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.mode: Optional[Union[str, "_models.CloudServicesNetworkStorageMode"]] = None - self.size_mi_b: Optional[int] = None - self.status: Optional[Union[str, "_models.CloudServicesNetworkStorageStatusStatus"]] = None - self.status_message: Optional[str] = None - self.volume_id: Optional[str] = None - - -class Cluster(TrackedResource): - """Cluster represents the on-premises Network Cloud cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster manager associated with the - cluster. Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar identity: The identity for the resource. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar action_states: The current state of any in progress or completed actions. The most recent - known instance of each action type is shown. - :vartype action_states: list[~azure.mgmt.networkcloud.models.ActionState] - :ivar aggregator_or_single_rack_definition: The rack definition that is intended to reflect - only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. - Required. - :vartype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition - :ivar analytics_output_settings: The settings for the log analytics workspace used for output - of logs from this cluster. - :vartype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings - :ivar analytics_workspace_id: Field Deprecated. The resource ID of the Log Analytics Workspace - that will be used for storing relevant logs. - :vartype analytics_workspace_id: str - :ivar available_upgrade_versions: The list of cluster runtime version upgrades available for - this cluster. - :vartype available_upgrade_versions: - list[~azure.mgmt.networkcloud.models.ClusterAvailableUpgradeVersion] - :ivar cluster_capacity: The capacity supported by this cluster. - :vartype cluster_capacity: ~azure.mgmt.networkcloud.models.ClusterCapacity - :ivar cluster_connection_status: The latest heartbeat status between the cluster manager and - the cluster. Known values are: "Connected", "Disconnected", "Timeout", and "Undefined". - :vartype cluster_connection_status: str or - ~azure.mgmt.networkcloud.models.ClusterConnectionStatus - :ivar cluster_extended_location: The extended location (custom location) that represents the - cluster's control plane location. This extended location is used to route the requests of child - objects of the cluster that are handled by the platform operator. - :vartype cluster_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar cluster_location: The customer-provided location information to identify where the - cluster resides. - :vartype cluster_location: str - :ivar cluster_manager_connection_status: The latest connectivity status between cluster manager - and the cluster. Known values are: "Connected" and "Unreachable". - :vartype cluster_manager_connection_status: str or - ~azure.mgmt.networkcloud.models.ClusterManagerConnectionStatus - :ivar cluster_manager_id: The resource ID of the cluster manager that manages this cluster. - This is set by the Cluster Manager when the cluster is created. - :vartype cluster_manager_id: str - :ivar cluster_service_principal: Field Deprecated: Use managed identity to provide cluster - privileges. The service principal to be used by the cluster during Arc Appliance installation. - :vartype cluster_service_principal: ~azure.mgmt.networkcloud.models.ServicePrincipalInformation - :ivar cluster_type: The type of rack configuration for the cluster. Required. Known values are: - "SingleRack" and "MultiRack". - :vartype cluster_type: str or ~azure.mgmt.networkcloud.models.ClusterType - :ivar cluster_version: The current runtime version of the cluster. Required. - :vartype cluster_version: str - :ivar command_output_settings: The settings for commands run in this cluster, such as bare - metal machine run read only commands and data extracts. - :vartype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings - :ivar compute_deployment_threshold: The validation threshold indicating the allowable failures - of compute machines during environment validation and deployment. - :vartype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold - :ivar compute_rack_definitions: The list of rack definitions for the compute racks in a - multi-rack cluster, or an empty list in a single-rack cluster. - :vartype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] - :ivar detailed_status: The current detailed status of the cluster. Known values are: - "PendingDeployment", "Deploying", "Running", "Updating", "UpdatePaused", "Degraded", - "Deleting", "Disconnected", and "Failed". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ClusterDetailedStatus - :ivar detailed_status_message: The descriptive message about the detailed status. - :vartype detailed_status_message: str - :ivar hybrid_aks_extended_location: Field Deprecated. This field will not be populated in an - upcoming version. The extended location (custom location) that represents the Hybrid AKS - control plane location. This extended location is used when creating provisioned clusters - (Hybrid AKS clusters). - :vartype hybrid_aks_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :vartype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :ivar manual_action_count: The count of Manual Action Taken (MAT) events that have not been - validated. - :vartype manual_action_count: int - :ivar network_fabric_id: The resource ID of the Network Fabric associated with the cluster. - Required. - :vartype network_fabric_id: str - :ivar provisioning_state: The provisioning state of the cluster. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", "Validating", and "Updating". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.ClusterProvisioningState - :ivar runtime_protection_configuration: The settings for cluster runtime protection. - :vartype runtime_protection_configuration: - ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration - :ivar secret_archive: The configuration for use of a key vault to store secrets for later - retrieval by the operator. - :vartype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive - :ivar secret_archive_settings: The settings for the secret archive used to hold credentials for - the cluster. - :vartype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings - :ivar support_expiry_date: The support end date of the runtime version of the cluster. - :vartype support_expiry_date: str - :ivar update_strategy: The strategy for updating the cluster. - :vartype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy - :ivar vulnerability_scanning_settings: The settings for how security vulnerability scanning is - applied to the cluster. - :vartype vulnerability_scanning_settings: - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettings - :ivar workload_resource_ids: The list of workload resource IDs that are hosted within this - cluster. - :vartype workload_resource_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "action_states": {"readonly": True}, - "aggregator_or_single_rack_definition": {"required": True}, - "available_upgrade_versions": {"readonly": True}, - "cluster_capacity": {"readonly": True}, - "cluster_connection_status": {"readonly": True}, - "cluster_extended_location": {"readonly": True}, - "cluster_location": {"max_length": 256}, - "cluster_manager_connection_status": {"readonly": True}, - "cluster_manager_id": {"readonly": True}, - "cluster_type": {"required": True}, - "cluster_version": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "hybrid_aks_extended_location": {"readonly": True}, - "manual_action_count": {"readonly": True}, - "network_fabric_id": {"required": True}, - "provisioning_state": {"readonly": True}, - "support_expiry_date": {"readonly": True}, - "workload_resource_ids": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "action_states": {"key": "properties.actionStates", "type": "[ActionState]"}, - "aggregator_or_single_rack_definition": { - "key": "properties.aggregatorOrSingleRackDefinition", - "type": "RackDefinition", - }, - "analytics_output_settings": {"key": "properties.analyticsOutputSettings", "type": "AnalyticsOutputSettings"}, - "analytics_workspace_id": {"key": "properties.analyticsWorkspaceId", "type": "str"}, - "available_upgrade_versions": { - "key": "properties.availableUpgradeVersions", - "type": "[ClusterAvailableUpgradeVersion]", - }, - "cluster_capacity": {"key": "properties.clusterCapacity", "type": "ClusterCapacity"}, - "cluster_connection_status": {"key": "properties.clusterConnectionStatus", "type": "str"}, - "cluster_extended_location": {"key": "properties.clusterExtendedLocation", "type": "ExtendedLocation"}, - "cluster_location": {"key": "properties.clusterLocation", "type": "str"}, - "cluster_manager_connection_status": {"key": "properties.clusterManagerConnectionStatus", "type": "str"}, - "cluster_manager_id": {"key": "properties.clusterManagerId", "type": "str"}, - "cluster_service_principal": { - "key": "properties.clusterServicePrincipal", - "type": "ServicePrincipalInformation", - }, - "cluster_type": {"key": "properties.clusterType", "type": "str"}, - "cluster_version": {"key": "properties.clusterVersion", "type": "str"}, - "command_output_settings": {"key": "properties.commandOutputSettings", "type": "CommandOutputSettings"}, - "compute_deployment_threshold": {"key": "properties.computeDeploymentThreshold", "type": "ValidationThreshold"}, - "compute_rack_definitions": {"key": "properties.computeRackDefinitions", "type": "[RackDefinition]"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "hybrid_aks_extended_location": {"key": "properties.hybridAksExtendedLocation", "type": "ExtendedLocation"}, - "managed_resource_group_configuration": { - "key": "properties.managedResourceGroupConfiguration", - "type": "ManagedResourceGroupConfiguration", - }, - "manual_action_count": {"key": "properties.manualActionCount", "type": "int"}, - "network_fabric_id": {"key": "properties.networkFabricId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "runtime_protection_configuration": { - "key": "properties.runtimeProtectionConfiguration", - "type": "RuntimeProtectionConfiguration", - }, - "secret_archive": {"key": "properties.secretArchive", "type": "ClusterSecretArchive"}, - "secret_archive_settings": {"key": "properties.secretArchiveSettings", "type": "SecretArchiveSettings"}, - "support_expiry_date": {"key": "properties.supportExpiryDate", "type": "str"}, - "update_strategy": {"key": "properties.updateStrategy", "type": "ClusterUpdateStrategy"}, - "vulnerability_scanning_settings": { - "key": "properties.vulnerabilityScanningSettings", - "type": "VulnerabilityScanningSettings", - }, - "workload_resource_ids": {"key": "properties.workloadResourceIds", "type": "[str]"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - aggregator_or_single_rack_definition: "_models.RackDefinition", - cluster_type: Union[str, "_models.ClusterType"], - cluster_version: str, - network_fabric_id: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = None, - analytics_workspace_id: Optional[str] = None, - cluster_location: Optional[str] = None, - cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = None, - command_output_settings: Optional["_models.CommandOutputSettings"] = None, - compute_deployment_threshold: Optional["_models.ValidationThreshold"] = None, - compute_rack_definitions: Optional[list["_models.RackDefinition"]] = None, - managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, - runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = None, - secret_archive: Optional["_models.ClusterSecretArchive"] = None, - secret_archive_settings: Optional["_models.SecretArchiveSettings"] = None, - update_strategy: Optional["_models.ClusterUpdateStrategy"] = None, - vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster manager associated with the - cluster. Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword identity: The identity for the resource. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword aggregator_or_single_rack_definition: The rack definition that is intended to reflect - only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. - Required. - :paramtype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition - :keyword analytics_output_settings: The settings for the log analytics workspace used for - output of logs from this cluster. - :paramtype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings - :keyword analytics_workspace_id: Field Deprecated. The resource ID of the Log Analytics - Workspace that will be used for storing relevant logs. - :paramtype analytics_workspace_id: str - :keyword cluster_location: The customer-provided location information to identify where the - cluster resides. - :paramtype cluster_location: str - :keyword cluster_service_principal: Field Deprecated: Use managed identity to provide cluster - privileges. The service principal to be used by the cluster during Arc Appliance installation. - :paramtype cluster_service_principal: - ~azure.mgmt.networkcloud.models.ServicePrincipalInformation - :keyword cluster_type: The type of rack configuration for the cluster. Required. Known values - are: "SingleRack" and "MultiRack". - :paramtype cluster_type: str or ~azure.mgmt.networkcloud.models.ClusterType - :keyword cluster_version: The current runtime version of the cluster. Required. - :paramtype cluster_version: str - :keyword command_output_settings: The settings for commands run in this cluster, such as bare - metal machine run read only commands and data extracts. - :paramtype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings - :keyword compute_deployment_threshold: The validation threshold indicating the allowable - failures of compute machines during environment validation and deployment. - :paramtype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold - :keyword compute_rack_definitions: The list of rack definitions for the compute racks in a - multi-rack cluster, or an empty list in a single-rack cluster. - :paramtype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] - :keyword managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :paramtype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :keyword network_fabric_id: The resource ID of the Network Fabric associated with the cluster. - Required. - :paramtype network_fabric_id: str - :keyword runtime_protection_configuration: The settings for cluster runtime protection. - :paramtype runtime_protection_configuration: - ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration - :keyword secret_archive: The configuration for use of a key vault to store secrets for later - retrieval by the operator. - :paramtype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive - :keyword secret_archive_settings: The settings for the secret archive used to hold credentials - for the cluster. - :paramtype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings - :keyword update_strategy: The strategy for updating the cluster. - :paramtype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy - :keyword vulnerability_scanning_settings: The settings for how security vulnerability scanning - is applied to the cluster. - :paramtype vulnerability_scanning_settings: - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettings - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.identity = identity - self.action_states: Optional[list["_models.ActionState"]] = None - self.aggregator_or_single_rack_definition = aggregator_or_single_rack_definition - self.analytics_output_settings = analytics_output_settings - self.analytics_workspace_id = analytics_workspace_id - self.available_upgrade_versions: Optional[list["_models.ClusterAvailableUpgradeVersion"]] = None - self.cluster_capacity: Optional["_models.ClusterCapacity"] = None - self.cluster_connection_status: Optional[Union[str, "_models.ClusterConnectionStatus"]] = None - self.cluster_extended_location: Optional["_models.ExtendedLocation"] = None - self.cluster_location = cluster_location - self.cluster_manager_connection_status: Optional[Union[str, "_models.ClusterManagerConnectionStatus"]] = None - self.cluster_manager_id: Optional[str] = None - self.cluster_service_principal = cluster_service_principal - self.cluster_type = cluster_type - self.cluster_version = cluster_version - self.command_output_settings = command_output_settings - self.compute_deployment_threshold = compute_deployment_threshold - self.compute_rack_definitions = compute_rack_definitions - self.detailed_status: Optional[Union[str, "_models.ClusterDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.hybrid_aks_extended_location: Optional["_models.ExtendedLocation"] = None - self.managed_resource_group_configuration = managed_resource_group_configuration - self.manual_action_count: Optional[int] = None - self.network_fabric_id = network_fabric_id - self.provisioning_state: Optional[Union[str, "_models.ClusterProvisioningState"]] = None - self.runtime_protection_configuration = runtime_protection_configuration - self.secret_archive = secret_archive - self.secret_archive_settings = secret_archive_settings - self.support_expiry_date: Optional[str] = None - self.update_strategy = update_strategy - self.vulnerability_scanning_settings = vulnerability_scanning_settings - self.workload_resource_ids: Optional[list[str]] = None - - -class ClusterAvailableUpgradeVersion(_serialization.Model): - """ClusterAvailableUpgradeVersion represents the various cluster upgrade parameters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar control_impact: The indicator of whether the control plane will be impacted during the - upgrade. Known values are: "True" and "False". - :vartype control_impact: str or ~azure.mgmt.networkcloud.models.ControlImpact - :ivar expected_duration: The expected duration needed for this upgrade. - :vartype expected_duration: str - :ivar impact_description: The impact description including the specific details and release - notes. - :vartype impact_description: str - :ivar support_expiry_date: The last date the version of the platform is supported. - :vartype support_expiry_date: str - :ivar target_cluster_version: The target version this cluster will be upgraded to. - :vartype target_cluster_version: str - :ivar workload_impact: The indicator of whether the workload will be impacted during the - upgrade. Known values are: "True" and "False". - :vartype workload_impact: str or ~azure.mgmt.networkcloud.models.WorkloadImpact - """ - - _validation = { - "control_impact": {"readonly": True}, - "expected_duration": {"readonly": True}, - "impact_description": {"readonly": True}, - "support_expiry_date": {"readonly": True}, - "target_cluster_version": {"readonly": True}, - "workload_impact": {"readonly": True}, - } - - _attribute_map = { - "control_impact": {"key": "controlImpact", "type": "str"}, - "expected_duration": {"key": "expectedDuration", "type": "str"}, - "impact_description": {"key": "impactDescription", "type": "str"}, - "support_expiry_date": {"key": "supportExpiryDate", "type": "str"}, - "target_cluster_version": {"key": "targetClusterVersion", "type": "str"}, - "workload_impact": {"key": "workloadImpact", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.control_impact: Optional[Union[str, "_models.ControlImpact"]] = None - self.expected_duration: Optional[str] = None - self.impact_description: Optional[str] = None - self.support_expiry_date: Optional[str] = None - self.target_cluster_version: Optional[str] = None - self.workload_impact: Optional[Union[str, "_models.WorkloadImpact"]] = None - - -class ClusterAvailableVersion(_serialization.Model): - """ClusterAvailableVersion represents the cluster version that the cluster manager can be asked to - create and manage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar support_expiry_date: The last date the version of the platform is supported. - :vartype support_expiry_date: str - :ivar target_cluster_version: The version of the cluster to be deployed. - :vartype target_cluster_version: str - """ - - _validation = { - "support_expiry_date": {"readonly": True}, - "target_cluster_version": {"readonly": True}, - } - - _attribute_map = { - "support_expiry_date": {"key": "supportExpiryDate", "type": "str"}, - "target_cluster_version": {"key": "targetClusterVersion", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.support_expiry_date: Optional[str] = None - self.target_cluster_version: Optional[str] = None - - -class ClusterCapacity(_serialization.Model): - """ClusterCapacity represents various details regarding compute capacity. - - :ivar available_appliance_storage_gb: The remaining appliance-based storage in GB available for - workload use. Measured in gibibytes. - :vartype available_appliance_storage_gb: int - :ivar available_core_count: The remaining number of cores that are available in this cluster - for workload use. - :vartype available_core_count: int - :ivar available_host_storage_gb: The remaining machine or host-based storage in GB available - for workload use. Measured in gibibytes. - :vartype available_host_storage_gb: int - :ivar available_memory_gb: The remaining memory in GB that are available in this cluster for - workload use. Measured in gibibytes. - :vartype available_memory_gb: int - :ivar total_appliance_storage_gb: The total appliance-based storage in GB supported by this - cluster for workload use. Measured in gibibytes. - :vartype total_appliance_storage_gb: int - :ivar total_core_count: The total number of cores that are supported by this cluster for - workload use. - :vartype total_core_count: int - :ivar total_host_storage_gb: The total machine or host-based storage in GB supported by this - cluster for workload use. Measured in gibibytes. - :vartype total_host_storage_gb: int - :ivar total_memory_gb: The total memory supported by this cluster for workload use. Measured in - gibibytes. - :vartype total_memory_gb: int - """ - - _attribute_map = { - "available_appliance_storage_gb": {"key": "availableApplianceStorageGB", "type": "int"}, - "available_core_count": {"key": "availableCoreCount", "type": "int"}, - "available_host_storage_gb": {"key": "availableHostStorageGB", "type": "int"}, - "available_memory_gb": {"key": "availableMemoryGB", "type": "int"}, - "total_appliance_storage_gb": {"key": "totalApplianceStorageGB", "type": "int"}, - "total_core_count": {"key": "totalCoreCount", "type": "int"}, - "total_host_storage_gb": {"key": "totalHostStorageGB", "type": "int"}, - "total_memory_gb": {"key": "totalMemoryGB", "type": "int"}, - } - - def __init__( - self, - *, - available_appliance_storage_gb: Optional[int] = None, - available_core_count: Optional[int] = None, - available_host_storage_gb: Optional[int] = None, - available_memory_gb: Optional[int] = None, - total_appliance_storage_gb: Optional[int] = None, - total_core_count: Optional[int] = None, - total_host_storage_gb: Optional[int] = None, - total_memory_gb: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_appliance_storage_gb: The remaining appliance-based storage in GB available - for workload use. Measured in gibibytes. - :paramtype available_appliance_storage_gb: int - :keyword available_core_count: The remaining number of cores that are available in this cluster - for workload use. - :paramtype available_core_count: int - :keyword available_host_storage_gb: The remaining machine or host-based storage in GB available - for workload use. Measured in gibibytes. - :paramtype available_host_storage_gb: int - :keyword available_memory_gb: The remaining memory in GB that are available in this cluster for - workload use. Measured in gibibytes. - :paramtype available_memory_gb: int - :keyword total_appliance_storage_gb: The total appliance-based storage in GB supported by this - cluster for workload use. Measured in gibibytes. - :paramtype total_appliance_storage_gb: int - :keyword total_core_count: The total number of cores that are supported by this cluster for - workload use. - :paramtype total_core_count: int - :keyword total_host_storage_gb: The total machine or host-based storage in GB supported by this - cluster for workload use. Measured in gibibytes. - :paramtype total_host_storage_gb: int - :keyword total_memory_gb: The total memory supported by this cluster for workload use. Measured - in gibibytes. - :paramtype total_memory_gb: int - """ - super().__init__(**kwargs) - self.available_appliance_storage_gb = available_appliance_storage_gb - self.available_core_count = available_core_count - self.available_host_storage_gb = available_host_storage_gb - self.available_memory_gb = available_memory_gb - self.total_appliance_storage_gb = total_appliance_storage_gb - self.total_core_count = total_core_count - self.total_host_storage_gb = total_host_storage_gb - self.total_memory_gb = total_memory_gb - - -class ClusterContinueUpdateVersionParameters(_serialization.Model): - """ClusterContinueUpdateVersionParameters represents the body of the request to continue the - update of a cluster version. - - :ivar machine_group_targeting_mode: The mode by which the cluster will target the next grouping - of servers to continue the update. "AlphaByRack" - :vartype machine_group_targeting_mode: str or - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionMachineGroupTargetingMode - """ - - _attribute_map = { - "machine_group_targeting_mode": {"key": "machineGroupTargetingMode", "type": "str"}, - } - - def __init__( - self, - *, - machine_group_targeting_mode: Union[ - str, "_models.ClusterContinueUpdateVersionMachineGroupTargetingMode" - ] = "AlphaByRack", - **kwargs: Any - ) -> None: - """ - :keyword machine_group_targeting_mode: The mode by which the cluster will target the next - grouping of servers to continue the update. "AlphaByRack" - :paramtype machine_group_targeting_mode: str or - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionMachineGroupTargetingMode - """ - super().__init__(**kwargs) - self.machine_group_targeting_mode = machine_group_targeting_mode - - -class ClusterDeployParameters(_serialization.Model): - """ClusterDeployParameters represents the body of the request to deploy cluster. - - :ivar skip_validations_for_machines: The names of bare metal machines in the cluster that - should be skipped during environment validation. - :vartype skip_validations_for_machines: list[str] - """ - - _attribute_map = { - "skip_validations_for_machines": {"key": "skipValidationsForMachines", "type": "[str]"}, - } - - def __init__(self, *, skip_validations_for_machines: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword skip_validations_for_machines: The names of bare metal machines in the cluster that - should be skipped during environment validation. - :paramtype skip_validations_for_machines: list[str] - """ - super().__init__(**kwargs) - self.skip_validations_for_machines = skip_validations_for_machines - - -class ClusterList(_serialization.Model): - """ClusterList represents a list of clusters. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of clusters. - :vartype value: list[~azure.mgmt.networkcloud.models.Cluster] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Cluster]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.Cluster"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of clusters. - :paramtype value: list[~azure.mgmt.networkcloud.models.Cluster] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ClusterManager(TrackedResource): - """ClusterManager represents a control-plane to manage one or more on-premises clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar identity: The identity of the cluster manager. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar analytics_workspace_id: The resource ID of the Log Analytics workspace that is used for - the logs collection. - :vartype analytics_workspace_id: str - :ivar availability_zones: The Azure availability zones within the region that will be used to - support the cluster manager resource. - :vartype availability_zones: list[str] - :ivar cluster_versions: The list of the cluster versions the manager supports. It is used as - input in clusterVersion property of a cluster resource. - :vartype cluster_versions: list[~azure.mgmt.networkcloud.models.ClusterAvailableVersion] - :ivar detailed_status: The detailed status that provides additional information about the - cluster manager. Known values are: "Error", "Available", "Provisioning", "ProvisioningFailed", - "Updating", and "UpdateFailed". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ClusterManagerDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar fabric_controller_id: The resource ID of the fabric controller that has one to one - mapping with the cluster manager. Required. - :vartype fabric_controller_id: str - :ivar managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :vartype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :ivar manager_extended_location: The extended location (custom location) that represents the - cluster manager's control plane location. This extended location is used when creating cluster - and rack manifest resources. - :vartype manager_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar provisioning_state: The provisioning state of the cluster manager. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", "Accepted", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.ClusterManagerProvisioningState - :ivar vm_size: The size of the Azure virtual machines to use for hosting the cluster manager - resource. - :vartype vm_size: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "cluster_versions": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "fabric_controller_id": {"required": True}, - "manager_extended_location": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "analytics_workspace_id": {"key": "properties.analyticsWorkspaceId", "type": "str"}, - "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, - "cluster_versions": {"key": "properties.clusterVersions", "type": "[ClusterAvailableVersion]"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "fabric_controller_id": {"key": "properties.fabricControllerId", "type": "str"}, - "managed_resource_group_configuration": { - "key": "properties.managedResourceGroupConfiguration", - "type": "ManagedResourceGroupConfiguration", - }, - "manager_extended_location": {"key": "properties.managerExtendedLocation", "type": "ExtendedLocation"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "vm_size": {"key": "properties.vmSize", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - fabric_controller_id: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - analytics_workspace_id: Optional[str] = None, - availability_zones: Optional[list[str]] = None, - managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, - vm_size: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The identity of the cluster manager. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword analytics_workspace_id: The resource ID of the Log Analytics workspace that is used - for the logs collection. - :paramtype analytics_workspace_id: str - :keyword availability_zones: The Azure availability zones within the region that will be used - to support the cluster manager resource. - :paramtype availability_zones: list[str] - :keyword fabric_controller_id: The resource ID of the fabric controller that has one to one - mapping with the cluster manager. Required. - :paramtype fabric_controller_id: str - :keyword managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :paramtype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :keyword vm_size: The size of the Azure virtual machines to use for hosting the cluster manager - resource. - :paramtype vm_size: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.identity = identity - self.analytics_workspace_id = analytics_workspace_id - self.availability_zones = availability_zones - self.cluster_versions: Optional[list["_models.ClusterAvailableVersion"]] = None - self.detailed_status: Optional[Union[str, "_models.ClusterManagerDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.fabric_controller_id = fabric_controller_id - self.managed_resource_group_configuration = managed_resource_group_configuration - self.manager_extended_location: Optional["_models.ExtendedLocation"] = None - self.provisioning_state: Optional[Union[str, "_models.ClusterManagerProvisioningState"]] = None - self.vm_size = vm_size - - -class ClusterManagerList(_serialization.Model): - """ClusterManagerList represents a list of cluster manager objects. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of cluster managers. - :vartype value: list[~azure.mgmt.networkcloud.models.ClusterManager] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ClusterManager]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.ClusterManager"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of cluster managers. - :paramtype value: list[~azure.mgmt.networkcloud.models.ClusterManager] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ClusterManagerPatchParameters(_serialization.Model): - """ClusterManagerPatchParameters represents the body of the request to patch the cluster - properties. - - :ivar identity: The identity for the resource. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The identity for the resource. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - - -class ClusterMetricsConfiguration(TrackedResource): - """ClusterMetricsConfiguration represents the metrics configuration of an on-premises Network - Cloud cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar collection_interval: The interval in minutes by which metrics will be collected. - Required. - :vartype collection_interval: int - :ivar detailed_status: The more detailed status of the metrics configuration. Known values are: - "Processing", "Applied", and "Error". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar disabled_metrics: The list of metrics that are available for the cluster but disabled at - the moment. - :vartype disabled_metrics: list[str] - :ivar enabled_metrics: The list of metric names that have been chosen to be enabled in addition - to the core set of enabled metrics. - :vartype enabled_metrics: list[str] - :ivar provisioning_state: The provisioning state of the metrics configuration. Known values - are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "collection_interval": {"required": True, "maximum": 1440, "minimum": 1}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "disabled_metrics": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "collection_interval": {"key": "properties.collectionInterval", "type": "int"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "disabled_metrics": {"key": "properties.disabledMetrics", "type": "[str]"}, - "enabled_metrics": {"key": "properties.enabledMetrics", "type": "[str]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - collection_interval: int, - tags: Optional[dict[str, str]] = None, - enabled_metrics: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword collection_interval: The interval in minutes by which metrics will be collected. - Required. - :paramtype collection_interval: int - :keyword enabled_metrics: The list of metric names that have been chosen to be enabled in - addition to the core set of enabled metrics. - :paramtype enabled_metrics: list[str] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.collection_interval = collection_interval - self.detailed_status: Optional[Union[str, "_models.ClusterMetricsConfigurationDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.disabled_metrics: Optional[list[str]] = None - self.enabled_metrics = enabled_metrics - self.provisioning_state: Optional[Union[str, "_models.ClusterMetricsConfigurationProvisioningState"]] = None - - -class ClusterMetricsConfigurationList(_serialization.Model): - """ClusterMetricsConfigurationList represents a list of metrics configuration of the cluster. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of metrics configurations. - :vartype value: list[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ClusterMetricsConfiguration]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.ClusterMetricsConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of metrics configurations. - :paramtype value: list[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ClusterMetricsConfigurationPatchParameters(_serialization.Model): # pylint: disable=name-too-long - """ClusterMetricsConfigurationPatchParameters represents the body of the request to patch the - metrics configuration of cluster. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar collection_interval: The interval in minutes by which metrics will be collected. - :vartype collection_interval: int - :ivar enabled_metrics: The list of metric names that have been chosen to be enabled in addition - to the core set of enabled metrics. - :vartype enabled_metrics: list[str] - """ - - _validation = { - "collection_interval": {"maximum": 1440, "minimum": 1}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "collection_interval": {"key": "properties.collectionInterval", "type": "int"}, - "enabled_metrics": {"key": "properties.enabledMetrics", "type": "[str]"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - collection_interval: Optional[int] = None, - enabled_metrics: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword collection_interval: The interval in minutes by which metrics will be collected. - :paramtype collection_interval: int - :keyword enabled_metrics: The list of metric names that have been chosen to be enabled in - addition to the core set of enabled metrics. - :paramtype enabled_metrics: list[str] - """ - super().__init__(**kwargs) - self.tags = tags - self.collection_interval = collection_interval - self.enabled_metrics = enabled_metrics - - -class ClusterPatchParameters(_serialization.Model): - """ClusterPatchParameters represents the body of the request to patch the cluster properties. - - :ivar identity: The identity for the resource. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar aggregator_or_single_rack_definition: The rack definition that is intended to reflect - only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. - :vartype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition - :ivar analytics_output_settings: The settings for the log analytics workspace used for output - of logs from this cluster. - :vartype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings - :ivar cluster_location: The customer-provided location information to identify where the - cluster resides. - :vartype cluster_location: str - :ivar cluster_service_principal: Field Deprecated: Use managed identity to provide cluster - privileges. The service principal to be used by the cluster during Arc Appliance installation. - :vartype cluster_service_principal: ~azure.mgmt.networkcloud.models.ServicePrincipalInformation - :ivar command_output_settings: The settings for commands run in this cluster, such as bare - metal machine run read only commands and data extracts. - :vartype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings - :ivar compute_deployment_threshold: The validation threshold indicating the allowable failures - of compute machines during environment validation and deployment. - :vartype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold - :ivar compute_rack_definitions: The list of rack definitions for the compute racks in a - multi-rack cluster, or an empty list in a single-rack cluster. - :vartype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] - :ivar runtime_protection_configuration: The settings for cluster runtime protection. - :vartype runtime_protection_configuration: - ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration - :ivar secret_archive: The configuration for use of a key vault to store secrets for later - retrieval by the operator. - :vartype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive - :ivar secret_archive_settings: The settings for the secret archive used to hold credentials for - the cluster. - :vartype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings - :ivar update_strategy: The strategy for updating the cluster. - :vartype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy - :ivar vulnerability_scanning_settings: The settings for how security vulnerability scanning is - applied to the cluster. - :vartype vulnerability_scanning_settings: - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsPatch - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "aggregator_or_single_rack_definition": { - "key": "properties.aggregatorOrSingleRackDefinition", - "type": "RackDefinition", - }, - "analytics_output_settings": {"key": "properties.analyticsOutputSettings", "type": "AnalyticsOutputSettings"}, - "cluster_location": {"key": "properties.clusterLocation", "type": "str"}, - "cluster_service_principal": { - "key": "properties.clusterServicePrincipal", - "type": "ServicePrincipalInformation", - }, - "command_output_settings": {"key": "properties.commandOutputSettings", "type": "CommandOutputSettings"}, - "compute_deployment_threshold": {"key": "properties.computeDeploymentThreshold", "type": "ValidationThreshold"}, - "compute_rack_definitions": {"key": "properties.computeRackDefinitions", "type": "[RackDefinition]"}, - "runtime_protection_configuration": { - "key": "properties.runtimeProtectionConfiguration", - "type": "RuntimeProtectionConfiguration", - }, - "secret_archive": {"key": "properties.secretArchive", "type": "ClusterSecretArchive"}, - "secret_archive_settings": {"key": "properties.secretArchiveSettings", "type": "SecretArchiveSettings"}, - "update_strategy": {"key": "properties.updateStrategy", "type": "ClusterUpdateStrategy"}, - "vulnerability_scanning_settings": { - "key": "properties.vulnerabilityScanningSettings", - "type": "VulnerabilityScanningSettingsPatch", - }, - } - - def __init__( - self, - *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[dict[str, str]] = None, - aggregator_or_single_rack_definition: Optional["_models.RackDefinition"] = None, - analytics_output_settings: Optional["_models.AnalyticsOutputSettings"] = None, - cluster_location: Optional[str] = None, - cluster_service_principal: Optional["_models.ServicePrincipalInformation"] = None, - command_output_settings: Optional["_models.CommandOutputSettings"] = None, - compute_deployment_threshold: Optional["_models.ValidationThreshold"] = None, - compute_rack_definitions: Optional[list["_models.RackDefinition"]] = None, - runtime_protection_configuration: Optional["_models.RuntimeProtectionConfiguration"] = None, - secret_archive: Optional["_models.ClusterSecretArchive"] = None, - secret_archive_settings: Optional["_models.SecretArchiveSettings"] = None, - update_strategy: Optional["_models.ClusterUpdateStrategy"] = None, - vulnerability_scanning_settings: Optional["_models.VulnerabilityScanningSettingsPatch"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The identity for the resource. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword aggregator_or_single_rack_definition: The rack definition that is intended to reflect - only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster. - :paramtype aggregator_or_single_rack_definition: ~azure.mgmt.networkcloud.models.RackDefinition - :keyword analytics_output_settings: The settings for the log analytics workspace used for - output of logs from this cluster. - :paramtype analytics_output_settings: ~azure.mgmt.networkcloud.models.AnalyticsOutputSettings - :keyword cluster_location: The customer-provided location information to identify where the - cluster resides. - :paramtype cluster_location: str - :keyword cluster_service_principal: Field Deprecated: Use managed identity to provide cluster - privileges. The service principal to be used by the cluster during Arc Appliance installation. - :paramtype cluster_service_principal: - ~azure.mgmt.networkcloud.models.ServicePrincipalInformation - :keyword command_output_settings: The settings for commands run in this cluster, such as bare - metal machine run read only commands and data extracts. - :paramtype command_output_settings: ~azure.mgmt.networkcloud.models.CommandOutputSettings - :keyword compute_deployment_threshold: The validation threshold indicating the allowable - failures of compute machines during environment validation and deployment. - :paramtype compute_deployment_threshold: ~azure.mgmt.networkcloud.models.ValidationThreshold - :keyword compute_rack_definitions: The list of rack definitions for the compute racks in a - multi-rack cluster, or an empty list in a single-rack cluster. - :paramtype compute_rack_definitions: list[~azure.mgmt.networkcloud.models.RackDefinition] - :keyword runtime_protection_configuration: The settings for cluster runtime protection. - :paramtype runtime_protection_configuration: - ~azure.mgmt.networkcloud.models.RuntimeProtectionConfiguration - :keyword secret_archive: The configuration for use of a key vault to store secrets for later - retrieval by the operator. - :paramtype secret_archive: ~azure.mgmt.networkcloud.models.ClusterSecretArchive - :keyword secret_archive_settings: The settings for the secret archive used to hold credentials - for the cluster. - :paramtype secret_archive_settings: ~azure.mgmt.networkcloud.models.SecretArchiveSettings - :keyword update_strategy: The strategy for updating the cluster. - :paramtype update_strategy: ~azure.mgmt.networkcloud.models.ClusterUpdateStrategy - :keyword vulnerability_scanning_settings: The settings for how security vulnerability scanning - is applied to the cluster. - :paramtype vulnerability_scanning_settings: - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsPatch - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.aggregator_or_single_rack_definition = aggregator_or_single_rack_definition - self.analytics_output_settings = analytics_output_settings - self.cluster_location = cluster_location - self.cluster_service_principal = cluster_service_principal - self.command_output_settings = command_output_settings - self.compute_deployment_threshold = compute_deployment_threshold - self.compute_rack_definitions = compute_rack_definitions - self.runtime_protection_configuration = runtime_protection_configuration - self.secret_archive = secret_archive - self.secret_archive_settings = secret_archive_settings - self.update_strategy = update_strategy - self.vulnerability_scanning_settings = vulnerability_scanning_settings - - -class ClusterScanRuntimeParameters(_serialization.Model): - """ClusterScanRuntimeParameters defines the parameters for the cluster scan runtime operation. - - :ivar scan_activity: The choice of if the scan operation should run the scan. Known values are: - "Scan" and "Skip". - :vartype scan_activity: str or - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParametersScanActivity - """ - - _attribute_map = { - "scan_activity": {"key": "scanActivity", "type": "str"}, - } - - def __init__( - self, *, scan_activity: Union[str, "_models.ClusterScanRuntimeParametersScanActivity"] = "Scan", **kwargs: Any - ) -> None: - """ - :keyword scan_activity: The choice of if the scan operation should run the scan. Known values - are: "Scan" and "Skip". - :paramtype scan_activity: str or - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParametersScanActivity - """ - super().__init__(**kwargs) - self.scan_activity = scan_activity - - -class ClusterSecretArchive(_serialization.Model): - """ClusterSecretArchive configures the key vault to archive the secrets of the cluster for later - retrieval. - - All required parameters must be populated in order to send to server. - - :ivar key_vault_id: The resource ID of the key vault to archive the secrets of the cluster. - Required. - :vartype key_vault_id: str - :ivar use_key_vault: The indicator if the specified key vault should be used to archive the - secrets of the cluster. Known values are: "True" and "False". - :vartype use_key_vault: str or ~azure.mgmt.networkcloud.models.ClusterSecretArchiveEnabled - """ - - _validation = { - "key_vault_id": {"required": True}, - } - - _attribute_map = { - "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "use_key_vault": {"key": "useKeyVault", "type": "str"}, - } - - def __init__( - self, - *, - key_vault_id: str, - use_key_vault: Union[str, "_models.ClusterSecretArchiveEnabled"] = "False", - **kwargs: Any - ) -> None: - """ - :keyword key_vault_id: The resource ID of the key vault to archive the secrets of the cluster. - Required. - :paramtype key_vault_id: str - :keyword use_key_vault: The indicator if the specified key vault should be used to archive the - secrets of the cluster. Known values are: "True" and "False". - :paramtype use_key_vault: str or ~azure.mgmt.networkcloud.models.ClusterSecretArchiveEnabled - """ - super().__init__(**kwargs) - self.key_vault_id = key_vault_id - self.use_key_vault = use_key_vault - - -class ClusterUpdateStrategy(_serialization.Model): - """ClusterUpdateStrategy represents the strategy for updating the cluster. - - All required parameters must be populated in order to send to server. - - :ivar max_unavailable: The maximum number of worker nodes that can be offline within the - increment of update, e.g., rack-by-rack. Limited by the maximum number of machines in the - increment. Defaults to the whole increment size. - :vartype max_unavailable: int - :ivar strategy_type: The mode of operation for runtime protection. Required. Known values are: - "Rack" and "PauseAfterRack". - :vartype strategy_type: str or ~azure.mgmt.networkcloud.models.ClusterUpdateStrategyType - :ivar threshold_type: Selection of how the threshold should be evaluated. Required. Known - values are: "CountSuccess" and "PercentSuccess". - :vartype threshold_type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType - :ivar threshold_value: The numeric threshold value. Required. - :vartype threshold_value: int - :ivar wait_time_minutes: The time to wait between the increments of update defined by the - strategy. - :vartype wait_time_minutes: int - """ - - _validation = { - "max_unavailable": {"minimum": 1}, - "strategy_type": {"required": True}, - "threshold_type": {"required": True}, - "threshold_value": {"required": True, "minimum": 0}, - "wait_time_minutes": {"maximum": 60, "minimum": 0}, - } - - _attribute_map = { - "max_unavailable": {"key": "maxUnavailable", "type": "int"}, - "strategy_type": {"key": "strategyType", "type": "str"}, - "threshold_type": {"key": "thresholdType", "type": "str"}, - "threshold_value": {"key": "thresholdValue", "type": "int"}, - "wait_time_minutes": {"key": "waitTimeMinutes", "type": "int"}, - } - - def __init__( - self, - *, - strategy_type: Union[str, "_models.ClusterUpdateStrategyType"], - threshold_type: Union[str, "_models.ValidationThresholdType"], - threshold_value: int, - max_unavailable: Optional[int] = None, - wait_time_minutes: int = 15, - **kwargs: Any - ) -> None: - """ - :keyword max_unavailable: The maximum number of worker nodes that can be offline within the - increment of update, e.g., rack-by-rack. Limited by the maximum number of machines in the - increment. Defaults to the whole increment size. - :paramtype max_unavailable: int - :keyword strategy_type: The mode of operation for runtime protection. Required. Known values - are: "Rack" and "PauseAfterRack". - :paramtype strategy_type: str or ~azure.mgmt.networkcloud.models.ClusterUpdateStrategyType - :keyword threshold_type: Selection of how the threshold should be evaluated. Required. Known - values are: "CountSuccess" and "PercentSuccess". - :paramtype threshold_type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType - :keyword threshold_value: The numeric threshold value. Required. - :paramtype threshold_value: int - :keyword wait_time_minutes: The time to wait between the increments of update defined by the - strategy. - :paramtype wait_time_minutes: int - """ - super().__init__(**kwargs) - self.max_unavailable = max_unavailable - self.strategy_type = strategy_type - self.threshold_type = threshold_type - self.threshold_value = threshold_value - self.wait_time_minutes = wait_time_minutes - - -class ClusterUpdateVersionParameters(_serialization.Model): - """ClusterUpdateVersionParameters represents the body of the request to update cluster version. - - All required parameters must be populated in order to send to server. - - :ivar target_cluster_version: The version to be applied to the cluster during update. Required. - :vartype target_cluster_version: str - """ - - _validation = { - "target_cluster_version": {"required": True}, - } - - _attribute_map = { - "target_cluster_version": {"key": "targetClusterVersion", "type": "str"}, - } - - def __init__(self, *, target_cluster_version: str, **kwargs: Any) -> None: - """ - :keyword target_cluster_version: The version to be applied to the cluster during update. - Required. - :paramtype target_cluster_version: str - """ - super().__init__(**kwargs) - self.target_cluster_version = target_cluster_version - - -class CommandOutputOverride(_serialization.Model): - """CommandOutputOverride represents an overridden value for the command output settings. - - :ivar associated_identity: The selection of the managed identity to use with this storage - account container. The identity type must be either system assigned or user assigned. - :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :ivar command_output_type: The type of command output for the override. Known values are: - "BareMetalMachineRunCommand", "BareMetalMachineRunDataExtracts", - "BareMetalMachineRunReadCommands", "StorageRunReadCommands", and - "BareMetalMachineRunDataExtractsRestricted". - :vartype command_output_type: str or ~azure.mgmt.networkcloud.models.CommandOutputType - :ivar container_url: The URL of the storage account container that is to be used by the - specified identities. - :vartype container_url: str - """ - - _attribute_map = { - "associated_identity": {"key": "associatedIdentity", "type": "IdentitySelector"}, - "command_output_type": {"key": "commandOutputType", "type": "str"}, - "container_url": {"key": "containerUrl", "type": "str"}, - } - - def __init__( - self, - *, - associated_identity: Optional["_models.IdentitySelector"] = None, - command_output_type: Optional[Union[str, "_models.CommandOutputType"]] = None, - container_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword associated_identity: The selection of the managed identity to use with this storage - account container. The identity type must be either system assigned or user assigned. - :paramtype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :keyword command_output_type: The type of command output for the override. Known values are: - "BareMetalMachineRunCommand", "BareMetalMachineRunDataExtracts", - "BareMetalMachineRunReadCommands", "StorageRunReadCommands", and - "BareMetalMachineRunDataExtractsRestricted". - :paramtype command_output_type: str or ~azure.mgmt.networkcloud.models.CommandOutputType - :keyword container_url: The URL of the storage account container that is to be used by the - specified identities. - :paramtype container_url: str - """ - super().__init__(**kwargs) - self.associated_identity = associated_identity - self.command_output_type = command_output_type - self.container_url = container_url - - -class CommandOutputSettings(_serialization.Model): - """CommandOutputSettings represents the settings for commands run within the cluster such as bare - metal machine run read-only commands. - - :ivar associated_identity: The selection of the managed identity to use with this storage - account container. The identity type must be either system assigned or user assigned. - :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :ivar container_url: The URL of the storage account container that is to be used by the - specified identities. - :vartype container_url: str - :ivar overrides: The list of optional overrides allowing for association of storage containers - and identities to specific types of command output. If a type is not overridden, the default - identity and storage container will be utilized. - :vartype overrides: list[~azure.mgmt.networkcloud.models.CommandOutputOverride] - """ - - _attribute_map = { - "associated_identity": {"key": "associatedIdentity", "type": "IdentitySelector"}, - "container_url": {"key": "containerUrl", "type": "str"}, - "overrides": {"key": "overrides", "type": "[CommandOutputOverride]"}, - } - - def __init__( - self, - *, - associated_identity: Optional["_models.IdentitySelector"] = None, - container_url: Optional[str] = None, - overrides: Optional[list["_models.CommandOutputOverride"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword associated_identity: The selection of the managed identity to use with this storage - account container. The identity type must be either system assigned or user assigned. - :paramtype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :keyword container_url: The URL of the storage account container that is to be used by the - specified identities. - :paramtype container_url: str - :keyword overrides: The list of optional overrides allowing for association of storage - containers and identities to specific types of command output. If a type is not overridden, the - default identity and storage container will be utilized. - :paramtype overrides: list[~azure.mgmt.networkcloud.models.CommandOutputOverride] - """ - super().__init__(**kwargs) - self.associated_identity = associated_identity - self.container_url = container_url - self.overrides = overrides - - -class Console(TrackedResource): - """Console represents the console of an on-premises Network Cloud virtual machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster manager associated with the - cluster this virtual machine is created on. Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar detailed_status: The more detailed status of the console. Known values are: "Ready" and - "Error". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.ConsoleDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar enabled: The indicator of whether the console access is enabled. Required. Known values - are: "True" and "False". - :vartype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled - :ivar expiration: The date and time after which the key will be disallowed access. - :vartype expiration: ~datetime.datetime - :ivar private_link_service_id: The resource ID of the private link service that is used to - provide virtual machine console access. - :vartype private_link_service_id: str - :ivar provisioning_state: The provisioning state of the virtual machine console. Known values - are: "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.ConsoleProvisioningState - :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is - expected to have the corresponding SSH private key for logging in. Required. - :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - :ivar virtual_machine_access_id: The unique identifier for the virtual machine that is used to - access the console. - :vartype virtual_machine_access_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "enabled": {"required": True}, - "private_link_service_id": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "ssh_public_key": {"required": True}, - "virtual_machine_access_id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "str"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "private_link_service_id": {"key": "properties.privateLinkServiceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "ssh_public_key": {"key": "properties.sshPublicKey", "type": "SshPublicKey"}, - "virtual_machine_access_id": {"key": "properties.virtualMachineAccessId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - enabled: Union[str, "_models.ConsoleEnabled"], - ssh_public_key: "_models.SshPublicKey", - tags: Optional[dict[str, str]] = None, - expiration: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster manager associated with the - cluster this virtual machine is created on. Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword enabled: The indicator of whether the console access is enabled. Required. Known - values are: "True" and "False". - :paramtype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled - :keyword expiration: The date and time after which the key will be disallowed access. - :paramtype expiration: ~datetime.datetime - :keyword ssh_public_key: The SSH public key that will be provisioned for user access. The user - is expected to have the corresponding SSH private key for logging in. Required. - :paramtype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.detailed_status: Optional[Union[str, "_models.ConsoleDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.enabled = enabled - self.expiration = expiration - self.private_link_service_id: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ConsoleProvisioningState"]] = None - self.ssh_public_key = ssh_public_key - self.virtual_machine_access_id: Optional[str] = None - - -class ConsoleList(_serialization.Model): - """ConsoleList represents a list of virtual machine consoles. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of virtual machine consoles. - :vartype value: list[~azure.mgmt.networkcloud.models.Console] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Console]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.Console"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of virtual machine consoles. - :paramtype value: list[~azure.mgmt.networkcloud.models.Console] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ConsolePatchParameters(_serialization.Model): - """ConsolePatchParameters represents the body of the request to patch the virtual machine console. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar enabled: The indicator of whether the console access is enabled. Known values are: "True" - and "False". - :vartype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled - :ivar expiration: The date and time after which the key will be disallowed access. - :vartype expiration: ~datetime.datetime - :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is - expected to have the corresponding SSH private key for logging in. - :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "enabled": {"key": "properties.enabled", "type": "str"}, - "expiration": {"key": "properties.expiration", "type": "iso-8601"}, - "ssh_public_key": {"key": "properties.sshPublicKey", "type": "SshPublicKey"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - enabled: Optional[Union[str, "_models.ConsoleEnabled"]] = None, - expiration: Optional[datetime.datetime] = None, - ssh_public_key: Optional["_models.SshPublicKey"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword enabled: The indicator of whether the console access is enabled. Known values are: - "True" and "False". - :paramtype enabled: str or ~azure.mgmt.networkcloud.models.ConsoleEnabled - :keyword expiration: The date and time after which the key will be disallowed access. - :paramtype expiration: ~datetime.datetime - :keyword ssh_public_key: The SSH public key that will be provisioned for user access. The user - is expected to have the corresponding SSH private key for logging in. - :paramtype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - """ - super().__init__(**kwargs) - self.tags = tags - self.enabled = enabled - self.expiration = expiration - self.ssh_public_key = ssh_public_key - - -class ControlPlaneNodeConfiguration(_serialization.Model): - """ControlPlaneNodeConfiguration represents the selection of virtual machines and size of the - control plane for a Kubernetes cluster. - - All required parameters must be populated in order to send to server. - - :ivar administrator_configuration: The administrator credentials to be used for the nodes in - the control plane. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :ivar availability_zones: The list of availability zones of the Network Cloud cluster to be - used for the provisioning of nodes in the control plane. If not specified, all availability - zones will be used. - :vartype availability_zones: list[str] - :ivar count: The number of virtual machines that use this configuration. Required. - :vartype count: int - :ivar vm_sku_name: The name of the VM SKU supplied during creation. Required. - :vartype vm_sku_name: str - """ - - _validation = { - "count": {"required": True, "minimum": 1}, - "vm_sku_name": {"required": True}, - } - - _attribute_map = { - "administrator_configuration": {"key": "administratorConfiguration", "type": "AdministratorConfiguration"}, - "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "count": {"key": "count", "type": "int"}, - "vm_sku_name": {"key": "vmSkuName", "type": "str"}, - } - - def __init__( - self, - *, - count: int, - vm_sku_name: str, - administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, - availability_zones: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword administrator_configuration: The administrator credentials to be used for the nodes in - the control plane. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :keyword availability_zones: The list of availability zones of the Network Cloud cluster to be - used for the provisioning of nodes in the control plane. If not specified, all availability - zones will be used. - :paramtype availability_zones: list[str] - :keyword count: The number of virtual machines that use this configuration. Required. - :paramtype count: int - :keyword vm_sku_name: The name of the VM SKU supplied during creation. Required. - :paramtype vm_sku_name: str - """ - super().__init__(**kwargs) - self.administrator_configuration = administrator_configuration - self.availability_zones = availability_zones - self.count = count - self.vm_sku_name = vm_sku_name - - -class ControlPlaneNodePatchConfiguration(_serialization.Model): - """ControlPlaneNodePatchConfiguration represents the properties of the control plane that can be - patched for this Kubernetes cluster. - - :ivar administrator_configuration: The configuration of administrator credentials for the - control plane nodes. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch - :ivar count: The number of virtual machines that use this configuration. - :vartype count: int - """ - - _validation = { - "count": {"minimum": 1}, - } - - _attribute_map = { - "administrator_configuration": {"key": "administratorConfiguration", "type": "AdministratorConfigurationPatch"}, - "count": {"key": "count", "type": "int"}, - } - - def __init__( - self, - *, - administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = None, - count: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword administrator_configuration: The configuration of administrator credentials for the - control plane nodes. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch - :keyword count: The number of virtual machines that use this configuration. - :paramtype count: int - """ - super().__init__(**kwargs) - self.administrator_configuration = administrator_configuration - self.count = count - - -class EgressEndpoint(_serialization.Model): - """EgressEndpoint represents the connection from a cloud services network to the specified - endpoint for a common purpose. - - All required parameters must be populated in order to send to server. - - :ivar category: The descriptive category name of endpoints accessible by the AKS agent node. - For example, azure-resource-management, API server, etc. The platform egress endpoints provided - by default will use the category 'default'. Required. - :vartype category: str - :ivar endpoints: The list of endpoint dependencies. Required. - :vartype endpoints: list[~azure.mgmt.networkcloud.models.EndpointDependency] - """ - - _validation = { - "category": {"required": True}, - "endpoints": {"required": True, "min_items": 1}, - } - - _attribute_map = { - "category": {"key": "category", "type": "str"}, - "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, - } - - def __init__(self, *, category: str, endpoints: list["_models.EndpointDependency"], **kwargs: Any) -> None: - """ - :keyword category: The descriptive category name of endpoints accessible by the AKS agent node. - For example, azure-resource-management, API server, etc. The platform egress endpoints provided - by default will use the category 'default'. Required. - :paramtype category: str - :keyword endpoints: The list of endpoint dependencies. Required. - :paramtype endpoints: list[~azure.mgmt.networkcloud.models.EndpointDependency] - """ - super().__init__(**kwargs) - self.category = category - self.endpoints = endpoints - - -class EndpointDependency(_serialization.Model): - """EndpointDependency represents the definition of an endpoint, including the domain and details. - - All required parameters must be populated in order to send to server. - - :ivar domain_name: The domain name of the dependency. Required. - :vartype domain_name: str - :ivar port: The port of this endpoint. - :vartype port: int - """ - - _validation = { - "domain_name": {"required": True}, - "port": {"maximum": 65535, "minimum": 1}, - } - - _attribute_map = { - "domain_name": {"key": "domainName", "type": "str"}, - "port": {"key": "port", "type": "int"}, - } - - def __init__(self, *, domain_name: str, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword domain_name: The domain name of the dependency. Required. - :paramtype domain_name: str - :keyword port: The port of this endpoint. - :paramtype port: int - """ - super().__init__(**kwargs) - self.domain_name = domain_name - self.port = port - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.networkcloud.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.networkcloud.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[list["_models.ErrorDetail"]] = None - self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.networkcloud.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.networkcloud.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class ExtendedLocation(_serialization.Model): - """ExtendedLocation represents the Azure custom location where the resource will be created. - - All required parameters must be populated in order to send to server. - - :ivar name: The resource ID of the extended location on which the resource will be created. - Required. - :vartype name: str - :ivar type: The extended location type, for example, CustomLocation. Required. - :vartype type: str - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: - """ - :keyword name: The resource ID of the extended location on which the resource will be created. - Required. - :paramtype name: str - :keyword type: The extended location type, for example, CustomLocation. Required. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class FeatureStatus(_serialization.Model): - """FeatureStatus contains information regarding a Kubernetes cluster feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar detailed_status: The status representing the state of this feature. Known values are: - "Running", "Failed", and "Unknown". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.FeatureDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar name: The name of the feature. - :vartype name: str - :ivar version: The version of the feature. - :vartype version: str - """ - - _validation = { - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "name": {"readonly": True}, - "version": {"readonly": True}, - } - - _attribute_map = { - "detailed_status": {"key": "detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "detailedStatusMessage", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.detailed_status: Optional[Union[str, "_models.FeatureDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.name: Optional[str] = None - self.version: Optional[str] = None - - -class HardwareInventory(_serialization.Model): - """HardwareInventory represents the hardware configuration of this machine as exposed to the - customer, including information acquired from the model/sku information and from the ironic - inspector. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_host_information: Freeform data extracted from the environment about this - machine. This information varies depending on the specific hardware and configuration. - :vartype additional_host_information: str - :ivar interfaces: The list of network interfaces and associated details for the bare metal - machine. - :vartype interfaces: list[~azure.mgmt.networkcloud.models.HardwareInventoryNetworkInterface] - :ivar nics: Field Deprecated. Will be removed in an upcoming version. The list of network - interface cards and associated details for the bare metal machine. - :vartype nics: list[~azure.mgmt.networkcloud.models.Nic] - """ - - _validation = { - "additional_host_information": {"readonly": True}, - "interfaces": {"readonly": True}, - "nics": {"readonly": True}, - } - - _attribute_map = { - "additional_host_information": {"key": "additionalHostInformation", "type": "str"}, - "interfaces": {"key": "interfaces", "type": "[HardwareInventoryNetworkInterface]"}, - "nics": {"key": "nics", "type": "[Nic]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.additional_host_information: Optional[str] = None - self.interfaces: Optional[list["_models.HardwareInventoryNetworkInterface"]] = None - self.nics: Optional[list["_models.Nic"]] = None - - -class HardwareInventoryNetworkInterface(_serialization.Model): - """HardwareInventoryNetworkInterface represents the network interface details as part of a - hardware inventory. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar link_status: The current status of the link. - :vartype link_status: str - :ivar mac_address: The MAC address associated with this interface. - :vartype mac_address: str - :ivar name: The name of the interface. - :vartype name: str - :ivar network_interface_id: The resource ID of the network interface for the port on the switch - that this machine's interface is connected to. - :vartype network_interface_id: str - """ - - _validation = { - "link_status": {"readonly": True}, - "mac_address": {"readonly": True}, - "name": {"readonly": True}, - "network_interface_id": {"readonly": True}, - } - - _attribute_map = { - "link_status": {"key": "linkStatus", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "network_interface_id": {"key": "networkInterfaceId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.link_status: Optional[str] = None - self.mac_address: Optional[str] = None - self.name: Optional[str] = None - self.network_interface_id: Optional[str] = None - - -class HardwareValidationStatus(_serialization.Model): - """HardwareValidationStatus represents the latest hardware validation details performed for this - bare metal machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar last_validation_time: The timestamp of the hardware validation execution. - :vartype last_validation_time: ~datetime.datetime - :ivar result: The outcome of the hardware validation. Known values are: "Pass", "Fail", and - "Pass". - :vartype result: str or - ~azure.mgmt.networkcloud.models.BareMetalMachineHardwareValidationResult - """ - - _validation = { - "last_validation_time": {"readonly": True}, - "result": {"readonly": True}, - } - - _attribute_map = { - "last_validation_time": {"key": "lastValidationTime", "type": "iso-8601"}, - "result": {"key": "result", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_validation_time: Optional[datetime.datetime] = None - self.result: Optional[Union[str, "_models.BareMetalMachineHardwareValidationResult"]] = None - - -class IdentitySelector(_serialization.Model): - """IdentitySelector represents the selection of a managed identity for use. - - :ivar identity_type: The type of managed identity that is being selected. Known values are: - "SystemAssignedIdentity" and "UserAssignedIdentity". - :vartype identity_type: str or - ~azure.mgmt.networkcloud.models.ManagedServiceIdentitySelectorType - :ivar user_assigned_identity_resource_id: The user assigned managed identity resource ID to - use. Mutually exclusive with a system assigned identity type. - :vartype user_assigned_identity_resource_id: str - """ - - _attribute_map = { - "identity_type": {"key": "identityType", "type": "str"}, - "user_assigned_identity_resource_id": {"key": "userAssignedIdentityResourceId", "type": "str"}, - } - - def __init__( - self, - *, - identity_type: Optional[Union[str, "_models.ManagedServiceIdentitySelectorType"]] = None, - user_assigned_identity_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity_type: The type of managed identity that is being selected. Known values are: - "SystemAssignedIdentity" and "UserAssignedIdentity". - :paramtype identity_type: str or - ~azure.mgmt.networkcloud.models.ManagedServiceIdentitySelectorType - :keyword user_assigned_identity_resource_id: The user assigned managed identity resource ID to - use. Mutually exclusive with a system assigned identity type. - :paramtype user_assigned_identity_resource_id: str - """ - super().__init__(**kwargs) - self.identity_type = identity_type - self.user_assigned_identity_resource_id = user_assigned_identity_resource_id - - -class ImageRepositoryCredentials(_serialization.Model): - """ImageRepositoryCredentials represents the credentials used to login to the image repository. - - All required parameters must be populated in order to send to server. - - :ivar password: The password or token used to access an image in the target repository. - Required. - :vartype password: str - :ivar registry_url: The URL of the authentication server used to validate the repository - credentials. Required. - :vartype registry_url: str - :ivar username: The username used to access an image in the target repository. Required. - :vartype username: str - """ - - _validation = { - "password": {"required": True, "min_length": 1}, - "registry_url": {"required": True}, - "username": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "password": {"key": "password", "type": "str"}, - "registry_url": {"key": "registryUrl", "type": "str"}, - "username": {"key": "username", "type": "str"}, - } - - def __init__(self, *, password: str, registry_url: str, username: str, **kwargs: Any) -> None: - """ - :keyword password: The password or token used to access an image in the target repository. - Required. - :paramtype password: str - :keyword registry_url: The URL of the authentication server used to validate the repository - credentials. Required. - :paramtype registry_url: str - :keyword username: The username used to access an image in the target repository. Required. - :paramtype username: str - """ - super().__init__(**kwargs) - self.password = password - self.registry_url = registry_url - self.username = username - - -class InitialAgentPoolConfiguration(_serialization.Model): - """InitialAgentPoolConfiguration specifies the configuration of a pool of virtual machines that - are initially defined with a Kubernetes cluster. - - All required parameters must be populated in order to send to server. - - :ivar administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :ivar agent_options: The configurations that will be applied to each agent in this agent pool. - :vartype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :ivar attached_network_configuration: The configuration of networks being attached to the agent - pool for use by the workloads that run on this Kubernetes cluster. - :vartype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :ivar availability_zones: The list of availability zones of the Network Cloud cluster used for - the provisioning of nodes in this agent pool. If not specified, all availability zones will be - used. - :vartype availability_zones: list[str] - :ivar count: The number of virtual machines that use this configuration. Required. - :vartype count: int - :ivar labels: The labels applied to the nodes in this agent pool. - :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar mode: The selection of how this agent pool is utilized, either as a system pool or a user - pool. System pools run the features and critical services for the Kubernetes Cluster, while - user pools are dedicated to user workloads. Every Kubernetes cluster must contain at least one - system node pool with at least one node. Required. Known values are: "System", "User", and - "NotApplicable". - :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :ivar name: The name that will be used for the agent pool resource representing this agent - pool. Required. - :vartype name: str - :ivar taints: The taints applied to the nodes in this agent pool. - :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar upgrade_settings: The configuration of the agent pool. - :vartype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :ivar vm_sku_name: The name of the VM SKU that determines the size of resources allocated for - node VMs. Required. - :vartype vm_sku_name: str - """ - - _validation = { - "count": {"required": True}, - "mode": {"required": True}, - "name": {"required": True, "pattern": r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$"}, - "vm_sku_name": {"required": True}, - } - - _attribute_map = { - "administrator_configuration": {"key": "administratorConfiguration", "type": "AdministratorConfiguration"}, - "agent_options": {"key": "agentOptions", "type": "AgentOptions"}, - "attached_network_configuration": { - "key": "attachedNetworkConfiguration", - "type": "AttachedNetworkConfiguration", - }, - "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "count": {"key": "count", "type": "int"}, - "labels": {"key": "labels", "type": "[KubernetesLabel]"}, - "mode": {"key": "mode", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "taints": {"key": "taints", "type": "[KubernetesLabel]"}, - "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, - "vm_sku_name": {"key": "vmSkuName", "type": "str"}, - } - - def __init__( - self, - *, - count: int, - mode: Union[str, "_models.AgentPoolMode"], - name: str, - vm_sku_name: str, - administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, - agent_options: Optional["_models.AgentOptions"] = None, - attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, - availability_zones: Optional[list[str]] = None, - labels: Optional[list["_models.KubernetesLabel"]] = None, - taints: Optional[list["_models.KubernetesLabel"]] = None, - upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword administrator_configuration: The administrator credentials to be used for the nodes in - this agent pool. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :keyword agent_options: The configurations that will be applied to each agent in this agent - pool. - :paramtype agent_options: ~azure.mgmt.networkcloud.models.AgentOptions - :keyword attached_network_configuration: The configuration of networks being attached to the - agent pool for use by the workloads that run on this Kubernetes cluster. - :paramtype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :keyword availability_zones: The list of availability zones of the Network Cloud cluster used - for the provisioning of nodes in this agent pool. If not specified, all availability zones will - be used. - :paramtype availability_zones: list[str] - :keyword count: The number of virtual machines that use this configuration. Required. - :paramtype count: int - :keyword labels: The labels applied to the nodes in this agent pool. - :paramtype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword mode: The selection of how this agent pool is utilized, either as a system pool or a - user pool. System pools run the features and critical services for the Kubernetes Cluster, - while user pools are dedicated to user workloads. Every Kubernetes cluster must contain at - least one system node pool with at least one node. Required. Known values are: "System", - "User", and "NotApplicable". - :paramtype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :keyword name: The name that will be used for the agent pool resource representing this agent - pool. Required. - :paramtype name: str - :keyword taints: The taints applied to the nodes in this agent pool. - :paramtype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :keyword upgrade_settings: The configuration of the agent pool. - :paramtype upgrade_settings: ~azure.mgmt.networkcloud.models.AgentPoolUpgradeSettings - :keyword vm_sku_name: The name of the VM SKU that determines the size of resources allocated - for node VMs. Required. - :paramtype vm_sku_name: str - """ - super().__init__(**kwargs) - self.administrator_configuration = administrator_configuration - self.agent_options = agent_options - self.attached_network_configuration = attached_network_configuration - self.availability_zones = availability_zones - self.count = count - self.labels = labels - self.mode = mode - self.name = name - self.taints = taints - self.upgrade_settings = upgrade_settings - self.vm_sku_name = vm_sku_name - - -class IpAddressPool(_serialization.Model): - """IpAddressPool represents a pool of IP addresses that can be allocated to a service. - - All required parameters must be populated in order to send to server. - - :ivar addresses: The list of IP address ranges. Each range can be a either a subnet in CIDR - format or an explicit start-end range of IP addresses. For a BGP service load balancer - configuration, only CIDR format is supported and excludes /32 (IPv4) and /128 (IPv6) prefixes. - Required. - :vartype addresses: list[str] - :ivar auto_assign: The indicator to determine if automatic allocation from the pool should - occur. Known values are: "True" and "False". - :vartype auto_assign: str or ~azure.mgmt.networkcloud.models.BfdEnabled - :ivar name: The name used to identify this IP address pool for association with a BGP - advertisement. Required. - :vartype name: str - :ivar only_use_host_ips: The indicator to prevent the use of IP addresses ending with .0 and - .255 for this pool. Enabling this option will only use IP addresses between .1 and .254 - inclusive. Known values are: "True" and "False". - :vartype only_use_host_ips: str or ~azure.mgmt.networkcloud.models.BfdEnabled - """ - - _validation = { - "addresses": {"required": True}, - "name": {"required": True, "pattern": r"^[a-z0-9]([a-z0-9.-]{0,61}[a-z0-9]){0,1}$"}, - } - - _attribute_map = { - "addresses": {"key": "addresses", "type": "[str]"}, - "auto_assign": {"key": "autoAssign", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "only_use_host_ips": {"key": "onlyUseHostIps", "type": "str"}, - } - - def __init__( - self, - *, - addresses: list[str], - name: str, - auto_assign: Optional[Union[str, "_models.BfdEnabled"]] = None, - only_use_host_ips: Optional[Union[str, "_models.BfdEnabled"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword addresses: The list of IP address ranges. Each range can be a either a subnet in CIDR - format or an explicit start-end range of IP addresses. For a BGP service load balancer - configuration, only CIDR format is supported and excludes /32 (IPv4) and /128 (IPv6) prefixes. - Required. - :paramtype addresses: list[str] - :keyword auto_assign: The indicator to determine if automatic allocation from the pool should - occur. Known values are: "True" and "False". - :paramtype auto_assign: str or ~azure.mgmt.networkcloud.models.BfdEnabled - :keyword name: The name used to identify this IP address pool for association with a BGP - advertisement. Required. - :paramtype name: str - :keyword only_use_host_ips: The indicator to prevent the use of IP addresses ending with .0 and - .255 for this pool. Enabling this option will only use IP addresses between .1 and .254 - inclusive. Known values are: "True" and "False". - :paramtype only_use_host_ips: str or ~azure.mgmt.networkcloud.models.BfdEnabled - """ - super().__init__(**kwargs) - self.addresses = addresses - self.auto_assign = auto_assign - self.name = name - self.only_use_host_ips = only_use_host_ips - - -class KeySetUser(_serialization.Model): - """KeySetUser represents the properties of the user in the key set. - - All required parameters must be populated in order to send to server. - - :ivar azure_user_name: The user name that will be used for access. Required. - :vartype azure_user_name: str - :ivar description: The free-form description for this user. - :vartype description: str - :ivar ssh_public_key: The SSH public key that will be provisioned for user access. The user is - expected to have the corresponding SSH private key for logging in. Required. - :vartype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - :ivar user_principal_name: The user principal name (email format) used to validate this user's - group membership. - :vartype user_principal_name: str - """ - - _validation = { - "azure_user_name": {"required": True}, - "description": {"max_length": 256}, - "ssh_public_key": {"required": True}, - } - - _attribute_map = { - "azure_user_name": {"key": "azureUserName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "ssh_public_key": {"key": "sshPublicKey", "type": "SshPublicKey"}, - "user_principal_name": {"key": "userPrincipalName", "type": "str"}, - } - - def __init__( - self, - *, - azure_user_name: str, - ssh_public_key: "_models.SshPublicKey", - description: Optional[str] = None, - user_principal_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_user_name: The user name that will be used for access. Required. - :paramtype azure_user_name: str - :keyword description: The free-form description for this user. - :paramtype description: str - :keyword ssh_public_key: The SSH public key that will be provisioned for user access. The user - is expected to have the corresponding SSH private key for logging in. Required. - :paramtype ssh_public_key: ~azure.mgmt.networkcloud.models.SshPublicKey - :keyword user_principal_name: The user principal name (email format) used to validate this - user's group membership. - :paramtype user_principal_name: str - """ - super().__init__(**kwargs) - self.azure_user_name = azure_user_name - self.description = description - self.ssh_public_key = ssh_public_key - self.user_principal_name = user_principal_name - - -class KeySetUserStatus(_serialization.Model): - """KeySetUserStatus represents the status of the key set user. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar azure_user_name: The user name that will be used for access. - :vartype azure_user_name: str - :ivar status: The indicator of whether the user is currently deployed for access. Known values - are: "Active" and "Invalid". - :vartype status: str or ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetUserSetupStatus - :ivar status_message: The additional information describing the current status of this user, if - any available. - :vartype status_message: str - """ - - _validation = { - "azure_user_name": {"readonly": True}, - "status": {"readonly": True}, - "status_message": {"readonly": True, "max_length": 256}, - } - - _attribute_map = { - "azure_user_name": {"key": "azureUserName", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "status_message": {"key": "statusMessage", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.azure_user_name: Optional[str] = None - self.status: Optional[Union[str, "_models.BareMetalMachineKeySetUserSetupStatus"]] = None - self.status_message: Optional[str] = None - - -class KubernetesCluster(TrackedResource): - """KubernetesCluster represents the Kubernetes cluster hosted on Network Cloud. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar aad_configuration: The Azure Active Directory Integration properties. - :vartype aad_configuration: ~azure.mgmt.networkcloud.models.AadConfiguration - :ivar administrator_configuration: The administrative credentials that will be applied to the - control plane and agent pool nodes that do not specify their own values. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :ivar attached_network_ids: The full list of network resource IDs that are attached to this - cluster, including those attached only to specific agent pools. - :vartype attached_network_ids: list[str] - :ivar available_upgrades: The list of versions that this Kubernetes cluster can be upgraded to. - :vartype available_upgrades: list[~azure.mgmt.networkcloud.models.AvailableUpgrade] - :ivar cluster_id: The resource ID of the Network Cloud cluster. - :vartype cluster_id: str - :ivar connected_cluster_id: The resource ID of the connected cluster set up when this - Kubernetes cluster is created. - :vartype connected_cluster_id: str - :ivar control_plane_kubernetes_version: The current running version of Kubernetes on the - control plane. - :vartype control_plane_kubernetes_version: str - :ivar control_plane_node_configuration: The defining characteristics of the control plane for - this Kubernetes Cluster. Required. - :vartype control_plane_node_configuration: - ~azure.mgmt.networkcloud.models.ControlPlaneNodeConfiguration - :ivar detailed_status: The current status of the Kubernetes cluster. Known values are: - "Available", "Error", and "Provisioning". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar feature_statuses: The current feature settings. - :vartype feature_statuses: list[~azure.mgmt.networkcloud.models.FeatureStatus] - :ivar initial_agent_pool_configurations: The agent pools that are created with this Kubernetes - cluster for running critical system services and workloads. This data in this field is only - used during creation, and the field will be empty following the creation of the Kubernetes - Cluster. After creation, the management of agent pools is done using the agentPools - sub-resource. Required. - :vartype initial_agent_pool_configurations: - list[~azure.mgmt.networkcloud.models.InitialAgentPoolConfiguration] - :ivar kubernetes_version: The Kubernetes version for this cluster. Required. - :vartype kubernetes_version: str - :ivar managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :vartype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :ivar network_configuration: The configuration of the Kubernetes cluster networking, including - the attachment of networks that span the cluster. Required. - :vartype network_configuration: ~azure.mgmt.networkcloud.models.NetworkConfiguration - :ivar nodes: The details of the nodes in this cluster. - :vartype nodes: list[~azure.mgmt.networkcloud.models.KubernetesClusterNode] - :ivar provisioning_state: The provisioning state of the Kubernetes cluster resource. Known - values are: "Succeeded", "Failed", "Canceled", "Accepted", "InProgress", "Created", "Updating", - and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "attached_network_ids": {"readonly": True}, - "available_upgrades": {"readonly": True}, - "cluster_id": {"readonly": True}, - "connected_cluster_id": {"readonly": True}, - "control_plane_kubernetes_version": {"readonly": True}, - "control_plane_node_configuration": {"required": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "feature_statuses": {"readonly": True}, - "initial_agent_pool_configurations": {"required": True, "min_items": 1}, - "kubernetes_version": {"required": True}, - "network_configuration": {"required": True}, - "nodes": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "aad_configuration": {"key": "properties.aadConfiguration", "type": "AadConfiguration"}, - "administrator_configuration": { - "key": "properties.administratorConfiguration", - "type": "AdministratorConfiguration", - }, - "attached_network_ids": {"key": "properties.attachedNetworkIds", "type": "[str]"}, - "available_upgrades": {"key": "properties.availableUpgrades", "type": "[AvailableUpgrade]"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "connected_cluster_id": {"key": "properties.connectedClusterId", "type": "str"}, - "control_plane_kubernetes_version": {"key": "properties.controlPlaneKubernetesVersion", "type": "str"}, - "control_plane_node_configuration": { - "key": "properties.controlPlaneNodeConfiguration", - "type": "ControlPlaneNodeConfiguration", - }, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "feature_statuses": {"key": "properties.featureStatuses", "type": "[FeatureStatus]"}, - "initial_agent_pool_configurations": { - "key": "properties.initialAgentPoolConfigurations", - "type": "[InitialAgentPoolConfiguration]", - }, - "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, - "managed_resource_group_configuration": { - "key": "properties.managedResourceGroupConfiguration", - "type": "ManagedResourceGroupConfiguration", - }, - "network_configuration": {"key": "properties.networkConfiguration", "type": "NetworkConfiguration"}, - "nodes": {"key": "properties.nodes", "type": "[KubernetesClusterNode]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - control_plane_node_configuration: "_models.ControlPlaneNodeConfiguration", - initial_agent_pool_configurations: list["_models.InitialAgentPoolConfiguration"], - kubernetes_version: str, - network_configuration: "_models.NetworkConfiguration", - tags: Optional[dict[str, str]] = None, - aad_configuration: Optional["_models.AadConfiguration"] = None, - administrator_configuration: Optional["_models.AdministratorConfiguration"] = None, - managed_resource_group_configuration: Optional["_models.ManagedResourceGroupConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword aad_configuration: The Azure Active Directory Integration properties. - :paramtype aad_configuration: ~azure.mgmt.networkcloud.models.AadConfiguration - :keyword administrator_configuration: The administrative credentials that will be applied to - the control plane and agent pool nodes that do not specify their own values. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfiguration - :keyword control_plane_node_configuration: The defining characteristics of the control plane - for this Kubernetes Cluster. Required. - :paramtype control_plane_node_configuration: - ~azure.mgmt.networkcloud.models.ControlPlaneNodeConfiguration - :keyword initial_agent_pool_configurations: The agent pools that are created with this - Kubernetes cluster for running critical system services and workloads. This data in this field - is only used during creation, and the field will be empty following the creation of the - Kubernetes Cluster. After creation, the management of agent pools is done using the agentPools - sub-resource. Required. - :paramtype initial_agent_pool_configurations: - list[~azure.mgmt.networkcloud.models.InitialAgentPoolConfiguration] - :keyword kubernetes_version: The Kubernetes version for this cluster. Required. - :paramtype kubernetes_version: str - :keyword managed_resource_group_configuration: The configuration of the managed resource group - associated with the resource. - :paramtype managed_resource_group_configuration: - ~azure.mgmt.networkcloud.models.ManagedResourceGroupConfiguration - :keyword network_configuration: The configuration of the Kubernetes cluster networking, - including the attachment of networks that span the cluster. Required. - :paramtype network_configuration: ~azure.mgmt.networkcloud.models.NetworkConfiguration - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.aad_configuration = aad_configuration - self.administrator_configuration = administrator_configuration - self.attached_network_ids: Optional[list[str]] = None - self.available_upgrades: Optional[list["_models.AvailableUpgrade"]] = None - self.cluster_id: Optional[str] = None - self.connected_cluster_id: Optional[str] = None - self.control_plane_kubernetes_version: Optional[str] = None - self.control_plane_node_configuration = control_plane_node_configuration - self.detailed_status: Optional[Union[str, "_models.KubernetesClusterDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.feature_statuses: Optional[list["_models.FeatureStatus"]] = None - self.initial_agent_pool_configurations = initial_agent_pool_configurations - self.kubernetes_version = kubernetes_version - self.managed_resource_group_configuration = managed_resource_group_configuration - self.network_configuration = network_configuration - self.nodes: Optional[list["_models.KubernetesClusterNode"]] = None - self.provisioning_state: Optional[Union[str, "_models.KubernetesClusterProvisioningState"]] = None - - -class KubernetesClusterFeature(TrackedResource): - """KubernetesClusterFeature represents the feature of a Kubernetes cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar availability_lifecycle: The lifecycle indicator of the feature. Known values are: - "Preview" and "GenerallyAvailable". - :vartype availability_lifecycle: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureAvailabilityLifecycle - :ivar detailed_status: The detailed status of the feature. Known values are: "Error", - "Provisioning", and "Installed". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureDetailedStatus - :ivar detailed_status_message: The descriptive message for the detailed status of the feature. - :vartype detailed_status_message: str - :ivar options: The configured options for the feature. - :vartype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] - :ivar provisioning_state: The provisioning state of the Kubernetes cluster feature. Known - values are: "Accepted", "Canceled", "Deleting", "Failed", "Succeeded", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureProvisioningState - :ivar required: The indicator of if the feature is required or optional. Optional features may - be deleted by the user, while required features are managed with the kubernetes cluster - lifecycle. Known values are: "True" and "False". - :vartype required: str or ~azure.mgmt.networkcloud.models.KubernetesClusterFeatureRequired - :ivar version: The version of the feature. - :vartype version: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "availability_lifecycle": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "required": {"readonly": True}, - "version": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "availability_lifecycle": {"key": "properties.availabilityLifecycle", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "options": {"key": "properties.options", "type": "[StringKeyValuePair]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "required": {"key": "properties.required", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - options: Optional[list["_models.StringKeyValuePair"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword options: The configured options for the feature. - :paramtype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.availability_lifecycle: Optional[Union[str, "_models.KubernetesClusterFeatureAvailabilityLifecycle"]] = ( - None - ) - self.detailed_status: Optional[Union[str, "_models.KubernetesClusterFeatureDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.options = options - self.provisioning_state: Optional[Union[str, "_models.KubernetesClusterFeatureProvisioningState"]] = None - self.required: Optional[Union[str, "_models.KubernetesClusterFeatureRequired"]] = None - self.version: Optional[str] = None - - -class KubernetesClusterFeatureList(_serialization.Model): - """KubernetesClusterFeatureList represents the list of Kubernetes cluster feature resources. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of Kubernetes cluster features. - :vartype value: list[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[KubernetesClusterFeature]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.KubernetesClusterFeature"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of Kubernetes cluster features. - :paramtype value: list[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class KubernetesClusterFeaturePatchParameters(_serialization.Model): - """KubernetesClusterFeaturePatchParameters represents the body of the request to patch the - Kubernetes cluster feature. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar options: The configured options for the feature. - :vartype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "options": {"key": "properties.options", "type": "[StringKeyValuePair]"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - options: Optional[list["_models.StringKeyValuePair"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword options: The configured options for the feature. - :paramtype options: list[~azure.mgmt.networkcloud.models.StringKeyValuePair] - """ - super().__init__(**kwargs) - self.tags = tags - self.options = options - - -class KubernetesClusterList(_serialization.Model): - """KubernetesClusterList represents a list of Kubernetes clusters. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of additional details related to Kubernetes clusters. - :vartype value: list[~azure.mgmt.networkcloud.models.KubernetesCluster] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[KubernetesCluster]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.KubernetesCluster"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of additional details related to Kubernetes clusters. - :paramtype value: list[~azure.mgmt.networkcloud.models.KubernetesCluster] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class KubernetesClusterNode(_serialization.Model): - """KubernetesClusterNode represents the details of a node in a Kubernetes cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar agent_pool_id: The resource ID of the agent pool that this node belongs to. This value is - not represented on control plane nodes. - :vartype agent_pool_id: str - :ivar availability_zone: The availability zone this node is running within. - :vartype availability_zone: str - :ivar bare_metal_machine_id: The resource ID of the bare metal machine that hosts this node. - :vartype bare_metal_machine_id: str - :ivar cpu_cores: The number of CPU cores configured for this node, derived from the VM SKU - specified. - :vartype cpu_cores: int - :ivar detailed_status: The detailed state of this node. Known values are: "Available", "Error", - "Provisioning", "Running", "Scheduling", "Stopped", "Terminating", and "Unknown". - :vartype detailed_status: str or - ~azure.mgmt.networkcloud.models.KubernetesClusterNodeDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar disk_size_gb: The size of the disk configured for this node. Allocations are measured in - gibibytes. - :vartype disk_size_gb: int - :ivar image: The machine image used to deploy this node. - :vartype image: str - :ivar kubernetes_version: The currently running version of Kubernetes and bundled features - running on this node. - :vartype kubernetes_version: str - :ivar labels: The list of labels on this node that have been assigned to the agent pool - containing this node. - :vartype labels: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar memory_size_gb: The amount of memory configured for this node, derived from the vm SKU - specified. Allocations are measured in gibibytes. - :vartype memory_size_gb: int - :ivar mode: The mode of the agent pool containing this node. Not applicable for control plane - nodes. Known values are: "System", "User", and "NotApplicable". - :vartype mode: str or ~azure.mgmt.networkcloud.models.AgentPoolMode - :ivar name: The name of this node, as realized in the Kubernetes cluster. - :vartype name: str - :ivar network_attachments: The NetworkAttachments made to this node. - :vartype network_attachments: list[~azure.mgmt.networkcloud.models.NetworkAttachment] - :ivar power_state: The power state of this node. Known values are: "On", "Off", and "Unknown". - :vartype power_state: str or ~azure.mgmt.networkcloud.models.KubernetesNodePowerState - :ivar role: The role of this node in the cluster. Known values are: "ControlPlane" and - "Worker". - :vartype role: str or ~azure.mgmt.networkcloud.models.KubernetesNodeRole - :ivar taints: The list of taints that have been assigned to the agent pool containing this - node. - :vartype taints: list[~azure.mgmt.networkcloud.models.KubernetesLabel] - :ivar vm_sku_name: The VM SKU name that was used to create this cluster node. - :vartype vm_sku_name: str - """ - - _validation = { - "agent_pool_id": {"readonly": True}, - "availability_zone": {"readonly": True}, - "bare_metal_machine_id": {"readonly": True}, - "cpu_cores": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "disk_size_gb": {"readonly": True}, - "image": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "labels": {"readonly": True}, - "memory_size_gb": {"readonly": True}, - "mode": {"readonly": True}, - "name": {"readonly": True}, - "network_attachments": {"readonly": True}, - "power_state": {"readonly": True}, - "role": {"readonly": True}, - "taints": {"readonly": True}, - "vm_sku_name": {"readonly": True}, - } - - _attribute_map = { - "agent_pool_id": {"key": "agentPoolId", "type": "str"}, - "availability_zone": {"key": "availabilityZone", "type": "str"}, - "bare_metal_machine_id": {"key": "bareMetalMachineId", "type": "str"}, - "cpu_cores": {"key": "cpuCores", "type": "int"}, - "detailed_status": {"key": "detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "detailedStatusMessage", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "image": {"key": "image", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "labels": {"key": "labels", "type": "[KubernetesLabel]"}, - "memory_size_gb": {"key": "memorySizeGB", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "network_attachments": {"key": "networkAttachments", "type": "[NetworkAttachment]"}, - "power_state": {"key": "powerState", "type": "str"}, - "role": {"key": "role", "type": "str"}, - "taints": {"key": "taints", "type": "[KubernetesLabel]"}, - "vm_sku_name": {"key": "vmSkuName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.agent_pool_id: Optional[str] = None - self.availability_zone: Optional[str] = None - self.bare_metal_machine_id: Optional[str] = None - self.cpu_cores: Optional[int] = None - self.detailed_status: Optional[Union[str, "_models.KubernetesClusterNodeDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.disk_size_gb: Optional[int] = None - self.image: Optional[str] = None - self.kubernetes_version: Optional[str] = None - self.labels: Optional[list["_models.KubernetesLabel"]] = None - self.memory_size_gb: Optional[int] = None - self.mode: Optional[Union[str, "_models.AgentPoolMode"]] = None - self.name: Optional[str] = None - self.network_attachments: Optional[list["_models.NetworkAttachment"]] = None - self.power_state: Optional[Union[str, "_models.KubernetesNodePowerState"]] = None - self.role: Optional[Union[str, "_models.KubernetesNodeRole"]] = None - self.taints: Optional[list["_models.KubernetesLabel"]] = None - self.vm_sku_name: Optional[str] = None - - -class KubernetesClusterPatchParameters(_serialization.Model): - """KubernetesClusterPatchParameters represents the body of the request to patch the Hybrid AKS - cluster. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar administrator_configuration: The configuration of the default administrator credentials. - :vartype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch - :ivar control_plane_node_configuration: The defining characteristics of the control plane that - can be patched for this Kubernetes cluster. - :vartype control_plane_node_configuration: - ~azure.mgmt.networkcloud.models.ControlPlaneNodePatchConfiguration - :ivar kubernetes_version: The Kubernetes version for this cluster. - :vartype kubernetes_version: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "administrator_configuration": { - "key": "properties.administratorConfiguration", - "type": "AdministratorConfigurationPatch", - }, - "control_plane_node_configuration": { - "key": "properties.controlPlaneNodeConfiguration", - "type": "ControlPlaneNodePatchConfiguration", - }, - "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - administrator_configuration: Optional["_models.AdministratorConfigurationPatch"] = None, - control_plane_node_configuration: Optional["_models.ControlPlaneNodePatchConfiguration"] = None, - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword administrator_configuration: The configuration of the default administrator - credentials. - :paramtype administrator_configuration: - ~azure.mgmt.networkcloud.models.AdministratorConfigurationPatch - :keyword control_plane_node_configuration: The defining characteristics of the control plane - that can be patched for this Kubernetes cluster. - :paramtype control_plane_node_configuration: - ~azure.mgmt.networkcloud.models.ControlPlaneNodePatchConfiguration - :keyword kubernetes_version: The Kubernetes version for this cluster. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.tags = tags - self.administrator_configuration = administrator_configuration - self.control_plane_node_configuration = control_plane_node_configuration - self.kubernetes_version = kubernetes_version - - -class KubernetesClusterRestartNodeParameters(_serialization.Model): - """KubernetesClusterRestartNodeParameters represents the body of the request to restart the node - of a Kubernetes cluster. - - All required parameters must be populated in order to send to server. - - :ivar node_name: The name of the node to restart. Required. - :vartype node_name: str - """ - - _validation = { - "node_name": {"required": True}, - } - - _attribute_map = { - "node_name": {"key": "nodeName", "type": "str"}, - } - - def __init__(self, *, node_name: str, **kwargs: Any) -> None: - """ - :keyword node_name: The name of the node to restart. Required. - :paramtype node_name: str - """ - super().__init__(**kwargs) - self.node_name = node_name - - -class KubernetesLabel(_serialization.Model): - """KubernetesLabel represents a single entry for a Kubernetes label or taint such as those used on - a node or pod. - - All required parameters must be populated in order to send to server. - - :ivar key: The name of the label or taint. Required. - :vartype key: str - :ivar value: The value of the label or taint. Required. - :vartype value: str - """ - - _validation = { - "key": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: - """ - :keyword key: The name of the label or taint. Required. - :paramtype key: str - :keyword value: The value of the label or taint. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.key = key - self.value = value - - -class L2Network(TrackedResource): - """L2Network represents a network that utilizes a single isolation domain set up for layer-2 - resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud - resources that have attached this network. - :vartype associated_resource_ids: list[str] - :ivar cluster_id: The resource ID of the Network Cloud cluster this L2 network is associated - with. - :vartype cluster_id: str - :ivar detailed_status: The more detailed status of the L2 network. Known values are: "Error", - "Available", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.L2NetworkDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of Hybrid AKS cluster resource ID(s) that are associated with this L2 network. - :vartype hybrid_aks_clusters_associated_ids: list[str] - :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will - have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known - values are: "DPDK", "SRIOV", and "OSDevice". - :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :ivar interface_name: The default interface name for this L2 network in the virtual machine. - This name can be overridden by the name supplied in the network attachment configuration of - that virtual machine. - :vartype interface_name: str - :ivar l2_isolation_domain_id: The resource ID of the Network Fabric l2IsolationDomain. - Required. - :vartype l2_isolation_domain_id: str - :ivar provisioning_state: The provisioning state of the L2 network. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.L2NetworkProvisioningState - :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of virtual machine resource ID(s), excluding any Hybrid AKS virtual machines, that are - currently using this L2 network. - :vartype virtual_machines_associated_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "associated_resource_ids": {"readonly": True}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "hybrid_aks_clusters_associated_ids": {"readonly": True}, - "interface_name": {"max_length": 12, "pattern": r"^[a-zA-Z0-9@._-]*$"}, - "l2_isolation_domain_id": {"required": True}, - "provisioning_state": {"readonly": True}, - "virtual_machines_associated_ids": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "associated_resource_ids": {"key": "properties.associatedResourceIds", "type": "[str]"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "hybrid_aks_clusters_associated_ids": {"key": "properties.hybridAksClustersAssociatedIds", "type": "[str]"}, - "hybrid_aks_plugin_type": {"key": "properties.hybridAksPluginType", "type": "str"}, - "interface_name": {"key": "properties.interfaceName", "type": "str"}, - "l2_isolation_domain_id": {"key": "properties.l2IsolationDomainId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "virtual_machines_associated_ids": {"key": "properties.virtualMachinesAssociatedIds", "type": "[str]"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - l2_isolation_domain_id: str, - tags: Optional[dict[str, str]] = None, - hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, - interface_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it - will have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. - Known values are: "DPDK", "SRIOV", and "OSDevice". - :paramtype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :keyword interface_name: The default interface name for this L2 network in the virtual machine. - This name can be overridden by the name supplied in the network attachment configuration of - that virtual machine. - :paramtype interface_name: str - :keyword l2_isolation_domain_id: The resource ID of the Network Fabric l2IsolationDomain. - Required. - :paramtype l2_isolation_domain_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.associated_resource_ids: Optional[list[str]] = None - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.L2NetworkDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.hybrid_aks_clusters_associated_ids: Optional[list[str]] = None - self.hybrid_aks_plugin_type = hybrid_aks_plugin_type - self.interface_name = interface_name - self.l2_isolation_domain_id = l2_isolation_domain_id - self.provisioning_state: Optional[Union[str, "_models.L2NetworkProvisioningState"]] = None - self.virtual_machines_associated_ids: Optional[list[str]] = None - - -class L2NetworkAttachmentConfiguration(_serialization.Model): - """L2NetworkAttachmentConfiguration represents the configuration of the attachment of a Layer 2 - network. - - All required parameters must be populated in order to send to server. - - :ivar network_id: The resource ID of the network that is being configured for attachment. - Required. - :vartype network_id: str - :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - - _validation = { - "network_id": {"required": True}, - } - - _attribute_map = { - "network_id": {"key": "networkId", "type": "str"}, - "plugin_type": {"key": "pluginType", "type": "str"}, - } - - def __init__( - self, - *, - network_id: str, - plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_id: The resource ID of the network that is being configured for attachment. - Required. - :paramtype network_id: str - :keyword plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :paramtype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - super().__init__(**kwargs) - self.network_id = network_id - self.plugin_type = plugin_type - - -class L2NetworkList(_serialization.Model): - """L2NetworkList represents a list of L2 networks. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of L2 networks. - :vartype value: list[~azure.mgmt.networkcloud.models.L2Network] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[L2Network]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.L2Network"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of L2 networks. - :paramtype value: list[~azure.mgmt.networkcloud.models.L2Network] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class L2NetworkPatchParameters(_serialization.Model): - """L2NetworkPatchParameters represents the body of the request to patch the L2 network. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :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: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class L2ServiceLoadBalancerConfiguration(_serialization.Model): - """L2ServiceLoadBalancerConfiguration represents the configuration of a layer 2 service load - balancer. - - :ivar ip_address_pools: The list of pools of IP addresses that can be allocated to load - balancer services. - :vartype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] - """ - - _attribute_map = { - "ip_address_pools": {"key": "ipAddressPools", "type": "[IpAddressPool]"}, - } - - def __init__(self, *, ip_address_pools: Optional[list["_models.IpAddressPool"]] = None, **kwargs: Any) -> None: - """ - :keyword ip_address_pools: The list of pools of IP addresses that can be allocated to load - balancer services. - :paramtype ip_address_pools: list[~azure.mgmt.networkcloud.models.IpAddressPool] - """ - super().__init__(**kwargs) - self.ip_address_pools = ip_address_pools - - -class L3Network(TrackedResource): - """L3Network represents a network that utilizes a single isolation domain set up for layer-3 - resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud - resources that have attached this network. - :vartype associated_resource_ids: list[str] - :ivar cluster_id: The resource ID of the Network Cloud cluster this L3 network is associated - with. - :vartype cluster_id: str - :ivar detailed_status: The more detailed status of the L3 network. Known values are: "Error", - "Available", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.L3NetworkDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of Hybrid AKS cluster resource IDs that are associated with this L3 network. - :vartype hybrid_aks_clusters_associated_ids: list[str] - :ivar hybrid_aks_ipam_enabled: Field Deprecated. The field was previously optional, now it will - have no defined behavior and will be ignored. The indicator of whether or not to disable IPAM - allocation on the network attachment definition injected into the Hybrid AKS Cluster. Known - values are: "True" and "False". - :vartype hybrid_aks_ipam_enabled: str or ~azure.mgmt.networkcloud.models.HybridAksIpamEnabled - :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will - have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known - values are: "DPDK", "SRIOV", and "OSDevice". - :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :ivar interface_name: The default interface name for this L3 network in the virtual machine. - This name can be overridden by the name supplied in the network attachment configuration of - that virtual machine. - :vartype interface_name: str - :ivar ip_allocation_type: The type of the IP address allocation, defaulted to "DualStack". - Known values are: "IPV4", "IPV6", and "DualStack". - :vartype ip_allocation_type: str or ~azure.mgmt.networkcloud.models.IpAllocationType - :ivar ipv4_connected_prefix: The IPV4 prefix (CIDR) assigned to this L3 network. Required when - the IP allocation type is IPV4 or DualStack. - :vartype ipv4_connected_prefix: str - :ivar ipv6_connected_prefix: The IPV6 prefix (CIDR) assigned to this L3 network. Required when - the IP allocation type is IPV6 or DualStack. - :vartype ipv6_connected_prefix: str - :ivar l3_isolation_domain_id: The resource ID of the Network Fabric l3IsolationDomain. - Required. - :vartype l3_isolation_domain_id: str - :ivar provisioning_state: The provisioning state of the L3 network. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.L3NetworkProvisioningState - :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are - currently using this L3 network. - :vartype virtual_machines_associated_ids: list[str] - :ivar vlan: The VLAN from the l3IsolationDomain that is used for this network. Required. - :vartype vlan: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "associated_resource_ids": {"readonly": True}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "hybrid_aks_clusters_associated_ids": {"readonly": True}, - "interface_name": {"max_length": 12, "pattern": r"^[a-zA-Z0-9@._-]*$"}, - "l3_isolation_domain_id": {"required": True}, - "provisioning_state": {"readonly": True}, - "virtual_machines_associated_ids": {"readonly": True}, - "vlan": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "associated_resource_ids": {"key": "properties.associatedResourceIds", "type": "[str]"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "hybrid_aks_clusters_associated_ids": {"key": "properties.hybridAksClustersAssociatedIds", "type": "[str]"}, - "hybrid_aks_ipam_enabled": {"key": "properties.hybridAksIpamEnabled", "type": "str"}, - "hybrid_aks_plugin_type": {"key": "properties.hybridAksPluginType", "type": "str"}, - "interface_name": {"key": "properties.interfaceName", "type": "str"}, - "ip_allocation_type": {"key": "properties.ipAllocationType", "type": "str"}, - "ipv4_connected_prefix": {"key": "properties.ipv4ConnectedPrefix", "type": "str"}, - "ipv6_connected_prefix": {"key": "properties.ipv6ConnectedPrefix", "type": "str"}, - "l3_isolation_domain_id": {"key": "properties.l3IsolationDomainId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "virtual_machines_associated_ids": {"key": "properties.virtualMachinesAssociatedIds", "type": "[str]"}, - "vlan": {"key": "properties.vlan", "type": "int"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - l3_isolation_domain_id: str, - vlan: int, - tags: Optional[dict[str, str]] = None, - hybrid_aks_ipam_enabled: Union[str, "_models.HybridAksIpamEnabled"] = "True", - hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, - interface_name: Optional[str] = None, - ip_allocation_type: Union[str, "_models.IpAllocationType"] = "DualStack", - ipv4_connected_prefix: Optional[str] = None, - ipv6_connected_prefix: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword hybrid_aks_ipam_enabled: Field Deprecated. The field was previously optional, now it - will have no defined behavior and will be ignored. The indicator of whether or not to disable - IPAM allocation on the network attachment definition injected into the Hybrid AKS Cluster. - Known values are: "True" and "False". - :paramtype hybrid_aks_ipam_enabled: str or ~azure.mgmt.networkcloud.models.HybridAksIpamEnabled - :keyword hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it - will have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. - Known values are: "DPDK", "SRIOV", and "OSDevice". - :paramtype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :keyword interface_name: The default interface name for this L3 network in the virtual machine. - This name can be overridden by the name supplied in the network attachment configuration of - that virtual machine. - :paramtype interface_name: str - :keyword ip_allocation_type: The type of the IP address allocation, defaulted to "DualStack". - Known values are: "IPV4", "IPV6", and "DualStack". - :paramtype ip_allocation_type: str or ~azure.mgmt.networkcloud.models.IpAllocationType - :keyword ipv4_connected_prefix: The IPV4 prefix (CIDR) assigned to this L3 network. Required - when the IP allocation type is IPV4 or DualStack. - :paramtype ipv4_connected_prefix: str - :keyword ipv6_connected_prefix: The IPV6 prefix (CIDR) assigned to this L3 network. Required - when the IP allocation type is IPV6 or DualStack. - :paramtype ipv6_connected_prefix: str - :keyword l3_isolation_domain_id: The resource ID of the Network Fabric l3IsolationDomain. - Required. - :paramtype l3_isolation_domain_id: str - :keyword vlan: The VLAN from the l3IsolationDomain that is used for this network. Required. - :paramtype vlan: int - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.associated_resource_ids: Optional[list[str]] = None - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.L3NetworkDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.hybrid_aks_clusters_associated_ids: Optional[list[str]] = None - self.hybrid_aks_ipam_enabled = hybrid_aks_ipam_enabled - self.hybrid_aks_plugin_type = hybrid_aks_plugin_type - self.interface_name = interface_name - self.ip_allocation_type = ip_allocation_type - self.ipv4_connected_prefix = ipv4_connected_prefix - self.ipv6_connected_prefix = ipv6_connected_prefix - self.l3_isolation_domain_id = l3_isolation_domain_id - self.provisioning_state: Optional[Union[str, "_models.L3NetworkProvisioningState"]] = None - self.virtual_machines_associated_ids: Optional[list[str]] = None - self.vlan = vlan - - -class L3NetworkAttachmentConfiguration(_serialization.Model): - """L3NetworkAttachmentConfiguration represents the configuration of the attachment of a Layer 3 - network. - - All required parameters must be populated in order to send to server. - - :ivar ipam_enabled: The indication of whether this network will or will not perform IP address - management and allocate IP addresses when attached. Known values are: "True" and "False". - :vartype ipam_enabled: str or ~azure.mgmt.networkcloud.models.L3NetworkConfigurationIpamEnabled - :ivar network_id: The resource ID of the network that is being configured for attachment. - Required. - :vartype network_id: str - :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - - _validation = { - "network_id": {"required": True}, - } - - _attribute_map = { - "ipam_enabled": {"key": "ipamEnabled", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "plugin_type": {"key": "pluginType", "type": "str"}, - } - - def __init__( - self, - *, - network_id: str, - ipam_enabled: Union[str, "_models.L3NetworkConfigurationIpamEnabled"] = "False", - plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword ipam_enabled: The indication of whether this network will or will not perform IP - address management and allocate IP addresses when attached. Known values are: "True" and - "False". - :paramtype ipam_enabled: str or - ~azure.mgmt.networkcloud.models.L3NetworkConfigurationIpamEnabled - :keyword network_id: The resource ID of the network that is being configured for attachment. - Required. - :paramtype network_id: str - :keyword plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :paramtype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - super().__init__(**kwargs) - self.ipam_enabled = ipam_enabled - self.network_id = network_id - self.plugin_type = plugin_type - - -class L3NetworkList(_serialization.Model): - """L3NetworkList represents a list of L3 networks. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of L3 networks. - :vartype value: list[~azure.mgmt.networkcloud.models.L3Network] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[L3Network]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.L3Network"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of L3 networks. - :paramtype value: list[~azure.mgmt.networkcloud.models.L3Network] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class L3NetworkPatchParameters(_serialization.Model): - """L3NetworkPatchParameters represents the body of the request to patch the cloud services - network. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :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: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class LldpNeighbor(_serialization.Model): - """Type Deprecated. Will be removed in an upcoming version. LldpNeighbor represents the details - about the device connected to the NIC. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar port_description: The descriptive information about the port on the connected device. - :vartype port_description: str - :ivar port_name: The system-assigned name of the port on the connected device. - :vartype port_name: str - :ivar system_description: The descriptive information about the connected device. - :vartype system_description: str - :ivar system_name: The system-assigned name of the connected device. - :vartype system_name: str - """ - - _validation = { - "port_description": {"readonly": True}, - "port_name": {"readonly": True}, - "system_description": {"readonly": True}, - "system_name": {"readonly": True}, - } - - _attribute_map = { - "port_description": {"key": "portDescription", "type": "str"}, - "port_name": {"key": "portName", "type": "str"}, - "system_description": {"key": "systemDescription", "type": "str"}, - "system_name": {"key": "systemName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.port_description: Optional[str] = None - self.port_name: Optional[str] = None - self.system_description: Optional[str] = None - self.system_name: Optional[str] = None - - -class MachineDisk(_serialization.Model): - """Disk represents the properties of the disk. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar capacity_gb: The maximum amount of storage. Measured in gibibytes. - :vartype capacity_gb: int - :ivar connection: The connection type of the rack SKU resource. Known values are: "PCIE", - "SATA", "RAID", and "SAS". - :vartype connection: str or ~azure.mgmt.networkcloud.models.MachineSkuDiskConnectionType - :ivar type: The disk type of rack SKU resource. Known values are: "HDD" and "SSD". - :vartype type: str or ~azure.mgmt.networkcloud.models.DiskType - """ - - _validation = { - "capacity_gb": {"readonly": True}, - "connection": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "capacity_gb": {"key": "capacityGB", "type": "int"}, - "connection": {"key": "connection", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.capacity_gb: Optional[int] = None - self.connection: Optional[Union[str, "_models.MachineSkuDiskConnectionType"]] = None - self.type: Optional[Union[str, "_models.DiskType"]] = None - - -class MachineSkuSlot(_serialization.Model): - """MachineSkuSlot represents a single SKU and rack slot associated with the machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar rack_slot: The position in the rack for the machine. - :vartype rack_slot: int - :ivar bootstrap_protocol: The type of bootstrap protocol used. "PXE" - :vartype bootstrap_protocol: str or ~azure.mgmt.networkcloud.models.BootstrapProtocol - :ivar cpu_cores: The count of CPU cores for this machine. - :vartype cpu_cores: int - :ivar cpu_sockets: The count of CPU sockets for this machine. - :vartype cpu_sockets: int - :ivar disks: The list of disks. - :vartype disks: list[~azure.mgmt.networkcloud.models.MachineDisk] - :ivar generation: The generation of the architecture. - :vartype generation: str - :ivar hardware_version: The hardware version of the machine. - :vartype hardware_version: str - :ivar memory_capacity_gb: The maximum amount of memory. Measured in gibibytes. - :vartype memory_capacity_gb: int - :ivar model: The model of the machine. - :vartype model: str - :ivar network_interfaces: The list of network interfaces. - :vartype network_interfaces: list[~azure.mgmt.networkcloud.models.NetworkInterface] - :ivar total_threads: The count of SMT and physical core threads for this machine. - :vartype total_threads: int - :ivar vendor: The make of the machine. - :vartype vendor: str - """ - - _validation = { - "rack_slot": {"readonly": True}, - "bootstrap_protocol": {"readonly": True}, - "cpu_cores": {"readonly": True}, - "cpu_sockets": {"readonly": True}, - "disks": {"readonly": True}, - "generation": {"readonly": True}, - "hardware_version": {"readonly": True}, - "memory_capacity_gb": {"readonly": True}, - "model": {"readonly": True}, - "network_interfaces": {"readonly": True}, - "total_threads": {"readonly": True}, - "vendor": {"readonly": True}, - } - - _attribute_map = { - "rack_slot": {"key": "rackSlot", "type": "int"}, - "bootstrap_protocol": {"key": "properties.bootstrapProtocol", "type": "str"}, - "cpu_cores": {"key": "properties.cpuCores", "type": "int"}, - "cpu_sockets": {"key": "properties.cpuSockets", "type": "int"}, - "disks": {"key": "properties.disks", "type": "[MachineDisk]"}, - "generation": {"key": "properties.generation", "type": "str"}, - "hardware_version": {"key": "properties.hardwareVersion", "type": "str"}, - "memory_capacity_gb": {"key": "properties.memoryCapacityGB", "type": "int"}, - "model": {"key": "properties.model", "type": "str"}, - "network_interfaces": {"key": "properties.networkInterfaces", "type": "[NetworkInterface]"}, - "total_threads": {"key": "properties.totalThreads", "type": "int"}, - "vendor": {"key": "properties.vendor", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.rack_slot: Optional[int] = None - self.bootstrap_protocol: Optional[Union[str, "_models.BootstrapProtocol"]] = None - self.cpu_cores: Optional[int] = None - self.cpu_sockets: Optional[int] = None - self.disks: Optional[list["_models.MachineDisk"]] = None - self.generation: Optional[str] = None - self.hardware_version: Optional[str] = None - self.memory_capacity_gb: Optional[int] = None - self.model: Optional[str] = None - self.network_interfaces: Optional[list["_models.NetworkInterface"]] = None - self.total_threads: Optional[int] = None - self.vendor: Optional[str] = None - - -class ManagedResourceGroupConfiguration(_serialization.Model): - """ManagedResourceGroupConfiguration represents the configuration of the resource group managed by - Azure. - - :ivar location: The location of the managed resource group. If not specified, the location of - the parent resource is chosen. - :vartype location: str - :ivar name: The name for the managed resource group. If not specified, the unique name is - automatically generated. - :vartype name: str - """ - - _validation = { - "name": {"max_length": 75}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: The location of the managed resource group. If not specified, the location - of the parent resource is chosen. - :paramtype location: str - :keyword name: The name for the managed resource group. If not specified, the unique name is - automatically generated. - :paramtype name: str - """ - super().__init__(**kwargs) - self.location = location - self.name = name - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - 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 principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.networkcloud.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.networkcloud.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": 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: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.networkcloud.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.networkcloud.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class NetworkAttachment(_serialization.Model): - """NetworkAttachment represents the single network attachment. - - 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 attached_network_id: The resource ID of the associated network attached to the virtual - machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork - resources. Required. - :vartype attached_network_id: str - :ivar default_gateway: The indicator of whether this is the default gateway. Only one of the - attached networks (including the CloudServicesNetwork attachment) for a single machine may be - specified as True. Known values are: "True" and "False". - :vartype default_gateway: str or ~azure.mgmt.networkcloud.models.DefaultGateway - :ivar ip_allocation_method: The IP allocation mechanism for the virtual machine. Dynamic and - Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the - only permitted value. Required. Known values are: "Dynamic", "Static", and "Disabled". - :vartype ip_allocation_method: str or - ~azure.mgmt.networkcloud.models.VirtualMachineIPAllocationMethod - :ivar ipv4_address: The IPv4 address of the virtual machine. This field is used only if the - attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - - this field must contain a user specified IPv4 address from within the subnet specified in the - attached network. Dynamic - this field is read-only, but will be populated with an address from - within the subnet specified in the attached network. Disabled - this field will be empty. - :vartype ipv4_address: str - :ivar ipv6_address: The IPv6 address of the virtual machine. This field is used only if the - attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - - this field must contain an IPv6 address range from within the range specified in the attached - network. Dynamic - this field is read-only, but will be populated with an range from within the - subnet specified in the attached network. Disabled - this field will be empty. - :vartype ipv6_address: str - :ivar mac_address: The MAC address of the interface for the virtual machine that corresponds to - this network attachment. - :vartype mac_address: str - :ivar network_attachment_name: The associated network's interface name. If specified, the - network attachment name has a maximum length of 15 characters and must be unique to this - virtual machine. If the user doesn’t specify this value, the default interface name of the - network resource will be used. For a CloudServicesNetwork resource, this name will be ignored. - :vartype network_attachment_name: str - """ - - _validation = { - "attached_network_id": {"required": True}, - "ip_allocation_method": {"required": True}, - "mac_address": {"readonly": True}, - "network_attachment_name": {"max_length": 15}, - } - - _attribute_map = { - "attached_network_id": {"key": "attachedNetworkId", "type": "str"}, - "default_gateway": {"key": "defaultGateway", "type": "str"}, - "ip_allocation_method": {"key": "ipAllocationMethod", "type": "str"}, - "ipv4_address": {"key": "ipv4Address", "type": "str"}, - "ipv6_address": {"key": "ipv6Address", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "network_attachment_name": {"key": "networkAttachmentName", "type": "str"}, - } - - def __init__( - self, - *, - attached_network_id: str, - ip_allocation_method: Union[str, "_models.VirtualMachineIPAllocationMethod"], - default_gateway: Optional[Union[str, "_models.DefaultGateway"]] = None, - ipv4_address: Optional[str] = None, - ipv6_address: Optional[str] = None, - network_attachment_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword attached_network_id: The resource ID of the associated network attached to the virtual - machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork - resources. Required. - :paramtype attached_network_id: str - :keyword default_gateway: The indicator of whether this is the default gateway. Only one of the - attached networks (including the CloudServicesNetwork attachment) for a single machine may be - specified as True. Known values are: "True" and "False". - :paramtype default_gateway: str or ~azure.mgmt.networkcloud.models.DefaultGateway - :keyword ip_allocation_method: The IP allocation mechanism for the virtual machine. Dynamic and - Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the - only permitted value. Required. Known values are: "Dynamic", "Static", and "Disabled". - :paramtype ip_allocation_method: str or - ~azure.mgmt.networkcloud.models.VirtualMachineIPAllocationMethod - :keyword ipv4_address: The IPv4 address of the virtual machine. This field is used only if the - attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - - this field must contain a user specified IPv4 address from within the subnet specified in the - attached network. Dynamic - this field is read-only, but will be populated with an address from - within the subnet specified in the attached network. Disabled - this field will be empty. - :paramtype ipv4_address: str - :keyword ipv6_address: The IPv6 address of the virtual machine. This field is used only if the - attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - - this field must contain an IPv6 address range from within the range specified in the attached - network. Dynamic - this field is read-only, but will be populated with an range from within the - subnet specified in the attached network. Disabled - this field will be empty. - :paramtype ipv6_address: str - :keyword network_attachment_name: The associated network's interface name. If specified, the - network attachment name has a maximum length of 15 characters and must be unique to this - virtual machine. If the user doesn’t specify this value, the default interface name of the - network resource will be used. For a CloudServicesNetwork resource, this name will be ignored. - :paramtype network_attachment_name: str - """ - super().__init__(**kwargs) - self.attached_network_id = attached_network_id - self.default_gateway = default_gateway - self.ip_allocation_method = ip_allocation_method - self.ipv4_address = ipv4_address - self.ipv6_address = ipv6_address - self.mac_address: Optional[str] = None - self.network_attachment_name = network_attachment_name - - -class NetworkConfiguration(_serialization.Model): - """NetworkConfiguration specifies the Kubernetes cluster network related configuration. - - All required parameters must be populated in order to send to server. - - :ivar attached_network_configuration: The configuration of networks being attached to the - cluster for use by the workloads that run on this Kubernetes cluster. - :vartype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :ivar bgp_service_load_balancer_configuration: The configuration of the BGP service load - balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, - either Layer 2 or BGP. - :vartype bgp_service_load_balancer_configuration: - ~azure.mgmt.networkcloud.models.BgpServiceLoadBalancerConfiguration - :ivar cloud_services_network_id: The resource ID of the associated Cloud Services network. - Required. - :vartype cloud_services_network_id: str - :ivar cni_network_id: The resource ID of the Layer 3 network that is used for creation of the - Container Networking Interface network. Required. - :vartype cni_network_id: str - :ivar dns_service_ip: The IP address assigned to the Kubernetes DNS service. It must be within - the Kubernetes service address range specified in service CIDR. - :vartype dns_service_ip: str - :ivar l2_service_load_balancer_configuration: The configuration of the Layer 2 service load - balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, - either Layer 2 or BGP. - :vartype l2_service_load_balancer_configuration: - ~azure.mgmt.networkcloud.models.L2ServiceLoadBalancerConfiguration - :ivar pod_cidrs: The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is - expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :vartype pod_cidrs: list[str] - :ivar service_cidrs: The CIDR notation IP ranges from which to assign service IPs. One IPv4 - CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :vartype service_cidrs: list[str] - """ - - _validation = { - "cloud_services_network_id": {"required": True}, - "cni_network_id": {"required": True}, - } - - _attribute_map = { - "attached_network_configuration": { - "key": "attachedNetworkConfiguration", - "type": "AttachedNetworkConfiguration", - }, - "bgp_service_load_balancer_configuration": { - "key": "bgpServiceLoadBalancerConfiguration", - "type": "BgpServiceLoadBalancerConfiguration", - }, - "cloud_services_network_id": {"key": "cloudServicesNetworkId", "type": "str"}, - "cni_network_id": {"key": "cniNetworkId", "type": "str"}, - "dns_service_ip": {"key": "dnsServiceIp", "type": "str"}, - "l2_service_load_balancer_configuration": { - "key": "l2ServiceLoadBalancerConfiguration", - "type": "L2ServiceLoadBalancerConfiguration", - }, - "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, - "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, - } - - def __init__( - self, - *, - cloud_services_network_id: str, - cni_network_id: str, - attached_network_configuration: Optional["_models.AttachedNetworkConfiguration"] = None, - bgp_service_load_balancer_configuration: Optional["_models.BgpServiceLoadBalancerConfiguration"] = None, - dns_service_ip: Optional[str] = None, - l2_service_load_balancer_configuration: Optional["_models.L2ServiceLoadBalancerConfiguration"] = None, - pod_cidrs: Optional[list[str]] = None, - service_cidrs: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword attached_network_configuration: The configuration of networks being attached to the - cluster for use by the workloads that run on this Kubernetes cluster. - :paramtype attached_network_configuration: - ~azure.mgmt.networkcloud.models.AttachedNetworkConfiguration - :keyword bgp_service_load_balancer_configuration: The configuration of the BGP service load - balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, - either Layer 2 or BGP. - :paramtype bgp_service_load_balancer_configuration: - ~azure.mgmt.networkcloud.models.BgpServiceLoadBalancerConfiguration - :keyword cloud_services_network_id: The resource ID of the associated Cloud Services network. - Required. - :paramtype cloud_services_network_id: str - :keyword cni_network_id: The resource ID of the Layer 3 network that is used for creation of - the Container Networking Interface network. Required. - :paramtype cni_network_id: str - :keyword dns_service_ip: The IP address assigned to the Kubernetes DNS service. It must be - within the Kubernetes service address range specified in service CIDR. - :paramtype dns_service_ip: str - :keyword l2_service_load_balancer_configuration: The configuration of the Layer 2 service load - balancer for this Kubernetes cluster. A maximum of one service load balancer may be specified, - either Layer 2 or BGP. - :paramtype l2_service_load_balancer_configuration: - ~azure.mgmt.networkcloud.models.L2ServiceLoadBalancerConfiguration - :keyword pod_cidrs: The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is - expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :paramtype pod_cidrs: list[str] - :keyword service_cidrs: The CIDR notation IP ranges from which to assign service IPs. One IPv4 - CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :paramtype service_cidrs: list[str] - """ - super().__init__(**kwargs) - self.attached_network_configuration = attached_network_configuration - self.bgp_service_load_balancer_configuration = bgp_service_load_balancer_configuration - self.cloud_services_network_id = cloud_services_network_id - self.cni_network_id = cni_network_id - self.dns_service_ip = dns_service_ip - self.l2_service_load_balancer_configuration = l2_service_load_balancer_configuration - self.pod_cidrs = pod_cidrs - self.service_cidrs = service_cidrs - - -class NetworkInterface(_serialization.Model): - """NetworkInterface represents properties of the network interface. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: The partial address of Peripheral Component Interconnect (PCI). - :vartype address: str - :ivar device_connection_type: The connection type of the device. "PCI" - :vartype device_connection_type: str or ~azure.mgmt.networkcloud.models.DeviceConnectionType - :ivar model: The model name of the device. - :vartype model: str - :ivar physical_slot: The physical slot for this device. - :vartype physical_slot: int - :ivar port_count: The number of ports on the device. - :vartype port_count: int - :ivar port_speed: The maximum amount of data in gigabits that the line card transmits through a - port at any given second. - :vartype port_speed: int - :ivar vendor: The vendor name of the device. - :vartype vendor: str - """ - - _validation = { - "address": {"readonly": True}, - "device_connection_type": {"readonly": True}, - "model": {"readonly": True}, - "physical_slot": {"readonly": True}, - "port_count": {"readonly": True}, - "port_speed": {"readonly": True}, - "vendor": {"readonly": True}, - } - - _attribute_map = { - "address": {"key": "address", "type": "str"}, - "device_connection_type": {"key": "deviceConnectionType", "type": "str"}, - "model": {"key": "model", "type": "str"}, - "physical_slot": {"key": "physicalSlot", "type": "int"}, - "port_count": {"key": "portCount", "type": "int"}, - "port_speed": {"key": "portSpeed", "type": "int"}, - "vendor": {"key": "vendor", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.address: Optional[str] = None - self.device_connection_type: Optional[Union[str, "_models.DeviceConnectionType"]] = None - self.model: Optional[str] = None - self.physical_slot: Optional[int] = None - self.port_count: Optional[int] = None - self.port_speed: Optional[int] = None - self.vendor: Optional[str] = None - - -class Nic(_serialization.Model): - """Type Deprecated. Will be removed in an upcoming version. Nic represents the network interface - card details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar lldp_neighbor: The information about the device connected to this NIC. - :vartype lldp_neighbor: ~azure.mgmt.networkcloud.models.LldpNeighbor - :ivar mac_address: The MAC address associated with this NIC. - :vartype mac_address: str - :ivar name: The name of the NIC/interface. - :vartype name: str - """ - - _validation = { - "lldp_neighbor": {"readonly": True}, - "mac_address": {"readonly": True}, - "name": {"readonly": True}, - } - - _attribute_map = { - "lldp_neighbor": {"key": "lldpNeighbor", "type": "LldpNeighbor"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.lldp_neighbor: Optional["_models.LldpNeighbor"] = None - self.mac_address: Optional[str] = None - self.name: Optional[str] = None - - -class NodePoolAdministratorConfigurationPatch(_serialization.Model): - """NodePoolAdministratorConfigurationPatch represents the patching capabilities for the - administrator configuration. - - :ivar ssh_public_keys: SshPublicKey represents the public key used to authenticate with a - resource through SSH. - :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - - _attribute_map = { - "ssh_public_keys": {"key": "sshPublicKeys", "type": "[SshPublicKey]"}, - } - - def __init__(self, *, ssh_public_keys: Optional[list["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: - """ - :keyword ssh_public_keys: SshPublicKey represents the public key used to authenticate with a - resource through SSH. - :paramtype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - """ - super().__init__(**kwargs) - self.ssh_public_keys = ssh_public_keys - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.networkcloud.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.networkcloud.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.networkcloud.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.networkcloud.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.is_data_action: Optional[bool] = None - self.display = display - self.origin: Optional[Union[str, "_models.Origin"]] = None - self.action_type: Optional[Union[str, "_models.ActionType"]] = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - self.resource: Optional[str] = None - self.operation: Optional[str] = None - self.description: Optional[str] = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.networkcloud.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Operation"]] = None - self.next_link: Optional[str] = None - - -class OperationStatusResult(_serialization.Model): - """The current status of an async operation. - - 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 end_time: The end time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.networkcloud.models.ErrorDetail - :ivar id: Fully qualified ID for the async operation. - :vartype id: str - :ivar name: Name of the async operation. - :vartype name: str - :ivar operations: The operations list. - :vartype operations: list[~azure.mgmt.networkcloud.models.OperationStatusResult] - :ivar percent_complete: Percent of the operation that is complete. - :vartype percent_complete: float - :ivar resource_id: Fully qualified ID of the resource against which the original async - operation was started. - :vartype resource_id: str - :ivar start_time: The start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar status: Operation status. Required. - :vartype status: str - :ivar exit_code: For actions that run commands or scripts, the exit code of the script - execution. - :vartype exit_code: str - :ivar output_head: For actions that run commands or scripts, the leading bytes of the output of - the script execution. - :vartype output_head: str - :ivar result_ref: For actions that run commands or scripts, a reference to the location of the - result. - :vartype result_ref: str - :ivar result_url: For actions that run commands or scripts, the URL where the full output of - the script output can be retrieved. - :vartype result_url: str - """ - - _validation = { - "end_time": {"readonly": True}, - "error": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "operations": {"readonly": True}, - "percent_complete": {"readonly": True, "maximum": 100, "minimum": 0}, - "resource_id": {"readonly": True}, - "start_time": {"readonly": True}, - "status": {"required": True}, - "exit_code": {"readonly": True}, - "output_head": {"readonly": True}, - "result_ref": {"readonly": True}, - "result_url": {"readonly": True}, - } - - _attribute_map = { - "end_time": {"key": "endTime", "type": "iso-8601"}, - "error": {"key": "error", "type": "ErrorDetail"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "operations": {"key": "operations", "type": "[OperationStatusResult]"}, - "percent_complete": {"key": "percentComplete", "type": "float"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - "exit_code": {"key": "properties.exitCode", "type": "str"}, - "output_head": {"key": "properties.outputHead", "type": "str"}, - "result_ref": {"key": "properties.resultRef", "type": "str"}, - "result_url": {"key": "properties.resultUrl", "type": "str"}, - } - - def __init__(self, *, status: str, **kwargs: Any) -> None: - """ - :keyword status: Operation status. Required. - :paramtype status: str - """ - super().__init__(**kwargs) - self.end_time: Optional[datetime.datetime] = None - self.error: Optional["_models.ErrorDetail"] = None - self.id: Optional[str] = None - self.name: Optional[str] = None - self.operations: Optional[list["_models.OperationStatusResult"]] = None - self.percent_complete: Optional[float] = None - self.resource_id: Optional[str] = None - self.start_time: Optional[datetime.datetime] = None - self.status = status - self.exit_code: Optional[str] = None - self.output_head: Optional[str] = None - self.result_ref: Optional[str] = None - self.result_url: Optional[str] = None - - -class OsDisk(_serialization.Model): - """OsDisk represents configuration of the boot disk. - - All required parameters must be populated in order to send to server. - - :ivar create_option: The strategy for creating the OS disk. Known values are: "Ephemeral" and - "Persistent". - :vartype create_option: str or ~azure.mgmt.networkcloud.models.OsDiskCreateOption - :ivar delete_option: The strategy for deleting the OS disk. "Delete" - :vartype delete_option: str or ~azure.mgmt.networkcloud.models.OsDiskDeleteOption - :ivar disk_size_gb: The size of the disk. Required if the createOption is Ephemeral. - Allocations are measured in gibibytes. Required. - :vartype disk_size_gb: int - """ - - _validation = { - "disk_size_gb": {"required": True}, - } - - _attribute_map = { - "create_option": {"key": "createOption", "type": "str"}, - "delete_option": {"key": "deleteOption", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - } - - def __init__( - self, - *, - disk_size_gb: int, - create_option: Union[str, "_models.OsDiskCreateOption"] = "Ephemeral", - delete_option: Union[str, "_models.OsDiskDeleteOption"] = "Delete", - **kwargs: Any - ) -> None: - """ - :keyword create_option: The strategy for creating the OS disk. Known values are: "Ephemeral" - and "Persistent". - :paramtype create_option: str or ~azure.mgmt.networkcloud.models.OsDiskCreateOption - :keyword delete_option: The strategy for deleting the OS disk. "Delete" - :paramtype delete_option: str or ~azure.mgmt.networkcloud.models.OsDiskDeleteOption - :keyword disk_size_gb: The size of the disk. Required if the createOption is Ephemeral. - Allocations are measured in gibibytes. Required. - :paramtype disk_size_gb: int - """ - super().__init__(**kwargs) - self.create_option = create_option - self.delete_option = delete_option - self.disk_size_gb = disk_size_gb - - -class Rack(TrackedResource): - """Rack represents the hardware of the rack and is dependent upon the cluster for lifecycle. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar availability_zone: The value that will be used for machines in this rack to represent the - availability zones that can be referenced by Hybrid AKS Clusters for node arrangement. - Required. - :vartype availability_zone: str - :ivar cluster_id: The resource ID of the cluster the rack is created for. This value is set - when the rack is created by the cluster. - :vartype cluster_id: str - :ivar detailed_status: The more detailed status of the rack. Known values are: "Error", - "Available", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.RackDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar provisioning_state: The provisioning state of the rack resource. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.RackProvisioningState - :ivar rack_location: The free-form description of the rack location. (e.g. “DTN Datacenter, - Floor 3, Isle 9, Rack 2B”). Required. - :vartype rack_location: str - :ivar rack_serial_number: The unique identifier for the rack within Network Cloud cluster. An - alternate unique alphanumeric value other than a serial number may be provided if desired. - Required. - :vartype rack_serial_number: str - :ivar rack_sku_id: The SKU for the rack. Required. - :vartype rack_sku_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "availability_zone": {"required": True, "pattern": r"^[a-zA-Z0-9]{1,10}$"}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "rack_location": {"required": True, "max_length": 256}, - "rack_serial_number": {"required": True, "max_length": 64, "min_length": 1}, - "rack_sku_id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "rack_location": {"key": "properties.rackLocation", "type": "str"}, - "rack_serial_number": {"key": "properties.rackSerialNumber", "type": "str"}, - "rack_sku_id": {"key": "properties.rackSkuId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - availability_zone: str, - rack_location: str, - rack_serial_number: str, - rack_sku_id: str, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword availability_zone: The value that will be used for machines in this rack to represent - the availability zones that can be referenced by Hybrid AKS Clusters for node arrangement. - Required. - :paramtype availability_zone: str - :keyword rack_location: The free-form description of the rack location. (e.g. “DTN Datacenter, - Floor 3, Isle 9, Rack 2B”). Required. - :paramtype rack_location: str - :keyword rack_serial_number: The unique identifier for the rack within Network Cloud cluster. - An alternate unique alphanumeric value other than a serial number may be provided if desired. - Required. - :paramtype rack_serial_number: str - :keyword rack_sku_id: The SKU for the rack. Required. - :paramtype rack_sku_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.availability_zone = availability_zone - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.RackDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.RackProvisioningState"]] = None - self.rack_location = rack_location - self.rack_serial_number = rack_serial_number - self.rack_sku_id = rack_sku_id - - -class RackDefinition(_serialization.Model): - """RackDefinition represents details regarding the rack. - - All required parameters must be populated in order to send to server. - - :ivar availability_zone: The zone name used for this rack when created. Availability zones are - used for workload placement. - :vartype availability_zone: str - :ivar bare_metal_machine_configuration_data: The unordered list of bare metal machine - configuration. - :vartype bare_metal_machine_configuration_data: - list[~azure.mgmt.networkcloud.models.BareMetalMachineConfigurationData] - :ivar network_rack_id: The resource ID of the network rack that matches this rack definition. - Required. - :vartype network_rack_id: str - :ivar rack_location: The free-form description of the rack's location. - :vartype rack_location: str - :ivar rack_serial_number: The unique identifier for the rack within Network Cloud cluster. An - alternate unique alphanumeric value other than a serial number may be provided if desired. - Required. - :vartype rack_serial_number: str - :ivar rack_sku_id: The resource ID of the sku for the rack being added. Required. - :vartype rack_sku_id: str - :ivar storage_appliance_configuration_data: The list of storage appliance configuration data - for this rack. - :vartype storage_appliance_configuration_data: - list[~azure.mgmt.networkcloud.models.StorageApplianceConfigurationData] - """ - - _validation = { - "availability_zone": {"pattern": r"^[a-zA-Z0-9]{1,10}$"}, - "network_rack_id": {"required": True}, - "rack_location": {"max_length": 256}, - "rack_serial_number": {"required": True, "max_length": 64, "min_length": 1}, - "rack_sku_id": {"required": True}, - } - - _attribute_map = { - "availability_zone": {"key": "availabilityZone", "type": "str"}, - "bare_metal_machine_configuration_data": { - "key": "bareMetalMachineConfigurationData", - "type": "[BareMetalMachineConfigurationData]", - }, - "network_rack_id": {"key": "networkRackId", "type": "str"}, - "rack_location": {"key": "rackLocation", "type": "str"}, - "rack_serial_number": {"key": "rackSerialNumber", "type": "str"}, - "rack_sku_id": {"key": "rackSkuId", "type": "str"}, - "storage_appliance_configuration_data": { - "key": "storageApplianceConfigurationData", - "type": "[StorageApplianceConfigurationData]", - }, - } - - def __init__( - self, - *, - network_rack_id: str, - rack_serial_number: str, - rack_sku_id: str, - availability_zone: Optional[str] = None, - bare_metal_machine_configuration_data: Optional[list["_models.BareMetalMachineConfigurationData"]] = None, - rack_location: Optional[str] = None, - storage_appliance_configuration_data: Optional[list["_models.StorageApplianceConfigurationData"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword availability_zone: The zone name used for this rack when created. Availability zones - are used for workload placement. - :paramtype availability_zone: str - :keyword bare_metal_machine_configuration_data: The unordered list of bare metal machine - configuration. - :paramtype bare_metal_machine_configuration_data: - list[~azure.mgmt.networkcloud.models.BareMetalMachineConfigurationData] - :keyword network_rack_id: The resource ID of the network rack that matches this rack - definition. Required. - :paramtype network_rack_id: str - :keyword rack_location: The free-form description of the rack's location. - :paramtype rack_location: str - :keyword rack_serial_number: The unique identifier for the rack within Network Cloud cluster. - An alternate unique alphanumeric value other than a serial number may be provided if desired. - Required. - :paramtype rack_serial_number: str - :keyword rack_sku_id: The resource ID of the sku for the rack being added. Required. - :paramtype rack_sku_id: str - :keyword storage_appliance_configuration_data: The list of storage appliance configuration data - for this rack. - :paramtype storage_appliance_configuration_data: - list[~azure.mgmt.networkcloud.models.StorageApplianceConfigurationData] - """ - super().__init__(**kwargs) - self.availability_zone = availability_zone - self.bare_metal_machine_configuration_data = bare_metal_machine_configuration_data - self.network_rack_id = network_rack_id - self.rack_location = rack_location - self.rack_serial_number = rack_serial_number - self.rack_sku_id = rack_sku_id - self.storage_appliance_configuration_data = storage_appliance_configuration_data - - -class RackList(_serialization.Model): - """RackList represents a list of racks. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of racks. - :vartype value: list[~azure.mgmt.networkcloud.models.Rack] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Rack]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.Rack"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of racks. - :paramtype value: list[~azure.mgmt.networkcloud.models.Rack] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class RackPatchParameters(_serialization.Model): - """RackPatchParameters represents the body of the request to patch the rack properties. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar rack_location: The free-form description of the rack location. (e.g. “DTN Datacenter, - Floor 3, Isle 9, Rack 2B”). - :vartype rack_location: str - :ivar rack_serial_number: The globally unique identifier for the rack. - :vartype rack_serial_number: str - """ - - _validation = { - "rack_location": {"max_length": 256}, - "rack_serial_number": {"max_length": 64, "min_length": 1}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "rack_location": {"key": "properties.rackLocation", "type": "str"}, - "rack_serial_number": {"key": "properties.rackSerialNumber", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - rack_location: Optional[str] = None, - rack_serial_number: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword rack_location: The free-form description of the rack location. (e.g. “DTN Datacenter, - Floor 3, Isle 9, Rack 2B”). - :paramtype rack_location: str - :keyword rack_serial_number: The globally unique identifier for the rack. - :paramtype rack_serial_number: str - """ - super().__init__(**kwargs) - self.tags = tags - self.rack_location = rack_location - self.rack_serial_number = rack_serial_number - - -class RackSku(Resource): - """RackSku represents the SKU information of the rack. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.models.SystemData - :ivar compute_machines: The list of machine SKUs and associated rack slot for the - compute-dedicated machines in this rack model. - :vartype compute_machines: list[~azure.mgmt.networkcloud.models.MachineSkuSlot] - :ivar controller_machines: The list of machine SKUs and associated rack slot for the - control-plane dedicated machines in this rack model. - :vartype controller_machines: list[~azure.mgmt.networkcloud.models.MachineSkuSlot] - :ivar description: The free-form text describing the rack. - :vartype description: str - :ivar max_cluster_slots: The maximum number of compute racks supported by an aggregator rack. 0 - if this is a compute rack or a rack for a single rack cluster(rackType="Single"). - :vartype max_cluster_slots: int - :ivar provisioning_state: The provisioning state of the rack SKU resource. Known values are: - "Canceled", "Failed", and "Succeeded". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.RackSkuProvisioningState - :ivar rack_type: The type of the rack. Known values are: "Aggregator", "Compute", and "Single". - :vartype rack_type: str or ~azure.mgmt.networkcloud.models.RackSkuType - :ivar storage_appliances: The list of appliance SKUs and associated rack slot for the storage - appliance(s) in this rack model. - :vartype storage_appliances: list[~azure.mgmt.networkcloud.models.StorageApplianceSkuSlot] - :ivar supported_rack_sku_ids: The list of supported SKUs if the rack is an aggregator. - :vartype supported_rack_sku_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "compute_machines": {"readonly": True}, - "controller_machines": {"readonly": True}, - "description": {"readonly": True}, - "max_cluster_slots": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "rack_type": {"readonly": True}, - "storage_appliances": {"readonly": True}, - "supported_rack_sku_ids": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "compute_machines": {"key": "properties.computeMachines", "type": "[MachineSkuSlot]"}, - "controller_machines": {"key": "properties.controllerMachines", "type": "[MachineSkuSlot]"}, - "description": {"key": "properties.description", "type": "str"}, - "max_cluster_slots": {"key": "properties.maxClusterSlots", "type": "int"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "rack_type": {"key": "properties.rackType", "type": "str"}, - "storage_appliances": {"key": "properties.storageAppliances", "type": "[StorageApplianceSkuSlot]"}, - "supported_rack_sku_ids": {"key": "properties.supportedRackSkuIds", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.compute_machines: Optional[list["_models.MachineSkuSlot"]] = None - self.controller_machines: Optional[list["_models.MachineSkuSlot"]] = None - self.description: Optional[str] = None - self.max_cluster_slots: Optional[int] = None - self.provisioning_state: Optional[Union[str, "_models.RackSkuProvisioningState"]] = None - self.rack_type: Optional[Union[str, "_models.RackSkuType"]] = None - self.storage_appliances: Optional[list["_models.StorageApplianceSkuSlot"]] = None - self.supported_rack_sku_ids: Optional[list[str]] = None - - -class RackSkuList(_serialization.Model): - """RackSkuList represents a list of rack SKUs. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of Rack SKUs. - :vartype value: list[~azure.mgmt.networkcloud.models.RackSku] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[RackSku]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.RackSku"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of Rack SKUs. - :paramtype value: list[~azure.mgmt.networkcloud.models.RackSku] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class RuntimeProtectionConfiguration(_serialization.Model): - """RuntimeProtectionConfiguration represents the runtime protection configuration for the cluster. - - :ivar enforcement_level: The mode of operation for runtime protection. Known values are: - "Audit", "Disabled", "OnDemand", "Passive", and "RealTime". - :vartype enforcement_level: str or - ~azure.mgmt.networkcloud.models.RuntimeProtectionEnforcementLevel - """ - - _attribute_map = { - "enforcement_level": {"key": "enforcementLevel", "type": "str"}, - } - - def __init__( - self, *, enforcement_level: Union[str, "_models.RuntimeProtectionEnforcementLevel"] = "Disabled", **kwargs: Any - ) -> None: - """ - :keyword enforcement_level: The mode of operation for runtime protection. Known values are: - "Audit", "Disabled", "OnDemand", "Passive", and "RealTime". - :paramtype enforcement_level: str or - ~azure.mgmt.networkcloud.models.RuntimeProtectionEnforcementLevel - """ - super().__init__(**kwargs) - self.enforcement_level = enforcement_level - - -class RuntimeProtectionStatus(_serialization.Model): - """RuntimeProtectionStatus represents the runtime protection status of the bare metal machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar definitions_last_updated: The timestamp when the malware definitions were last updated. - :vartype definitions_last_updated: ~datetime.datetime - :ivar definitions_version: The version of the malware definitions. - :vartype definitions_version: str - :ivar scan_completed_time: The timestamp of the most recently completed scan, or empty if there - has never been a scan. - :vartype scan_completed_time: ~datetime.datetime - :ivar scan_scheduled_time: The timestamp of the most recently scheduled scan, or empty if no - scan has been scheduled. - :vartype scan_scheduled_time: ~datetime.datetime - :ivar scan_started_time: The timestamp of the most recently started scan, or empty if there has - never been a scan. - :vartype scan_started_time: ~datetime.datetime - """ - - _validation = { - "definitions_last_updated": {"readonly": True}, - "definitions_version": {"readonly": True}, - "scan_completed_time": {"readonly": True}, - "scan_scheduled_time": {"readonly": True}, - "scan_started_time": {"readonly": True}, - } - - _attribute_map = { - "definitions_last_updated": {"key": "definitionsLastUpdated", "type": "iso-8601"}, - "definitions_version": {"key": "definitionsVersion", "type": "str"}, - "scan_completed_time": {"key": "scanCompletedTime", "type": "iso-8601"}, - "scan_scheduled_time": {"key": "scanScheduledTime", "type": "iso-8601"}, - "scan_started_time": {"key": "scanStartedTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.definitions_last_updated: Optional[datetime.datetime] = None - self.definitions_version: Optional[str] = None - self.scan_completed_time: Optional[datetime.datetime] = None - self.scan_scheduled_time: Optional[datetime.datetime] = None - self.scan_started_time: Optional[datetime.datetime] = None - - -class SecretArchiveReference(_serialization.Model): - """SecretArchiveReference represents the reference to a secret in a key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar key_vault_id: The resource ID of the key vault containing the secret. - :vartype key_vault_id: str - :ivar key_vault_uri: The URI of the key containing the secret. - :vartype key_vault_uri: str - :ivar secret_name: The name of the secret in the key vault. - :vartype secret_name: str - :ivar secret_version: The version of the secret in the key vault. - :vartype secret_version: str - """ - - _validation = { - "key_vault_id": {"readonly": True}, - "key_vault_uri": {"readonly": True}, - "secret_name": {"readonly": True}, - "secret_version": {"readonly": True}, - } - - _attribute_map = { - "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, - "secret_name": {"key": "secretName", "type": "str"}, - "secret_version": {"key": "secretVersion", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.key_vault_id: Optional[str] = None - self.key_vault_uri: Optional[str] = None - self.secret_name: Optional[str] = None - self.secret_version: Optional[str] = None - - -class SecretArchiveSettings(_serialization.Model): - """SecretArchiveSettings represents the settings for the secret archive used to hold credentials - for the cluster. - - :ivar associated_identity: The selection of the managed identity to use with this vault URI. - The identity type must be either system assigned or user assigned. - :vartype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :ivar vault_uri: The URI for the key vault used as the secret archive. - :vartype vault_uri: str - """ - - _attribute_map = { - "associated_identity": {"key": "associatedIdentity", "type": "IdentitySelector"}, - "vault_uri": {"key": "vaultUri", "type": "str"}, - } - - def __init__( - self, - *, - associated_identity: Optional["_models.IdentitySelector"] = None, - vault_uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword associated_identity: The selection of the managed identity to use with this vault URI. - The identity type must be either system assigned or user assigned. - :paramtype associated_identity: ~azure.mgmt.networkcloud.models.IdentitySelector - :keyword vault_uri: The URI for the key vault used as the secret archive. - :paramtype vault_uri: str - """ - super().__init__(**kwargs) - self.associated_identity = associated_identity - self.vault_uri = vault_uri - - -class SecretRotationStatus(_serialization.Model): - """SecretRotationStatus represents the status of a secret rotation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar expire_period_days: The maximum number of days the secret may be used before it must be - changed. - :vartype expire_period_days: int - :ivar last_rotation_time: The date and time when the secret was last changed. - :vartype last_rotation_time: ~datetime.datetime - :ivar rotation_period_days: The number of days a secret exists before rotations will be - attempted. - :vartype rotation_period_days: int - :ivar secret_archive_reference: The reference to the secret in a key vault. - :vartype secret_archive_reference: ~azure.mgmt.networkcloud.models.SecretArchiveReference - :ivar secret_type: The type name used to identify the purpose of the secret. - :vartype secret_type: str - """ - - _validation = { - "expire_period_days": {"readonly": True}, - "last_rotation_time": {"readonly": True}, - "rotation_period_days": {"readonly": True}, - "secret_archive_reference": {"readonly": True}, - "secret_type": {"readonly": True}, - } - - _attribute_map = { - "expire_period_days": {"key": "expirePeriodDays", "type": "int"}, - "last_rotation_time": {"key": "lastRotationTime", "type": "iso-8601"}, - "rotation_period_days": {"key": "rotationPeriodDays", "type": "int"}, - "secret_archive_reference": {"key": "secretArchiveReference", "type": "SecretArchiveReference"}, - "secret_type": {"key": "secretType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.expire_period_days: Optional[int] = None - self.last_rotation_time: Optional[datetime.datetime] = None - self.rotation_period_days: Optional[int] = None - self.secret_archive_reference: Optional["_models.SecretArchiveReference"] = None - self.secret_type: Optional[str] = None - - -class ServiceLoadBalancerBgpPeer(_serialization.Model): - """ServiceLoadBalancerBgpPeer represents the configuration of the BGP service load balancer for - the Kubernetes cluster. - - All required parameters must be populated in order to send to server. - - :ivar bfd_enabled: The indicator of BFD enablement for this BgpPeer. Known values are: "True" - and "False". - :vartype bfd_enabled: str or ~azure.mgmt.networkcloud.models.BfdEnabled - :ivar bgp_multi_hop: The indicator to enable multi-hop peering support. Known values are: - "True" and "False". - :vartype bgp_multi_hop: str or ~azure.mgmt.networkcloud.models.BgpMultiHop - :ivar hold_time: Field Deprecated. The field was previously optional, now it will have no - defined behavior and will be ignored. The requested BGP hold time value. This field uses ISO - 8601 duration format, for example P1H. - :vartype hold_time: str - :ivar keep_alive_time: Field Deprecated. The field was previously optional, now it will have no - defined behavior and will be ignored. The requested BGP keepalive time value. This field uses - ISO 8601 duration format, for example P1H. - :vartype keep_alive_time: str - :ivar my_asn: The autonomous system number used for the local end of the BGP session. - :vartype my_asn: int - :ivar name: The name used to identify this BGP peer for association with a BGP advertisement. - Required. - :vartype name: str - :ivar password: The authentication password for routers enforcing TCP MD5 authenticated - sessions. - :vartype password: str - :ivar peer_address: The IPv4 or IPv6 address used to connect this BGP session. Required. - :vartype peer_address: str - :ivar peer_asn: The autonomous system number expected from the remote end of the BGP session. - Required. - :vartype peer_asn: int - :ivar peer_port: The port used to connect this BGP session. - :vartype peer_port: int - """ - - _validation = { - "my_asn": {"maximum": 4294967295, "minimum": 0}, - "name": {"required": True, "pattern": r"^[a-z0-9]([a-z0-9.-]{0,61}[a-z0-9]){0,1}$"}, - "password": {"max_length": 80, "pattern": r"^[a-zA-Z0-9]{0,80}$"}, - "peer_address": {"required": True}, - "peer_asn": {"required": True, "maximum": 4294967295, "minimum": 0}, - } - - _attribute_map = { - "bfd_enabled": {"key": "bfdEnabled", "type": "str"}, - "bgp_multi_hop": {"key": "bgpMultiHop", "type": "str"}, - "hold_time": {"key": "holdTime", "type": "str"}, - "keep_alive_time": {"key": "keepAliveTime", "type": "str"}, - "my_asn": {"key": "myAsn", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "password": {"key": "password", "type": "str"}, - "peer_address": {"key": "peerAddress", "type": "str"}, - "peer_asn": {"key": "peerAsn", "type": "int"}, - "peer_port": {"key": "peerPort", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - peer_address: str, - peer_asn: int, - bfd_enabled: Optional[Union[str, "_models.BfdEnabled"]] = None, - bgp_multi_hop: Union[str, "_models.BgpMultiHop"] = "False", - hold_time: Optional[str] = None, - keep_alive_time: Optional[str] = None, - my_asn: Optional[int] = None, - password: Optional[str] = None, - peer_port: int = 179, - **kwargs: Any - ) -> None: - """ - :keyword bfd_enabled: The indicator of BFD enablement for this BgpPeer. Known values are: - "True" and "False". - :paramtype bfd_enabled: str or ~azure.mgmt.networkcloud.models.BfdEnabled - :keyword bgp_multi_hop: The indicator to enable multi-hop peering support. Known values are: - "True" and "False". - :paramtype bgp_multi_hop: str or ~azure.mgmt.networkcloud.models.BgpMultiHop - :keyword hold_time: Field Deprecated. The field was previously optional, now it will have no - defined behavior and will be ignored. The requested BGP hold time value. This field uses ISO - 8601 duration format, for example P1H. - :paramtype hold_time: str - :keyword keep_alive_time: Field Deprecated. The field was previously optional, now it will have - no defined behavior and will be ignored. The requested BGP keepalive time value. This field - uses ISO 8601 duration format, for example P1H. - :paramtype keep_alive_time: str - :keyword my_asn: The autonomous system number used for the local end of the BGP session. - :paramtype my_asn: int - :keyword name: The name used to identify this BGP peer for association with a BGP - advertisement. Required. - :paramtype name: str - :keyword password: The authentication password for routers enforcing TCP MD5 authenticated - sessions. - :paramtype password: str - :keyword peer_address: The IPv4 or IPv6 address used to connect this BGP session. Required. - :paramtype peer_address: str - :keyword peer_asn: The autonomous system number expected from the remote end of the BGP - session. Required. - :paramtype peer_asn: int - :keyword peer_port: The port used to connect this BGP session. - :paramtype peer_port: int - """ - super().__init__(**kwargs) - self.bfd_enabled = bfd_enabled - self.bgp_multi_hop = bgp_multi_hop - self.hold_time = hold_time - self.keep_alive_time = keep_alive_time - self.my_asn = my_asn - self.name = name - self.password = password - self.peer_address = peer_address - self.peer_asn = peer_asn - self.peer_port = peer_port - - -class ServicePrincipalInformation(_serialization.Model): - """ServicePrincipalInformation represents the details of the service principal to be used by the - cluster during Arc Appliance installation. - - All required parameters must be populated in order to send to server. - - :ivar application_id: The application ID, also known as client ID, of the service principal. - Required. - :vartype application_id: str - :ivar password: The password of the service principal. Required. - :vartype password: str - :ivar principal_id: The principal ID, also known as the object ID, of the service principal. - Required. - :vartype principal_id: str - :ivar tenant_id: The tenant ID, also known as the directory ID, of the tenant in which the - service principal is created. Required. - :vartype tenant_id: str - """ - - _validation = { - "application_id": {"required": True}, - "password": {"required": True}, - "principal_id": {"required": True}, - "tenant_id": {"required": True}, - } - - _attribute_map = { - "application_id": {"key": "applicationId", "type": "str"}, - "password": {"key": "password", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__(self, *, application_id: str, password: str, principal_id: str, tenant_id: str, **kwargs: Any) -> None: - """ - :keyword application_id: The application ID, also known as client ID, of the service principal. - Required. - :paramtype application_id: str - :keyword password: The password of the service principal. Required. - :paramtype password: str - :keyword principal_id: The principal ID, also known as the object ID, of the service principal. - Required. - :paramtype principal_id: str - :keyword tenant_id: The tenant ID, also known as the directory ID, of the tenant in which the - service principal is created. Required. - :paramtype tenant_id: str - """ - super().__init__(**kwargs) - self.application_id = application_id - self.password = password - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class SshPublicKey(_serialization.Model): - """SshPublicKey represents the public key used to authenticate with a resource through SSH. - - All required parameters must be populated in order to send to server. - - :ivar key_data: The SSH public key data. Required. - :vartype key_data: str - """ - - _validation = { - "key_data": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, - } - - def __init__(self, *, key_data: str, **kwargs: Any) -> None: - """ - :keyword key_data: The SSH public key data. Required. - :paramtype key_data: str - """ - super().__init__(**kwargs) - self.key_data = key_data - - -class StepState(_serialization.Model): - """StepState represents the state of a step in an action. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar end_time: The timestamp for when processing of the step reached its terminal state, in - ISO 8601 format. - :vartype end_time: str - :ivar message: The message providing additional context for the status value. May be empty, or - contain diagnostic information in the case of a failure. - :vartype message: str - :ivar start_time: The timestamp for when processing of the step began, in ISO 8601 format. - :vartype start_time: str - :ivar status: The status of the step. A value of Completed or Failed indicates a terminal state - for the step. Known values are: "Completed", "InProgress", "Failed", and "NotStarted". - :vartype status: str or ~azure.mgmt.networkcloud.models.StepStateStatus - :ivar step_name: The name for the step. - :vartype step_name: str - """ - - _validation = { - "end_time": {"readonly": True}, - "message": {"readonly": True}, - "start_time": {"readonly": True}, - "status": {"readonly": True}, - "step_name": {"readonly": True}, - } - - _attribute_map = { - "end_time": {"key": "endTime", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "step_name": {"key": "stepName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.end_time: Optional[str] = None - self.message: Optional[str] = None - self.start_time: Optional[str] = None - self.status: Optional[Union[str, "_models.StepStateStatus"]] = None - self.step_name: Optional[str] = None - - -class StorageAppliance(TrackedResource): - """StorageAppliance represents on-premises Network Cloud storage appliance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar administrator_credentials: The credentials of the administrative interface on this - storage appliance. Required. - :vartype administrator_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :ivar ca_certificate: The CA certificate information issued by the platform for connecting to - TLS interfaces for the storage appliance. Callers add this certificate to their trusted CA - store to allow secure communication with the storage appliance. - :vartype ca_certificate: ~azure.mgmt.networkcloud.models.CertificateInfo - :ivar capacity: The total capacity of the storage appliance. Measured in GiB. - :vartype capacity: int - :ivar capacity_used: The amount of storage consumed. Measured in GiB. - :vartype capacity_used: int - :ivar cluster_id: The resource ID of the cluster this storage appliance is associated with. - :vartype cluster_id: str - :ivar detailed_status: The detailed status of the storage appliance. Known values are: - "Available", "Degraded", "Error", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.StorageApplianceDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar management_ipv4_address: The endpoint for the management interface of the storage - appliance. - :vartype management_ipv4_address: str - :ivar manufacturer: The manufacturer of the storage appliance. - :vartype manufacturer: str - :ivar model: The model of the storage appliance. - :vartype model: str - :ivar provisioning_state: The provisioning state of the storage appliance. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.StorageApplianceProvisioningState - :ivar rack_id: The resource ID of the rack where this storage appliance resides. Required. - :vartype rack_id: str - :ivar rack_slot: The slot the storage appliance is in the rack based on the BOM configuration. - Required. - :vartype rack_slot: int - :ivar remote_vendor_management_feature: The indicator of whether the storage appliance supports - remote vendor management. Known values are: "Supported" and "Unsupported". - :vartype remote_vendor_management_feature: str or - ~azure.mgmt.networkcloud.models.RemoteVendorManagementFeature - :ivar remote_vendor_management_status: The indicator of whether the remote vendor management - feature is enabled or disabled, or unsupported if it is an unsupported feature. Known values - are: "Enabled", "Disabled", and "Unsupported". - :vartype remote_vendor_management_status: str or - ~azure.mgmt.networkcloud.models.RemoteVendorManagementStatus - :ivar secret_rotation_status: The list of statuses that represent secret rotation activity. - :vartype secret_rotation_status: list[~azure.mgmt.networkcloud.models.SecretRotationStatus] - :ivar serial_number: The serial number for the storage appliance. Required. - :vartype serial_number: str - :ivar storage_appliance_sku_id: The SKU for the storage appliance. Required. - :vartype storage_appliance_sku_id: str - :ivar version: The version of the storage appliance. - :vartype version: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "administrator_credentials": {"required": True}, - "ca_certificate": {"readonly": True}, - "capacity": {"readonly": True}, - "capacity_used": {"readonly": True}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "management_ipv4_address": {"readonly": True}, - "manufacturer": {"readonly": True}, - "model": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "rack_id": {"required": True}, - "rack_slot": {"required": True, "maximum": 256, "minimum": 1}, - "remote_vendor_management_feature": {"readonly": True}, - "remote_vendor_management_status": {"readonly": True}, - "secret_rotation_status": {"readonly": True}, - "serial_number": {"required": True}, - "storage_appliance_sku_id": {"required": True}, - "version": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "administrator_credentials": { - "key": "properties.administratorCredentials", - "type": "AdministrativeCredentials", - }, - "ca_certificate": {"key": "properties.caCertificate", "type": "CertificateInfo"}, - "capacity": {"key": "properties.capacity", "type": "int"}, - "capacity_used": {"key": "properties.capacityUsed", "type": "int"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "management_ipv4_address": {"key": "properties.managementIpv4Address", "type": "str"}, - "manufacturer": {"key": "properties.manufacturer", "type": "str"}, - "model": {"key": "properties.model", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "rack_id": {"key": "properties.rackId", "type": "str"}, - "rack_slot": {"key": "properties.rackSlot", "type": "int"}, - "remote_vendor_management_feature": {"key": "properties.remoteVendorManagementFeature", "type": "str"}, - "remote_vendor_management_status": {"key": "properties.remoteVendorManagementStatus", "type": "str"}, - "secret_rotation_status": {"key": "properties.secretRotationStatus", "type": "[SecretRotationStatus]"}, - "serial_number": {"key": "properties.serialNumber", "type": "str"}, - "storage_appliance_sku_id": {"key": "properties.storageApplianceSkuId", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - administrator_credentials: "_models.AdministrativeCredentials", - rack_id: str, - rack_slot: int, - serial_number: str, - storage_appliance_sku_id: str, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword administrator_credentials: The credentials of the administrative interface on this - storage appliance. Required. - :paramtype administrator_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :keyword rack_id: The resource ID of the rack where this storage appliance resides. Required. - :paramtype rack_id: str - :keyword rack_slot: The slot the storage appliance is in the rack based on the BOM - configuration. Required. - :paramtype rack_slot: int - :keyword serial_number: The serial number for the storage appliance. Required. - :paramtype serial_number: str - :keyword storage_appliance_sku_id: The SKU for the storage appliance. Required. - :paramtype storage_appliance_sku_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.administrator_credentials = administrator_credentials - self.ca_certificate: Optional["_models.CertificateInfo"] = None - self.capacity: Optional[int] = None - self.capacity_used: Optional[int] = None - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.StorageApplianceDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.management_ipv4_address: Optional[str] = None - self.manufacturer: Optional[str] = None - self.model: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.StorageApplianceProvisioningState"]] = None - self.rack_id = rack_id - self.rack_slot = rack_slot - self.remote_vendor_management_feature: Optional[Union[str, "_models.RemoteVendorManagementFeature"]] = None - self.remote_vendor_management_status: Optional[Union[str, "_models.RemoteVendorManagementStatus"]] = None - self.secret_rotation_status: Optional[list["_models.SecretRotationStatus"]] = None - self.serial_number = serial_number - self.storage_appliance_sku_id = storage_appliance_sku_id - self.version: Optional[str] = None - - -class StorageApplianceCommandSpecification(_serialization.Model): - """StorageApplianceCommandSpecification represents the command and optional arguments to run. - - All required parameters must be populated in order to send to server. - - :ivar arguments: The list of strings that will be passed to the script in order as separate - arguments. - :vartype arguments: list[str] - :ivar command: The command to execute. Required. - :vartype command: str - """ - - _validation = { - "command": {"required": True}, - } - - _attribute_map = { - "arguments": {"key": "arguments", "type": "[str]"}, - "command": {"key": "command", "type": "str"}, - } - - def __init__(self, *, command: str, arguments: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword arguments: The list of strings that will be passed to the script in order as separate - arguments. - :paramtype arguments: list[str] - :keyword command: The command to execute. Required. - :paramtype command: str - """ - super().__init__(**kwargs) - self.arguments = arguments - self.command = command - - -class StorageApplianceConfigurationData(_serialization.Model): - """StorageApplianceConfigurationData represents configuration for the storage application. - - All required parameters must be populated in order to send to server. - - :ivar admin_credentials: The credentials of the administrative interface on this storage - appliance. The password field is expected to be an Azure Key Vault key URL. Until the cluster - is converted to utilize managed identity by setting the secret archive settings, the actual - password value should be provided instead. Required. - :vartype admin_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :ivar rack_slot: The slot that storage appliance is in the rack based on the BOM configuration. - Required. - :vartype rack_slot: int - :ivar serial_number: The serial number of the appliance. Required. - :vartype serial_number: str - :ivar storage_appliance_name: The user-provided name for the storage appliance that will be - created from this specification. - :vartype storage_appliance_name: str - """ - - _validation = { - "admin_credentials": {"required": True}, - "rack_slot": {"required": True, "maximum": 256, "minimum": 1}, - "serial_number": {"required": True}, - "storage_appliance_name": {"pattern": r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$"}, - } - - _attribute_map = { - "admin_credentials": {"key": "adminCredentials", "type": "AdministrativeCredentials"}, - "rack_slot": {"key": "rackSlot", "type": "int"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - "storage_appliance_name": {"key": "storageApplianceName", "type": "str"}, - } - - def __init__( - self, - *, - admin_credentials: "_models.AdministrativeCredentials", - rack_slot: int, - serial_number: str, - storage_appliance_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword admin_credentials: The credentials of the administrative interface on this storage - appliance. The password field is expected to be an Azure Key Vault key URL. Until the cluster - is converted to utilize managed identity by setting the secret archive settings, the actual - password value should be provided instead. Required. - :paramtype admin_credentials: ~azure.mgmt.networkcloud.models.AdministrativeCredentials - :keyword rack_slot: The slot that storage appliance is in the rack based on the BOM - configuration. Required. - :paramtype rack_slot: int - :keyword serial_number: The serial number of the appliance. Required. - :paramtype serial_number: str - :keyword storage_appliance_name: The user-provided name for the storage appliance that will be - created from this specification. - :paramtype storage_appliance_name: str - """ - super().__init__(**kwargs) - self.admin_credentials = admin_credentials - self.rack_slot = rack_slot - self.serial_number = serial_number - self.storage_appliance_name = storage_appliance_name - - -class StorageApplianceEnableRemoteVendorManagementParameters(_serialization.Model): # pylint: disable=name-too-long - """StorageApplianceEnableRemoteVendorManagementParameters represents the body of the request to - enable remote vendor management of a storage appliance. - - :ivar support_endpoints: Field Deprecated. This field is not used and will be rejected if - provided. The list of IPv4 subnets (in CIDR format), IPv6 subnets (in CIDR format), or - hostnames that the storage appliance needs accessible in order to turn on the remote vendor - management. - :vartype support_endpoints: list[str] - """ - - _attribute_map = { - "support_endpoints": {"key": "supportEndpoints", "type": "[str]"}, - } - - def __init__(self, *, support_endpoints: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword support_endpoints: Field Deprecated. This field is not used and will be rejected if - provided. The list of IPv4 subnets (in CIDR format), IPv6 subnets (in CIDR format), or - hostnames that the storage appliance needs accessible in order to turn on the remote vendor - management. - :paramtype support_endpoints: list[str] - """ - super().__init__(**kwargs) - self.support_endpoints = support_endpoints - - -class StorageApplianceList(_serialization.Model): - """StorageApplianceList represents a list of storage appliances. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of storage appliances. - :vartype value: list[~azure.mgmt.networkcloud.models.StorageAppliance] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[StorageAppliance]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.StorageAppliance"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of storage appliances. - :paramtype value: list[~azure.mgmt.networkcloud.models.StorageAppliance] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class StorageAppliancePatchParameters(_serialization.Model): - """StorageAppliancePatchParameters represents the body of the request to patch storage appliance - properties. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar serial_number: The serial number for the storage appliance. - :vartype serial_number: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "serial_number": {"key": "properties.serialNumber", "type": "str"}, - } - - def __init__( - self, *, tags: Optional[dict[str, str]] = None, serial_number: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword serial_number: The serial number for the storage appliance. - :paramtype serial_number: str - """ - super().__init__(**kwargs) - self.tags = tags - self.serial_number = serial_number - - -class StorageApplianceRunReadCommandsParameters(_serialization.Model): # pylint: disable=name-too-long - """StorageApplianceRunReadCommandsParameters represents the body of request containing list of - read-only commands to run on the storage appliance. - - All required parameters must be populated in order to send to server. - - :ivar commands: The list of read-only commands to be executed directly against the target - storage appliance. Required. - :vartype commands: list[~azure.mgmt.networkcloud.models.StorageApplianceCommandSpecification] - :ivar limit_time_seconds: The maximum time the commands are allowed to run. Required. - :vartype limit_time_seconds: int - """ - - _validation = { - "commands": {"required": True, "min_items": 1}, - "limit_time_seconds": {"required": True, "maximum": 14400, "minimum": 60}, - } - - _attribute_map = { - "commands": {"key": "commands", "type": "[StorageApplianceCommandSpecification]"}, - "limit_time_seconds": {"key": "limitTimeSeconds", "type": "int"}, - } - - def __init__( - self, *, commands: list["_models.StorageApplianceCommandSpecification"], limit_time_seconds: int, **kwargs: Any - ) -> None: - """ - :keyword commands: The list of read-only commands to be executed directly against the target - storage appliance. Required. - :paramtype commands: list[~azure.mgmt.networkcloud.models.StorageApplianceCommandSpecification] - :keyword limit_time_seconds: The maximum time the commands are allowed to run. Required. - :paramtype limit_time_seconds: int - """ - super().__init__(**kwargs) - self.commands = commands - self.limit_time_seconds = limit_time_seconds - - -class StorageApplianceSkuSlot(_serialization.Model): - """StorageApplianceSkuSlot represents the single SKU and rack slot associated with the storage - appliance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar rack_slot: The position in the rack for the storage appliance. - :vartype rack_slot: int - :ivar capacity_gb: The maximum capacity of the storage appliance. Measured in gibibytes. - :vartype capacity_gb: int - :ivar model: The model of the storage appliance. - :vartype model: str - """ - - _validation = { - "rack_slot": {"readonly": True}, - "capacity_gb": {"readonly": True}, - "model": {"readonly": True}, - } - - _attribute_map = { - "rack_slot": {"key": "rackSlot", "type": "int"}, - "capacity_gb": {"key": "properties.capacityGB", "type": "int"}, - "model": {"key": "properties.model", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.rack_slot: Optional[int] = None - self.capacity_gb: Optional[int] = None - self.model: Optional[str] = None - - -class StorageProfile(_serialization.Model): - """StorageProfile represents information about a disk. - - All required parameters must be populated in order to send to server. - - :ivar os_disk: The disk to use with this virtual machine. Required. - :vartype os_disk: ~azure.mgmt.networkcloud.models.OsDisk - :ivar volume_attachments: The resource IDs of volumes that are requested to be attached to the - virtual machine. - :vartype volume_attachments: list[str] - """ - - _validation = { - "os_disk": {"required": True}, - } - - _attribute_map = { - "os_disk": {"key": "osDisk", "type": "OsDisk"}, - "volume_attachments": {"key": "volumeAttachments", "type": "[str]"}, - } - - def __init__( - self, *, os_disk: "_models.OsDisk", volume_attachments: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword os_disk: The disk to use with this virtual machine. Required. - :paramtype os_disk: ~azure.mgmt.networkcloud.models.OsDisk - :keyword volume_attachments: The resource IDs of volumes that are requested to be attached to - the virtual machine. - :paramtype volume_attachments: list[str] - """ - super().__init__(**kwargs) - self.os_disk = os_disk - self.volume_attachments = volume_attachments - - -class StringKeyValuePair(_serialization.Model): - """StringKeyValuePair represents a single entry in a mapping of keys to values. - - All required parameters must be populated in order to send to server. - - :ivar key: The key to the mapped value. Required. - :vartype key: str - :ivar value: The value of the mapping key. Required. - :vartype value: str - """ - - _validation = { - "key": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: - """ - :keyword key: The key to the mapped value. Required. - :paramtype key: str - :keyword value: The value of the mapping key. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.key = key - self.value = value - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.networkcloud.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.networkcloud.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.networkcloud.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.networkcloud.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TagsParameter(_serialization.Model): - """TagsParameter represents the resource tags. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :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: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class TrunkedNetwork(TrackedResource): - """TrunkedNetwork represents a network that utilizes multiple isolation domains and specified - VLANs to create a trunked network. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar associated_resource_ids: The list of resource IDs for the other Microsoft.NetworkCloud - resources that have attached this network. - :vartype associated_resource_ids: list[str] - :ivar cluster_id: The resource ID of the Network Cloud cluster this trunked network is - associated with. - :vartype cluster_id: str - :ivar detailed_status: The more detailed status of the trunked network. Known values are: - "Error", "Available", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.TrunkedNetworkDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar hybrid_aks_clusters_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of Hybrid AKS cluster resource IDs that are associated with this trunked network. - :vartype hybrid_aks_clusters_associated_ids: list[str] - :ivar hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it will - have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. Known - values are: "DPDK", "SRIOV", and "OSDevice". - :vartype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :ivar interface_name: The default interface name for this trunked network in the virtual - machine. This name can be overridden by the name supplied in the network attachment - configuration of that virtual machine. - :vartype interface_name: str - :ivar isolation_domain_ids: The list of resource IDs representing the Network Fabric isolation - domains. It can be any combination of l2IsolationDomain and l3IsolationDomain resources. - Required. - :vartype isolation_domain_ids: list[str] - :ivar provisioning_state: The provisioning state of the trunked network. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.TrunkedNetworkProvisioningState - :ivar virtual_machines_associated_ids: Field Deprecated. These fields will be empty/omitted. - The list of virtual machine resource IDs, excluding any Hybrid AKS virtual machines, that are - currently using this trunked network. - :vartype virtual_machines_associated_ids: list[str] - :ivar vlans: The list of vlans that are selected from the isolation domains for trunking. - Required. - :vartype vlans: list[int] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "associated_resource_ids": {"readonly": True}, - "cluster_id": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "hybrid_aks_clusters_associated_ids": {"readonly": True}, - "interface_name": {"max_length": 12, "pattern": r"^[a-zA-Z0-9@._-]*$"}, - "isolation_domain_ids": {"required": True, "min_items": 1}, - "provisioning_state": {"readonly": True}, - "virtual_machines_associated_ids": {"readonly": True}, - "vlans": {"required": True, "min_items": 1}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "associated_resource_ids": {"key": "properties.associatedResourceIds", "type": "[str]"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "hybrid_aks_clusters_associated_ids": {"key": "properties.hybridAksClustersAssociatedIds", "type": "[str]"}, - "hybrid_aks_plugin_type": {"key": "properties.hybridAksPluginType", "type": "str"}, - "interface_name": {"key": "properties.interfaceName", "type": "str"}, - "isolation_domain_ids": {"key": "properties.isolationDomainIds", "type": "[str]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "virtual_machines_associated_ids": {"key": "properties.virtualMachinesAssociatedIds", "type": "[str]"}, - "vlans": {"key": "properties.vlans", "type": "[int]"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - isolation_domain_ids: list[str], - vlans: list[int], - tags: Optional[dict[str, str]] = None, - hybrid_aks_plugin_type: Optional[Union[str, "_models.HybridAksPluginType"]] = None, - interface_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword hybrid_aks_plugin_type: Field Deprecated. The field was previously optional, now it - will have no defined behavior and will be ignored. The network plugin type for Hybrid AKS. - Known values are: "DPDK", "SRIOV", and "OSDevice". - :paramtype hybrid_aks_plugin_type: str or ~azure.mgmt.networkcloud.models.HybridAksPluginType - :keyword interface_name: The default interface name for this trunked network in the virtual - machine. This name can be overridden by the name supplied in the network attachment - configuration of that virtual machine. - :paramtype interface_name: str - :keyword isolation_domain_ids: The list of resource IDs representing the Network Fabric - isolation domains. It can be any combination of l2IsolationDomain and l3IsolationDomain - resources. Required. - :paramtype isolation_domain_ids: list[str] - :keyword vlans: The list of vlans that are selected from the isolation domains for trunking. - Required. - :paramtype vlans: list[int] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.associated_resource_ids: Optional[list[str]] = None - self.cluster_id: Optional[str] = None - self.detailed_status: Optional[Union[str, "_models.TrunkedNetworkDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.hybrid_aks_clusters_associated_ids: Optional[list[str]] = None - self.hybrid_aks_plugin_type = hybrid_aks_plugin_type - self.interface_name = interface_name - self.isolation_domain_ids = isolation_domain_ids - self.provisioning_state: Optional[Union[str, "_models.TrunkedNetworkProvisioningState"]] = None - self.virtual_machines_associated_ids: Optional[list[str]] = None - self.vlans = vlans - - -class TrunkedNetworkAttachmentConfiguration(_serialization.Model): - """TrunkedNetworkAttachmentConfiguration represents the configuration of the attachment of a - trunked network. - - All required parameters must be populated in order to send to server. - - :ivar network_id: The resource ID of the network that is being configured for attachment. - Required. - :vartype network_id: str - :ivar plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :vartype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - - _validation = { - "network_id": {"required": True}, - } - - _attribute_map = { - "network_id": {"key": "networkId", "type": "str"}, - "plugin_type": {"key": "pluginType", "type": "str"}, - } - - def __init__( - self, - *, - network_id: str, - plugin_type: Optional[Union[str, "_models.KubernetesPluginType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_id: The resource ID of the network that is being configured for attachment. - Required. - :paramtype network_id: str - :keyword plugin_type: The indicator of how this network will be utilized by the Kubernetes - cluster. Known values are: "DPDK", "SRIOV", "OSDevice", "MACVLAN", and "IPVLAN". - :paramtype plugin_type: str or ~azure.mgmt.networkcloud.models.KubernetesPluginType - """ - super().__init__(**kwargs) - self.network_id = network_id - self.plugin_type = plugin_type - - -class TrunkedNetworkList(_serialization.Model): - """TrunkedNetworkList represents a list of trunked networks. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of trunked networks. - :vartype value: list[~azure.mgmt.networkcloud.models.TrunkedNetwork] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[TrunkedNetwork]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.TrunkedNetwork"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of trunked networks. - :paramtype value: list[~azure.mgmt.networkcloud.models.TrunkedNetwork] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class TrunkedNetworkPatchParameters(_serialization.Model): - """TrunkedNetworkPatchParameters represents the body of the request to patch the Trunked network. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :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: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class ValidationThreshold(_serialization.Model): - """ValidationThreshold indicates allowed machine and node hardware and deployment failures. - - All required parameters must be populated in order to send to server. - - :ivar grouping: Selection of how the type evaluation is applied to the cluster calculation. - Required. Known values are: "PerCluster" and "PerRack". - :vartype grouping: str or ~azure.mgmt.networkcloud.models.ValidationThresholdGrouping - :ivar type: Selection of how the threshold should be evaluated. Required. Known values are: - "CountSuccess" and "PercentSuccess". - :vartype type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType - :ivar value: The numeric threshold value. Required. - :vartype value: int - """ - - _validation = { - "grouping": {"required": True}, - "type": {"required": True}, - "value": {"required": True, "minimum": 0}, - } - - _attribute_map = { - "grouping": {"key": "grouping", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "int"}, - } - - def __init__( - self, - *, - grouping: Union[str, "_models.ValidationThresholdGrouping"], - type: Union[str, "_models.ValidationThresholdType"], - value: int, - **kwargs: Any - ) -> None: - """ - :keyword grouping: Selection of how the type evaluation is applied to the cluster calculation. - Required. Known values are: "PerCluster" and "PerRack". - :paramtype grouping: str or ~azure.mgmt.networkcloud.models.ValidationThresholdGrouping - :keyword type: Selection of how the threshold should be evaluated. Required. Known values are: - "CountSuccess" and "PercentSuccess". - :paramtype type: str or ~azure.mgmt.networkcloud.models.ValidationThresholdType - :keyword value: The numeric threshold value. Required. - :paramtype value: int - """ - super().__init__(**kwargs) - self.grouping = grouping - self.type = type - self.value = value - - -class VirtualMachine(TrackedResource): - """VirtualMachine represents the on-premises Network Cloud virtual machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar identity: The identity for the resource. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar admin_username: The name of the administrator to which the ssh public keys will be added - into the authorized keys. Required. - :vartype admin_username: str - :ivar availability_zone: The cluster availability zone containing this virtual machine. - :vartype availability_zone: str - :ivar bare_metal_machine_id: The resource ID of the bare metal machine that hosts the virtual - machine. - :vartype bare_metal_machine_id: str - :ivar boot_method: Selects the boot method for the virtual machine. Known values are: "UEFI" - and "BIOS". - :vartype boot_method: str or ~azure.mgmt.networkcloud.models.VirtualMachineBootMethod - :ivar cloud_services_network_attachment: The cloud service network that provides platform-level - services for the virtual machine. Required. - :vartype cloud_services_network_attachment: ~azure.mgmt.networkcloud.models.NetworkAttachment - :ivar cluster_id: The resource ID of the cluster the virtual machine is created for. - :vartype cluster_id: str - :ivar console_extended_location: The extended location to use for creation of a VM console - resource. - :vartype console_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar cpu_cores: The number of CPU cores in the virtual machine. Required. - :vartype cpu_cores: int - :ivar detailed_status: The more detailed status of the virtual machine. Known values are: - "Available", "Error", "Provisioning", "Running", "Scheduling", "Stopped", "Terminating", and - "Unknown". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.VirtualMachineDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar isolate_emulator_thread: Field Deprecated, the value will be ignored if provided. The - indicator of whether one of the specified CPU cores is isolated to run the emulator thread for - this virtual machine. Known values are: "True" and "False". - :vartype isolate_emulator_thread: str or - ~azure.mgmt.networkcloud.models.VirtualMachineIsolateEmulatorThread - :ivar memory_size_gb: The memory size of the virtual machine. Allocations are measured in - gibibytes. Required. - :vartype memory_size_gb: int - :ivar network_attachments: The list of network attachments to the virtual machine. - :vartype network_attachments: list[~azure.mgmt.networkcloud.models.NetworkAttachment] - :ivar network_data: Field Deprecated: The Base64 encoded cloud-init network data. The - networkDataContent property will be used in preference to this property. - :vartype network_data: str - :ivar network_data_content: The Base64 encoded cloud-init network data. - :vartype network_data_content: str - :ivar placement_hints: The scheduling hints for the virtual machine. - :vartype placement_hints: list[~azure.mgmt.networkcloud.models.VirtualMachinePlacementHint] - :ivar power_state: The power state of the virtual machine. Known values are: "On", "Off", and - "Unknown". - :vartype power_state: str or ~azure.mgmt.networkcloud.models.VirtualMachinePowerState - :ivar provisioning_state: The provisioning state of the virtual machine. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or - ~azure.mgmt.networkcloud.models.VirtualMachineProvisioningState - :ivar ssh_public_keys: The list of ssh public keys. Each key will be added to the virtual - machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername. - :vartype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - :ivar storage_profile: The storage profile that specifies size and other parameters about the - disks related to the virtual machine. Required. - :vartype storage_profile: ~azure.mgmt.networkcloud.models.StorageProfile - :ivar user_data: Field Deprecated: The Base64 encoded cloud-init user data. The userDataContent - property will be used in preference to this property. - :vartype user_data: str - :ivar user_data_content: The Base64 encoded cloud-init user data. - :vartype user_data_content: str - :ivar virtio_interface: Field Deprecated, use virtualizationModel instead. The type of the - virtio interface. Known values are: "Modern" and "Transitional". - :vartype virtio_interface: str or - ~azure.mgmt.networkcloud.models.VirtualMachineVirtioInterfaceType - :ivar vm_device_model: The type of the device model to use. Known values are: "T1", "T2", and - "T3". - :vartype vm_device_model: str or ~azure.mgmt.networkcloud.models.VirtualMachineDeviceModelType - :ivar vm_image: The virtual machine image that is currently provisioned to the OS disk, using - the full url and tag notation used to pull the image. Required. - :vartype vm_image: str - :ivar vm_image_repository_credentials: The credentials used to login to the image repository - that has access to the specified image. - :vartype vm_image_repository_credentials: - ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials - :ivar volumes: The resource IDs of volumes that are attached to the virtual machine. - :vartype volumes: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "admin_username": {"required": True, "max_length": 32, "min_length": 1, "pattern": r"^[a-z_][a-z0-9_]{0,31}$"}, - "availability_zone": {"readonly": True}, - "bare_metal_machine_id": {"readonly": True}, - "cloud_services_network_attachment": {"required": True}, - "cluster_id": {"readonly": True}, - "cpu_cores": {"required": True, "minimum": 2}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "memory_size_gb": {"required": True, "minimum": 1}, - "power_state": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "storage_profile": {"required": True}, - "vm_image": {"required": True}, - "volumes": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "admin_username": {"key": "properties.adminUsername", "type": "str"}, - "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, - "bare_metal_machine_id": {"key": "properties.bareMetalMachineId", "type": "str"}, - "boot_method": {"key": "properties.bootMethod", "type": "str"}, - "cloud_services_network_attachment": { - "key": "properties.cloudServicesNetworkAttachment", - "type": "NetworkAttachment", - }, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "console_extended_location": {"key": "properties.consoleExtendedLocation", "type": "ExtendedLocation"}, - "cpu_cores": {"key": "properties.cpuCores", "type": "int"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "isolate_emulator_thread": {"key": "properties.isolateEmulatorThread", "type": "str"}, - "memory_size_gb": {"key": "properties.memorySizeGB", "type": "int"}, - "network_attachments": {"key": "properties.networkAttachments", "type": "[NetworkAttachment]"}, - "network_data": {"key": "properties.networkData", "type": "str"}, - "network_data_content": {"key": "properties.networkDataContent", "type": "str"}, - "placement_hints": {"key": "properties.placementHints", "type": "[VirtualMachinePlacementHint]"}, - "power_state": {"key": "properties.powerState", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "ssh_public_keys": {"key": "properties.sshPublicKeys", "type": "[SshPublicKey]"}, - "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfile"}, - "user_data": {"key": "properties.userData", "type": "str"}, - "user_data_content": {"key": "properties.userDataContent", "type": "str"}, - "virtio_interface": {"key": "properties.virtioInterface", "type": "str"}, - "vm_device_model": {"key": "properties.vmDeviceModel", "type": "str"}, - "vm_image": {"key": "properties.vmImage", "type": "str"}, - "vm_image_repository_credentials": { - "key": "properties.vmImageRepositoryCredentials", - "type": "ImageRepositoryCredentials", - }, - "volumes": {"key": "properties.volumes", "type": "[str]"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - admin_username: str, - cloud_services_network_attachment: "_models.NetworkAttachment", - cpu_cores: int, - memory_size_gb: int, - storage_profile: "_models.StorageProfile", - vm_image: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - boot_method: Union[str, "_models.VirtualMachineBootMethod"] = "UEFI", - console_extended_location: Optional["_models.ExtendedLocation"] = None, - isolate_emulator_thread: Union[str, "_models.VirtualMachineIsolateEmulatorThread"] = "True", - network_attachments: Optional[list["_models.NetworkAttachment"]] = None, - network_data: Optional[str] = None, - network_data_content: Optional[str] = None, - placement_hints: Optional[list["_models.VirtualMachinePlacementHint"]] = None, - ssh_public_keys: Optional[list["_models.SshPublicKey"]] = None, - user_data: Optional[str] = None, - user_data_content: Optional[str] = None, - virtio_interface: Union[str, "_models.VirtualMachineVirtioInterfaceType"] = "Modern", - vm_device_model: Union[str, "_models.VirtualMachineDeviceModelType"] = "T2", - vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword identity: The identity for the resource. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword admin_username: The name of the administrator to which the ssh public keys will be - added into the authorized keys. Required. - :paramtype admin_username: str - :keyword boot_method: Selects the boot method for the virtual machine. Known values are: "UEFI" - and "BIOS". - :paramtype boot_method: str or ~azure.mgmt.networkcloud.models.VirtualMachineBootMethod - :keyword cloud_services_network_attachment: The cloud service network that provides - platform-level services for the virtual machine. Required. - :paramtype cloud_services_network_attachment: ~azure.mgmt.networkcloud.models.NetworkAttachment - :keyword console_extended_location: The extended location to use for creation of a VM console - resource. - :paramtype console_extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword cpu_cores: The number of CPU cores in the virtual machine. Required. - :paramtype cpu_cores: int - :keyword isolate_emulator_thread: Field Deprecated, the value will be ignored if provided. The - indicator of whether one of the specified CPU cores is isolated to run the emulator thread for - this virtual machine. Known values are: "True" and "False". - :paramtype isolate_emulator_thread: str or - ~azure.mgmt.networkcloud.models.VirtualMachineIsolateEmulatorThread - :keyword memory_size_gb: The memory size of the virtual machine. Allocations are measured in - gibibytes. Required. - :paramtype memory_size_gb: int - :keyword network_attachments: The list of network attachments to the virtual machine. - :paramtype network_attachments: list[~azure.mgmt.networkcloud.models.NetworkAttachment] - :keyword network_data: Field Deprecated: The Base64 encoded cloud-init network data. The - networkDataContent property will be used in preference to this property. - :paramtype network_data: str - :keyword network_data_content: The Base64 encoded cloud-init network data. - :paramtype network_data_content: str - :keyword placement_hints: The scheduling hints for the virtual machine. - :paramtype placement_hints: list[~azure.mgmt.networkcloud.models.VirtualMachinePlacementHint] - :keyword ssh_public_keys: The list of ssh public keys. Each key will be added to the virtual - machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername. - :paramtype ssh_public_keys: list[~azure.mgmt.networkcloud.models.SshPublicKey] - :keyword storage_profile: The storage profile that specifies size and other parameters about - the disks related to the virtual machine. Required. - :paramtype storage_profile: ~azure.mgmt.networkcloud.models.StorageProfile - :keyword user_data: Field Deprecated: The Base64 encoded cloud-init user data. The - userDataContent property will be used in preference to this property. - :paramtype user_data: str - :keyword user_data_content: The Base64 encoded cloud-init user data. - :paramtype user_data_content: str - :keyword virtio_interface: Field Deprecated, use virtualizationModel instead. The type of the - virtio interface. Known values are: "Modern" and "Transitional". - :paramtype virtio_interface: str or - ~azure.mgmt.networkcloud.models.VirtualMachineVirtioInterfaceType - :keyword vm_device_model: The type of the device model to use. Known values are: "T1", "T2", - and "T3". - :paramtype vm_device_model: str or - ~azure.mgmt.networkcloud.models.VirtualMachineDeviceModelType - :keyword vm_image: The virtual machine image that is currently provisioned to the OS disk, - using the full url and tag notation used to pull the image. Required. - :paramtype vm_image: str - :keyword vm_image_repository_credentials: The credentials used to login to the image repository - that has access to the specified image. - :paramtype vm_image_repository_credentials: - ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.identity = identity - self.admin_username = admin_username - self.availability_zone: Optional[str] = None - self.bare_metal_machine_id: Optional[str] = None - self.boot_method = boot_method - self.cloud_services_network_attachment = cloud_services_network_attachment - self.cluster_id: Optional[str] = None - self.console_extended_location = console_extended_location - self.cpu_cores = cpu_cores - self.detailed_status: Optional[Union[str, "_models.VirtualMachineDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.isolate_emulator_thread = isolate_emulator_thread - self.memory_size_gb = memory_size_gb - self.network_attachments = network_attachments - self.network_data = network_data - self.network_data_content = network_data_content - self.placement_hints = placement_hints - self.power_state: Optional[Union[str, "_models.VirtualMachinePowerState"]] = None - self.provisioning_state: Optional[Union[str, "_models.VirtualMachineProvisioningState"]] = None - self.ssh_public_keys = ssh_public_keys - self.storage_profile = storage_profile - self.user_data = user_data - self.user_data_content = user_data_content - self.virtio_interface = virtio_interface - self.vm_device_model = vm_device_model - self.vm_image = vm_image - self.vm_image_repository_credentials = vm_image_repository_credentials - self.volumes: Optional[list[str]] = None - - -class VirtualMachineAssignRelayParameters(_serialization.Model): - """VirtualMachineAssignRelayParameters represents the body of the request to update the relay used - for a Microsoft.HybridCompute machine associated with the virtual machine. - - All required parameters must be populated in order to send to server. - - :ivar machine_id: The resourceId of the Microsoft.HybridCompute machine resource to assign - relay usage. Required. - :vartype machine_id: str - :ivar relay_type: The indicator of which relay type the machine should be assigned to use. - Platform indicates the use of a platform-dedicated relay. Public indicates the use of the - standard public relay for Arc services. Known values are: "Platform" and "Public". - :vartype relay_type: str or ~azure.mgmt.networkcloud.models.RelayType - """ - - _validation = { - "machine_id": {"required": True}, - } - - _attribute_map = { - "machine_id": {"key": "machineId", "type": "str"}, - "relay_type": {"key": "relayType", "type": "str"}, - } - - def __init__( - self, *, machine_id: str, relay_type: Union[str, "_models.RelayType"] = "Platform", **kwargs: Any - ) -> None: - """ - :keyword machine_id: The resourceId of the Microsoft.HybridCompute machine resource to assign - relay usage. Required. - :paramtype machine_id: str - :keyword relay_type: The indicator of which relay type the machine should be assigned to use. - Platform indicates the use of a platform-dedicated relay. Public indicates the use of the - standard public relay for Arc services. Known values are: "Platform" and "Public". - :paramtype relay_type: str or ~azure.mgmt.networkcloud.models.RelayType - """ - super().__init__(**kwargs) - self.machine_id = machine_id - self.relay_type = relay_type - - -class VirtualMachineList(_serialization.Model): - """VirtualMachineList represents a list of virtual machines. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of virtual machines. - :vartype value: list[~azure.mgmt.networkcloud.models.VirtualMachine] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[VirtualMachine]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.VirtualMachine"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of virtual machines. - :paramtype value: list[~azure.mgmt.networkcloud.models.VirtualMachine] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class VirtualMachinePatchParameters(_serialization.Model): - """VirtualMachinePatchParameters represents the body of the request to patch the virtual machine. - - :ivar identity: The identity for the resource. - :vartype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :ivar tags: The Azure resource tags that will replace the existing ones. - :vartype tags: dict[str, str] - :ivar vm_image_repository_credentials: The credentials used to login to the image repository - that has access to the specified image. - :vartype vm_image_repository_credentials: - ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "vm_image_repository_credentials": { - "key": "properties.vmImageRepositoryCredentials", - "type": "ImageRepositoryCredentials", - }, - } - - def __init__( - self, - *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[dict[str, str]] = None, - vm_image_repository_credentials: Optional["_models.ImageRepositoryCredentials"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The identity for the resource. - :paramtype identity: ~azure.mgmt.networkcloud.models.ManagedServiceIdentity - :keyword tags: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - :keyword vm_image_repository_credentials: The credentials used to login to the image repository - that has access to the specified image. - :paramtype vm_image_repository_credentials: - ~azure.mgmt.networkcloud.models.ImageRepositoryCredentials - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.vm_image_repository_credentials = vm_image_repository_credentials - - -class VirtualMachinePlacementHint(_serialization.Model): - """VirtualMachinePlacementHint represents a single scheduling hint of the virtual machine. - - All required parameters must be populated in order to send to server. - - :ivar hint_type: The specification of whether this hint supports affinity or anti-affinity with - the referenced resources. Required. Known values are: "Affinity" and "AntiAffinity". - :vartype hint_type: str or ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintType - :ivar resource_id: The resource ID of the target object that the placement hints will be - checked against, e.g., the bare metal node to host the virtual machine. Required. - :vartype resource_id: str - :ivar scheduling_execution: The indicator of whether the hint is a hard or soft requirement - during scheduling. Required. Known values are: "Hard" and "Soft". - :vartype scheduling_execution: str or - ~azure.mgmt.networkcloud.models.VirtualMachineSchedulingExecution - :ivar scope: The scope for the virtual machine affinity or anti-affinity placement hint. It - should always be "Machine" in the case of node affinity. Required. Known values are: "Rack" and - "Machine". - :vartype scope: str or - ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope - """ - - _validation = { - "hint_type": {"required": True}, - "resource_id": {"required": True}, - "scheduling_execution": {"required": True}, - "scope": {"required": True}, - } - - _attribute_map = { - "hint_type": {"key": "hintType", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "scheduling_execution": {"key": "schedulingExecution", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - } - - def __init__( - self, - *, - hint_type: Union[str, "_models.VirtualMachinePlacementHintType"], - resource_id: str, - scheduling_execution: Union[str, "_models.VirtualMachineSchedulingExecution"], - scope: Union[str, "_models.VirtualMachinePlacementHintPodAffinityScope"], - **kwargs: Any - ) -> None: - """ - :keyword hint_type: The specification of whether this hint supports affinity or anti-affinity - with the referenced resources. Required. Known values are: "Affinity" and "AntiAffinity". - :paramtype hint_type: str or ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintType - :keyword resource_id: The resource ID of the target object that the placement hints will be - checked against, e.g., the bare metal node to host the virtual machine. Required. - :paramtype resource_id: str - :keyword scheduling_execution: The indicator of whether the hint is a hard or soft requirement - during scheduling. Required. Known values are: "Hard" and "Soft". - :paramtype scheduling_execution: str or - ~azure.mgmt.networkcloud.models.VirtualMachineSchedulingExecution - :keyword scope: The scope for the virtual machine affinity or anti-affinity placement hint. It - should always be "Machine" in the case of node affinity. Required. Known values are: "Rack" and - "Machine". - :paramtype scope: str or - ~azure.mgmt.networkcloud.models.VirtualMachinePlacementHintPodAffinityScope - """ - super().__init__(**kwargs) - self.hint_type = hint_type - self.resource_id = resource_id - self.scheduling_execution = scheduling_execution - self.scope = scope - - -class VirtualMachinePowerOffParameters(_serialization.Model): - """VirtualMachinePowerOffParameters represents the body of the request to power off virtual - machine. - - :ivar skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off - the virtual machine immediately. Known values are: "True" and "False". - :vartype skip_shutdown: str or ~azure.mgmt.networkcloud.models.SkipShutdown - """ - - _attribute_map = { - "skip_shutdown": {"key": "skipShutdown", "type": "str"}, - } - - def __init__(self, *, skip_shutdown: Union[str, "_models.SkipShutdown"] = "False", **kwargs: Any) -> None: - """ - :keyword skip_shutdown: The indicator of whether to skip the graceful OS shutdown and power off - the virtual machine immediately. Known values are: "True" and "False". - :paramtype skip_shutdown: str or ~azure.mgmt.networkcloud.models.SkipShutdown - """ - super().__init__(**kwargs) - self.skip_shutdown = skip_shutdown - - -class Volume(TrackedResource): - """Volume represents storage made available for use by resources running on the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.networkcloud.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 etag: Resource ETag. - :vartype etag: str - :ivar extended_location: The extended location of the cluster associated with the resource. - Required. - :vartype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :ivar allocated_size_mi_b: The allocated size of the volume in Mebibytes. - :vartype allocated_size_mi_b: int - :ivar attached_to: The list of resource IDs that attach the volume. It may include virtual - machines and Hybrid AKS clusters. - :vartype attached_to: list[str] - :ivar detailed_status: The more detailed status of the volume. Known values are: "Error", - "Active", and "Provisioning". - :vartype detailed_status: str or ~azure.mgmt.networkcloud.models.VolumeDetailedStatus - :ivar detailed_status_message: The descriptive message about the current detailed status. - :vartype detailed_status_message: str - :ivar provisioning_state: The provisioning state of the volume. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.networkcloud.models.VolumeProvisioningState - :ivar serial_number: The unique identifier of the volume. - :vartype serial_number: str - :ivar size_mi_b: The requested storage allocation for the volume in Mebibytes. Required. - :vartype size_mi_b: int - :ivar storage_appliance_id: The resource ID of the storage appliance that hosts the volume. - :vartype storage_appliance_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "extended_location": {"required": True}, - "allocated_size_mi_b": {"readonly": True, "minimum": 0}, - "attached_to": {"readonly": True}, - "detailed_status": {"readonly": True}, - "detailed_status_message": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "serial_number": {"readonly": True}, - "size_mi_b": {"required": True, "minimum": 1}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "allocated_size_mi_b": {"key": "properties.allocatedSizeMiB", "type": "int"}, - "attached_to": {"key": "properties.attachedTo", "type": "[str]"}, - "detailed_status": {"key": "properties.detailedStatus", "type": "str"}, - "detailed_status_message": {"key": "properties.detailedStatusMessage", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "serial_number": {"key": "properties.serialNumber", "type": "str"}, - "size_mi_b": {"key": "properties.sizeMiB", "type": "int"}, - "storage_appliance_id": {"key": "properties.storageApplianceId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - size_mi_b: int, - tags: Optional[dict[str, str]] = None, - storage_appliance_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extended location of the cluster associated with the resource. - Required. - :paramtype extended_location: ~azure.mgmt.networkcloud.models.ExtendedLocation - :keyword size_mi_b: The requested storage allocation for the volume in Mebibytes. Required. - :paramtype size_mi_b: int - :keyword storage_appliance_id: The resource ID of the storage appliance that hosts the volume. - :paramtype storage_appliance_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag: Optional[str] = None - self.extended_location = extended_location - self.allocated_size_mi_b: Optional[int] = None - self.attached_to: Optional[list[str]] = None - self.detailed_status: Optional[Union[str, "_models.VolumeDetailedStatus"]] = None - self.detailed_status_message: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.VolumeProvisioningState"]] = None - self.serial_number: Optional[str] = None - self.size_mi_b = size_mi_b - self.storage_appliance_id = storage_appliance_id - - -class VolumeList(_serialization.Model): - """VolumeList represents a list of volumes. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of volumes. - :vartype value: list[~azure.mgmt.networkcloud.models.Volume] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Volume]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.Volume"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of volumes. - :paramtype value: list[~azure.mgmt.networkcloud.models.Volume] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class VolumePatchParameters(_serialization.Model): - """VolumePatchParameters represents the body of the request to patch the volume resource. - - :ivar tags: The Azure resource tags that will replace the existing ones. - :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: The Azure resource tags that will replace the existing ones. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class VulnerabilityScanningSettings(_serialization.Model): - """VulnerabilityScanningSettings represents the settings for how security vulnerability scanning - is applied to the cluster. - - :ivar container_scan: The mode selection for container vulnerability scanning. Known values - are: "Disabled" and "Enabled". - :vartype container_scan: str or - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan - """ - - _attribute_map = { - "container_scan": {"key": "containerScan", "type": "str"}, - } - - def __init__( - self, - *, - container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_scan: The mode selection for container vulnerability scanning. Known values - are: "Disabled" and "Enabled". - :paramtype container_scan: str or - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan - """ - super().__init__(**kwargs) - self.container_scan = container_scan - - -class VulnerabilityScanningSettingsPatch(_serialization.Model): - """VulnerabilityScanningSettingsPatch represents the settings for how security vulnerability - scanning is applied to the cluster. - - :ivar container_scan: The mode selection for container vulnerability scanning. Known values - are: "Disabled" and "Enabled". - :vartype container_scan: str or - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan - """ - - _attribute_map = { - "container_scan": {"key": "containerScan", "type": "str"}, - } - - def __init__( - self, - *, - container_scan: Optional[Union[str, "_models.VulnerabilityScanningSettingsContainerScan"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_scan: The mode selection for container vulnerability scanning. Known values - are: "Disabled" and "Enabled". - :paramtype container_scan: str or - ~azure.mgmt.networkcloud.models.VulnerabilityScanningSettingsContainerScan - """ - super().__init__(**kwargs) - self.container_scan = container_scan diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/__init__.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/__init__.py index 364ebc77254d..a3eb236d5878 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/__init__.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,25 +13,25 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._bare_metal_machines_operations import BareMetalMachinesOperations # type: ignore -from ._cloud_services_networks_operations import CloudServicesNetworksOperations # type: ignore -from ._cluster_managers_operations import ClusterManagersOperations # type: ignore -from ._clusters_operations import ClustersOperations # type: ignore -from ._kubernetes_clusters_operations import KubernetesClustersOperations # type: ignore -from ._l2_networks_operations import L2NetworksOperations # type: ignore -from ._l3_networks_operations import L3NetworksOperations # type: ignore -from ._rack_skus_operations import RackSkusOperations # type: ignore -from ._racks_operations import RacksOperations # type: ignore -from ._storage_appliances_operations import StorageAppliancesOperations # type: ignore -from ._trunked_networks_operations import TrunkedNetworksOperations # type: ignore -from ._virtual_machines_operations import VirtualMachinesOperations # type: ignore -from ._volumes_operations import VolumesOperations # type: ignore -from ._bare_metal_machine_key_sets_operations import BareMetalMachineKeySetsOperations # type: ignore -from ._bmc_key_sets_operations import BmcKeySetsOperations # type: ignore -from ._metrics_configurations_operations import MetricsConfigurationsOperations # type: ignore -from ._agent_pools_operations import AgentPoolsOperations # type: ignore -from ._kubernetes_cluster_features_operations import KubernetesClusterFeaturesOperations # type: ignore -from ._consoles_operations import ConsolesOperations # type: ignore +from ._operations import BareMetalMachinesOperations # type: ignore +from ._operations import CloudServicesNetworksOperations # type: ignore +from ._operations import ClusterManagersOperations # type: ignore +from ._operations import ClustersOperations # type: ignore +from ._operations import KubernetesClustersOperations # type: ignore +from ._operations import L2NetworksOperations # type: ignore +from ._operations import L3NetworksOperations # type: ignore +from ._operations import RackSkusOperations # type: ignore +from ._operations import RacksOperations # type: ignore +from ._operations import StorageAppliancesOperations # type: ignore +from ._operations import TrunkedNetworksOperations # type: ignore +from ._operations import VirtualMachinesOperations # type: ignore +from ._operations import VolumesOperations # type: ignore +from ._operations import BareMetalMachineKeySetsOperations # type: ignore +from ._operations import BmcKeySetsOperations # type: ignore +from ._operations import AgentPoolsOperations # type: ignore +from ._operations import KubernetesClusterFeaturesOperations # type: ignore +from ._operations import ConsolesOperations # type: ignore +from ._operations import MetricsConfigurationsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -54,10 +54,10 @@ "VolumesOperations", "BareMetalMachineKeySetsOperations", "BmcKeySetsOperations", - "MetricsConfigurationsOperations", "AgentPoolsOperations", "KubernetesClusterFeaturesOperations", "ConsolesOperations", + "MetricsConfigurationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_agent_pools_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_agent_pools_operations.py deleted file mode 100644 index 8dce087d50d4..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_agent_pools_operations.py +++ /dev/null @@ -1,1156 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_kubernetes_cluster_request( - resource_group_name: str, - kubernetes_cluster_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, kubernetes_cluster_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "agentPoolName": _SERIALIZER.url( - "agent_pool_name", agent_pool_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "agentPoolName": _SERIALIZER.url( - "agent_pool_name", agent_pool_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "agentPoolName": _SERIALIZER.url( - "agent_pool_name", agent_pool_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "agentPoolName": _SERIALIZER.url( - "agent_pool_name", agent_pool_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class AgentPoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`agent_pools` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_kubernetes_cluster( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.AgentPool"]: - """List agent pools of the Kubernetes cluster. - - Get a list of agent pools for the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either AgentPool or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AgentPoolList] = 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_kubernetes_cluster_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("AgentPoolList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, kubernetes_cluster_name: str, agent_pool_name: str, **kwargs: Any - ) -> _models.AgentPool: - """Retrieve the Kubernetes cluster agent pool. - - Get properties of the provided Kubernetes cluster agent pool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.AgentPool - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: Union[_models.AgentPool, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(agent_pool_parameters, (IOBase, bytes)): - _content = agent_pool_parameters - else: - _json = self._serialize.body(agent_pool_parameters, "AgentPool") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: _models.AgentPool, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Required. - :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Required. - :type agent_pool_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - agent_pool_parameters: Union[_models.AgentPool, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Create or update the Kubernetes cluster agent pool. - - Create a new Kubernetes cluster agent pool or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param agent_pool_parameters: The request body. Is either a AgentPool type or a IO[bytes] type. - Required. - :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - agent_pool_parameters=agent_pool_parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster agent pool. - - Delete the provided Kubernetes cluster agent pool. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if agent_pool_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if agent_pool_update_parameters else None - _json = None - _content = None - if isinstance(agent_pool_update_parameters, (IOBase, bytes)): - _content = agent_pool_update_parameters - else: - if agent_pool_update_parameters is not None: - _json = self._serialize.body(agent_pool_update_parameters, "AgentPoolPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[_models.AgentPoolPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Default value is None. - :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Default value is None. - :type agent_pool_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - agent_pool_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Patch the Kubernetes cluster agent pool. - - Patch the properties of the provided Kubernetes cluster agent pool, or update the tags - associated with the Kubernetes cluster agent pool. Properties and tag updates can be done - independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. - :type agent_pool_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param agent_pool_update_parameters: The request body. Is either a AgentPoolPatchParameters - type or a IO[bytes] type. Default value is None. - :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters or - IO[bytes] - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if agent_pool_update_parameters else None - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - agent_pool_name=agent_pool_name, - if_match=if_match, - if_none_match=if_none_match, - agent_pool_update_parameters=agent_pool_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machine_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machine_key_sets_operations.py deleted file mode 100644 index 90d53ec15c09..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machine_key_sets_operations.py +++ /dev/null @@ -1,1170 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_cluster_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, - bare_metal_machine_key_set_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bareMetalMachineKeySetName": _SERIALIZER.url( - "bare_metal_machine_key_set_name", - bare_metal_machine_key_set_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bareMetalMachineKeySetName": _SERIALIZER.url( - "bare_metal_machine_key_set_name", - bare_metal_machine_key_set_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bareMetalMachineKeySetName": _SERIALIZER.url( - "bare_metal_machine_key_set_name", - bare_metal_machine_key_set_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bareMetalMachineKeySetName": _SERIALIZER.url( - "bare_metal_machine_key_set_name", - bare_metal_machine_key_set_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class BareMetalMachineKeySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`bare_metal_machine_key_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.BareMetalMachineKeySet"]: - """List bare metal machine key sets of the cluster. - - Get a list of bare metal machine key sets for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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.BareMetalMachineKeySetList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("BareMetalMachineKeySetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, bare_metal_machine_key_set_name: str, **kwargs: Any - ) -> _models.BareMetalMachineKeySet: - """Retrieve the bare metal machine key set of the cluster. - - Get bare metal machine key set of the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :return: BareMetalMachineKeySet or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet - :raises ~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.BareMetalMachineKeySet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BareMetalMachineKeySet", 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, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bare_metal_machine_key_set_parameters, (IOBase, bytes)): - _content = bare_metal_machine_key_set_parameters - else: - _json = self._serialize.body(bare_metal_machine_key_set_parameters, "BareMetalMachineKeySet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: _models.BareMetalMachineKeySet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Required. - :type bare_metal_machine_key_set_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Required. - :type bare_metal_machine_key_set_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Create or update the bare metal machine key set of the cluster. - - Create a new bare metal machine key set or update the existing one for the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param bare_metal_machine_key_set_parameters: The request body. Is either a - BareMetalMachineKeySet type or a IO[bytes] type. Required. - :type bare_metal_machine_key_set_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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.BareMetalMachineKeySet] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - bare_metal_machine_key_set_parameters=bare_metal_machine_key_set_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BareMetalMachineKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BareMetalMachineKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BareMetalMachineKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the bare metal machine key set of the cluster. - - Delete the bare metal machine key set of the provided 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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[ - Union[_models.BareMetalMachineKeySetPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_key_set_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_key_set_update_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_key_set_update_parameters, (IOBase, bytes)): - _content = bare_metal_machine_key_set_update_parameters - else: - if bare_metal_machine_key_set_update_parameters is not None: - _json = self._serialize.body( - bare_metal_machine_key_set_update_parameters, "BareMetalMachineKeySetPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[_models.BareMetalMachineKeySetPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. - :type bare_metal_machine_key_set_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters - :keyword content_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 BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. - :type bare_metal_machine_key_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bare_metal_machine_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_key_set_update_parameters: Optional[ - Union[_models.BareMetalMachineKeySetPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachineKeySet]: - """Patch bare metal machine key set of the cluster. - - Patch properties of bare metal machine key set for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. - :type bare_metal_machine_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_key_set_update_parameters: The request body. Is either a - BareMetalMachineKeySetPatchParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_key_set_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either BareMetalMachineKeySet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] - :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)) - content_type = content_type if bare_metal_machine_key_set_update_parameters else None - cls: ClsType[_models.BareMetalMachineKeySet] = 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, - bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - bare_metal_machine_key_set_update_parameters=bare_metal_machine_key_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BareMetalMachineKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BareMetalMachineKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BareMetalMachineKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machines_operations.py deleted file mode 100644 index 1714815a2e01..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bare_metal_machines_operations.py +++ /dev/null @@ -1,3698 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - bare_metal_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - bare_metal_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - bare_metal_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - 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_cordon_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/cordon", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/powerOff", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/reimage", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_replace_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/replace", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_command_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runCommand", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_data_extracts_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runDataExtracts", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_data_extracts_restricted_request( # pylint: disable=name-too-long - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runDataExtractsRestricted", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_read_commands_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runReadCommands", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/start", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_uncordon_request( - resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/uncordon", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "bareMetalMachineName": _SERIALIZER.url( - "bare_metal_machine_name", - bare_metal_machine_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BareMetalMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`bare_metal_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.BareMetalMachine"]: - """List bare metal machines in the subscription. - - Get a list of bare metal machines in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachineList] = 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, - top=top, - skip_token=skip_token, - 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("BareMetalMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.BareMetalMachine"]: - """List bare metal machines in the resource group. - - Get a list of bare metal machines in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BareMetalMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachineList] = 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, - top=top, - skip_token=skip_token, - 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("BareMetalMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any) -> _models.BareMetalMachine: - """Retrieve the bare metal machine. - - Get properties of the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: BareMetalMachine or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachine - :raises ~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.BareMetalMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BareMetalMachine", 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, - bare_metal_machine_name: str, - bare_metal_machine_parameters: Union[_models.BareMetalMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bare_metal_machine_parameters, (IOBase, bytes)): - _content = bare_metal_machine_parameters - else: - _json = self._serialize.body(bare_metal_machine_parameters, "BareMetalMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bare_metal_machine_name: str, - bare_metal_machine_parameters: _models.BareMetalMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Required. - :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Required. - :type bare_metal_machine_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_parameters: Union[_models.BareMetalMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Create or update the bare metal machine. - - Create a new bare metal machine or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_parameters: The request body. Is either a BareMetalMachine type or a - IO[bytes] type. Required. - :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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.BareMetalMachine] = 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, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_parameters=bare_metal_machine_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BareMetalMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BareMetalMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BareMetalMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the bare metal machine. - - Delete the provided bare metal machine. All customer initiated requests will be rejected as the - life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[ - Union[_models.BareMetalMachinePatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_update_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_update_parameters, (IOBase, bytes)): - _content = bare_metal_machine_update_parameters - else: - if bare_metal_machine_update_parameters is not None: - _json = self._serialize.body(bare_metal_machine_update_parameters, "BareMetalMachinePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[_models.BareMetalMachinePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Default value is None. - :type bare_metal_machine_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters - :keyword content_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 BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Default value is None. - :type bare_metal_machine_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - bare_metal_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bare_metal_machine_update_parameters: Optional[ - Union[_models.BareMetalMachinePatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.BareMetalMachine]: - """Patch the bare metal machine. - - Patch properties of the provided bare metal machine, or update tags associated with the bare - metal machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bare_metal_machine_update_parameters: The request body. Is either a - BareMetalMachinePatchParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_update_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either BareMetalMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] - :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)) - content_type = content_type if bare_metal_machine_update_parameters else None - cls: ClsType[_models.BareMetalMachine] = 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, - bare_metal_machine_name=bare_metal_machine_name, - if_match=if_match, - if_none_match=if_none_match, - bare_metal_machine_update_parameters=bare_metal_machine_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BareMetalMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BareMetalMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BareMetalMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _cordon_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[ - Union[_models.BareMetalMachineCordonParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_cordon_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_cordon_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_cordon_parameters, (IOBase, bytes)): - _content = bare_metal_machine_cordon_parameters - else: - if bare_metal_machine_cordon_parameters is not None: - _json = self._serialize.body(bare_metal_machine_cordon_parameters, "BareMetalMachineCordonParameters") - else: - _json = None - - _request = build_cordon_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[_models.BareMetalMachineCordonParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Default value is None. - :type bare_metal_machine_cordon_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Default value is None. - :type bare_metal_machine_cordon_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_cordon( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_cordon_parameters: Optional[ - Union[_models.BareMetalMachineCordonParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Cordon the bare metal machine. - - Cordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_cordon_parameters: The request body. Is either a - BareMetalMachineCordonParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_cordon_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_cordon_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._cordon_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_cordon_parameters=bare_metal_machine_cordon_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _power_off_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[ - Union[_models.BareMetalMachinePowerOffParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_power_off_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_power_off_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_power_off_parameters, (IOBase, bytes)): - _content = bare_metal_machine_power_off_parameters - else: - if bare_metal_machine_power_off_parameters is not None: - _json = self._serialize.body( - bare_metal_machine_power_off_parameters, "BareMetalMachinePowerOffParameters" - ) - else: - _json = None - - _request = build_power_off_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[_models.BareMetalMachinePowerOffParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Default value is None. - :type bare_metal_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Default value is None. - :type bare_metal_machine_power_off_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_power_off( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_power_off_parameters: Optional[ - Union[_models.BareMetalMachinePowerOffParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the bare metal machine. - - Power off the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_power_off_parameters: The request body. Is either a - BareMetalMachinePowerOffParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_power_off_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_power_off_parameters=bare_metal_machine_power_off_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _reimage_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reimage( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Reimage the bare metal machine. - - Reimage the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _replace_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[ - Union[_models.BareMetalMachineReplaceParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if bare_metal_machine_replace_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bare_metal_machine_replace_parameters else None - _json = None - _content = None - if isinstance(bare_metal_machine_replace_parameters, (IOBase, bytes)): - _content = bare_metal_machine_replace_parameters - else: - if bare_metal_machine_replace_parameters is not None: - _json = self._serialize.body(bare_metal_machine_replace_parameters, "BareMetalMachineReplaceParameters") - else: - _json = None - - _request = build_replace_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[_models.BareMetalMachineReplaceParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Default value is None. - :type bare_metal_machine_replace_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Default value is None. - :type bare_metal_machine_replace_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_replace( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_replace_parameters: Optional[ - Union[_models.BareMetalMachineReplaceParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Replace (service) the bare metal machine. - - Replace the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_replace_parameters: The request body. Is either a - BareMetalMachineReplaceParameters type or a IO[bytes] type. Default value is None. - :type bare_metal_machine_replace_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if bare_metal_machine_replace_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._replace_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_replace_parameters=bare_metal_machine_replace_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _restart_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Restart the bare metal machine. - - Restart the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _run_command_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, 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(bare_metal_machine_run_command_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_command_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_command_parameters, "BareMetalMachineRunCommandParameters" - ) - - _request = build_run_command_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: _models.BareMetalMachineRunCommandParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Required. - :type bare_metal_machine_run_command_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Required. - :type bare_metal_machine_run_command_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_command( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run the command on the bare metal machine. - - Run the command or the script on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_command_parameters: The request body. Is either a - BareMetalMachineRunCommandParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_command_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_command_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_command_parameters=bare_metal_machine_run_command_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _run_data_extracts_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_data_extracts_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_data_extracts_parameters, "BareMetalMachineRunDataExtractsParameters" - ) - - _request = build_run_data_extracts_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: _models.BareMetalMachineRunDataExtractsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_data_extracts( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run data extraction for a bare metal machine. - - Run one or more data extractions on the provided bare metal machine. The URL to storage account - with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_parameters: The request body. Is either a - BareMetalMachineRunDataExtractsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_data_extracts_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_data_extracts_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_data_extracts_parameters=bare_metal_machine_run_data_extracts_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _run_data_extracts_restricted_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_restricted_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_data_extracts_restricted_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_data_extracts_restricted_parameters, "BareMetalMachineRunDataExtractsParameters" - ) - - _request = build_run_data_extracts_restricted_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: _models.BareMetalMachineRunDataExtractsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_restricted_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. - :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_data_extracts_restricted( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_data_extracts_restricted_parameters: Union[ - _models.BareMetalMachineRunDataExtractsParameters, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run restricted data extraction for a bare metal machine. - - Run one or more restricted data extractions on the provided bare metal machine. The URL to - storage account with the command execution results and the command exit code can be retrieved - from the operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Is either - a BareMetalMachineRunDataExtractsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_data_extracts_restricted_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_data_extracts_restricted_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_data_extracts_restricted_parameters=bare_metal_machine_run_data_extracts_restricted_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _run_read_commands_initial( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: Union[ - _models.BareMetalMachineRunReadCommandsParameters, 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(bare_metal_machine_run_read_commands_parameters, (IOBase, bytes)): - _content = bare_metal_machine_run_read_commands_parameters - else: - _json = self._serialize.body( - bare_metal_machine_run_read_commands_parameters, "BareMetalMachineRunReadCommandsParameters" - ) - - _request = build_run_read_commands_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: _models.BareMetalMachineRunReadCommandsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Required. - :type bare_metal_machine_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Required. - :type bare_metal_machine_run_read_commands_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_read_commands( - self, - resource_group_name: str, - bare_metal_machine_name: str, - bare_metal_machine_run_read_commands_parameters: Union[ - _models.BareMetalMachineRunReadCommandsParameters, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a bare metal machine. - - Run one or more read-only commands on the provided bare metal machine. The URL to storage - account with the command execution results and the command exit code can be retrieved from the - operation status API once available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :param bare_metal_machine_run_read_commands_parameters: The request body. Is either a - BareMetalMachineRunReadCommandsParameters type or a IO[bytes] type. Required. - :type bare_metal_machine_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_read_commands_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - bare_metal_machine_run_read_commands_parameters=bare_metal_machine_run_read_commands_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_initial(self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Start the bare metal machine. - - Start the provided bare metal machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _uncordon_initial( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_uncordon_request( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_uncordon( - self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Uncordon the bare metal machine. - - Uncordon the provided bare metal machine's Kubernetes node. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param bare_metal_machine_name: The name of the bare metal machine. Required. - :type bare_metal_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._uncordon_initial( - resource_group_name=resource_group_name, - bare_metal_machine_name=bare_metal_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bmc_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bmc_key_sets_operations.py deleted file mode 100644 index 063ab45706d6..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_bmc_key_sets_operations.py +++ /dev/null @@ -1,1141 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_cluster_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, bmc_key_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bmcKeySetName": _SERIALIZER.url( - "bmc_key_set_name", bmc_key_set_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bmcKeySetName": _SERIALIZER.url( - "bmc_key_set_name", bmc_key_set_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bmcKeySetName": _SERIALIZER.url( - "bmc_key_set_name", bmc_key_set_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "bmcKeySetName": _SERIALIZER.url( - "bmc_key_set_name", bmc_key_set_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class BmcKeySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`bmc_key_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.BmcKeySet"]: - """List baseboard management controller key sets of the cluster. - - Get a list of baseboard management controller key sets for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either BmcKeySet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BmcKeySet] - :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.BmcKeySetList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("BmcKeySetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, bmc_key_set_name: str, **kwargs: Any - ) -> _models.BmcKeySet: - """Retrieve the baseboard management controller key set of the cluster. - - Get baseboard management controller key set of the provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :return: BmcKeySet or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.BmcKeySet - :raises ~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.BmcKeySet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BmcKeySet", 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, - bmc_key_set_name: str, - bmc_key_set_parameters: Union[_models.BmcKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(bmc_key_set_parameters, (IOBase, bytes)): - _content = bmc_key_set_parameters - else: - _json = self._serialize.body(bmc_key_set_parameters, "BmcKeySet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - bmc_key_set_name: str, - bmc_key_set_parameters: _models.BmcKeySet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Required. - :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - bmc_key_set_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Required. - :type bmc_key_set_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - bmc_key_set_parameters: Union[_models.BmcKeySet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Create or update the baseboard management controller key set of the cluster. - - Create a new baseboard management controller key set or update the existing one for the - provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param bmc_key_set_parameters: The request body. Is either a BmcKeySet type or a IO[bytes] - type. Required. - :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :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.BmcKeySet] = 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, - bmc_key_set_name=bmc_key_set_name, - bmc_key_set_parameters=bmc_key_set_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("BmcKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BmcKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BmcKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the baseboard management controller key set of the cluster. - - Delete the baseboard management controller key set of the provided 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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - bmc_key_set_name=bmc_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if bmc_key_set_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if bmc_key_set_update_parameters else None - _json = None - _content = None - if isinstance(bmc_key_set_update_parameters, (IOBase, bytes)): - _content = bmc_key_set_update_parameters - else: - if bmc_key_set_update_parameters is not None: - _json = self._serialize.body(bmc_key_set_update_parameters, "BmcKeySetPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - bmc_key_set_name=bmc_key_set_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[_models.BmcKeySetPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Default value is None. - :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters - :keyword content_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 BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Default value is None. - :type bmc_key_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - bmc_key_set_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.BmcKeySet]: - """Patch baseboard management controller key set of the cluster. - - Patch properties of baseboard management controller key set for the provided cluster, or update - the tags associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param bmc_key_set_name: The name of the baseboard management controller key set. Required. - :type bmc_key_set_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param bmc_key_set_update_parameters: The request body. Is either a BmcKeySetPatchParameters - type or a IO[bytes] type. Default value is None. - :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters - or IO[bytes] - :return: An instance of LROPoller that returns either BmcKeySet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] - :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)) - content_type = content_type if bmc_key_set_update_parameters else None - cls: ClsType[_models.BmcKeySet] = 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, - bmc_key_set_name=bmc_key_set_name, - if_match=if_match, - if_none_match=if_none_match, - bmc_key_set_update_parameters=bmc_key_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BmcKeySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BmcKeySet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BmcKeySet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cloud_services_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cloud_services_networks_operations.py deleted file mode 100644 index e48d959084b0..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cloud_services_networks_operations.py +++ /dev/null @@ -1,1232 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, cloud_services_network_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "cloudServicesNetworkName": _SERIALIZER.url( - "cloud_services_network_name", - cloud_services_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cloud_services_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "cloudServicesNetworkName": _SERIALIZER.url( - "cloud_services_network_name", - cloud_services_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cloud_services_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "cloudServicesNetworkName": _SERIALIZER.url( - "cloud_services_network_name", - cloud_services_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cloud_services_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "cloudServicesNetworkName": _SERIALIZER.url( - "cloud_services_network_name", - cloud_services_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudServicesNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`cloud_services_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.CloudServicesNetwork"]: - """List cloud services networks in the subscription. - - Get a list of cloud services networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("CloudServicesNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.CloudServicesNetwork"]: - """List cloud services networks in the resource group. - - Get a list of cloud services networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("CloudServicesNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, cloud_services_network_name: str, **kwargs: Any - ) -> _models.CloudServicesNetwork: - """Retrieve the cloud services network. - - Get properties of the provided cloud services network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :return: CloudServicesNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - :raises ~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.CloudServicesNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CloudServicesNetwork", 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, - cloud_services_network_name: str, - cloud_services_network_parameters: Union[_models.CloudServicesNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cloud_services_network_parameters, (IOBase, bytes)): - _content = cloud_services_network_parameters - else: - _json = self._serialize.body(cloud_services_network_parameters, "CloudServicesNetwork") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - cloud_services_network_name: str, - cloud_services_network_parameters: _models.CloudServicesNetwork, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Required. - :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - cloud_services_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Required. - :type cloud_services_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - cloud_services_network_parameters: Union[_models.CloudServicesNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Create or update the cloud services network. - - Create a new cloud services network or update the properties of the existing cloud services - network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param cloud_services_network_parameters: The request body. Is either a CloudServicesNetwork - type or a IO[bytes] type. Required. - :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork - or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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.CloudServicesNetwork] = 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, - cloud_services_network_name=cloud_services_network_name, - cloud_services_network_parameters=cloud_services_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("CloudServicesNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CloudServicesNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CloudServicesNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the cloud services network. - - Delete the provided cloud services network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - cloud_services_network_name=cloud_services_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[ - Union[_models.CloudServicesNetworkPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if cloud_services_network_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cloud_services_network_update_parameters else None - _json = None - _content = None - if isinstance(cloud_services_network_update_parameters, (IOBase, bytes)): - _content = cloud_services_network_update_parameters - else: - if cloud_services_network_update_parameters is not None: - _json = self._serialize.body( - cloud_services_network_update_parameters, "CloudServicesNetworkPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cloud_services_network_name=cloud_services_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[_models.CloudServicesNetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Default value is None. - :type cloud_services_network_update_parameters: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters - :keyword content_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 CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Default value is None. - :type cloud_services_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cloud_services_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cloud_services_network_update_parameters: Optional[ - Union[_models.CloudServicesNetworkPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.CloudServicesNetwork]: - """Patch the cloud services network. - - Update properties of the provided cloud services network, or update the tags associated with - it. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cloud_services_network_name: The name of the cloud services network. Required. - :type cloud_services_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cloud_services_network_update_parameters: The request body. Is either a - CloudServicesNetworkPatchParameters type or a IO[bytes] type. Default value is None. - :type cloud_services_network_update_parameters: - ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either CloudServicesNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] - :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)) - content_type = content_type if cloud_services_network_update_parameters else None - cls: ClsType[_models.CloudServicesNetwork] = 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, - cloud_services_network_name=cloud_services_network_name, - if_match=if_match, - if_none_match=if_none_match, - cloud_services_network_update_parameters=cloud_services_network_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CloudServicesNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CloudServicesNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CloudServicesNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cluster_managers_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cluster_managers_operations.py deleted file mode 100644 index 321fcc221d8f..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_cluster_managers_operations.py +++ /dev/null @@ -1,1142 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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_manager_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterManagerName": _SERIALIZER.url( - "cluster_manager_name", - cluster_manager_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cluster_manager_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterManagerName": _SERIALIZER.url( - "cluster_manager_name", - cluster_manager_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_manager_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterManagerName": _SERIALIZER.url( - "cluster_manager_name", - cluster_manager_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cluster_manager_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterManagerName": _SERIALIZER.url( - "cluster_manager_name", - cluster_manager_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class ClusterManagersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`cluster_managers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ClusterManager"]: - """List cluster managers in the subscription. - - Get a list of cluster managers in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterManager or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManagerList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterManagerList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ClusterManager"]: - """List cluster managers in the resource group. - - Get a list of cluster managers in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterManager or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManagerList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterManagerList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, cluster_manager_name: str, **kwargs: Any) -> _models.ClusterManager: - """Retrieve the cluster manager. - - Get the properties of the provided cluster manager. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~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.ClusterManager] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterManager", 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_manager_name: str, - cluster_manager_parameters: Union[_models.ClusterManager, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cluster_manager_parameters, (IOBase, bytes)): - _content = cluster_manager_parameters - else: - _json = self._serialize.body(cluster_manager_parameters, "ClusterManager") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_manager_name: str, - cluster_manager_parameters: _models.ClusterManager, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Required. - :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_manager_name: str, - cluster_manager_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Required. - :type cluster_manager_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_manager_name: str, - cluster_manager_parameters: Union[_models.ClusterManager, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.ClusterManager]: - """Create or update the cluster manager. - - Create a new cluster manager or update properties of the cluster manager if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param cluster_manager_parameters: The request body. Is either a ClusterManager type or a - IO[bytes] type. Required. - :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either ClusterManager or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] - :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.ClusterManager] = 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_manager_name=cluster_manager_name, - cluster_manager_parameters=cluster_manager_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("ClusterManager", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ClusterManager].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ClusterManager]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the cluster manager. - - Delete the provided cluster manager. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_manager_name=cluster_manager_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[_models.ClusterManagerPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Default value is None. - :type cluster_manager_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Default value is None. - :type cluster_manager_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_manager_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_manager_update_parameters: Optional[Union[_models.ClusterManagerPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ClusterManager: - """Patch the cluster manager. - - Patch properties of the provided cluster manager, or update the tags assigned to the cluster - manager. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_manager_name: The name of the cluster manager. Required. - :type cluster_manager_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_manager_update_parameters: The request body. Is either a - ClusterManagerPatchParameters type or a IO[bytes] type. Default value is None. - :type cluster_manager_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters or IO[bytes] - :return: ClusterManager or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterManager - :raises ~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)) - content_type = content_type if cluster_manager_update_parameters else None - cls: ClsType[_models.ClusterManager] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_manager_update_parameters else None - _json = None - _content = None - if isinstance(cluster_manager_update_parameters, (IOBase, bytes)): - _content = cluster_manager_update_parameters - else: - if cluster_manager_update_parameters is not None: - _json = self._serialize.body(cluster_manager_update_parameters, "ClusterManagerPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_manager_name=cluster_manager_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterManager", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_clusters_operations.py deleted file mode 100644 index 1e55b37720f7..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_clusters_operations.py +++ /dev/null @@ -1,2204 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters") - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - 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_continue_update_version_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-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/continueUpdateVersion", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_deploy_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-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/deploy", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_scan_runtime_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-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/scanRuntime", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_version_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-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/updateVersion", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Cluster"]: - """List clusters in the subscription. - - Get a list of clusters in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Cluster] - :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.ClusterList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Cluster"]: - """List clusters in the resource group. - - Get a list of clusters in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Cluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Cluster] - :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.ClusterList] = 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, - top=top, - skip_token=skip_token, - 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("ClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Retrieve the cluster. - - Get properties of the provided 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. Required. - :type cluster_name: str - :return: Cluster or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Cluster - :raises ~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.Cluster] = 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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Cluster", 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, - cluster_parameters: Union[_models.Cluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(cluster_parameters, (IOBase, bytes)): - _content = cluster_parameters - else: - _json = self._serialize.body(cluster_parameters, "Cluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - cluster_parameters: _models.Cluster, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Required. - :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - cluster_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Required. - :type cluster_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - cluster_parameters: Union[_models.Cluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Create or update the cluster. - - Create a new cluster or update the properties of the cluster if it exists. - - :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. Required. - :type cluster_name: str - :param cluster_parameters: The request body. Is either a Cluster type or a IO[bytes] type. - Required. - :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :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.Cluster] = 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, - cluster_parameters=cluster_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Cluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Cluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Cluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the cluster. - - Delete the provided 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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_update_parameters else None - _json = None - _content = None - if isinstance(cluster_update_parameters, (IOBase, bytes)): - _content = cluster_update_parameters - else: - if cluster_update_parameters is not None: - _json = self._serialize.body(cluster_update_parameters, "ClusterPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[_models.ClusterPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Default value is None. - :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters - :keyword content_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 Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Default value is None. - :type cluster_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.Cluster]: - """Patch the cluster. - - Patch the properties of the provided cluster, or update the tags associated with the cluster. - Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param cluster_update_parameters: The request body. Is either a ClusterPatchParameters type or - a IO[bytes] type. Default value is None. - :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters or - IO[bytes] - :return: An instance of LROPoller that returns either Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] - :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)) - content_type = content_type if cluster_update_parameters else None - cls: ClsType[_models.Cluster] = 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, - if_match=if_match, - if_none_match=if_none_match, - cluster_update_parameters=cluster_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Cluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Cluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Cluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _continue_update_version_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: Union[_models.ClusterContinueUpdateVersionParameters, 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(cluster_continue_update_version_parameters, (IOBase, bytes)): - _content = cluster_continue_update_version_parameters - else: - _json = self._serialize.body( - cluster_continue_update_version_parameters, "ClusterContinueUpdateVersionParameters" - ) - - _request = build_continue_update_version_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: _models.ClusterContinueUpdateVersionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Required. - :type cluster_continue_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Required. - :type cluster_continue_update_version_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_continue_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_continue_update_version_parameters: Union[_models.ClusterContinueUpdateVersionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Continue a paused update to the cluster version. - - Trigger the continuation of an update for a cluster with a matching update strategy that has - paused after completing a segment of the update. - - :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. Required. - :type cluster_name: str - :param cluster_continue_update_version_parameters: The request body. Is either a - ClusterContinueUpdateVersionParameters type or a IO[bytes] type. Required. - :type cluster_continue_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._continue_update_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_continue_update_version_parameters=cluster_continue_update_version_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _deploy_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_deploy_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_deploy_parameters else None - _json = None - _content = None - if isinstance(cluster_deploy_parameters, (IOBase, bytes)): - _content = cluster_deploy_parameters - else: - if cluster_deploy_parameters is not None: - _json = self._serialize.body(cluster_deploy_parameters, "ClusterDeployParameters") - else: - _json = None - - _request = build_deploy_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[_models.ClusterDeployParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Default value is None. - :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Default value is None. - :type cluster_deploy_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_deploy( - self, - resource_group_name: str, - cluster_name: str, - cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Deploy the cluster. - - Deploy the cluster using the rack configuration provided during creation. - - :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. Required. - :type cluster_name: str - :param cluster_deploy_parameters: The request body. Is either a ClusterDeployParameters type or - a IO[bytes] type. Default value is None. - :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters or - IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if cluster_deploy_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._deploy_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_deploy_parameters=cluster_deploy_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _scan_runtime_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if cluster_scan_runtime_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if cluster_scan_runtime_parameters else None - _json = None - _content = None - if isinstance(cluster_scan_runtime_parameters, (IOBase, bytes)): - _content = cluster_scan_runtime_parameters - else: - if cluster_scan_runtime_parameters is not None: - _json = self._serialize.body(cluster_scan_runtime_parameters, "ClusterScanRuntimeParameters") - else: - _json = None - - _request = build_scan_runtime_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[_models.ClusterScanRuntimeParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Default value is None. - :type cluster_scan_runtime_parameters: - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Default value is None. - :type cluster_scan_runtime_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_scan_runtime( - self, - resource_group_name: str, - cluster_name: str, - cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Execute a runtime protection scan on the cluster. - - Triggers the execution of a runtime protection scan to detect and remediate detected issues, in - accordance with the cluster configuration. - - :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. Required. - :type cluster_name: str - :param cluster_scan_runtime_parameters: The request body. Is either a - ClusterScanRuntimeParameters type or a IO[bytes] type. Default value is None. - :type cluster_scan_runtime_parameters: - ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if cluster_scan_runtime_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._scan_runtime_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_scan_runtime_parameters=cluster_scan_runtime_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_version_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, 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(cluster_update_version_parameters, (IOBase, bytes)): - _content = cluster_update_version_parameters - else: - _json = self._serialize.body(cluster_update_version_parameters, "ClusterUpdateVersionParameters") - - _request = build_update_version_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: _models.ClusterUpdateVersionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Required. - :type cluster_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Required. - :type cluster_update_version_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_version( - self, - resource_group_name: str, - cluster_name: str, - cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Update the cluster version. - - Update the version of the provided cluster to one of the available supported versions. - - :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. Required. - :type cluster_name: str - :param cluster_update_version_parameters: The request body. Is either a - ClusterUpdateVersionParameters type or a IO[bytes] type. Required. - :type cluster_update_version_parameters: - ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_update_version_parameters=cluster_update_version_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_consoles_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_consoles_operations.py deleted file mode 100644 index 21b4ff315375..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_consoles_operations.py +++ /dev/null @@ -1,1133 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_virtual_machine_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, virtual_machine_name: str, console_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - "consoleName": _SERIALIZER.url("console_name", console_name, "str", pattern=r"^default$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - "consoleName": _SERIALIZER.url("console_name", console_name, "str", pattern=r"^default$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - "consoleName": _SERIALIZER.url("console_name", console_name, "str", pattern=r"^default$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - "consoleName": _SERIALIZER.url("console_name", console_name, "str", pattern=r"^default$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConsolesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`consoles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_virtual_machine( - self, - resource_group_name: str, - virtual_machine_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.Console"]: - """List consoles of the virtual machine. - - Get a list of consoles for the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Console or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Console] - :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.ConsoleList] = 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_virtual_machine_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("ConsoleList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, virtual_machine_name: str, console_name: str, **kwargs: Any - ) -> _models.Console: - """Retrieve the virtual machine console. - - Get properties of the provided virtual machine console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :return: Console or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Console - :raises ~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.Console] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Console", 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, - virtual_machine_name: str, - console_name: str, - console_parameters: Union[_models.Console, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(console_parameters, (IOBase, bytes)): - _content = console_parameters - else: - _json = self._serialize.body(console_parameters, "Console") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - virtual_machine_name: str, - console_name: str, - console_parameters: _models.Console, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Required. - :type console_parameters: ~azure.mgmt.networkcloud.models.Console - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - console_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Required. - :type console_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - console_parameters: Union[_models.Console, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Create or update the virtual machine console. - - Create a new virtual machine console or update the properties of the existing virtual machine - console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param console_parameters: The request body. Is either a Console type or a IO[bytes] type. - Required. - :type console_parameters: ~azure.mgmt.networkcloud.models.Console or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :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.Console] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - console_parameters=console_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Console", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Console].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Console]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the virtual machine console. - - Delete the provided virtual machine console. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[Union[_models.ConsolePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if console_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if console_update_parameters else None - _json = None - _content = None - if isinstance(console_update_parameters, (IOBase, bytes)): - _content = console_update_parameters - else: - if console_update_parameters is not None: - _json = self._serialize.body(console_update_parameters, "ConsolePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[_models.ConsolePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Default value is None. - :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters - :keyword content_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 Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Default value is None. - :type console_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - console_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - console_update_parameters: Optional[Union[_models.ConsolePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.Console]: - """Patch the virtual machine console. - - Patch the properties of the provided virtual machine console, or update the tags associated - with the virtual machine console. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param console_name: The name of the virtual machine console. Required. - :type console_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param console_update_parameters: The request body. Is either a ConsolePatchParameters type or - a IO[bytes] type. Default value is None. - :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters or - IO[bytes] - :return: An instance of LROPoller that returns either Console or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] - :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)) - content_type = content_type if console_update_parameters else None - cls: ClsType[_models.Console] = 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, - virtual_machine_name=virtual_machine_name, - console_name=console_name, - if_match=if_match, - if_none_match=if_none_match, - console_update_parameters=console_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Console", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Console].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Console]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_cluster_features_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_cluster_features_operations.py deleted file mode 100644 index 547a2b1186bc..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_cluster_features_operations.py +++ /dev/null @@ -1,1169 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_kubernetes_cluster_request( - resource_group_name: str, - kubernetes_cluster_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, kubernetes_cluster_name: str, feature_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "featureName": _SERIALIZER.url( - "feature_name", feature_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "featureName": _SERIALIZER.url( - "feature_name", feature_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "featureName": _SERIALIZER.url( - "feature_name", feature_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - "featureName": _SERIALIZER.url( - "feature_name", feature_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class KubernetesClusterFeaturesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`kubernetes_cluster_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_kubernetes_cluster( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.KubernetesClusterFeature"]: - """List features for the Kubernetes cluster. - - Get a list of features for the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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.KubernetesClusterFeatureList] = 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_kubernetes_cluster_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("KubernetesClusterFeatureList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, kubernetes_cluster_name: str, feature_name: str, **kwargs: Any - ) -> _models.KubernetesClusterFeature: - """Retrieve the Kubernetes cluster feature. - - Get properties of the provided the Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :return: KubernetesClusterFeature or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.KubernetesClusterFeature - :raises ~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.KubernetesClusterFeature] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KubernetesClusterFeature", 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, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(kubernetes_cluster_feature_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_feature_parameters - else: - _json = self._serialize.body(kubernetes_cluster_feature_parameters, "KubernetesClusterFeature") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: _models.KubernetesClusterFeature, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Required. - :type kubernetes_cluster_feature_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeature - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Required. - :type kubernetes_cluster_feature_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Create or update the Kubernetes cluster feature. - - Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature - if it exists. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param kubernetes_cluster_feature_parameters: The request body. Is either a - KubernetesClusterFeature type or a IO[bytes] type. Required. - :type kubernetes_cluster_feature_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeature or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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.KubernetesClusterFeature] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - kubernetes_cluster_feature_parameters=kubernetes_cluster_feature_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("KubernetesClusterFeature", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.KubernetesClusterFeature].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.KubernetesClusterFeature]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster feature. - - Delete the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[ - Union[_models.KubernetesClusterFeaturePatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if kubernetes_cluster_feature_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if kubernetes_cluster_feature_update_parameters else None - _json = None - _content = None - if isinstance(kubernetes_cluster_feature_update_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_feature_update_parameters - else: - if kubernetes_cluster_feature_update_parameters is not None: - _json = self._serialize.body( - kubernetes_cluster_feature_update_parameters, "KubernetesClusterFeaturePatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[_models.KubernetesClusterFeaturePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_feature_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters - :keyword content_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 KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_feature_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - feature_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_feature_update_parameters: Optional[ - Union[_models.KubernetesClusterFeaturePatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.KubernetesClusterFeature]: - """Patch the Kubernetes cluster feature. - - Patch properties of the provided Kubernetes cluster feature. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param feature_name: The name of the feature. Required. - :type feature_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_feature_update_parameters: The request body. Is either a - KubernetesClusterFeaturePatchParameters type or a IO[bytes] type. Default value is None. - :type kubernetes_cluster_feature_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either KubernetesClusterFeature or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] - :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)) - content_type = content_type if kubernetes_cluster_feature_update_parameters else None - cls: ClsType[_models.KubernetesClusterFeature] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - feature_name=feature_name, - if_match=if_match, - if_none_match=if_none_match, - kubernetes_cluster_feature_update_parameters=kubernetes_cluster_feature_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubernetesClusterFeature", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.KubernetesClusterFeature].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.KubernetesClusterFeature]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_clusters_operations.py deleted file mode 100644 index 2218355de98d..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_kubernetes_clusters_operations.py +++ /dev/null @@ -1,1476 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, kubernetes_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-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - kubernetes_cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - kubernetes_cluster_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - 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_restart_node_request( - resource_group_name: str, kubernetes_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-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/restartNode", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "kubernetesClusterName": _SERIALIZER.url( - "kubernetes_cluster_name", - kubernetes_cluster_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class KubernetesClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`kubernetes_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.KubernetesCluster"]: - """List Kubernetes clusters in the subscription. - - Get a list of Kubernetes clusters in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesCluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesClusterList] = 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, - top=top, - skip_token=skip_token, - 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("KubernetesClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.KubernetesCluster"]: - """List Kubernetes clusters in the resource group. - - Get a list of Kubernetes clusters in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either KubernetesCluster or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesClusterList] = 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, - top=top, - skip_token=skip_token, - 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("KubernetesClusterList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, kubernetes_cluster_name: str, **kwargs: Any) -> _models.KubernetesCluster: - """Retrieve the Kubernetes cluster. - - Get properties of the provided the Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :return: KubernetesCluster or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.KubernetesCluster - :raises ~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.KubernetesCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KubernetesCluster", 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, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: Union[_models.KubernetesCluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(kubernetes_cluster_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_parameters - else: - _json = self._serialize.body(kubernetes_cluster_parameters, "KubernetesCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: _models.KubernetesCluster, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Required. - :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Required. - :type kubernetes_cluster_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_parameters: Union[_models.KubernetesCluster, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Create or update the Kubernetes cluster. - - Create a new Kubernetes cluster or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_parameters: The request body. Is either a KubernetesCluster type or a - IO[bytes] type. Required. - :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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.KubernetesCluster] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - kubernetes_cluster_parameters=kubernetes_cluster_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("KubernetesCluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.KubernetesCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.KubernetesCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the Kubernetes cluster. - - Delete the provided Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[ - Union[_models.KubernetesClusterPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if kubernetes_cluster_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if kubernetes_cluster_update_parameters else None - _json = None - _content = None - if isinstance(kubernetes_cluster_update_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_update_parameters - else: - if kubernetes_cluster_update_parameters is not None: - _json = self._serialize.body(kubernetes_cluster_update_parameters, "KubernetesClusterPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[_models.KubernetesClusterPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters - :keyword content_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 KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Default value is None. - :type kubernetes_cluster_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - kubernetes_cluster_update_parameters: Optional[ - Union[_models.KubernetesClusterPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.KubernetesCluster]: - """Patch the Kubernetes cluster. - - Patch the properties of the provided Kubernetes cluster, or update the tags associated with the - Kubernetes cluster. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param kubernetes_cluster_update_parameters: The request body. Is either a - KubernetesClusterPatchParameters type or a IO[bytes] type. Default value is None. - :type kubernetes_cluster_update_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either KubernetesCluster or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] - :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)) - content_type = content_type if kubernetes_cluster_update_parameters else None - cls: ClsType[_models.KubernetesCluster] = 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, - kubernetes_cluster_name=kubernetes_cluster_name, - if_match=if_match, - if_none_match=if_none_match, - kubernetes_cluster_update_parameters=kubernetes_cluster_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubernetesCluster", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.KubernetesCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.KubernetesCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _restart_node_initial( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: Union[_models.KubernetesClusterRestartNodeParameters, 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(kubernetes_cluster_restart_node_parameters, (IOBase, bytes)): - _content = kubernetes_cluster_restart_node_parameters - else: - _json = self._serialize.body( - kubernetes_cluster_restart_node_parameters, "KubernetesClusterRestartNodeParameters" - ) - - _request = build_restart_node_request( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_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.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: _models.KubernetesClusterRestartNodeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Required. - :type kubernetes_cluster_restart_node_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Required. - :type kubernetes_cluster_restart_node_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_restart_node( - self, - resource_group_name: str, - kubernetes_cluster_name: str, - kubernetes_cluster_restart_node_parameters: Union[_models.KubernetesClusterRestartNodeParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Restart a targeted node. - - Restart a targeted node of a Kubernetes cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. - :type kubernetes_cluster_name: str - :param kubernetes_cluster_restart_node_parameters: The request body. Is either a - KubernetesClusterRestartNodeParameters type or a IO[bytes] type. Required. - :type kubernetes_cluster_restart_node_parameters: - ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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_node_initial( - resource_group_name=resource_group_name, - kubernetes_cluster_name=kubernetes_cluster_name, - kubernetes_cluster_restart_node_parameters=kubernetes_cluster_restart_node_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l2_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l2_networks_operations.py deleted file mode 100644 index b7459c8bc20b..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l2_networks_operations.py +++ /dev/null @@ -1,1121 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks") - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, l2_network_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l2NetworkName": _SERIALIZER.url( - "l2_network_name", l2_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - l2_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l2NetworkName": _SERIALIZER.url( - "l2_network_name", l2_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - l2_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l2NetworkName": _SERIALIZER.url( - "l2_network_name", l2_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - l2_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l2NetworkName": _SERIALIZER.url( - "l2_network_name", l2_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class L2NetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`l2_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.L2Network"]: - """List layer 2 (L2) networks in the subscription. - - Get a list of layer 2 (L2) networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L2Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L2Network] - :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.L2NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L2NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.L2Network"]: - """List layer 2 (L2) networks in the resource group. - - Get a list of layer 2 (L2) networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L2Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L2Network] - :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.L2NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L2NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, l2_network_name: str, **kwargs: Any) -> _models.L2Network: - """Retrieve the layer 2 (L2) network. - - Get properties of the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~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.L2Network] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L2Network", 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, - l2_network_name: str, - l2_network_parameters: Union[_models.L2Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(l2_network_parameters, (IOBase, bytes)): - _content = l2_network_parameters - else: - _json = self._serialize.body(l2_network_parameters, "L2Network") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - l2_network_name: str, - l2_network_parameters: _models.L2Network, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Required. - :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 L2Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - l2_network_name: str, - l2_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Required. - :type l2_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 L2Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - l2_network_name: str, - l2_network_parameters: Union[_models.L2Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.L2Network]: - """Create or update the layer 2 (L2) network. - - Create a new layer 2 (L2) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param l2_network_parameters: The request body. Is either a L2Network type or a IO[bytes] type. - Required. - :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either L2Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] - :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.L2Network] = 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, - l2_network_name=l2_network_name, - l2_network_parameters=l2_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("L2Network", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.L2Network].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.L2Network]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the layer 2 (L2) network. - - Delete the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - l2_network_name=l2_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[_models.L2NetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Default value is None. - :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Default value is None. - :type l2_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - l2_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l2_network_update_parameters: Optional[Union[_models.L2NetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.L2Network: - """Patch the layer 2 (L2) network. - - Update tags associated with the provided layer 2 (L2) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l2_network_name: The name of the L2 network. Required. - :type l2_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l2_network_update_parameters: The request body. Is either a L2NetworkPatchParameters - type or a IO[bytes] type. Default value is None. - :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters or - IO[bytes] - :return: L2Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L2Network - :raises ~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)) - content_type = content_type if l2_network_update_parameters else None - cls: ClsType[_models.L2Network] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if l2_network_update_parameters else None - _json = None - _content = None - if isinstance(l2_network_update_parameters, (IOBase, bytes)): - _content = l2_network_update_parameters - else: - if l2_network_update_parameters is not None: - _json = self._serialize.body(l2_network_update_parameters, "L2NetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - l2_network_name=l2_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L2Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l3_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l3_networks_operations.py deleted file mode 100644 index e4b1d131d4c1..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_l3_networks_operations.py +++ /dev/null @@ -1,1121 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks") - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, l3_network_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l3NetworkName": _SERIALIZER.url( - "l3_network_name", l3_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - l3_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l3NetworkName": _SERIALIZER.url( - "l3_network_name", l3_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - l3_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l3NetworkName": _SERIALIZER.url( - "l3_network_name", l3_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - l3_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "l3NetworkName": _SERIALIZER.url( - "l3_network_name", l3_network_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class L3NetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`l3_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.L3Network"]: - """List layer 3 (L3) networks in the subscription. - - Get a list of layer 3 (L3) networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L3Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L3Network] - :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.L3NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L3NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.L3Network"]: - """List layer 3 (L3) networks in the resource group. - - Get a list of layer 3 (L3) networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either L3Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L3Network] - :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.L3NetworkList] = 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, - top=top, - skip_token=skip_token, - 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("L3NetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, l3_network_name: str, **kwargs: Any) -> _models.L3Network: - """Retrieve the layer 3 (L3) network. - - Get properties of the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~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.L3Network] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L3Network", 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, - l3_network_name: str, - l3_network_parameters: Union[_models.L3Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(l3_network_parameters, (IOBase, bytes)): - _content = l3_network_parameters - else: - _json = self._serialize.body(l3_network_parameters, "L3Network") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - l3_network_name: str, - l3_network_parameters: _models.L3Network, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Required. - :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 L3Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - l3_network_name: str, - l3_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Required. - :type l3_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 L3Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - l3_network_name: str, - l3_network_parameters: Union[_models.L3Network, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.L3Network]: - """Create or update the layer 3 (L3) network. - - Create a new layer 3 (L3) network or update the properties of the existing network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param l3_network_parameters: The request body. Is either a L3Network type or a IO[bytes] type. - Required. - :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either L3Network or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] - :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.L3Network] = 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, - l3_network_name=l3_network_name, - l3_network_parameters=l3_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("L3Network", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.L3Network].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.L3Network]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the layer 3 (L3) network. - - Delete the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - l3_network_name=l3_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[_models.L3NetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Default value is None. - :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Default value is None. - :type l3_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - l3_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - l3_network_update_parameters: Optional[Union[_models.L3NetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.L3Network: - """Patch the layer 3 (L3) network. - - Update tags associated with the provided layer 3 (L3) network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param l3_network_name: The name of the L3 network. Required. - :type l3_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param l3_network_update_parameters: The request body. Is either a L3NetworkPatchParameters - type or a IO[bytes] type. Default value is None. - :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters or - IO[bytes] - :return: L3Network or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.L3Network - :raises ~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)) - content_type = content_type if l3_network_update_parameters else None - cls: ClsType[_models.L3Network] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if l3_network_update_parameters else None - _json = None - _content = None - if isinstance(l3_network_update_parameters, (IOBase, bytes)): - _content = l3_network_update_parameters - else: - if l3_network_update_parameters is not None: - _json = self._serialize.body(l3_network_update_parameters, "L3NetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - l3_network_name=l3_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("L3Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_metrics_configurations_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_metrics_configurations_operations.py deleted file mode 100644 index 91a9c5adda18..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_metrics_configurations_operations.py +++ /dev/null @@ -1,1169 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_cluster_request( - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, metrics_configuration_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "metricsConfigurationName": _SERIALIZER.url( - "metrics_configuration_name", metrics_configuration_name, "str", pattern=r"^default$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "metricsConfigurationName": _SERIALIZER.url( - "metrics_configuration_name", metrics_configuration_name, "str", pattern=r"^default$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "metricsConfigurationName": _SERIALIZER.url( - "metrics_configuration_name", metrics_configuration_name, "str", pattern=r"^default$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url( - "cluster_name", cluster_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - "metricsConfigurationName": _SERIALIZER.url( - "metrics_configuration_name", metrics_configuration_name, "str", pattern=r"^default$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MetricsConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`metrics_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.ClusterMetricsConfiguration"]: - """List metrics configurations of the cluster. - - Get a list of metrics configurations for the provided 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. Required. - :type cluster_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either ClusterMetricsConfiguration or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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.ClusterMetricsConfigurationList] = 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_cluster_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - top=top, - skip_token=skip_token, - 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("ClusterMetricsConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, metrics_configuration_name: str, **kwargs: Any - ) -> _models.ClusterMetricsConfiguration: - """Retrieve the metrics configuration of the cluster. - - Get metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :return: ClusterMetricsConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration - :raises ~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.ClusterMetricsConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterMetricsConfiguration", 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, - metrics_configuration_name: str, - metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(metrics_configuration_parameters, (IOBase, bytes)): - _content = metrics_configuration_parameters - else: - _json = self._serialize.body(metrics_configuration_parameters, "ClusterMetricsConfiguration") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - metrics_configuration_name: str, - metrics_configuration_parameters: _models.ClusterMetricsConfiguration, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Required. - :type metrics_configuration_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - metrics_configuration_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Required. - :type metrics_configuration_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Create or update metrics configuration of the cluster. - - Create new or update the existing metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param metrics_configuration_parameters: The request body. Is either a - ClusterMetricsConfiguration type or a IO[bytes] type. Required. - :type metrics_configuration_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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.ClusterMetricsConfiguration] = 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, - metrics_configuration_name=metrics_configuration_name, - metrics_configuration_parameters=metrics_configuration_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("ClusterMetricsConfiguration", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ClusterMetricsConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ClusterMetricsConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the metrics configuration of the cluster. - - Delete the metrics configuration of the provided 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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - metrics_configuration_name=metrics_configuration_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[ - Union[_models.ClusterMetricsConfigurationPatchParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if metrics_configuration_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if metrics_configuration_update_parameters else None - _json = None - _content = None - if isinstance(metrics_configuration_update_parameters, (IOBase, bytes)): - _content = metrics_configuration_update_parameters - else: - if metrics_configuration_update_parameters is not None: - _json = self._serialize.body( - metrics_configuration_update_parameters, "ClusterMetricsConfigurationPatchParameters" - ) - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - metrics_configuration_name=metrics_configuration_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[_models.ClusterMetricsConfigurationPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Default value is None. - :type metrics_configuration_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters - :keyword content_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 ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Default value is None. - :type metrics_configuration_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - metrics_configuration_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - metrics_configuration_update_parameters: Optional[ - Union[_models.ClusterMetricsConfigurationPatchParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.ClusterMetricsConfiguration]: - """Patch metrics configuration of the cluster. - - Patch properties of metrics configuration for the provided cluster, or update the tags - associated with it. Properties and tag updates can be done independently. - - :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. Required. - :type cluster_name: str - :param metrics_configuration_name: The name of the metrics configuration for the cluster. - Required. - :type metrics_configuration_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param metrics_configuration_update_parameters: The request body. Is either a - ClusterMetricsConfigurationPatchParameters type or a IO[bytes] type. Default value is None. - :type metrics_configuration_update_parameters: - ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either ClusterMetricsConfiguration or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] - :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)) - content_type = content_type if metrics_configuration_update_parameters else None - cls: ClsType[_models.ClusterMetricsConfiguration] = 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, - metrics_configuration_name=metrics_configuration_name, - if_match=if_match, - if_none_match=if_none_match, - metrics_configuration_update_parameters=metrics_configuration_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClusterMetricsConfiguration", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ClusterMetricsConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ClusterMetricsConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_operations.py index c83324743879..88c7a9b87667 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_operations.py @@ -1,43 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse -from azure.core import PipelineClient +from azure.core import MatchConditions, PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._configuration import NetworkCloudMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import prep_if_match, prep_if_none_match T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -45,7 +56,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.NetworkCloud/operations") + _url = "/providers/Microsoft.NetworkCloud/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -56,6 +67,4479 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_bare_metal_machines_get_request( + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + bare_metal_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_update_request( + resource_group_name: str, + bare_metal_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_delete_request( + resource_group_name: str, + bare_metal_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_cordon_request( + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/cordon" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/powerOff" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_bare_metal_machines_replace_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/replace" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_restart_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_bare_metal_machines_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runCommand" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_run_data_extracts_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runDataExtracts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_run_data_extracts_restricted_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runDataExtractsRestricted" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_run_read_commands_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runReadCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machines_start_request( + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_bare_metal_machines_uncordon_request( # pylint: disable=name-too-long + resource_group_name: str, bare_metal_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/uncordon" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bareMetalMachineName": _SERIALIZER.url("bare_metal_machine_name", bare_metal_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_cloud_services_networks_get_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_services_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServicesNetworkName": _SERIALIZER.url("cloud_services_network_name", cloud_services_network_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_cloud_services_networks_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cloud_services_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServicesNetworkName": _SERIALIZER.url("cloud_services_network_name", cloud_services_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_networks_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cloud_services_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServicesNetworkName": _SERIALIZER.url("cloud_services_network_name", cloud_services_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_networks_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + cloud_services_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServicesNetworkName": _SERIALIZER.url("cloud_services_network_name", cloud_services_network_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_networks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_networks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_managers_get_request( + resource_group_name: str, cluster_manager_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterManagerName": _SERIALIZER.url("cluster_manager_name", cluster_manager_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_cluster_managers_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_manager_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterManagerName": _SERIALIZER.url("cluster_manager_name", cluster_manager_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_managers_update_request( + resource_group_name: str, + cluster_manager_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterManagerName": _SERIALIZER.url("cluster_manager_name", cluster_manager_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_managers_delete_request( + resource_group_name: str, + cluster_manager_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterManagerName": _SERIALIZER.url("cluster_manager_name", cluster_manager_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_managers_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_managers_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{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_clusters_create_or_update_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_update_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_delete_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_continue_update_version_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-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/continueUpdateVersion" + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_deploy_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-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/deploy" + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_scan_runtime_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-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/scanRuntime" + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clusters_update_version_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-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/updateVersion" + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_get_request( + resource_group_name: str, kubernetes_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_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_kubernetes_clusters_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_update_request( + resource_group_name: str, + kubernetes_cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_delete_request( + resource_group_name: str, + kubernetes_cluster_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_clusters_restart_node_request( # pylint: disable=name-too-long + resource_group_name: str, kubernetes_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-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/restartNode" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l2_networks_get_request( + resource_group_name: str, l2_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l2NetworkName": _SERIALIZER.url("l2_network_name", l2_network_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_l2_networks_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + l2_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l2NetworkName": _SERIALIZER.url("l2_network_name", l2_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l2_networks_update_request( + resource_group_name: str, + l2_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l2NetworkName": _SERIALIZER.url("l2_network_name", l2_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l2_networks_delete_request( + resource_group_name: str, + l2_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l2NetworkName": _SERIALIZER.url("l2_network_name", l2_network_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l2_networks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l2_networks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l3_networks_get_request( + resource_group_name: str, l3_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l3NetworkName": _SERIALIZER.url("l3_network_name", l3_network_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_l3_networks_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + l3_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l3NetworkName": _SERIALIZER.url("l3_network_name", l3_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l3_networks_update_request( + resource_group_name: str, + l3_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l3NetworkName": _SERIALIZER.url("l3_network_name", l3_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l3_networks_delete_request( + resource_group_name: str, + l3_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "l3NetworkName": _SERIALIZER.url("l3_network_name", l3_network_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l3_networks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_l3_networks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rack_skus_get_request(rack_sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "rackSkuName": _SERIALIZER.url("rack_sku_name", rack_sku_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_rack_skus_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus" + 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_racks_get_request( + resource_group_name: str, rack_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "rackName": _SERIALIZER.url("rack_name", rack_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_racks_create_or_update_request( + resource_group_name: str, + rack_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "rackName": _SERIALIZER.url("rack_name", rack_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_racks_update_request( + resource_group_name: str, + rack_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "rackName": _SERIALIZER.url("rack_name", rack_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_racks_delete_request( + resource_group_name: str, + rack_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "rackName": _SERIALIZER.url("rack_name", rack_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_racks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_racks_list_by_subscription_request( + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_get_request( + resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_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_storage_appliances_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_appliance_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_update_request( + resource_group_name: str, + storage_appliance_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_delete_request( + resource_group_name: str, + storage_appliance_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_disable_remote_vendor_management_request( # pylint: disable=name-too-long + resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/disableRemoteVendorManagement" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_storage_appliances_enable_remote_vendor_management_request( # pylint: disable=name-too-long + resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/enableRemoteVendorManagement" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_appliances_run_read_commands_request( # pylint: disable=name-too-long + resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/runReadCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageApplianceName": _SERIALIZER.url("storage_appliance_name", storage_appliance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_trunked_networks_get_request( + resource_group_name: str, trunked_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trunkedNetworkName": _SERIALIZER.url("trunked_network_name", trunked_network_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_trunked_networks_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + trunked_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trunkedNetworkName": _SERIALIZER.url("trunked_network_name", trunked_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_trunked_networks_update_request( + resource_group_name: str, + trunked_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trunkedNetworkName": _SERIALIZER.url("trunked_network_name", trunked_network_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_trunked_networks_delete_request( + resource_group_name: str, + trunked_network_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trunkedNetworkName": _SERIALIZER.url("trunked_network_name", trunked_network_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_trunked_networks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_trunked_networks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_get_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + virtual_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_update_request( + resource_group_name: str, + virtual_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_delete_request( + resource_group_name: str, + virtual_machine_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_assign_relay_request( # pylint: disable=name-too-long + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/assignRelay" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_power_off_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/powerOff" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_machines_reimage_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_restart_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_virtual_machines_start_request( + resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_volumes_get_request( + resource_group_name: str, volume_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "volumeName": _SERIALIZER.url("volume_name", volume_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_volumes_create_or_update_request( + resource_group_name: str, + volume_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "volumeName": _SERIALIZER.url("volume_name", volume_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_volumes_update_request( + resource_group_name: str, + volume_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "volumeName": _SERIALIZER.url("volume_name", volume_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_volumes_delete_request( + resource_group_name: str, + volume_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "volumeName": _SERIALIZER.url("volume_name", volume_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_volumes_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_volumes_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machine_key_sets_get_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}" + 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"), + "bareMetalMachineKeySetName": _SERIALIZER.url( + "bare_metal_machine_key_set_name", bare_metal_machine_key_set_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machine_key_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}" + 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"), + "bareMetalMachineKeySetName": _SERIALIZER.url( + "bare_metal_machine_key_set_name", bare_metal_machine_key_set_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machine_key_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}" + 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"), + "bareMetalMachineKeySetName": _SERIALIZER.url( + "bare_metal_machine_key_set_name", bare_metal_machine_key_set_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machine_key_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}" + 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"), + "bareMetalMachineKeySetName": _SERIALIZER.url( + "bare_metal_machine_key_set_name", bare_metal_machine_key_set_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bare_metal_machine_key_sets_list_by_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bmc_key_sets_get_request( + resource_group_name: str, cluster_name: str, bmc_key_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}" + 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"), + "bmcKeySetName": _SERIALIZER.url("bmc_key_set_name", bmc_key_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bmc_key_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}" + 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"), + "bmcKeySetName": _SERIALIZER.url("bmc_key_set_name", bmc_key_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bmc_key_sets_update_request( + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}" + 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"), + "bmcKeySetName": _SERIALIZER.url("bmc_key_set_name", bmc_key_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bmc_key_sets_delete_request( + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}" + 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"), + "bmcKeySetName": _SERIALIZER.url("bmc_key_set_name", bmc_key_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bmc_key_sets_list_by_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_pools_get_request( + resource_group_name: str, kubernetes_cluster_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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_agent_pools_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_pools_update_request( + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_pools_delete_request( + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_pools_list_by_kubernetes_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_cluster_features_get_request( # pylint: disable=name-too-long + resource_group_name: str, kubernetes_cluster_name: str, feature_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "featureName": _SERIALIZER.url("feature_name", feature_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_kubernetes_cluster_features_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "featureName": _SERIALIZER.url("feature_name", feature_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_cluster_features_update_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "featureName": _SERIALIZER.url("feature_name", feature_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_cluster_features_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features/{featureName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + "featureName": _SERIALIZER.url("feature_name", feature_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_kubernetes_cluster_features_list_by_kubernetes_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + kubernetes_cluster_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/features" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "kubernetesClusterName": _SERIALIZER.url("kubernetes_cluster_name", kubernetes_cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_consoles_get_request( + resource_group_name: str, virtual_machine_name: str, console_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "consoleName": _SERIALIZER.url("console_name", console_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_consoles_create_or_update_request( + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "consoleName": _SERIALIZER.url("console_name", console_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_consoles_update_request( + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "consoleName": _SERIALIZER.url("console_name", console_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_consoles_delete_request( + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "consoleName": _SERIALIZER.url("console_name", console_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_consoles_list_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, + virtual_machine_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_configurations_get_request( + resource_group_name: str, cluster_name: str, metrics_configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}" + 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"), + "metricsConfigurationName": _SERIALIZER.url("metrics_configuration_name", metrics_configuration_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_metrics_configurations_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}" + 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"), + "metricsConfigurationName": _SERIALIZER.url("metrics_configuration_name", metrics_configuration_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_configurations_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}" + 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"), + "metricsConfigurationName": _SERIALIZER.url("metrics_configuration_name", metrics_configuration_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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_configurations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}" + 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"), + "metricsConfigurationName": _SERIALIZER.url("metrics_configuration_name", metrics_configuration_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_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_metrics_configurations_list_by_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: @@ -63,11 +4547,21971 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'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: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = 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.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BareMetalMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`bare_metal_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bare_metal_machine_name: str, **kwargs: Any) -> _models.BareMetalMachine: + """Get properties of the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: BareMetalMachine. The BareMetalMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachine + :raises ~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.BareMetalMachine] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_get_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BareMetalMachine, 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, + bare_metal_machine_name: str, + bare_metal_machine_parameters: Union[_models.BareMetalMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bare_metal_machine_parameters, (IOBase, bytes)): + _content = bare_metal_machine_parameters + else: + _content = json.dumps(bare_metal_machine_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_create_or_update_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: _models.BareMetalMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Required. + :type bare_metal_machine_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_parameters: Union[_models.BareMetalMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Create a new bare metal machine or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_parameters: The request body. Is one of the following types: + BareMetalMachine, JSON, IO[bytes] Required. + :type bare_metal_machine_parameters: ~azure.mgmt.networkcloud.models.BareMetalMachine or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :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.BareMetalMachine] = 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, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_parameters=bare_metal_machine_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachine, 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.BareMetalMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BareMetalMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[ + Union[_models.BareMetalMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bare_metal_machine_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_update_parameters else None + _content = None + if isinstance(bare_metal_machine_update_parameters, (IOBase, bytes)): + _content = bare_metal_machine_update_parameters + else: + if bare_metal_machine_update_parameters is not None: + _content = json.dumps(bare_metal_machine_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_update_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[_models.BareMetalMachinePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Default value is None. + :type bare_metal_machine_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_update_parameters: Optional[ + Union[_models.BareMetalMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachine]: + """Patch properties of the provided bare metal machine, or update tags associated with the bare + metal machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_update_parameters: The request body. Is one of the following types: + BareMetalMachinePatchParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachine. The BareMetalMachine is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachine] + :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)) + content_type = content_type if bare_metal_machine_update_parameters else None + cls: ClsType[_models.BareMetalMachine] = 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, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_update_parameters=bare_metal_machine_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachine, 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.BareMetalMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BareMetalMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bare_metal_machines_delete_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + bare_metal_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided bare metal machine. All customer initiated requests will be rejected as the + life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.BareMetalMachine"]: + """Get a list of bare metal machines in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BareMetalMachine]] = 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_bare_metal_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BareMetalMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.BareMetalMachine"]: + """Get a list of bare metal machines in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BareMetalMachine]] = 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_bare_metal_machines_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BareMetalMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _cordon_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[ + Union[_models.BareMetalMachineCordonParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_cordon_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_cordon_parameters else None + _content = None + if isinstance(bare_metal_machine_cordon_parameters, (IOBase, bytes)): + _content = bare_metal_machine_cordon_parameters + else: + if bare_metal_machine_cordon_parameters is not None: + _content = json.dumps(bare_metal_machine_cordon_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_cordon_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[_models.BareMetalMachineCordonParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Default value is None. + :type bare_metal_machine_cordon_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_cordon( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_cordon_parameters: Optional[ + Union[_models.BareMetalMachineCordonParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Cordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_cordon_parameters: The request body. Is one of the following types: + BareMetalMachineCordonParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_cordon_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineCordonParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_cordon_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._cordon_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_cordon_parameters=bare_metal_machine_cordon_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _power_off_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[ + Union[_models.BareMetalMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_power_off_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_power_off_parameters else None + _content = None + if isinstance(bare_metal_machine_power_off_parameters, (IOBase, bytes)): + _content = bare_metal_machine_power_off_parameters + else: + if bare_metal_machine_power_off_parameters is not None: + _content = json.dumps(bare_metal_machine_power_off_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_power_off_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[_models.BareMetalMachinePowerOffParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Default value is None. + :type bare_metal_machine_power_off_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_power_off( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_power_off_parameters: Optional[ + Union[_models.BareMetalMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_power_off_parameters: The request body. Is one of the following + types: BareMetalMachinePowerOffParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachinePowerOffParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_power_off_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_power_off_parameters=bare_metal_machine_power_off_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_reimage_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reimage( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Reimage the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _replace_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[ + Union[_models.BareMetalMachineReplaceParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if bare_metal_machine_replace_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_replace_parameters else None + _content = None + if isinstance(bare_metal_machine_replace_parameters, (IOBase, bytes)): + _content = bare_metal_machine_replace_parameters + else: + if bare_metal_machine_replace_parameters is not None: + _content = json.dumps(bare_metal_machine_replace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machines_replace_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[_models.BareMetalMachineReplaceParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Default value is None. + :type bare_metal_machine_replace_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_replace( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_replace_parameters: Optional[ + Union[_models.BareMetalMachineReplaceParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Replace the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_replace_parameters: The request body. Is one of the following types: + BareMetalMachineReplaceParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_replace_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineReplaceParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if bare_metal_machine_replace_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._replace_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_replace_parameters=bare_metal_machine_replace_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _restart_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_restart_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_command_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, 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(bare_metal_machine_run_command_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_command_parameters + else: + _content = json.dumps(bare_metal_machine_run_command_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_command_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: _models.BareMetalMachineRunCommandParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Required. + :type bare_metal_machine_run_command_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_command_parameters: Union[_models.BareMetalMachineRunCommandParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run the command or the script on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_command_parameters: The request body. Is one of the following + types: BareMetalMachineRunCommandParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_command_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunCommandParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_command_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_command_parameters=bare_metal_machine_run_command_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_data_extracts_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_data_extracts_parameters + else: + _content = json.dumps(bare_metal_machine_run_data_extracts_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_data_extracts_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: _models.BareMetalMachineRunDataExtractsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_data_extracts( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more data extractions on the provided bare metal machine. The URL to storage account + with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_parameters: The request body. Is one of the + following types: BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_data_extracts_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_data_extracts_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_data_extracts_parameters=bare_metal_machine_run_data_extracts_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_data_extracts_restricted_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, 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(bare_metal_machine_run_data_extracts_restricted_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_data_extracts_restricted_parameters + else: + _content = json.dumps(bare_metal_machine_run_data_extracts_restricted_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_data_extracts_restricted_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: _models.BareMetalMachineRunDataExtractsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Required. + :type bare_metal_machine_run_data_extracts_restricted_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_data_extracts_restricted( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_data_extracts_restricted_parameters: Union[ + _models.BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more restricted data extractions on the provided bare metal machine. The URL to + storage account with the command execution results and the command exit code can be retrieved + from the operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_data_extracts_restricted_parameters: The request body. Is one of + the following types: BareMetalMachineRunDataExtractsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_data_extracts_restricted_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunDataExtractsParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_data_extracts_restricted_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_data_extracts_restricted_parameters=bare_metal_machine_run_data_extracts_restricted_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_read_commands_initial( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: Union[ + _models.BareMetalMachineRunReadCommandsParameters, 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(bare_metal_machine_run_read_commands_parameters, (IOBase, bytes)): + _content = bare_metal_machine_run_read_commands_parameters + else: + _content = json.dumps(bare_metal_machine_run_read_commands_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machines_run_read_commands_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: _models.BareMetalMachineRunReadCommandsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Required. + :type bare_metal_machine_run_read_commands_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_read_commands( + self, + resource_group_name: str, + bare_metal_machine_name: str, + bare_metal_machine_run_read_commands_parameters: Union[ + _models.BareMetalMachineRunReadCommandsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided bare metal machine. The URL to storage + account with the command execution results and the command exit code can be retrieved from the + operation status API once available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :param bare_metal_machine_run_read_commands_parameters: The request body. Is one of the + following types: BareMetalMachineRunReadCommandsParameters, JSON, IO[bytes] Required. + :type bare_metal_machine_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineRunReadCommandsParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_read_commands_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + bare_metal_machine_run_read_commands_parameters=bare_metal_machine_run_read_commands_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _start_initial(self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_start_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Start the provided bare metal machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _uncordon_initial( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_bare_metal_machines_uncordon_request( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_uncordon( + self, resource_group_name: str, bare_metal_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Uncordon the provided bare metal machine's Kubernetes node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param bare_metal_machine_name: The name of the bare metal machine. Required. + :type bare_metal_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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._uncordon_initial( + resource_group_name=resource_group_name, + bare_metal_machine_name=bare_metal_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class CloudServicesNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`cloud_services_networks` 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: NetworkCloudMgmtClientConfiguration = 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, cloud_services_network_name: str, **kwargs: Any + ) -> _models.CloudServicesNetwork: + """Get properties of the provided cloud services network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :return: CloudServicesNetwork. The CloudServicesNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + :raises ~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.CloudServicesNetwork] = kwargs.pop("cls", None) + + _request = build_cloud_services_networks_get_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudServicesNetwork, 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, + cloud_services_network_name: str, + cloud_services_network_parameters: Union[_models.CloudServicesNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cloud_services_network_parameters, (IOBase, bytes)): + _content = cloud_services_network_parameters + else: + _content = json.dumps(cloud_services_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_services_networks_create_or_update_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: _models.CloudServicesNetwork, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Required. + :type cloud_services_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_parameters: Union[_models.CloudServicesNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Create a new cloud services network or update the properties of the existing cloud services + network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_parameters: The request body. Is one of the following types: + CloudServicesNetwork, JSON, IO[bytes] Required. + :type cloud_services_network_parameters: ~azure.mgmt.networkcloud.models.CloudServicesNetwork + or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :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.CloudServicesNetwork] = 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, + cloud_services_network_name=cloud_services_network_name, + cloud_services_network_parameters=cloud_services_network_parameters, + etag=etag, + match_condition=match_condition, + 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.CloudServicesNetwork, 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.CloudServicesNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudServicesNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[ + Union[_models.CloudServicesNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cloud_services_network_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cloud_services_network_update_parameters else None + _content = None + if isinstance(cloud_services_network_update_parameters, (IOBase, bytes)): + _content = cloud_services_network_update_parameters + else: + if cloud_services_network_update_parameters is not None: + _content = json.dumps(cloud_services_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_cloud_services_networks_update_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[_models.CloudServicesNetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: + ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Default value is None. + :type cloud_services_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cloud_services_network_name: str, + cloud_services_network_update_parameters: Optional[ + Union[_models.CloudServicesNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudServicesNetwork]: + """Update properties of the provided cloud services network, or update the tags associated with + it. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :param cloud_services_network_update_parameters: The request body. Is one of the following + types: CloudServicesNetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type cloud_services_network_update_parameters: + ~azure.mgmt.networkcloud.models.CloudServicesNetworkPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns CloudServicesNetwork. The CloudServicesNetwork + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :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)) + content_type = content_type if cloud_services_network_update_parameters else None + cls: ClsType[_models.CloudServicesNetwork] = 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, + cloud_services_network_name=cloud_services_network_name, + cloud_services_network_update_parameters=cloud_services_network_update_parameters, + etag=etag, + match_condition=match_condition, + 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.CloudServicesNetwork, 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.CloudServicesNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudServicesNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + cloud_services_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_cloud_services_networks_delete_request( + resource_group_name=resource_group_name, + cloud_services_network_name=cloud_services_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cloud_services_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided cloud services network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloud_services_network_name: The name of the cloud services network. Required. + :type cloud_services_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + cloud_services_network_name=cloud_services_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.CloudServicesNetwork"]: + """Get a list of cloud services networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of CloudServicesNetwork + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudServicesNetwork]] = 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_cloud_services_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.CloudServicesNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.CloudServicesNetwork"]: + """Get a list of cloud services networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of CloudServicesNetwork + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.CloudServicesNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudServicesNetwork]] = 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_cloud_services_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.CloudServicesNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ClusterManagersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`cluster_managers` 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: NetworkCloudMgmtClientConfiguration = 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_manager_name: str, **kwargs: Any) -> _models.ClusterManager: + """Get the properties of the provided cluster manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~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.ClusterManager] = kwargs.pop("cls", None) + + _request = build_cluster_managers_get_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterManager, 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_manager_name: str, + cluster_manager_parameters: Union[_models.ClusterManager, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cluster_manager_parameters, (IOBase, bytes)): + _content = cluster_manager_parameters + else: + _content = json.dumps(cluster_manager_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cluster_managers_create_or_update_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: _models.ClusterManager, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterManager. The ClusterManager is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterManager. The ClusterManager is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Required. + :type cluster_manager_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterManager. The ClusterManager is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_parameters: Union[_models.ClusterManager, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterManager]: + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_parameters: The request body. Is one of the following types: + ClusterManager, JSON, IO[bytes] Required. + :type cluster_manager_parameters: ~azure.mgmt.networkcloud.models.ClusterManager or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterManager. The ClusterManager is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterManager] + :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.ClusterManager] = 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_manager_name=cluster_manager_name, + cluster_manager_parameters=cluster_manager_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterManager, 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.ClusterManager].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ClusterManager]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[_models.ClusterManagerPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Default value is None. + :type cluster_manager_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_manager_name: str, + cluster_manager_update_parameters: Optional[ + Union[_models.ClusterManagerPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.ClusterManager: + """Patch properties of the provided cluster manager, or update the tags assigned to the cluster + manager. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :param cluster_manager_update_parameters: The request body. Is one of the following types: + ClusterManagerPatchParameters, JSON, IO[bytes] Default value is None. + :type cluster_manager_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterManagerPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: ClusterManager. The ClusterManager is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cluster_manager_update_parameters else None + cls: ClsType[_models.ClusterManager] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_manager_update_parameters else None + _content = None + if isinstance(cluster_manager_update_parameters, (IOBase, bytes)): + _content = cluster_manager_update_parameters + else: + if cluster_manager_update_parameters is not None: + _content = json.dumps(cluster_manager_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_cluster_managers_update_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterManager, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + cluster_manager_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_cluster_managers_delete_request( + resource_group_name=resource_group_name, + cluster_manager_name=cluster_manager_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_manager_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided cluster manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_manager_name: The name of the cluster manager. Required. + :type cluster_manager_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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_manager_name=cluster_manager_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ClusterManager"]: + """Get a list of cluster managers in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterManager + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterManager]] = 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_cluster_managers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.ClusterManager], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ClusterManager"]: + """Get a list of cluster managers in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterManager + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterManager] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterManager]] = 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_cluster_managers_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.ClusterManager], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`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: NetworkCloudMgmtClientConfiguration = 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.Cluster: + """Get properties of the provided 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. Required. + :type cluster_name: str + :return: Cluster. The Cluster is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Cluster + :raises ~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.Cluster] = kwargs.pop("cls", None) + + _request = build_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Cluster, 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, + cluster_parameters: Union[_models.Cluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(cluster_parameters, (IOBase, bytes)): + _content = cluster_parameters + else: + _content = json.dumps(cluster_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: _models.Cluster, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Required. + :type cluster_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_parameters: Union[_models.Cluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Create a new cluster or update the properties of the cluster if it exists. + + :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. Required. + :type cluster_name: str + :param cluster_parameters: The request body. Is one of the following types: Cluster, JSON, + IO[bytes] Required. + :type cluster_parameters: ~azure.mgmt.networkcloud.models.Cluster or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :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.Cluster] = 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, + cluster_parameters=cluster_parameters, + etag=etag, + match_condition=match_condition, + 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.Cluster, 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.Cluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if cluster_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_update_parameters else None + _content = None + if isinstance(cluster_update_parameters, (IOBase, bytes)): + _content = cluster_update_parameters + else: + if cluster_update_parameters is not None: + _content = json.dumps(cluster_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[_models.ClusterPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Default value is None. + :type cluster_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_parameters: Optional[Union[_models.ClusterPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Patch the properties of the provided cluster, or update the tags associated with the cluster. + Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param cluster_update_parameters: The request body. Is one of the following types: + ClusterPatchParameters, JSON, IO[bytes] Default value is None. + :type cluster_update_parameters: ~azure.mgmt.networkcloud.models.ClusterPatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Cluster. The Cluster is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Cluster] + :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)) + content_type = content_type if cluster_update_parameters else None + cls: ClsType[_models.Cluster] = 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, + cluster_update_parameters=cluster_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Cluster, 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.Cluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided 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. Required. + :type cluster_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Cluster"]: + """Get a list of clusters in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Cluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Cluster]] = 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_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Cluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Cluster"]: + """Get a list of clusters in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Cluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Cluster]] = 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_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Cluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _continue_update_version_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: Union[ + _models.ClusterContinueUpdateVersionParameters, 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(cluster_continue_update_version_parameters, (IOBase, bytes)): + _content = cluster_continue_update_version_parameters + else: + _content = json.dumps(cluster_continue_update_version_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_continue_update_version_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: _models.ClusterContinueUpdateVersionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Required. + :type cluster_continue_update_version_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_continue_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_continue_update_version_parameters: Union[ + _models.ClusterContinueUpdateVersionParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Trigger the continuation of an update for a cluster with a matching update strategy that has + paused after completing a segment of the update. + + :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. Required. + :type cluster_name: str + :param cluster_continue_update_version_parameters: The request body. Is one of the following + types: ClusterContinueUpdateVersionParameters, JSON, IO[bytes] Required. + :type cluster_continue_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterContinueUpdateVersionParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._continue_update_version_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_continue_update_version_parameters=cluster_continue_update_version_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _deploy_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, JSON, IO[bytes]]] = None, + **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)) + content_type = content_type if cluster_deploy_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_deploy_parameters else None + _content = None + if isinstance(cluster_deploy_parameters, (IOBase, bytes)): + _content = cluster_deploy_parameters + else: + if cluster_deploy_parameters is not None: + _content = json.dumps(cluster_deploy_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_deploy_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[_models.ClusterDeployParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Default value is None. + :type cluster_deploy_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_deploy( + self, + resource_group_name: str, + cluster_name: str, + cluster_deploy_parameters: Optional[Union[_models.ClusterDeployParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Deploy the cluster using the rack configuration provided during creation. + + :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. Required. + :type cluster_name: str + :param cluster_deploy_parameters: The request body. Is one of the following types: + ClusterDeployParameters, JSON, IO[bytes] Default value is None. + :type cluster_deploy_parameters: ~azure.mgmt.networkcloud.models.ClusterDeployParameters or + JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if cluster_deploy_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._deploy_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_deploy_parameters=cluster_deploy_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _scan_runtime_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, JSON, IO[bytes]]] = None, + **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)) + content_type = content_type if cluster_scan_runtime_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if cluster_scan_runtime_parameters else None + _content = None + if isinstance(cluster_scan_runtime_parameters, (IOBase, bytes)): + _content = cluster_scan_runtime_parameters + else: + if cluster_scan_runtime_parameters is not None: + _content = json.dumps(cluster_scan_runtime_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_clusters_scan_runtime_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[_models.ClusterScanRuntimeParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_parameters: + ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Default value is None. + :type cluster_scan_runtime_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_scan_runtime( + self, + resource_group_name: str, + cluster_name: str, + cluster_scan_runtime_parameters: Optional[Union[_models.ClusterScanRuntimeParameters, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Triggers the execution of a runtime protection scan to detect and remediate detected issues, in + accordance with the cluster configuration. + + :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. Required. + :type cluster_name: str + :param cluster_scan_runtime_parameters: The request body. Is one of the following types: + ClusterScanRuntimeParameters, JSON, IO[bytes] Default value is None. + :type cluster_scan_runtime_parameters: + ~azure.mgmt.networkcloud.models.ClusterScanRuntimeParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if cluster_scan_runtime_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._scan_runtime_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_scan_runtime_parameters=cluster_scan_runtime_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_version_initial( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, 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(cluster_update_version_parameters, (IOBase, bytes)): + _content = cluster_update_version_parameters + else: + _content = json.dumps(cluster_update_version_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_clusters_update_version_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: _models.ClusterUpdateVersionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Required. + :type cluster_update_version_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_version( + self, + resource_group_name: str, + cluster_name: str, + cluster_update_version_parameters: Union[_models.ClusterUpdateVersionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Update the version of the provided cluster to one of the available supported versions. + + :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. Required. + :type cluster_name: str + :param cluster_update_version_parameters: The request body. Is one of the following types: + ClusterUpdateVersionParameters, JSON, IO[bytes] Required. + :type cluster_update_version_parameters: + ~azure.mgmt.networkcloud.models.ClusterUpdateVersionParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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_version_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_update_version_parameters=cluster_update_version_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class KubernetesClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`kubernetes_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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, **kwargs: Any) -> _models.KubernetesCluster: + """Get properties of the provided the Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :return: KubernetesCluster. The KubernetesCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.KubernetesCluster + :raises ~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.KubernetesCluster] = kwargs.pop("cls", None) + + _request = build_kubernetes_clusters_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KubernetesCluster, 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, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: Union[_models.KubernetesCluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(kubernetes_cluster_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_parameters + else: + _content = json.dumps(kubernetes_cluster_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_clusters_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: _models.KubernetesCluster, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Required. + :type kubernetes_cluster_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_parameters: Union[_models.KubernetesCluster, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Create a new Kubernetes cluster or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_parameters: The request body. Is one of the following types: + KubernetesCluster, JSON, IO[bytes] Required. + :type kubernetes_cluster_parameters: ~azure.mgmt.networkcloud.models.KubernetesCluster or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :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.KubernetesCluster] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_parameters=kubernetes_cluster_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesCluster, 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.KubernetesCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.KubernetesCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[ + Union[_models.KubernetesClusterPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if kubernetes_cluster_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if kubernetes_cluster_update_parameters else None + _content = None + if isinstance(kubernetes_cluster_update_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_update_parameters + else: + if kubernetes_cluster_update_parameters is not None: + _content = json.dumps(kubernetes_cluster_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_kubernetes_clusters_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[_models.KubernetesClusterPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_update_parameters: Optional[ + Union[_models.KubernetesClusterPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesCluster]: + """Patch the properties of the provided Kubernetes cluster, or update the tags associated with the + Kubernetes cluster. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_update_parameters: The request body. Is one of the following types: + KubernetesClusterPatchParameters, JSON, IO[bytes] Default value is None. + :type kubernetes_cluster_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesCluster. The KubernetesCluster is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesCluster] + :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)) + content_type = content_type if kubernetes_cluster_update_parameters else None + cls: ClsType[_models.KubernetesCluster] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_update_parameters=kubernetes_cluster_update_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesCluster, 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.KubernetesCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.KubernetesCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_kubernetes_clusters_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.KubernetesCluster"]: + """Get a list of Kubernetes clusters in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesCluster]] = 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_kubernetes_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesCluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.KubernetesCluster"]: + """Get a list of Kubernetes clusters in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesCluster + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesCluster]] = 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_kubernetes_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesCluster], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _restart_node_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: Union[ + _models.KubernetesClusterRestartNodeParameters, 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(kubernetes_cluster_restart_node_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_restart_node_parameters + else: + _content = json.dumps(kubernetes_cluster_restart_node_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_clusters_restart_node_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: _models.KubernetesClusterRestartNodeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Required. + :type kubernetes_cluster_restart_node_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restart_node( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + kubernetes_cluster_restart_node_parameters: Union[ + _models.KubernetesClusterRestartNodeParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart a targeted node of a Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param kubernetes_cluster_restart_node_parameters: The request body. Is one of the following + types: KubernetesClusterRestartNodeParameters, JSON, IO[bytes] Required. + :type kubernetes_cluster_restart_node_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterRestartNodeParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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_node_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + kubernetes_cluster_restart_node_parameters=kubernetes_cluster_restart_node_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class L2NetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`l2_networks` 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: NetworkCloudMgmtClientConfiguration = 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, l2_network_name: str, **kwargs: Any) -> _models.L2Network: + """Get properties of the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~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.L2Network] = kwargs.pop("cls", None) + + _request = build_l2_networks_get_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L2Network, 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, + l2_network_name: str, + l2_network_parameters: Union[_models.L2Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(l2_network_parameters, (IOBase, bytes)): + _content = l2_network_parameters + else: + _content = json.dumps(l2_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_l2_networks_create_or_update_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: _models.L2Network, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Required. + :type l2_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_parameters: Union[_models.L2Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L2Network]: + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_parameters: The request body. Is one of the following types: L2Network, JSON, + IO[bytes] Required. + :type l2_network_parameters: ~azure.mgmt.networkcloud.models.L2Network or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L2Network. The L2Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L2Network] + :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.L2Network] = 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, + l2_network_name=l2_network_name, + l2_network_parameters=l2_network_parameters, + etag=etag, + match_condition=match_condition, + 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.L2Network, 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.L2Network].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.L2Network]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[_models.L2NetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Default value is None. + :type l2_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + l2_network_name: str, + l2_network_update_parameters: Optional[Union[_models.L2NetworkPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L2Network: + """Update tags associated with the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :param l2_network_update_parameters: The request body. Is one of the following types: + L2NetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type l2_network_update_parameters: ~azure.mgmt.networkcloud.models.L2NetworkPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L2Network. The L2Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L2Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if l2_network_update_parameters else None + cls: ClsType[_models.L2Network] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if l2_network_update_parameters else None + _content = None + if isinstance(l2_network_update_parameters, (IOBase, bytes)): + _content = l2_network_update_parameters + else: + if l2_network_update_parameters is not None: + _content = json.dumps(l2_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_l2_networks_update_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L2Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + l2_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_l2_networks_delete_request( + resource_group_name=resource_group_name, + l2_network_name=l2_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + l2_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided layer 2 (L2) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l2_network_name: The name of the L2 network. Required. + :type l2_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + l2_network_name=l2_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.L2Network"]: + """Get a list of layer 2 (L2) networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L2Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L2Network]] = 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_l2_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L2Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.L2Network"]: + """Get a list of layer 2 (L2) networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L2Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L2Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L2Network]] = 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_l2_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L2Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class L3NetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`l3_networks` 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: NetworkCloudMgmtClientConfiguration = 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, l3_network_name: str, **kwargs: Any) -> _models.L3Network: + """Get properties of the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~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.L3Network] = kwargs.pop("cls", None) + + _request = build_l3_networks_get_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L3Network, 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, + l3_network_name: str, + l3_network_parameters: Union[_models.L3Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(l3_network_parameters, (IOBase, bytes)): + _content = l3_network_parameters + else: + _content = json.dumps(l3_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_l3_networks_create_or_update_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: _models.L3Network, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Required. + :type l3_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_parameters: Union[_models.L3Network, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.L3Network]: + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_parameters: The request body. Is one of the following types: L3Network, JSON, + IO[bytes] Required. + :type l3_network_parameters: ~azure.mgmt.networkcloud.models.L3Network or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns L3Network. The L3Network is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.L3Network] + :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.L3Network] = 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, + l3_network_name=l3_network_name, + l3_network_parameters=l3_network_parameters, + etag=etag, + match_condition=match_condition, + 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.L3Network, 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.L3Network].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.L3Network]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[_models.L3NetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Default value is None. + :type l3_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + l3_network_name: str, + l3_network_update_parameters: Optional[Union[_models.L3NetworkPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.L3Network: + """Update tags associated with the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :param l3_network_update_parameters: The request body. Is one of the following types: + L3NetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type l3_network_update_parameters: ~azure.mgmt.networkcloud.models.L3NetworkPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: L3Network. The L3Network is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.L3Network + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if l3_network_update_parameters else None + cls: ClsType[_models.L3Network] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if l3_network_update_parameters else None + _content = None + if isinstance(l3_network_update_parameters, (IOBase, bytes)): + _content = l3_network_update_parameters + else: + if l3_network_update_parameters is not None: + _content = json.dumps(l3_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_l3_networks_update_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.L3Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + l3_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_l3_networks_delete_request( + resource_group_name=resource_group_name, + l3_network_name=l3_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + l3_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided layer 3 (L3) network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param l3_network_name: The name of the L3 network. Required. + :type l3_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + l3_network_name=l3_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.L3Network"]: + """Get a list of layer 3 (L3) networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L3Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L3Network]] = 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_l3_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L3Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.L3Network"]: + """Get a list of layer 3 (L3) networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of L3Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.L3Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.L3Network]] = 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_l3_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.L3Network], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RackSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`rack_skus` 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: NetworkCloudMgmtClientConfiguration = 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, rack_sku_name: str, **kwargs: Any) -> _models.RackSku: + """Get the properties of the provided rack SKU. + + :param rack_sku_name: The name of the rack SKU. Required. + :type rack_sku_name: str + :return: RackSku. The RackSku is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.RackSku + :raises ~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.RackSku] = kwargs.pop("cls", None) + + _request = build_rack_skus_get_request( + rack_sku_name=rack_sku_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RackSku, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.RackSku"]: + """Get a list of rack SKUs in the provided subscription. + + :return: An iterator like instance of RackSku + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.RackSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RackSku]] = 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_rack_skus_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.RackSku], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RacksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`racks` 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: NetworkCloudMgmtClientConfiguration = 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, rack_name: str, **kwargs: Any) -> _models.Rack: + """Get properties of the provided rack. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :return: Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Rack + :raises ~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.Rack] = kwargs.pop("cls", None) + + _request = build_racks_get_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Rack, 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, + rack_name: str, + rack_parameters: Union[_models.Rack, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(rack_parameters, (IOBase, bytes)): + _content = rack_parameters + else: + _content = json.dumps(rack_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_racks_create_or_update_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: _models.Rack, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Required. + :type rack_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + rack_name: str, + rack_parameters: Union[_models.Rack, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Create a new rack or update properties of the existing one. All customer initiated requests + will be rejected as the life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_parameters: The request body. Is one of the following types: Rack, JSON, IO[bytes] + Required. + :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :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.Rack] = 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, + rack_name=rack_name, + rack_parameters=rack_parameters, + etag=etag, + match_condition=match_condition, + 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.Rack, 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.Rack].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Rack]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[Union[_models.RackPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if rack_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if rack_update_parameters else None + _content = None + if isinstance(rack_update_parameters, (IOBase, bytes)): + _content = rack_update_parameters + else: + if rack_update_parameters is not None: + _content = json.dumps(rack_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_racks_update_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[_models.RackPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Default value is None. + :type rack_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + rack_name: str, + rack_update_parameters: Optional[Union[_models.RackPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Rack]: + """Patch properties of the provided rack, or update the tags associated with the rack. Properties + and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :param rack_update_parameters: The request body. Is one of the following types: + RackPatchParameters, JSON, IO[bytes] Default value is None. + :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Rack. The Rack is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] + :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)) + content_type = content_type if rack_update_parameters else None + cls: ClsType[_models.Rack] = 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, + rack_name=rack_name, + rack_update_parameters=rack_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Rack, 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.Rack].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Rack]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + rack_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_racks_delete_request( + resource_group_name=resource_group_name, + rack_name=rack_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + rack_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided rack. All customer initiated requests will be rejected as the life cycle of + this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rack_name: The name of the rack. Required. + :type rack_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + rack_name=rack_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Rack"]: + """Get a list of racks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Rack + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Rack]] = 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_racks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Rack], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Rack"]: + """Get a list of racks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Rack + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Rack] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Rack]] = 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_racks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Rack], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class StorageAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`storage_appliances` 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: NetworkCloudMgmtClientConfiguration = 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, storage_appliance_name: str, **kwargs: Any) -> _models.StorageAppliance: + """Get properties of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :return: StorageAppliance. The StorageAppliance is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.StorageAppliance + :raises ~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.StorageAppliance] = kwargs.pop("cls", None) + + _request = build_storage_appliances_get_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageAppliance, 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, + storage_appliance_name: str, + storage_appliance_parameters: Union[_models.StorageAppliance, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(storage_appliance_parameters, (IOBase, bytes)): + _content = storage_appliance_parameters + else: + _content = json.dumps(storage_appliance_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_appliances_create_or_update_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: _models.StorageAppliance, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Required. + :type storage_appliance_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_parameters: Union[_models.StorageAppliance, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Create a new storage appliance or update the properties of the existing one. All customer + initiated requests will be rejected as the life cycle of this resource is managed by the + system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_parameters: The request body. Is one of the following types: + StorageAppliance, JSON, IO[bytes] Required. + :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :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.StorageAppliance] = 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, + storage_appliance_name=storage_appliance_name, + storage_appliance_parameters=storage_appliance_parameters, + etag=etag, + match_condition=match_condition, + 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.StorageAppliance, 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.StorageAppliance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageAppliance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[ + Union[_models.StorageAppliancePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if storage_appliance_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if storage_appliance_update_parameters else None + _content = None + if isinstance(storage_appliance_update_parameters, (IOBase, bytes)): + _content = storage_appliance_update_parameters + else: + if storage_appliance_update_parameters is not None: + _content = json.dumps(storage_appliance_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_appliances_update_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[_models.StorageAppliancePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: + ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Default value is None. + :type storage_appliance_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_update_parameters: Optional[ + Union[_models.StorageAppliancePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageAppliance]: + """Update properties of the provided storage appliance, or update tags associated with the storage + appliance Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_update_parameters: The request body. Is one of the following types: + StorageAppliancePatchParameters, JSON, IO[bytes] Default value is None. + :type storage_appliance_update_parameters: + ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns StorageAppliance. The StorageAppliance is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] + :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)) + content_type = content_type if storage_appliance_update_parameters else None + cls: ClsType[_models.StorageAppliance] = 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, + storage_appliance_name=storage_appliance_name, + storage_appliance_update_parameters=storage_appliance_update_parameters, + etag=etag, + match_condition=match_condition, + 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.StorageAppliance, 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.StorageAppliance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageAppliance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_storage_appliances_delete_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_appliance_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided storage appliance. All customer initiated requests will be rejected as the + life cycle of this resource is managed by the system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + storage_appliance_name=storage_appliance_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.StorageAppliance"]: + """Get a list of storage appliances in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of StorageAppliance + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageAppliance]] = 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_storage_appliances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.StorageAppliance], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.StorageAppliance"]: + """Get a list of storage appliances in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of StorageAppliance + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageAppliance]] = 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_storage_appliances_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.StorageAppliance], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _disable_remote_vendor_management_initial( # pylint: disable=name-too-long + self, resource_group_name: str, storage_appliance_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_storage_appliances_disable_remote_vendor_management_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_disable_remote_vendor_management( + self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Disable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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._disable_remote_vendor_management_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _enable_remote_vendor_management_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = ( + content_type or "application/json" if storage_appliance_enable_remote_vendor_management_parameters else None + ) + _content = None + if isinstance(storage_appliance_enable_remote_vendor_management_parameters, (IOBase, bytes)): + _content = storage_appliance_enable_remote_vendor_management_parameters + else: + if storage_appliance_enable_remote_vendor_management_parameters is not None: + _content = json.dumps(storage_appliance_enable_remote_vendor_management_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_appliances_enable_remote_vendor_management_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + _models.StorageApplianceEnableRemoteVendorManagementParameters + ] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default + value is None. + :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_remote_vendor_management( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_enable_remote_vendor_management_parameters: Optional[ + Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Enable remote vendor management of the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Is one + of the following types: StorageApplianceEnableRemoteVendorManagementParameters, JSON, IO[bytes] + Default value is None. + :type storage_appliance_enable_remote_vendor_management_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters or JSON + or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._enable_remote_vendor_management_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + storage_appliance_enable_remote_vendor_management_parameters=storage_appliance_enable_remote_vendor_management_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _run_read_commands_initial( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: Union[ + _models.StorageApplianceRunReadCommandsParameters, 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(storage_appliance_run_read_commands_parameters, (IOBase, bytes)): + _content = storage_appliance_run_read_commands_parameters + else: + _content = json.dumps(storage_appliance_run_read_commands_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_appliances_run_read_commands_request( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: _models.StorageApplianceRunReadCommandsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Required. + :type storage_appliance_run_read_commands_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_read_commands( + self, + resource_group_name: str, + storage_appliance_name: str, + storage_appliance_run_read_commands_parameters: Union[ + _models.StorageApplianceRunReadCommandsParameters, JSON, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Run one or more read-only commands on the provided storage appliance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_appliance_name: The name of the storage appliance. Required. + :type storage_appliance_name: str + :param storage_appliance_run_read_commands_parameters: The request body. Is one of the + following types: StorageApplianceRunReadCommandsParameters, JSON, IO[bytes] Required. + :type storage_appliance_run_read_commands_parameters: + ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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.OperationStatusResult] = 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._run_read_commands_initial( + resource_group_name=resource_group_name, + storage_appliance_name=storage_appliance_name, + storage_appliance_run_read_commands_parameters=storage_appliance_run_read_commands_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class TrunkedNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`trunked_networks` 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: NetworkCloudMgmtClientConfiguration = 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, trunked_network_name: str, **kwargs: Any) -> _models.TrunkedNetwork: + """Get properties of the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~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.TrunkedNetwork] = kwargs.pop("cls", None) + + _request = build_trunked_networks_get_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TrunkedNetwork, 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, + trunked_network_name: str, + trunked_network_parameters: Union[_models.TrunkedNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(trunked_network_parameters, (IOBase, bytes)): + _content = trunked_network_parameters + else: + _content = json.dumps(trunked_network_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_trunked_networks_create_or_update_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: _models.TrunkedNetwork, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns TrunkedNetwork. The TrunkedNetwork is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns TrunkedNetwork. The TrunkedNetwork is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Required. + :type trunked_network_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns TrunkedNetwork. The TrunkedNetwork is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_parameters: Union[_models.TrunkedNetwork, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.TrunkedNetwork]: + """Create a new trunked network or update the properties of the existing trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_parameters: The request body. Is one of the following types: + TrunkedNetwork, JSON, IO[bytes] Required. + :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns TrunkedNetwork. The TrunkedNetwork is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :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.TrunkedNetwork] = 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, + trunked_network_name=trunked_network_name, + trunked_network_parameters=trunked_network_parameters, + etag=etag, + match_condition=match_condition, + 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.TrunkedNetwork, 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.TrunkedNetwork].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.TrunkedNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[_models.TrunkedNetworkPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: + ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Default value is None. + :type trunked_network_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + trunked_network_name: str, + trunked_network_update_parameters: Optional[ + Union[_models.TrunkedNetworkPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.TrunkedNetwork: + """Update tags associated with the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :param trunked_network_update_parameters: The request body. Is one of the following types: + TrunkedNetworkPatchParameters, JSON, IO[bytes] Default value is None. + :type trunked_network_update_parameters: + ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TrunkedNetwork. The TrunkedNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if trunked_network_update_parameters else None + cls: ClsType[_models.TrunkedNetwork] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if trunked_network_update_parameters else None + _content = None + if isinstance(trunked_network_update_parameters, (IOBase, bytes)): + _content = trunked_network_update_parameters + else: + if trunked_network_update_parameters is not None: + _content = json.dumps(trunked_network_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_trunked_networks_update_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TrunkedNetwork, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + trunked_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_trunked_networks_delete_request( + resource_group_name=resource_group_name, + trunked_network_name=trunked_network_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + trunked_network_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided trunked network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param trunked_network_name: The name of the trunked network. Required. + :type trunked_network_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + trunked_network_name=trunked_network_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.TrunkedNetwork"]: + """Get a list of trunked networks in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of TrunkedNetwork + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TrunkedNetwork]] = 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_trunked_networks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.TrunkedNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.TrunkedNetwork"]: + """Get a list of trunked networks in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of TrunkedNetwork + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TrunkedNetwork]] = 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_trunked_networks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.TrunkedNetwork], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`virtual_machines` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: + """Get properties of the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: VirtualMachine. The VirtualMachine is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.VirtualMachine + :raises ~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.VirtualMachine] = kwargs.pop("cls", None) + + _request = build_virtual_machines_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VirtualMachine, 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, + virtual_machine_name: str, + virtual_machine_parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(virtual_machine_parameters, (IOBase, bytes)): + _content = virtual_machine_parameters + else: + _content = json.dumps(virtual_machine_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_virtual_machines_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: _models.VirtualMachine, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Required. + :type virtual_machine_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_parameters: Union[_models.VirtualMachine, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Create a new virtual machine or update the properties of the existing virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_parameters: The request body. Is one of the following types: + VirtualMachine, JSON, IO[bytes] Required. + :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :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.VirtualMachine] = 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_parameters=virtual_machine_parameters, + etag=etag, + match_condition=match_condition, + 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.VirtualMachine, 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.VirtualMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[ + Union[_models.VirtualMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if virtual_machine_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_update_parameters else None + _content = None + if isinstance(virtual_machine_update_parameters, (IOBase, bytes)): + _content = virtual_machine_update_parameters + else: + if virtual_machine_update_parameters is not None: + _content = json.dumps(virtual_machine_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[_models.VirtualMachinePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Default value is None. + :type virtual_machine_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_update_parameters: Optional[ + Union[_models.VirtualMachinePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """Patch the properties of the provided virtual machine, or update the tags associated with the + virtual machine. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_update_parameters: The request body. Is one of the following types: + VirtualMachinePatchParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_update_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns VirtualMachine. The VirtualMachine is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] + :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)) + content_type = content_type if virtual_machine_update_parameters else None + cls: ClsType[_models.VirtualMachine] = 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, + virtual_machine_name=virtual_machine_name, + virtual_machine_update_parameters=virtual_machine_update_parameters, + etag=etag, + match_condition=match_condition, + 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.VirtualMachine, 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.VirtualMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_virtual_machines_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachine"]: + """Get a list of virtual machines in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = 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_virtual_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.VirtualMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.VirtualMachine"]: + """Get a list of virtual machines in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of VirtualMachine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VirtualMachine]] = 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_virtual_machines_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.VirtualMachine], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _assign_relay_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[ + Union[_models.VirtualMachineAssignRelayParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if virtual_machine_assign_relay_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_assign_relay_parameters else None + _content = None + if isinstance(virtual_machine_assign_relay_parameters, (IOBase, bytes)): + _content = virtual_machine_assign_relay_parameters + else: + if virtual_machine_assign_relay_parameters is not None: + _content = json.dumps(virtual_machine_assign_relay_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_assign_relay_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[_models.VirtualMachineAssignRelayParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Default value is None. + :type virtual_machine_assign_relay_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_assign_relay( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_assign_relay_parameters: Optional[ + Union[_models.VirtualMachineAssignRelayParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided + virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_assign_relay_parameters: The request body. Is one of the following + types: VirtualMachineAssignRelayParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_assign_relay_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if virtual_machine_assign_relay_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._assign_relay_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + virtual_machine_assign_relay_parameters=virtual_machine_assign_relay_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _power_off_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[ + Union[_models.VirtualMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **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)) + content_type = content_type if virtual_machine_power_off_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if virtual_machine_power_off_parameters else None + _content = None + if isinstance(virtual_machine_power_off_parameters, (IOBase, bytes)): + _content = virtual_machine_power_off_parameters + else: + if virtual_machine_power_off_parameters is not None: + _content = json.dumps(virtual_machine_power_off_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_virtual_machines_power_off_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[_models.VirtualMachinePowerOffParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters + :keyword content_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Default value is None. + :type virtual_machine_power_off_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 OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_power_off( + self, + resource_group_name: str, + virtual_machine_name: str, + virtual_machine_power_off_parameters: Optional[ + Union[_models.VirtualMachinePowerOffParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Power off the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param virtual_machine_power_off_parameters: The request body. Is one of the following types: + VirtualMachinePowerOffParameters, JSON, IO[bytes] Default value is None. + :type virtual_machine_power_off_parameters: + ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :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)) + content_type = content_type if virtual_machine_power_off_parameters else None + cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + virtual_machine_power_off_parameters=virtual_machine_power_off_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reimage_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reimage( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Reimage the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _restart_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Restart the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _start_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Start the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class VolumesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`volumes` 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: NetworkCloudMgmtClientConfiguration = 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, volume_name: str, **kwargs: Any) -> _models.Volume: + """Get properties of the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~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.Volume] = kwargs.pop("cls", None) + + _request = build_volumes_get_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Volume, 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, + volume_name: str, + volume_parameters: Union[_models.Volume, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(volume_parameters, (IOBase, bytes)): + _content = volume_parameters + else: + _content = json.dumps(volume_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_volumes_create_or_update_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: _models.Volume, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Required. + :type volume_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + volume_name: str, + volume_parameters: Union[_models.Volume, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a new volume or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_parameters: The request body. Is one of the following types: Volume, JSON, + IO[bytes] Required. + :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Volume. The Volume is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] + :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.Volume] = 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, + volume_name=volume_name, + volume_parameters=volume_parameters, + etag=etag, + match_condition=match_condition, + 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.Volume, 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.Volume].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[_models.VolumePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Default value is None. + :type volume_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + volume_name: str, + volume_update_parameters: Optional[Union[_models.VolumePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.Volume: + """Update tags associated with the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :param volume_update_parameters: The request body. Is one of the following types: + VolumePatchParameters, JSON, IO[bytes] Default value is None. + :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: Volume. The Volume is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Volume + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if volume_update_parameters else None + cls: ClsType[_models.Volume] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if volume_update_parameters else None + _content = None + if isinstance(volume_update_parameters, (IOBase, bytes)): + _content = volume_update_parameters + else: + if volume_update_parameters is not None: + _content = json.dumps(volume_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_volumes_update_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Volume, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + volume_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_volumes_delete_request( + resource_group_name=resource_group_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + volume_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param volume_name: The name of the volume. Required. + :type volume_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + volume_name=volume_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Volume"]: + """Get a list of volumes in the provided resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Volume + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Volume]] = 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_volumes_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Volume], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Volume"]: + """Get a list of volumes in the provided subscription. + + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Volume + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Volume]] = 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_volumes_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Volume], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BareMetalMachineKeySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`bare_metal_machine_key_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bare_metal_machine_key_set_name: str, **kwargs: Any + ) -> _models.BareMetalMachineKeySet: + """Get bare metal machine key set of the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :return: BareMetalMachineKeySet. The BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet + :raises ~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.BareMetalMachineKeySet] = kwargs.pop("cls", None) + + _request = build_bare_metal_machine_key_sets_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BareMetalMachineKeySet, 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, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bare_metal_machine_key_set_parameters, (IOBase, bytes)): + _content = bare_metal_machine_key_set_parameters + else: + _content = json.dumps(bare_metal_machine_key_set_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bare_metal_machine_key_sets_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: _models.BareMetalMachineKeySet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Required. + :type bare_metal_machine_key_set_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_parameters: Union[_models.BareMetalMachineKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Create a new bare metal machine key set or update the existing one for the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_parameters: The request body. Is one of the following types: + BareMetalMachineKeySet, JSON, IO[bytes] Required. + :type bare_metal_machine_key_set_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :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.BareMetalMachineKeySet] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + bare_metal_machine_key_set_parameters=bare_metal_machine_key_set_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachineKeySet, 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.BareMetalMachineKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BareMetalMachineKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[ + Union[_models.BareMetalMachineKeySetPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bare_metal_machine_key_set_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bare_metal_machine_key_set_update_parameters else None + _content = None + if isinstance(bare_metal_machine_key_set_update_parameters, (IOBase, bytes)): + _content = bare_metal_machine_key_set_update_parameters + else: + if bare_metal_machine_key_set_update_parameters is not None: + _content = json.dumps(bare_metal_machine_key_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bare_metal_machine_key_sets_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[_models.BareMetalMachineKeySetPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Default value is None. + :type bare_metal_machine_key_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + bare_metal_machine_key_set_update_parameters: Optional[ + Union[_models.BareMetalMachineKeySetPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BareMetalMachineKeySet]: + """Patch properties of bare metal machine key set for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :param bare_metal_machine_key_set_update_parameters: The request body. Is one of the following + types: BareMetalMachineKeySetPatchParameters, JSON, IO[bytes] Default value is None. + :type bare_metal_machine_key_set_update_parameters: + ~azure.mgmt.networkcloud.models.BareMetalMachineKeySetPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BareMetalMachineKeySet. The + BareMetalMachineKeySet is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :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)) + content_type = content_type if bare_metal_machine_key_set_update_parameters else None + cls: ClsType[_models.BareMetalMachineKeySet] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + bare_metal_machine_key_set_update_parameters=bare_metal_machine_key_set_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BareMetalMachineKeySet, 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.BareMetalMachineKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BareMetalMachineKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bare_metal_machine_key_sets_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + bare_metal_machine_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the bare metal machine key set of the provided 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. Required. + :type cluster_name: str + :param bare_metal_machine_key_set_name: The name of the bare metal machine key set. Required. + :type bare_metal_machine_key_set_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bare_metal_machine_key_set_name=bare_metal_machine_key_set_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.BareMetalMachineKeySet"]: + """Get a list of bare metal machine key sets for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BareMetalMachineKeySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BareMetalMachineKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BareMetalMachineKeySet]] = 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_bare_metal_machine_key_sets_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BareMetalMachineKeySet], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BmcKeySetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`bmc_key_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: NetworkCloudMgmtClientConfiguration = 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, bmc_key_set_name: str, **kwargs: Any + ) -> _models.BmcKeySet: + """Get baseboard management controller key set of the provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :return: BmcKeySet. The BmcKeySet is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.BmcKeySet + :raises ~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.BmcKeySet] = kwargs.pop("cls", None) + + _request = build_bmc_key_sets_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BmcKeySet, 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, + bmc_key_set_name: str, + bmc_key_set_parameters: Union[_models.BmcKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(bmc_key_set_parameters, (IOBase, bytes)): + _content = bmc_key_set_parameters + else: + _content = json.dumps(bmc_key_set_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bmc_key_sets_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: _models.BmcKeySet, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Required. + :type bmc_key_set_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_parameters: Union[_models.BmcKeySet, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Create a new baseboard management controller key set or update the existing one for the + provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_parameters: The request body. Is one of the following types: BmcKeySet, + JSON, IO[bytes] Required. + :type bmc_key_set_parameters: ~azure.mgmt.networkcloud.models.BmcKeySet or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :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.BmcKeySet] = 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, + bmc_key_set_name=bmc_key_set_name, + bmc_key_set_parameters=bmc_key_set_parameters, + etag=etag, + match_condition=match_condition, + 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.BmcKeySet, 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.BmcKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BmcKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if bmc_key_set_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if bmc_key_set_update_parameters else None + _content = None + if isinstance(bmc_key_set_update_parameters, (IOBase, bytes)): + _content = bmc_key_set_update_parameters + else: + if bmc_key_set_update_parameters is not None: + _content = json.dumps(bmc_key_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_bmc_key_sets_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[_models.BmcKeySetPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Default value is None. + :type bmc_key_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + bmc_key_set_update_parameters: Optional[Union[_models.BmcKeySetPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.BmcKeySet]: + """Patch properties of baseboard management controller key set for the provided cluster, or update + the tags associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :param bmc_key_set_update_parameters: The request body. Is one of the following types: + BmcKeySetPatchParameters, JSON, IO[bytes] Default value is None. + :type bmc_key_set_update_parameters: ~azure.mgmt.networkcloud.models.BmcKeySetPatchParameters + or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns BmcKeySet. The BmcKeySet is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.BmcKeySet] + :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)) + content_type = content_type if bmc_key_set_update_parameters else None + cls: ClsType[_models.BmcKeySet] = 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, + bmc_key_set_name=bmc_key_set_name, + bmc_key_set_update_parameters=bmc_key_set_update_parameters, + etag=etag, + match_condition=match_condition, + 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.BmcKeySet, 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.BmcKeySet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BmcKeySet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_bmc_key_sets_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + bmc_key_set_name=bmc_key_set_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + bmc_key_set_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the baseboard management controller key set of the provided 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. Required. + :type cluster_name: str + :param bmc_key_set_name: The name of the baseboard management controller key set. Required. + :type bmc_key_set_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + bmc_key_set_name=bmc_key_set_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.BmcKeySet"]: + """Get a list of baseboard management controller key sets for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of BmcKeySet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.BmcKeySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BmcKeySet]] = 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_bmc_key_sets_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.BmcKeySet], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`agent_pools` 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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Get properties of the provided Kubernetes cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :return: AgentPool. The AgentPool is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + + _request = build_agent_pools_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentPool, 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, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: Union[_models.AgentPool, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(agent_pool_parameters, (IOBase, bytes)): + _content = agent_pool_parameters + else: + _content = json.dumps(agent_pool_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agent_pools_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: _models.AgentPool, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Required. + :type agent_pool_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_parameters: Union[_models.AgentPool, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Create a new Kubernetes cluster agent pool or update the properties of the existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_parameters: The request body. Is one of the following types: AgentPool, JSON, + IO[bytes] Required. + :type agent_pool_parameters: ~azure.mgmt.networkcloud.models.AgentPool or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :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.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + agent_pool_parameters=agent_pool_parameters, + etag=etag, + match_condition=match_condition, + 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.AgentPool, 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.AgentPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AgentPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if agent_pool_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if agent_pool_update_parameters else None + _content = None + if isinstance(agent_pool_update_parameters, (IOBase, bytes)): + _content = agent_pool_update_parameters + else: + if agent_pool_update_parameters is not None: + _content = json.dumps(agent_pool_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_agent_pools_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[_models.AgentPoolPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Default value is None. + :type agent_pool_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + agent_pool_update_parameters: Optional[Union[_models.AgentPoolPatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Patch the properties of the provided Kubernetes cluster agent pool, or update the tags + associated with the Kubernetes cluster agent pool. Properties and tag updates can be done + independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :param agent_pool_update_parameters: The request body. Is one of the following types: + AgentPoolPatchParameters, JSON, IO[bytes] Default value is None. + :type agent_pool_update_parameters: ~azure.mgmt.networkcloud.models.AgentPoolPatchParameters or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AgentPool. The AgentPool is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.AgentPool] + :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)) + content_type = content_type if agent_pool_update_parameters else None + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + agent_pool_update_parameters=agent_pool_update_parameters, + etag=etag, + match_condition=match_condition, + 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.AgentPool, 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.AgentPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AgentPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_agent_pools_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + agent_pool_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param agent_pool_name: The name of the Kubernetes cluster agent pool. Required. + :type agent_pool_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + agent_pool_name=agent_pool_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_kubernetes_cluster( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AgentPool"]: + """Get a list of agent pools for the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of AgentPool + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentPool]] = 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_agent_pools_list_by_kubernetes_cluster_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.AgentPool], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class KubernetesClusterFeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`kubernetes_cluster_features` 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: NetworkCloudMgmtClientConfiguration = 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, kubernetes_cluster_name: str, feature_name: str, **kwargs: Any + ) -> _models.KubernetesClusterFeature: + """Get properties of the provided the Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :return: KubernetesClusterFeature. The KubernetesClusterFeature is compatible with + MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.KubernetesClusterFeature + :raises ~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.KubernetesClusterFeature] = kwargs.pop("cls", None) + + _request = build_kubernetes_cluster_features_get_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.KubernetesClusterFeature, 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, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(kubernetes_cluster_feature_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_feature_parameters + else: + _content = json.dumps(kubernetes_cluster_feature_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_kubernetes_cluster_features_create_or_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: _models.KubernetesClusterFeature, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeature + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Required. + :type kubernetes_cluster_feature_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_parameters: Union[_models.KubernetesClusterFeature, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Create a new Kubernetes cluster feature or update properties of the Kubernetes cluster feature + if it exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_parameters: The request body. Is one of the following types: + KubernetesClusterFeature, JSON, IO[bytes] Required. + :type kubernetes_cluster_feature_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeature or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :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.KubernetesClusterFeature] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + kubernetes_cluster_feature_parameters=kubernetes_cluster_feature_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesClusterFeature, 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.KubernetesClusterFeature].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.KubernetesClusterFeature]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[ + Union[_models.KubernetesClusterFeaturePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if kubernetes_cluster_feature_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if kubernetes_cluster_feature_update_parameters else None + _content = None + if isinstance(kubernetes_cluster_feature_update_parameters, (IOBase, bytes)): + _content = kubernetes_cluster_feature_update_parameters + else: + if kubernetes_cluster_feature_update_parameters is not None: + _content = json.dumps(kubernetes_cluster_feature_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_kubernetes_cluster_features_update_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[_models.KubernetesClusterFeaturePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Default value is None. + :type kubernetes_cluster_feature_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + kubernetes_cluster_feature_update_parameters: Optional[ + Union[_models.KubernetesClusterFeaturePatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.KubernetesClusterFeature]: + """Patch properties of the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :param kubernetes_cluster_feature_update_parameters: The request body. Is one of the following + types: KubernetesClusterFeaturePatchParameters, JSON, IO[bytes] Default value is None. + :type kubernetes_cluster_feature_update_parameters: + ~azure.mgmt.networkcloud.models.KubernetesClusterFeaturePatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns KubernetesClusterFeature. The + KubernetesClusterFeature is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :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)) + content_type = content_type if kubernetes_cluster_feature_update_parameters else None + cls: ClsType[_models.KubernetesClusterFeature] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + kubernetes_cluster_feature_update_parameters=kubernetes_cluster_feature_update_parameters, + etag=etag, + match_condition=match_condition, + 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.KubernetesClusterFeature, 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.KubernetesClusterFeature].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.KubernetesClusterFeature]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_kubernetes_cluster_features_delete_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + feature_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided Kubernetes cluster feature. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :param feature_name: The name of the feature. Required. + :type feature_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + kubernetes_cluster_name=kubernetes_cluster_name, + feature_name=feature_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_kubernetes_cluster( + self, + resource_group_name: str, + kubernetes_cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.KubernetesClusterFeature"]: + """Get a list of features for the provided Kubernetes cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kubernetes_cluster_name: The name of the Kubernetes cluster. Required. + :type kubernetes_cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of KubernetesClusterFeature + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.KubernetesClusterFeature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KubernetesClusterFeature]] = 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_kubernetes_cluster_features_list_by_kubernetes_cluster_request( + resource_group_name=resource_group_name, + kubernetes_cluster_name=kubernetes_cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.KubernetesClusterFeature], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConsolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`consoles` 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: NetworkCloudMgmtClientConfiguration = 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, virtual_machine_name: str, console_name: str, **kwargs: Any + ) -> _models.Console: + """Get properties of the provided virtual machine console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :return: Console. The Console is compatible with MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.Console + :raises ~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.Console] = kwargs.pop("cls", None) + + _request = build_consoles_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Console, 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, + virtual_machine_name: str, + console_name: str, + console_parameters: Union[_models.Console, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(console_parameters, (IOBase, bytes)): + _content = console_parameters + else: + _content = json.dumps(console_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_consoles_create_or_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: _models.Console, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_parameters: ~azure.mgmt.networkcloud.models.Console + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Required. + :type console_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_parameters: Union[_models.Console, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Create a new virtual machine console or update the properties of the existing virtual machine + console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_parameters: The request body. Is one of the following types: Console, JSON, + IO[bytes] Required. + :type console_parameters: ~azure.mgmt.networkcloud.models.Console or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :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.Console] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + console_parameters=console_parameters, + etag=etag, + match_condition=match_condition, + 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.Console, 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.Console].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Console]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[Union[_models.ConsolePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if console_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if console_update_parameters else None + _content = None + if isinstance(console_update_parameters, (IOBase, bytes)): + _content = console_update_parameters + else: + if console_update_parameters is not None: + _content = json.dumps(console_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_consoles_update_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[_models.ConsolePatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Default value is None. + :type console_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + console_update_parameters: Optional[Union[_models.ConsolePatchParameters, JSON, IO[bytes]]] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.Console]: + """Patch the properties of the provided virtual machine console, or update the tags associated + with the virtual machine console. Properties and tag updates can be done independently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :param console_update_parameters: The request body. Is one of the following types: + ConsolePatchParameters, JSON, IO[bytes] Default value is None. + :type console_update_parameters: ~azure.mgmt.networkcloud.models.ConsolePatchParameters or JSON + or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns Console. The Console is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Console] + :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)) + content_type = content_type if console_update_parameters else None + cls: ClsType[_models.Console] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + console_update_parameters=console_update_parameters, + etag=etag, + match_condition=match_condition, + 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.Console, 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.Console].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Console]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_consoles_delete_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + virtual_machine_name: str, + console_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the provided virtual machine console. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :param console_name: The name of the virtual machine console. Required. + :type console_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + virtual_machine_name=virtual_machine_name, + console_name=console_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_virtual_machine( + self, + resource_group_name: str, + virtual_machine_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.Console"]: + """Get a list of consoles for the provided virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: The name of the virtual machine. Required. + :type virtual_machine_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of Console + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Console] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Console]] = 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_consoles_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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.Console], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class MetricsConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s + :attr:`metrics_configurations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -76,21 +26520,895 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """List resource provider operations. + def get( + self, resource_group_name: str, cluster_name: str, metrics_configuration_name: str, **kwargs: Any + ) -> _models.ClusterMetricsConfiguration: + """Get metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :return: ClusterMetricsConfiguration. The ClusterMetricsConfiguration is compatible with + MutableMapping + :rtype: ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration + :raises ~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 {} - Get a list of all available resource provider operations. It contains a URL link to get the - next set of results. + cls: ClsType[_models.ClusterMetricsConfiguration] = kwargs.pop("cls", None) - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Operation] + _request = build_metrics_configurations_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterMetricsConfiguration, 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, + metrics_configuration_name: str, + metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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(metrics_configuration_parameters, (IOBase, bytes)): + _content = metrics_configuration_parameters + else: + _content = json.dumps(metrics_configuration_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_metrics_configurations_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: _models.ClusterMetricsConfiguration, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Required. + :type metrics_configuration_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 + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_parameters: Union[_models.ClusterMetricsConfiguration, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Create new or update the existing metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_parameters: The request body. Is one of the following types: + ClusterMetricsConfiguration, JSON, IO[bytes] Required. + :type metrics_configuration_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :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.ClusterMetricsConfiguration] = 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, + metrics_configuration_name=metrics_configuration_name, + metrics_configuration_parameters=metrics_configuration_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterMetricsConfiguration, 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.ClusterMetricsConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ClusterMetricsConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[ + Union[_models.ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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)) + content_type = content_type if metrics_configuration_update_parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if metrics_configuration_update_parameters else None + _content = None + if isinstance(metrics_configuration_update_parameters, (IOBase, bytes)): + _content = metrics_configuration_update_parameters + else: + if metrics_configuration_update_parameters is not None: + _content = json.dumps(metrics_configuration_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_metrics_configurations_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[_models.ClusterMetricsConfigurationPatchParameters] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Default value is None. + :type metrics_configuration_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + metrics_configuration_update_parameters: Optional[ + Union[_models.ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes]] + ] = None, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.ClusterMetricsConfiguration]: + """Patch properties of metrics configuration for the provided cluster, or update the tags + associated with it. Properties and tag updates can be done independently. + + :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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :param metrics_configuration_update_parameters: The request body. Is one of the following + types: ClusterMetricsConfigurationPatchParameters, JSON, IO[bytes] Default value is None. + :type metrics_configuration_update_parameters: + ~azure.mgmt.networkcloud.models.ClusterMetricsConfigurationPatchParameters or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns ClusterMetricsConfiguration. The + ClusterMetricsConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] + :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)) + content_type = content_type if metrics_configuration_update_parameters else None + cls: ClsType[_models.ClusterMetricsConfiguration] = 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, + metrics_configuration_name=metrics_configuration_name, + metrics_configuration_update_parameters=metrics_configuration_update_parameters, + etag=etag, + match_condition=match_condition, + 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.ClusterMetricsConfiguration, 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.ClusterMetricsConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ClusterMetricsConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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_metrics_configurations_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + metrics_configuration_name=metrics_configuration_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + metrics_configuration_name: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Delete the metrics configuration of the provided 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. Required. + :type cluster_name: str + :param metrics_configuration_name: The name of the metrics configuration for the cluster. + Required. + :type metrics_configuration_name: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatusResult] = 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, + metrics_configuration_name=metrics_configuration_name, + etag=etag, + match_condition=match_condition, + 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")) + + deserialized = _deserialize(_models.OperationStatusResult, 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.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ClusterMetricsConfiguration"]: + """Get a list of metrics configurations for the provided 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. Required. + :type cluster_name: str + :keyword top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :paramtype top: int + :keyword skip_token: The opaque token that the server returns to indicate where to continue + listing resources from. This is used for paging through large result sets. Default value is + None. + :paramtype skip_token: str + :return: An iterator like instance of ClusterMetricsConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.ClusterMetricsConfiguration] :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.ClusterMetricsConfiguration]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -103,12 +27421,22 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_metrics_configurations_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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 @@ -123,16 +27451,24 @@ 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.ClusterMetricsConfiguration], + 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) @@ -145,9 +27481,9 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_rack_skus_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_rack_skus_operations.py deleted file mode 100644 index 3f6ca9621011..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_rack_skus_operations.py +++ /dev/null @@ -1,247 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus") - 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(rack_sku_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName}" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "rackSkuName": _SERIALIZER.url( - "rack_sku_name", rack_sku_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,126}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RackSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`rack_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.RackSku"]: - """List rack SKUs in the subscription. - - Get a list of rack SKUs in the provided subscription. - - :return: An iterator like instance of either RackSku or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.RackSku] - :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.RackSkuList] = 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("RackSkuList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, rack_sku_name: str, **kwargs: Any) -> _models.RackSku: - """Retrieve the rack SKU. - - Get the properties of the provided rack SKU. - - :param rack_sku_name: The name of the rack SKU. Required. - :type rack_sku_name: str - :return: RackSku or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.RackSku - :raises ~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.RackSku] = kwargs.pop("cls", None) - - _request = build_get_request( - rack_sku_name=rack_sku_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RackSku", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_racks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_racks_operations.py deleted file mode 100644 index 699820c066a1..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_racks_operations.py +++ /dev/null @@ -1,1197 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks") - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, rack_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "rackName": _SERIALIZER.url( - "rack_name", rack_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - rack_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "rackName": _SERIALIZER.url( - "rack_name", rack_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - rack_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "rackName": _SERIALIZER.url( - "rack_name", rack_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - rack_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "rackName": _SERIALIZER.url( - "rack_name", rack_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class RacksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`racks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Rack"]: - """List racks in the subscription. - - Get a list of racks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Rack or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Rack] - :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.RackList] = 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, - top=top, - skip_token=skip_token, - 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("RackList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Rack"]: - """List racks in the resource group. - - Get a list of racks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Rack or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Rack] - :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.RackList] = 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, - top=top, - skip_token=skip_token, - 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("RackList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, rack_name: str, **kwargs: Any) -> _models.Rack: - """Retrieve the rack. - - Get properties of the provided rack. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :return: Rack or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Rack - :raises ~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.Rack] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Rack", 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, - rack_name: str, - rack_parameters: Union[_models.Rack, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(rack_parameters, (IOBase, bytes)): - _content = rack_parameters - else: - _json = self._serialize.body(rack_parameters, "Rack") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - rack_name: str, - rack_parameters: _models.Rack, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Required. - :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - rack_name: str, - rack_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Required. - :type rack_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - rack_name: str, - rack_parameters: Union[_models.Rack, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Create or update the rack. - - Create a new rack or update properties of the existing one. All customer initiated requests - will be rejected as the life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param rack_parameters: The request body. Is either a Rack type or a IO[bytes] type. Required. - :type rack_parameters: ~azure.mgmt.networkcloud.models.Rack or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :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.Rack] = 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, - rack_name=rack_name, - rack_parameters=rack_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Rack", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Rack].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Rack]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the rack. - - Delete the provided rack. All customer initiated requests will be rejected as the life cycle of - this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - rack_name=rack_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[Union[_models.RackPatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if rack_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if rack_update_parameters else None - _json = None - _content = None - if isinstance(rack_update_parameters, (IOBase, bytes)): - _content = rack_update_parameters - else: - if rack_update_parameters is not None: - _json = self._serialize.body(rack_update_parameters, "RackPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - rack_name=rack_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[_models.RackPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Default value is None. - :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters - :keyword content_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 Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Default value is None. - :type rack_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - rack_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - rack_update_parameters: Optional[Union[_models.RackPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.Rack]: - """Patch the rack. - - Patch properties of the provided rack, or update the tags associated with the rack. Properties - and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rack_name: The name of the rack. Required. - :type rack_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param rack_update_parameters: The request body. Is either a RackPatchParameters type or a - IO[bytes] type. Default value is None. - :type rack_update_parameters: ~azure.mgmt.networkcloud.models.RackPatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either Rack or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Rack] - :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)) - content_type = content_type if rack_update_parameters else None - cls: ClsType[_models.Rack] = 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, - rack_name=rack_name, - if_match=if_match, - if_none_match=if_none_match, - rack_update_parameters=rack_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Rack", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Rack].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Rack]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_storage_appliances_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_storage_appliances_operations.py deleted file mode 100644 index 18db39a18b93..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_storage_appliances_operations.py +++ /dev/null @@ -1,1914 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, storage_appliance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - storage_appliance_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - storage_appliance_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - storage_appliance_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - 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_disable_remote_vendor_management_request( # pylint: disable=name-too-long - resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/disableRemoteVendorManagement", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_enable_remote_vendor_management_request( # pylint: disable=name-too-long - resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/enableRemoteVendorManagement", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_run_read_commands_request( - resource_group_name: str, storage_appliance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/runReadCommands", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageApplianceName": _SERIALIZER.url( - "storage_appliance_name", - storage_appliance_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class StorageAppliancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`storage_appliances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.StorageAppliance"]: - """List storage appliances in the subscription. - - Get a list of storage appliances in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either StorageAppliance or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageApplianceList] = 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, - top=top, - skip_token=skip_token, - 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("StorageApplianceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.StorageAppliance"]: - """List storage appliances in the resource group. - - Get a list of storage appliances in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either StorageAppliance or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageApplianceList] = 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, - top=top, - skip_token=skip_token, - 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("StorageApplianceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any) -> _models.StorageAppliance: - """Retrieve the storage appliance. - - Get properties of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :return: StorageAppliance or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.StorageAppliance - :raises ~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.StorageAppliance] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("StorageAppliance", 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, - storage_appliance_name: str, - storage_appliance_parameters: Union[_models.StorageAppliance, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(storage_appliance_parameters, (IOBase, bytes)): - _content = storage_appliance_parameters - else: - _json = self._serialize.body(storage_appliance_parameters, "StorageAppliance") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - storage_appliance_name: str, - storage_appliance_parameters: _models.StorageAppliance, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Required. - :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Required. - :type storage_appliance_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_parameters: Union[_models.StorageAppliance, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Create or update the storage appliance. - - Create a new storage appliance or update the properties of the existing one. All customer - initiated requests will be rejected as the life cycle of this resource is managed by the - system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_parameters: The request body. Is either a StorageAppliance type or a - IO[bytes] type. Required. - :type storage_appliance_parameters: ~azure.mgmt.networkcloud.models.StorageAppliance or - IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :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.StorageAppliance] = 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, - storage_appliance_name=storage_appliance_name, - storage_appliance_parameters=storage_appliance_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("StorageAppliance", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageAppliance].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageAppliance]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the storage appliance. - - Delete the provided storage appliance. All customer initiated requests will be rejected as the - life cycle of this resource is managed by the system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - storage_appliance_name=storage_appliance_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[Union[_models.StorageAppliancePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if storage_appliance_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if storage_appliance_update_parameters else None - _json = None - _content = None - if isinstance(storage_appliance_update_parameters, (IOBase, bytes)): - _content = storage_appliance_update_parameters - else: - if storage_appliance_update_parameters is not None: - _json = self._serialize.body(storage_appliance_update_parameters, "StorageAppliancePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[_models.StorageAppliancePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Default value is None. - :type storage_appliance_update_parameters: - ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters - :keyword content_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 StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Default value is None. - :type storage_appliance_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - storage_appliance_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - storage_appliance_update_parameters: Optional[Union[_models.StorageAppliancePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.StorageAppliance]: - """Patch the storage appliance. - - Update properties of the provided storage appliance, or update tags associated with the storage - appliance Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param storage_appliance_update_parameters: The request body. Is either a - StorageAppliancePatchParameters type or a IO[bytes] type. Default value is None. - :type storage_appliance_update_parameters: - ~azure.mgmt.networkcloud.models.StorageAppliancePatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either StorageAppliance or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.StorageAppliance] - :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)) - content_type = content_type if storage_appliance_update_parameters else None - cls: ClsType[_models.StorageAppliance] = 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, - storage_appliance_name=storage_appliance_name, - if_match=if_match, - if_none_match=if_none_match, - storage_appliance_update_parameters=storage_appliance_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAppliance", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageAppliance].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageAppliance]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _disable_remote_vendor_management_initial( # pylint: disable=name-too-long - self, resource_group_name: str, storage_appliance_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_disable_remote_vendor_management_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable_remote_vendor_management( - self, resource_group_name: str, storage_appliance_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Turn off remote vendor management for a storage appliance, if supported. - - Disable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._disable_remote_vendor_management_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _enable_remote_vendor_management_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = ( - content_type or "application/json" if storage_appliance_enable_remote_vendor_management_parameters else None - ) - _json = None - _content = None - if isinstance(storage_appliance_enable_remote_vendor_management_parameters, (IOBase, bytes)): - _content = storage_appliance_enable_remote_vendor_management_parameters - else: - if storage_appliance_enable_remote_vendor_management_parameters is not None: - _json = self._serialize.body( - storage_appliance_enable_remote_vendor_management_parameters, - "StorageApplianceEnableRemoteVendorManagementParameters", - ) - else: - _json = None - - _request = build_enable_remote_vendor_management_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - _models.StorageApplianceEnableRemoteVendorManagementParameters - ] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default - value is None. - :type storage_appliance_enable_remote_vendor_management_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Default - value is None. - :type storage_appliance_enable_remote_vendor_management_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enable_remote_vendor_management( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_enable_remote_vendor_management_parameters: Optional[ - Union[_models.StorageApplianceEnableRemoteVendorManagementParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Turn on remote vendor management for a storage appliance, if supported. - - Enable remote vendor management of the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_enable_remote_vendor_management_parameters: The request body. Is - either a StorageApplianceEnableRemoteVendorManagementParameters type or a IO[bytes] type. - Default value is None. - :type storage_appliance_enable_remote_vendor_management_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceEnableRemoteVendorManagementParameters or - IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if storage_appliance_enable_remote_vendor_management_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._enable_remote_vendor_management_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - storage_appliance_enable_remote_vendor_management_parameters=storage_appliance_enable_remote_vendor_management_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _run_read_commands_initial( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: Union[ - _models.StorageApplianceRunReadCommandsParameters, 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(storage_appliance_run_read_commands_parameters, (IOBase, bytes)): - _content = storage_appliance_run_read_commands_parameters - else: - _json = self._serialize.body( - storage_appliance_run_read_commands_parameters, "StorageApplianceRunReadCommandsParameters" - ) - - _request = build_run_read_commands_request( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: _models.StorageApplianceRunReadCommandsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Required. - :type storage_appliance_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Required. - :type storage_appliance_run_read_commands_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_run_read_commands( - self, - resource_group_name: str, - storage_appliance_name: str, - storage_appliance_run_read_commands_parameters: Union[ - _models.StorageApplianceRunReadCommandsParameters, IO[bytes] - ], - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Run read-only commands against a storage appliance. - - Run one or more read-only commands on the provided storage appliance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_appliance_name: The name of the storage appliance. Required. - :type storage_appliance_name: str - :param storage_appliance_run_read_commands_parameters: The request body. Is either a - StorageApplianceRunReadCommandsParameters type or a IO[bytes] type. Required. - :type storage_appliance_run_read_commands_parameters: - ~azure.mgmt.networkcloud.models.StorageApplianceRunReadCommandsParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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._run_read_commands_initial( - resource_group_name=resource_group_name, - storage_appliance_name=storage_appliance_name, - storage_appliance_run_read_commands_parameters=storage_appliance_run_read_commands_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_trunked_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_trunked_networks_operations.py deleted file mode 100644 index 43c2bf82eeed..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_trunked_networks_operations.py +++ /dev/null @@ -1,1139 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, trunked_network_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "trunkedNetworkName": _SERIALIZER.url( - "trunked_network_name", - trunked_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - trunked_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "trunkedNetworkName": _SERIALIZER.url( - "trunked_network_name", - trunked_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - trunked_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "trunkedNetworkName": _SERIALIZER.url( - "trunked_network_name", - trunked_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - trunked_network_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "trunkedNetworkName": _SERIALIZER.url( - "trunked_network_name", - trunked_network_name, - "str", - pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class TrunkedNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`trunked_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.TrunkedNetwork"]: - """List trunked networks in the subscription. - - Get a list of trunked networks in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either TrunkedNetwork or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("TrunkedNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.TrunkedNetwork"]: - """List trunked networks in the resource group. - - Get a list of trunked networks in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either TrunkedNetwork or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetworkList] = 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, - top=top, - skip_token=skip_token, - 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("TrunkedNetworkList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, trunked_network_name: str, **kwargs: Any) -> _models.TrunkedNetwork: - """Retrieve the trunked network. - - Get properties of the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~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.TrunkedNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TrunkedNetwork", 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, - trunked_network_name: str, - trunked_network_parameters: Union[_models.TrunkedNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(trunked_network_parameters, (IOBase, bytes)): - _content = trunked_network_parameters - else: - _json = self._serialize.body(trunked_network_parameters, "TrunkedNetwork") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - trunked_network_name: str, - trunked_network_parameters: _models.TrunkedNetwork, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Required. - :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - trunked_network_name: str, - trunked_network_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Required. - :type trunked_network_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - trunked_network_name: str, - trunked_network_parameters: Union[_models.TrunkedNetwork, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.TrunkedNetwork]: - """Create or update the trunked network. - - Create a new trunked network or update the properties of the existing trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param trunked_network_parameters: The request body. Is either a TrunkedNetwork type or a - IO[bytes] type. Required. - :type trunked_network_parameters: ~azure.mgmt.networkcloud.models.TrunkedNetwork or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either TrunkedNetwork or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.TrunkedNetwork] - :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.TrunkedNetwork] = 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, - trunked_network_name=trunked_network_name, - trunked_network_parameters=trunked_network_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("TrunkedNetwork", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.TrunkedNetwork].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.TrunkedNetwork]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the trunked network. - - Delete the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - trunked_network_name=trunked_network_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[_models.TrunkedNetworkPatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Default value is None. - :type trunked_network_update_parameters: - ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Default value is None. - :type trunked_network_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - trunked_network_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - trunked_network_update_parameters: Optional[Union[_models.TrunkedNetworkPatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.TrunkedNetwork: - """Patch the trunked network. - - Update tags associated with the provided trunked network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param trunked_network_name: The name of the trunked network. Required. - :type trunked_network_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param trunked_network_update_parameters: The request body. Is either a - TrunkedNetworkPatchParameters type or a IO[bytes] type. Default value is None. - :type trunked_network_update_parameters: - ~azure.mgmt.networkcloud.models.TrunkedNetworkPatchParameters or IO[bytes] - :return: TrunkedNetwork or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.TrunkedNetwork - :raises ~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)) - content_type = content_type if trunked_network_update_parameters else None - cls: ClsType[_models.TrunkedNetwork] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if trunked_network_update_parameters else None - _json = None - _content = None - if isinstance(trunked_network_update_parameters, (IOBase, bytes)): - _content = trunked_network_update_parameters - else: - if trunked_network_update_parameters is not None: - _json = self._serialize.body(trunked_network_update_parameters, "TrunkedNetworkPatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - trunked_network_name=trunked_network_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TrunkedNetwork", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_virtual_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_virtual_machines_operations.py deleted file mode 100644 index 01e0cce5dfaf..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_virtual_machines_operations.py +++ /dev/null @@ -1,2190 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines" - ) - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - 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_assign_relay_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/assignRelay", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_power_off_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/powerOff", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reimage_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/reimage", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/restart", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/start", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "virtualMachineName": _SERIALIZER.url( - "virtual_machine_name", virtual_machine_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """List virtual machines in the subscription. - - Get a list of virtual machines in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachineList] = 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, - top=top, - skip_token=skip_token, - 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("VirtualMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VirtualMachine"]: - """List virtual machines in the resource group. - - Get a list of virtual machines in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachineList] = 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, - top=top, - skip_token=skip_token, - 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("VirtualMachineList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: - """Retrieve the virtual machine. - - Get properties of the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.VirtualMachine - :raises ~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.VirtualMachine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", 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, - virtual_machine_name: str, - virtual_machine_parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(virtual_machine_parameters, (IOBase, bytes)): - _content = virtual_machine_parameters - else: - _json = self._serialize.body(virtual_machine_parameters, "VirtualMachine") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - virtual_machine_name: str, - virtual_machine_parameters: _models.VirtualMachine, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Required. - :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Required. - :type virtual_machine_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_parameters: Union[_models.VirtualMachine, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Create or update the virtual machine. - - Create a new virtual machine or update the properties of the existing virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_parameters: The request body. Is either a VirtualMachine type or a - IO[bytes] type. Required. - :type virtual_machine_parameters: ~azure.mgmt.networkcloud.models.VirtualMachine or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :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.VirtualMachine] = 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, - virtual_machine_name=virtual_machine_name, - virtual_machine_parameters=virtual_machine_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the virtual machine. - - Delete the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[Union[_models.VirtualMachinePatchParameters, IO[bytes]]] = None, - **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)) - content_type = content_type if virtual_machine_update_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_update_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_update_parameters, (IOBase, bytes)): - _content = virtual_machine_update_parameters - else: - if virtual_machine_update_parameters is not None: - _json = self._serialize.body(virtual_machine_update_parameters, "VirtualMachinePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["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, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[_models.VirtualMachinePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Default value is None. - :type virtual_machine_update_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters - :keyword content_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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Default value is None. - :type virtual_machine_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - virtual_machine_update_parameters: Optional[Union[_models.VirtualMachinePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Patch the virtual machine. - - Patch the properties of the provided virtual machine, or update the tags associated with the - virtual machine. Properties and tag updates can be done independently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param virtual_machine_update_parameters: The request body. Is either a - VirtualMachinePatchParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_update_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePatchParameters or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.VirtualMachine] - :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)) - content_type = content_type if virtual_machine_update_parameters else None - cls: ClsType[_models.VirtualMachine] = 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, - virtual_machine_name=virtual_machine_name, - if_match=if_match, - if_none_match=if_none_match, - virtual_machine_update_parameters=virtual_machine_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _assign_relay_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[ - Union[_models.VirtualMachineAssignRelayParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if virtual_machine_assign_relay_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_assign_relay_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_assign_relay_parameters, (IOBase, bytes)): - _content = virtual_machine_assign_relay_parameters - else: - if virtual_machine_assign_relay_parameters is not None: - _json = self._serialize.body( - virtual_machine_assign_relay_parameters, "VirtualMachineAssignRelayParameters" - ) - else: - _json = None - - _request = build_assign_relay_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[_models.VirtualMachineAssignRelayParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Default value is None. - :type virtual_machine_assign_relay_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Default value is None. - :type virtual_machine_assign_relay_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_assign_relay( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_assign_relay_parameters: Optional[ - Union[_models.VirtualMachineAssignRelayParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Assigns a relay to the specified Microsoft.HybridCompute machine. - - Assigns a relay to the specified Microsoft.HybridCompute machine associated with the provided - virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_assign_relay_parameters: The request body. Is either a - VirtualMachineAssignRelayParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_assign_relay_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachineAssignRelayParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if virtual_machine_assign_relay_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._assign_relay_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - virtual_machine_assign_relay_parameters=virtual_machine_assign_relay_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _power_off_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[ - Union[_models.VirtualMachinePowerOffParameters, IO[bytes]] - ] = None, - **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)) - content_type = content_type if virtual_machine_power_off_parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if virtual_machine_power_off_parameters else None - _json = None - _content = None - if isinstance(virtual_machine_power_off_parameters, (IOBase, bytes)): - _content = virtual_machine_power_off_parameters - else: - if virtual_machine_power_off_parameters is not None: - _json = self._serialize.body(virtual_machine_power_off_parameters, "VirtualMachinePowerOffParameters") - else: - _json = None - - _request = build_power_off_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[_models.VirtualMachinePowerOffParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Default value is None. - :type virtual_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters - :keyword content_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Default value is None. - :type virtual_machine_power_off_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 OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_power_off( - self, - resource_group_name: str, - virtual_machine_name: str, - virtual_machine_power_off_parameters: Optional[ - Union[_models.VirtualMachinePowerOffParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Power off the virtual machine. - - Power off the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :param virtual_machine_power_off_parameters: The request body. Is either a - VirtualMachinePowerOffParameters type or a IO[bytes] type. Default value is None. - :type virtual_machine_power_off_parameters: - ~azure.mgmt.networkcloud.models.VirtualMachinePowerOffParameters or IO[bytes] - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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)) - content_type = content_type if virtual_machine_power_off_parameters else None - cls: ClsType[_models.OperationStatusResult] = 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._power_off_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - virtual_machine_power_off_parameters=virtual_machine_power_off_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("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _reimage_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reimage_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reimage( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Reimage the virtual machine. - - Reimage the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _restart_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Restart the virtual machine. - - Restart the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_initial(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Start the virtual machine. - - Start the provided virtual machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the virtual machine. Required. - :type virtual_machine_name: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_volumes_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_volumes_operations.py deleted file mode 100644 index 0d967f0e5a01..000000000000 --- a/sdk/networkcloud/azure-mgmt-networkcloud/azure/mgmt/networkcloud/operations/_volumes_operations.py +++ /dev/null @@ -1,1119 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import NetworkCloudMgmtClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes") - 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") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, volume_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "volumeName": _SERIALIZER.url( - "volume_name", volume_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - volume_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "volumeName": _SERIALIZER.url( - "volume_name", volume_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - volume_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "volumeName": _SERIALIZER.url( - "volume_name", volume_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - volume_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "volumeName": _SERIALIZER.url( - "volume_name", volume_name, "str", pattern=r"^([a-zA-Z0-9][a-zA-Z0-9-_]{0,62}[a-zA-Z0-9])$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class VolumesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.networkcloud.NetworkCloudMgmtClient`'s - :attr:`volumes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NetworkCloudMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Volume"]: - """List volumes in the subscription. - - Get a list of volumes in the provided subscription. - - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Volume or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Volume] - :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.VolumeList] = 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, - top=top, - skip_token=skip_token, - 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("VolumeList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Volume"]: - """List volumes in the resource group. - - Get a list of volumes in the provided resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of resources to return from the operation. Example: '$top=10'. - Default value is None. - :type top: int - :param skip_token: The opaque token that the server returns to indicate where to continue - listing resources from. This is used for paging through large result sets. Default value is - None. - :type skip_token: str - :return: An iterator like instance of either Volume or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkcloud.models.Volume] - :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.VolumeList] = 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, - top=top, - skip_token=skip_token, - 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("VolumeList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, volume_name: str, **kwargs: Any) -> _models.Volume: - """Retrieve the volume. - - Get properties of the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~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.Volume] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Volume", 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, - volume_name: str, - volume_parameters: Union[_models.Volume, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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(volume_parameters, (IOBase, bytes)): - _content = volume_parameters - else: - _json = self._serialize.body(volume_parameters, "Volume") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - volume_name: str, - volume_parameters: _models.Volume, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Required. - :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :keyword content_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 Volume or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - volume_name: str, - volume_parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Required. - :type volume_parameters: IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :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 Volume or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - volume_name: str, - volume_parameters: Union[_models.Volume, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Volume]: - """Create or update the volume. - - Create a new volume or update the properties of the existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param volume_parameters: The request body. Is either a Volume type or a IO[bytes] type. - Required. - :type volume_parameters: ~azure.mgmt.networkcloud.models.Volume or IO[bytes] - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Volume or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.Volume] - :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.Volume] = 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, - volume_name=volume_name, - volume_parameters=volume_parameters, - if_match=if_match, - if_none_match=if_none_match, - 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("Volume", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Volume].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Volume]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **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, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Delete the volume. - - Delete the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkcloud.models.OperationStatusResult] - :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.OperationStatusResult] = 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, - volume_name=volume_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", 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.OperationStatusResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationStatusResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[_models.VolumePatchParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Default value is None. - :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Default value is None. - :type volume_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - volume_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - volume_update_parameters: Optional[Union[_models.VolumePatchParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Volume: - """Patch the volume. - - Update tags associated with the provided volume. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param volume_name: The name of the volume. Required. - :type volume_name: str - :param if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing resource. Other values will result in error from server as they are not - supported. Default value is None. - :type if_none_match: str - :param volume_update_parameters: The request body. Is either a VolumePatchParameters type or a - IO[bytes] type. Default value is None. - :type volume_update_parameters: ~azure.mgmt.networkcloud.models.VolumePatchParameters or - IO[bytes] - :return: Volume or the result of cls(response) - :rtype: ~azure.mgmt.networkcloud.models.Volume - :raises ~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)) - content_type = content_type if volume_update_parameters else None - cls: ClsType[_models.Volume] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if volume_update_parameters else None - _json = None - _content = None - if isinstance(volume_update_parameters, (IOBase, bytes)): - _content = volume_update_parameters - else: - if volume_update_parameters is not None: - _json = self._serialize.body(volume_update_parameters, "VolumePatchParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - volume_name=volume_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Volume", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_create.py index fe48fedfbbf3..1ca9933179c7 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pools.begin_create_or_update( @@ -86,6 +86,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/AgentPools_Create.json +# x-ms-original-file: 2025-09-01/AgentPools_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_delete.py index 7694f3325647..242b8b5498c1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pools.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/AgentPools_Delete.json +# x-ms-original-file: 2025-09-01/AgentPools_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_get.py index 0fe5349b8cdc..3aabce9f101c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pools.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/AgentPools_Get.json +# x-ms-original-file: 2025-09-01/AgentPools_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_list_by_kubernetes_cluster.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_list_by_kubernetes_cluster.py index 29edceb8c09d..c00461fae94d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_list_by_kubernetes_cluster.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_list_by_kubernetes_cluster.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pools.list_by_kubernetes_cluster( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/AgentPools_ListByKubernetesCluster.json +# x-ms-original-file: 2025-09-01/AgentPools_ListByKubernetesCluster.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_patch.py index dd33733b77e8..d93c4af0ee1e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/agent_pools_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pools.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/AgentPools_Patch.json +# x-ms-original-file: 2025-09-01/AgentPools_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_create.py index 449993a93a76..0d5be2f4b6cd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machine_key_sets.begin_create_or_update( @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachineKeySets_Create.json +# x-ms-original-file: 2025-09-01/BareMetalMachineKeySets_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_delete.py index b9627ed57a5c..efbf07ec7b3e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machine_key_sets.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachineKeySets_Delete.json +# x-ms-original-file: 2025-09-01/BareMetalMachineKeySets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_get.py index 2ad0707ecddb..1a96f4f78bca 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machine_key_sets.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachineKeySets_Get.json +# x-ms-original-file: 2025-09-01/BareMetalMachineKeySets_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_list_by_cluster.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_list_by_cluster.py index 610aaeaffc86..f944a1ee28ae 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_list_by_cluster.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_list_by_cluster.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machine_key_sets.list_by_cluster( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachineKeySets_ListByCluster.json +# x-ms-original-file: 2025-09-01/BareMetalMachineKeySets_ListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_patch.py index 219c04670096..16cc0b62ee13 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machine_key_sets_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machine_key_sets.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachineKeySets_Patch.json +# x-ms-original-file: 2025-09-01/BareMetalMachineKeySets_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_cordon.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_cordon.py index 664682ce3d86..54790e7ce01e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_cordon.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_cordon.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_cordon( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Cordon.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Cordon.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_create.py index 7e412937ec5c..8a86eeb91f05 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_create_or_update( @@ -41,7 +41,7 @@ def main(): }, "location": "location", "properties": { - "bmcConnectionString": "bmcconnectionstring", + "bmcConnectionString": "redfish+https://10.10.10.16/redfish/v1/Systems/System.Embedded.1", "bmcCredentials": {"password": "{password}", "username": "bmcuser"}, "bmcMacAddress": "00:00:4f:00:57:00", "bootMacAddress": "00:00:4e:00:58:af", @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Create.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_delete.py index 96224ed2eb67..842059ac385b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Delete.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_get.py index efa175bdde96..fafca7472bb6 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Get.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_resource_group.py index b5a5f09f5da1..bc4b79e2963b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_subscription.py index c5331f4f2601..2b93411c4516 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_ListBySubscription.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_patch.py index 4b9e238534a9..415b8a03a34c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Patch.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_power_off.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_power_off.py index 33d4b59fd763..31893ad7eabc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_power_off.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_power_off.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_power_off( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_PowerOff.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_PowerOff.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_reimage.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_reimage.py index 9ca1ba7f1a54..6cc44ae27e86 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_reimage.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_reimage.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_reimage( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Reimage.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Reimage.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_replace.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_replace.py index ddc41c9f9e2b..25e739ab449f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_replace.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_replace.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_replace( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Replace.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Replace.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_restart.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_restart.py index d97f1a1918b0..9e1554204044 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_restart.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_restart.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_restart( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Restart.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Restart.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_command.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_command.py index d0f4b6c296e1..b16ab7cf33a1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_command.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_command.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_run_command( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_RunCommand.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_RunCommand.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts.py index ebcc51eba637..2b4b784fa389 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_run_data_extracts( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_RunDataExtracts.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_RunDataExtracts.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts_restricted.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts_restricted.py index 0a26758e1985..1b95ec41d443 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts_restricted.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_data_extracts_restricted.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_run_data_extracts_restricted( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_RunDataExtractsRestricted.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_RunDataExtractsRestricted.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_hostname.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_hostname.py index 07ab6da4dce7..5db8bc37789c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_hostname.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_hostname.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_run_read_commands( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_RunReadCommands_Hostname.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_RunReadCommands_Hostname.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_multiple.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_multiple.py index 8d06f8005963..8b3a3397770f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_multiple.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_run_read_commands_multiple.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_run_read_commands( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_RunReadCommands_Multiple.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_RunReadCommands_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_start.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_start.py index fabe0978f4eb..2ffb0370b1b5 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_start.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_start.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_start( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Start.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Start.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_uncordon.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_uncordon.py index 748b06d9a18c..554c3e3aad9f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_uncordon.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bare_metal_machines_uncordon.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bare_metal_machines.begin_uncordon( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BareMetalMachines_Uncordon.json +# x-ms-original-file: 2025-09-01/BareMetalMachines_Uncordon.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_create.py index 90ee8a1ef6f4..e849ff8d3971 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bmc_key_sets.begin_create_or_update( @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BmcKeySets_Create.json +# x-ms-original-file: 2025-09-01/BmcKeySets_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_delete.py index c3570a71b715..e4dd3f513291 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bmc_key_sets.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BmcKeySets_Delete.json +# x-ms-original-file: 2025-09-01/BmcKeySets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_get.py index 45b48846939f..b625817c2fcc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bmc_key_sets.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BmcKeySets_Get.json +# x-ms-original-file: 2025-09-01/BmcKeySets_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_list_by_cluster.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_list_by_cluster.py index 2c0346a88a48..16ba1cb38864 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_list_by_cluster.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_list_by_cluster.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bmc_key_sets.list_by_cluster( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BmcKeySets_ListByCluster.json +# x-ms-original-file: 2025-09-01/BmcKeySets_ListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_patch.py index c434eeadf350..3047689bc16d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/bmc_key_sets_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.bmc_key_sets.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/BmcKeySets_Patch.json +# x-ms-original-file: 2025-09-01/BmcKeySets_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_create.py index 67a3162f19f0..3aa58eae72e2 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.begin_create_or_update( @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_Create.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_delete.py index 5690db2ed357..8488404d90e6 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_Delete.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_get.py index 39f0ada3bac8..8e921e2b9d10 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_Get.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_resource_group.py index a52d7a98a70f..464d2319f9cd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_subscription.py index 0d83f9aaa526..4128ad4784aa 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_ListBySubscription.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_patch.py index 736dc2674999..077b5778b3d8 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cloud_services_networks_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_services_networks.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/CloudServicesNetworks_Patch.json +# x-ms-original-file: 2025-09-01/CloudServicesNetworks_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create.py index 9a914faa9658..4da584a16ac1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.begin_create_or_update( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_Create.json +# x-ms-original-file: 2025-09-01/ClusterManagers_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create_uami.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create_uami.py index a1287462a64e..7cacb0718907 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create_uami.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_create_uami.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.begin_create_or_update( @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_Create_Uami.json +# x-ms-original-file: 2025-09-01/ClusterManagers_Create_Uami.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_delete.py index b4002b984e66..2c225d4a28bd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_Delete.json +# x-ms-original-file: 2025-09-01/ClusterManagers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_get.py index c1ef138dc77b..cef697a3390a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_Get.json +# x-ms-original-file: 2025-09-01/ClusterManagers_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_resource_group.py index 5fd910bf4bb4..e74b17b6cf96 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/ClusterManagers_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_subscription.py index b3de89550f2c..05170557c98b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_ListBySubscription.json +# x-ms-original-file: 2025-09-01/ClusterManagers_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_patch.py index 4e8a24d193be..f7a2ea4f0cd3 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_managers_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_managers.update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterManagers_Patch.json +# x-ms-original-file: 2025-09-01/ClusterManagers_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_create.py index 35cd3159ccdc..c09d1d7431fb 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.metrics_configurations.begin_create_or_update( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterMetricsConfigurations_Create.json +# x-ms-original-file: 2025-09-01/ClusterMetricsConfigurations_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_delete.py index 3761e1c4f59b..05774fbfd63e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.metrics_configurations.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterMetricsConfigurations_Delete.json +# x-ms-original-file: 2025-09-01/ClusterMetricsConfigurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_get.py index 80d85f2e633b..dbe2effb860b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.metrics_configurations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterMetricsConfigurations_Get.json +# x-ms-original-file: 2025-09-01/ClusterMetricsConfigurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_list_by_cluster.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_list_by_cluster.py index 0799c23d4135..9d85a97f0df1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_list_by_cluster.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_list_by_cluster.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.metrics_configurations.list_by_cluster( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterMetricsConfigurations_ListByCluster.json +# x-ms-original-file: 2025-09-01/ClusterMetricsConfigurations_ListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_patch.py index a243b130dfc1..f717fb1d771e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/cluster_metrics_configurations_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.metrics_configurations.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/ClusterMetricsConfigurations_Patch.json +# x-ms-original-file: 2025-09-01/ClusterMetricsConfigurations_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_continue_update_version.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_continue_update_version.py index 47c96664e96e..907238e73085 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_continue_update_version.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_continue_update_version.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_continue_update_version( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_ContinueUpdateVersion.json +# x-ms-original-file: 2025-09-01/Clusters_ContinueUpdateVersion.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_create.py index 22db38e29cd6..b7648f448871 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_create_or_update( @@ -188,6 +188,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Create.json +# x-ms-original-file: 2025-09-01/Clusters_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_delete.py index eab2e43c8fe8..a789a88da815 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Delete.json +# x-ms-original-file: 2025-09-01/Clusters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy.py index 8e7dfc643ac4..bb7199c41719 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_deploy( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Deploy.json +# x-ms-original-file: 2025-09-01/Clusters_Deploy.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy_skip_validation.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy_skip_validation.py index 3a9e45b8366c..797951188c58 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy_skip_validation.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_deploy_skip_validation.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_deploy( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Deploy_SkipValidation.json +# x-ms-original-file: 2025-09-01/Clusters_Deploy_SkipValidation.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_get.py index b76891685ebb..4526140462e5 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Get.json +# x-ms-original-file: 2025-09-01/Clusters_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_resource_group.py index 08fca98fc2e5..024f032fb0b8 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/Clusters_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_subscription.py index 6a2c4ce668ce..d5bf6e4edf54 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_ListBySubscription.json +# x-ms-original-file: 2025-09-01/Clusters_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_aggregator_or_single_rack_definition.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_aggregator_or_single_rack_definition.py index dc8b61b0f53f..4e8f499b0883 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_aggregator_or_single_rack_definition.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_aggregator_or_single_rack_definition.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_AggregatorOrSingleRackDefinition.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_AggregatorOrSingleRackDefinition.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_analytics_output.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_analytics_output.py index 95bb27a04b12..deb09bb816e4 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_analytics_output.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_analytics_output.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_AnalyticsOutput.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_AnalyticsOutput.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_command_output.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_command_output.py index 1f9d7f258390..d72cd5d65bce 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_command_output.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_command_output.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_CommandOutput.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_CommandOutput.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_location.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_location.py index c7e906bb011d..be88331771cf 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_location.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_location.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_Location.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_Location.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_runtime_protection_configuration.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_runtime_protection_configuration.py index 8ef32ac87440..9ba54e988cc9 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_runtime_protection_configuration.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_runtime_protection_configuration.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_RuntimeProtectionConfiguration.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_RuntimeProtectionConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_secret_archive.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_secret_archive.py index bebd1d6a7950..19f017e6c3e4 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_secret_archive.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_secret_archive.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_SecretArchive.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_SecretArchive.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_update_strategy.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_update_strategy.py index 199d832805e6..b7e1e7b83538 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_update_strategy.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_update_strategy.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_UpdateStrategy.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_UpdateStrategy.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_vulnerability_scanning.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_vulnerability_scanning.py index bd5877d96749..b958b4a4594f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_vulnerability_scanning.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_patch_vulnerability_scanning.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_Patch_VulnerabilityScanning.json +# x-ms-original-file: 2025-09-01/Clusters_Patch_VulnerabilityScanning.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_scan_runtime.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_scan_runtime.py index 0a09b7f3dbb9..06bcb31de243 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_scan_runtime.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_scan_runtime.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_scan_runtime( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_ScanRuntime.json +# x-ms-original-file: 2025-09-01/Clusters_ScanRuntime.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_update_version.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_update_version.py index 0d8b277fd358..a7a55496dae7 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_update_version.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/clusters_update_version.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.clusters.begin_update_version( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Clusters_UpdateVersion.json +# x-ms-original-file: 2025-09-01/Clusters_UpdateVersion.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_create.py index 989b26138618..4b1f416e3d5e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.consoles.begin_create_or_update( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Consoles_Create.json +# x-ms-original-file: 2025-09-01/Consoles_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_delete.py index e5a5469738a0..c9d3c8ac3c5c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.consoles.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Consoles_Delete.json +# x-ms-original-file: 2025-09-01/Consoles_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_get.py index b8748ad5df6f..10035812eef0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.consoles.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Consoles_Get.json +# x-ms-original-file: 2025-09-01/Consoles_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_list_by_virtual_machine.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_list_by_virtual_machine.py index 4be191746873..34659cf12413 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_list_by_virtual_machine.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_list_by_virtual_machine.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.consoles.list_by_virtual_machine( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Consoles_ListByVirtualMachine.json +# x-ms-original-file: 2025-09-01/Consoles_ListByVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_patch.py index 64c2f9534613..364ff90c46c3 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/consoles_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.consoles.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Consoles_Patch.json +# x-ms-original-file: 2025-09-01/Consoles_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_create.py index 0bb6dcd36236..fc4a62c609a8 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_create.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_cluster_features.begin_create_or_update( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusterFeatures_Create.json +# x-ms-original-file: 2025-09-01/KubernetesClusterFeatures_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_delete.py index f5ecf21c5de4..f8460aeba19d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_cluster_features.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusterFeatures_Delete.json +# x-ms-original-file: 2025-09-01/KubernetesClusterFeatures_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_get.py index e2b4851f883f..47cba3efa4eb 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_cluster_features.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusterFeatures_Get.json +# x-ms-original-file: 2025-09-01/KubernetesClusterFeatures_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_list_by_kubernetes_cluster.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_list_by_kubernetes_cluster.py index 269d2d211a20..653f13acc4ad 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_list_by_kubernetes_cluster.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_list_by_kubernetes_cluster.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_cluster_features.list_by_kubernetes_cluster( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusterFeatures_ListByKubernetesCluster.json +# x-ms-original-file: 2025-09-01/KubernetesClusterFeatures_ListByKubernetesCluster.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_patch.py index 91647a0ff291..ea77fcb5824c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_cluster_features_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_cluster_features.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusterFeatures_Patch.json +# x-ms-original-file: 2025-09-01/KubernetesClusterFeatures_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_create.py index 76ff6f0d2d0f..7354719d2490 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.begin_create_or_update( @@ -174,6 +174,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_Create.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_delete.py index c8657e7b157c..d001bfde286d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_Delete.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_get.py index 2f62df3abce4..41499b2620fe 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_Get.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_l2_load_balancer_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_l2_load_balancer_create.py index c93b0589a83e..af19cc43a598 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_l2_load_balancer_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_l2_load_balancer_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.begin_create_or_update( @@ -147,6 +147,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_L2LoadBalancer_Create.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_L2LoadBalancer_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_resource_group.py index 3af51cabe650..0ee8a0b5234d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_subscription.py index f00644c34fc3..97080cc088cb 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_ListBySubscription.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_patch.py index 9ba9625ebaa3..3b019256737a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_Patch.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_restart_node.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_restart_node.py index 8e21b2e6e8fe..98efd4e4dfda 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_restart_node.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/kubernetes_clusters_restart_node.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.kubernetes_clusters.begin_restart_node( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/KubernetesClusters_RestartNode.json +# x-ms-original-file: 2025-09-01/KubernetesClusters_RestartNode.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_create.py index 64f38025e71e..703c490df96e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.begin_create_or_update( @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_Create.json +# x-ms-original-file: 2025-09-01/L2Networks_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_delete.py index 360f07fd1467..afbfbc511aaa 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_Delete.json +# x-ms-original-file: 2025-09-01/L2Networks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_get.py index fc034e07e817..77517e71055f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_Get.json +# x-ms-original-file: 2025-09-01/L2Networks_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_resource_group.py index 43ee20df1eed..9fec92cd797c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/L2Networks_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_subscription.py index 69c40346c6f7..3d59ceb5aa7f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_ListBySubscription.json +# x-ms-original-file: 2025-09-01/L2Networks_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_patch.py index f8351d3e7ba3..ba827f195b2f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l2_networks_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l2_networks.update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L2Networks_Patch.json +# x-ms-original-file: 2025-09-01/L2Networks_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_create.py index bb8a1c8e7156..410c9eaa94ac 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.begin_create_or_update( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_Create.json +# x-ms-original-file: 2025-09-01/L3Networks_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_delete.py index 4df3f655be1b..6b97f5db777a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_Delete.json +# x-ms-original-file: 2025-09-01/L3Networks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_get.py index b9ac92fa3627..f744d8211888 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_Get.json +# x-ms-original-file: 2025-09-01/L3Networks_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_resource_group.py index 9bdb7ab3cc12..bfb84911a1c2 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/L3Networks_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_subscription.py index 4fcc3a85159b..9eaf290ab92a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_ListBySubscription.json +# x-ms-original-file: 2025-09-01/L3Networks_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_patch.py index 9b6192b79b4f..1882794fde9e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/l3_networks_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.l3_networks.update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/L3Networks_Patch.json +# x-ms-original-file: 2025-09-01/L3Networks_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/operations_list.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/operations_list.py index 9335700e2528..431c47b4b468 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/operations_list.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/operations_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Operations_List.json +# x-ms-original-file: 2025-09-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_get.py index f25ee5361942..fd5f8d4686bb 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.rack_skus.get( @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/RackSkus_Get.json +# x-ms-original-file: 2025-09-01/RackSkus_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_list_by_subscription.py index ba89d676e50f..b51d090da444 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/rack_skus_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.rack_skus.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/RackSkus_ListBySubscription.json +# x-ms-original-file: 2025-09-01/RackSkus_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_create.py index 7c7e0301f336..769eaefea87c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.begin_create_or_update( @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_Create.json +# x-ms-original-file: 2025-09-01/Racks_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_delete.py index 6876572e3f08..1a9336b5ee91 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_Delete.json +# x-ms-original-file: 2025-09-01/Racks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_get.py index ba8e35b11a5e..d695b18740ab 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_Get.json +# x-ms-original-file: 2025-09-01/Racks_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_resource_group.py index ee4fc70b7d52..83b1341606fd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/Racks_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_subscription.py index 8419e98a861b..cd56f08ba54c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_ListBySubscription.json +# x-ms-original-file: 2025-09-01/Racks_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_patch.py index f4cef9200c05..b7f237532f99 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/racks_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.racks.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Racks_Patch.json +# x-ms-original-file: 2025-09-01/Racks_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_create.py index e4447c655ba1..f5b5fdd54baa 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_create_or_update( @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_Create.json +# x-ms-original-file: 2025-09-01/StorageAppliances_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_delete.py index 2a70ebf175b9..ed95947e58c1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_Delete.json +# x-ms-original-file: 2025-09-01/StorageAppliances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_disable_remote_vendor_management.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_disable_remote_vendor_management.py index cdaefd6edd26..76cec268dd7b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_disable_remote_vendor_management.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_disable_remote_vendor_management.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_disable_remote_vendor_management( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_DisableRemoteVendorManagement.json +# x-ms-original-file: 2025-09-01/StorageAppliances_DisableRemoteVendorManagement.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_enable_remote_vendor_management.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_enable_remote_vendor_management.py index 803388b3cfa4..cd626bb56d25 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_enable_remote_vendor_management.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_enable_remote_vendor_management.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_enable_remote_vendor_management( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_EnableRemoteVendorManagement.json +# x-ms-original-file: 2025-09-01/StorageAppliances_EnableRemoteVendorManagement.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_get.py index 934e9e2eb58b..cf327a531150 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_Get.json +# x-ms-original-file: 2025-09-01/StorageAppliances_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_resource_group.py index f819a28ae669..445320eebee3 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/StorageAppliances_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_subscription.py index ec96c2009efb..e5d6346a1c38 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_ListBySubscription.json +# x-ms-original-file: 2025-09-01/StorageAppliances_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_patch.py index 024d24ff80ba..88c881301f76 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_Patch.json +# x-ms-original-file: 2025-09-01/StorageAppliances_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_run_read_commands.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_run_read_commands.py index 8b2d52cf7ea4..5f301c16f509 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_run_read_commands.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/storage_appliances_run_read_commands.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_appliances.begin_run_read_commands( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/StorageAppliances_RunReadCommands.json +# x-ms-original-file: 2025-09-01/StorageAppliances_RunReadCommands.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_create.py index 737f2d0e84f8..fd75e93fed26 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.begin_create_or_update( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_Create.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_delete.py index cf9db582bd35..c871f3701bfb 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_Delete.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_get.py index d9d6094ed350..1e0302a9891e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_Get.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_resource_group.py index f17b8e22f0b9..e2bd051a117f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_subscription.py index 2375730e2b7e..2ec4d4a42c49 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_ListBySubscription.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_patch.py index de9151249152..c7dcfad08556 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/trunked_networks_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.trunked_networks.update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/TrunkedNetworks_Patch.json +# x-ms-original-file: 2025-09-01/TrunkedNetworks_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_assign_relay.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_assign_relay.py index 070fc905b78d..31cdbfb149a8 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_assign_relay.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_assign_relay.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_assign_relay( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_AssignRelay.json +# x-ms-original-file: 2025-09-01/VirtualMachines_AssignRelay.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_create.py index f972f79d3172..1d0f3a347639 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_create_or_update( @@ -100,6 +100,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Create.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_delete.py index c8c70338acde..cd0814f7bfcc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Delete.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_get.py index 42ce574e2ff9..4312f556a49e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Get.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_resource_group.py index bd8cbb7696a6..db8cadd5150f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/VirtualMachines_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_subscription.py index 76d2c1219e45..1df667055557 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_ListBySubscription.json +# x-ms-original-file: 2025-09-01/VirtualMachines_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_patch.py index 9ea2ecd332ed..9a2cedefe497 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Patch.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_power_off.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_power_off.py index 043d6cb5d877..c96d66f62a93 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_power_off.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_power_off.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_power_off( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_PowerOff.json +# x-ms-original-file: 2025-09-01/VirtualMachines_PowerOff.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_reimage.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_reimage.py index 1bc1fb11e128..f10882284acf 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_reimage.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_reimage.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_reimage( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Reimage.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Reimage.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_restart.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_restart.py index 7aa029583cef..f482732e7a22 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_restart.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_restart.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_restart( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Restart.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Restart.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_start.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_start.py index b51f29c57a15..df0cbdb2cef1 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_start.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/virtual_machines_start.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.virtual_machines.begin_start( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/VirtualMachines_Start.json +# x-ms-original-file: 2025-09-01/VirtualMachines_Start.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_create.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_create.py index fbc2c93e07ed..2b2a7e7a8a77 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_create.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_create.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.begin_create_or_update( @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_Create.json +# x-ms-original-file: 2025-09-01/Volumes_Create.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_delete.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_delete.py index d613881f09ac..8c669b34d91d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_delete.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.begin_delete( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_Delete.json +# x-ms-original-file: 2025-09-01/Volumes_Delete.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_get.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_get.py index 922b5371804b..ae442c7fe77c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_get.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_Get.json +# x-ms-original-file: 2025-09-01/Volumes_Get.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_resource_group.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_resource_group.py index 9a0c445bdde6..ada7a02a7194 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_resource_group.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_ListByResourceGroup.json +# x-ms-original-file: 2025-09-01/Volumes_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_subscription.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_subscription.py index ad8bc82cdfcf..50418a9cb0f3 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_subscription.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_ListBySubscription.json +# x-ms-original-file: 2025-09-01/Volumes_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_patch.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_patch.py index 4a170324f766..542e37a68039 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_patch.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_samples/volumes_patch.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = NetworkCloudMgmtClient( credential=DefaultAzureCredential(), - subscription_id="123e4567-e89b-12d3-a456-426655440000", + subscription_id="SUBSCRIPTION_ID", ) response = client.volumes.update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/networkcloud/resource-manager/Microsoft.NetworkCloud/stable/2025-09-01/examples/Volumes_Patch.json +# x-ms-original-file: 2025-09-01/Volumes_Patch.json if __name__ == "__main__": main() diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/conftest.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/conftest.py index 185aecc42db0..aa21a7e44b76 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/conftest.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/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/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations.py index 3ca654a1e1fc..de69009053b8 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_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,18 +18,6 @@ class TestNetworkCloudMgmtAgentPoolsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_list_by_kubernetes_cluster(self, resource_group): - response = self.client.agent_pools.list_by_kubernetes_cluster( - resource_group_name=resource_group.name, - kubernetes_cluster_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_agent_pools_get(self, resource_group): @@ -37,7 +25,6 @@ def test_agent_pools_get(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -51,27 +38,31 @@ def test_agent_pools_begin_create_or_update(self, resource_group): kubernetes_cluster_name="str", agent_pool_name="str", agent_pool_parameters={ - "count": 0, "location": "str", - "mode": "str", - "vmSkuName": "str", - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "2M"}, - "attachedNetworkConfiguration": { - "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], - "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + "properties": { + "count": 0, + "mode": "str", + "vmSkuName": "str", + "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, + "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "str"}, + "attachedNetworkConfiguration": { + "l2Networks": [{"networkId": "str", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], + "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + }, + "availabilityZones": ["str"], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "kubernetesVersion": "str", + "labels": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "taints": [{"key": "str", "value": "str"}], + "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, }, - "availabilityZones": ["str"], - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", - "kubernetesVersion": "str", - "labels": [{"key": "str", "value": "str"}], "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -81,11 +72,8 @@ def test_agent_pools_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "taints": [{"key": "str", "value": "str"}], "type": "str", - "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -93,12 +81,11 @@ def test_agent_pools_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_agent_pools_begin_delete(self, resource_group): - response = self.client.agent_pools.begin_delete( + def test_agent_pools_begin_update(self, resource_group): + response = self.client.agent_pools.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -106,13 +93,23 @@ def test_agent_pools_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_agent_pools_begin_update(self, resource_group): - response = self.client.agent_pools.begin_update( + def test_agent_pools_begin_delete(self, resource_group): + response = self.client.agent_pools.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_agent_pools_list_by_kubernetes_cluster(self, resource_group): + response = self.client.agent_pools.list_by_kubernetes_cluster( + resource_group_name=resource_group.name, + kubernetes_cluster_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations_async.py index 7fbc586ec527..77cd3b19710d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_agent_pools_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,18 +19,6 @@ class TestNetworkCloudMgmtAgentPoolsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_list_by_kubernetes_cluster(self, resource_group): - response = self.client.agent_pools.list_by_kubernetes_cluster( - resource_group_name=resource_group.name, - kubernetes_cluster_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_agent_pools_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_agent_pools_get(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -53,27 +40,31 @@ async def test_agent_pools_begin_create_or_update(self, resource_group): kubernetes_cluster_name="str", agent_pool_name="str", agent_pool_parameters={ - "count": 0, "location": "str", - "mode": "str", - "vmSkuName": "str", - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "2M"}, - "attachedNetworkConfiguration": { - "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], - "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + "properties": { + "count": 0, + "mode": "str", + "vmSkuName": "str", + "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, + "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "str"}, + "attachedNetworkConfiguration": { + "l2Networks": [{"networkId": "str", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], + "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + }, + "availabilityZones": ["str"], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "kubernetesVersion": "str", + "labels": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "taints": [{"key": "str", "value": "str"}], + "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, }, - "availabilityZones": ["str"], - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "extendedLocation": {"name": "str", "type": "str"}, "id": "str", - "kubernetesVersion": "str", - "labels": [{"key": "str", "value": "str"}], "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,11 +74,8 @@ async def test_agent_pools_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "taints": [{"key": "str", "value": "str"}], "type": "str", - "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -96,13 +84,12 @@ async def test_agent_pools_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_agent_pools_begin_delete(self, resource_group): + async def test_agent_pools_begin_update(self, resource_group): response = await ( - await self.client.agent_pools.begin_delete( + await self.client.agent_pools.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -111,15 +98,25 @@ async def test_agent_pools_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_agent_pools_begin_update(self, resource_group): + async def test_agent_pools_begin_delete(self, resource_group): response = await ( - await self.client.agent_pools.begin_update( + await self.client.agent_pools.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", agent_pool_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_agent_pools_list_by_kubernetes_cluster(self, resource_group): + response = self.client.agent_pools.list_by_kubernetes_cluster( + resource_group_name=resource_group.name, + kubernetes_cluster_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations.py index 0c83a27aaabc..546b101b4708 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_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,18 +18,6 @@ class TestNetworkCloudMgmtBareMetalMachineKeySetsOperations(AzureMgmtRecordedTes def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_bare_metal_machine_key_sets_list_by_cluster(self, resource_group): - response = self.client.bare_metal_machine_key_sets.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_bare_metal_machine_key_sets_get(self, resource_group): @@ -37,7 +25,6 @@ def test_bare_metal_machine_key_sets_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -51,29 +38,32 @@ def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource_group cluster_name="str", bare_metal_machine_key_set_name="str", bare_metal_machine_key_set_parameters={ - "azureGroupId": "str", - "expiration": "2020-02-20 00:00:00", "extendedLocation": {"name": "str", "type": "str"}, - "jumpHostsAllowed": ["str"], "location": "str", - "privilegeLevel": "str", - "userList": [ - { - "azureUserName": "str", - "sshPublicKey": {"keyData": "str"}, - "description": "str", - "userPrincipalName": "str", - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "azureGroupId": "str", + "expiration": "2020-02-20 00:00:00", + "jumpHostsAllowed": ["str"], + "privilegeLevel": "str", + "userList": [ + { + "azureUserName": "str", + "sshPublicKey": {"keyData": "str"}, + "description": "str", + "userPrincipalName": "str", + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "lastValidation": "2020-02-20 00:00:00", + "osGroupName": "str", + "privilegeLevelName": "str", + "provisioningState": "str", + "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], + }, "etag": "str", "id": "str", - "lastValidation": "2020-02-20 00:00:00", "name": "str", - "osGroupName": "str", - "privilegeLevelName": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -84,9 +74,7 @@ def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource_group }, "tags": {"str": "str"}, "type": "str", - "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,12 +82,11 @@ def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): - response = self.client.bare_metal_machine_key_sets.begin_delete( + def test_bare_metal_machine_key_sets_begin_update(self, resource_group): + response = self.client.bare_metal_machine_key_sets.begin_update( resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -107,13 +94,23 @@ def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bare_metal_machine_key_sets_begin_update(self, resource_group): - response = self.client.bare_metal_machine_key_sets.begin_update( + def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): + response = self.client.bare_metal_machine_key_sets.begin_delete( resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bare_metal_machine_key_sets_list_by_cluster(self, resource_group): + response = self.client.bare_metal_machine_key_sets.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations_async.py index 32c2026d28a2..52cc66a21c9b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machine_key_sets_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,18 +19,6 @@ class TestNetworkCloudMgmtBareMetalMachineKeySetsOperationsAsync(AzureMgmtRecord def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_bare_metal_machine_key_sets_list_by_cluster(self, resource_group): - response = self.client.bare_metal_machine_key_sets.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_bare_metal_machine_key_sets_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_bare_metal_machine_key_sets_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -53,29 +40,32 @@ async def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource cluster_name="str", bare_metal_machine_key_set_name="str", bare_metal_machine_key_set_parameters={ - "azureGroupId": "str", - "expiration": "2020-02-20 00:00:00", "extendedLocation": {"name": "str", "type": "str"}, - "jumpHostsAllowed": ["str"], "location": "str", - "privilegeLevel": "str", - "userList": [ - { - "azureUserName": "str", - "sshPublicKey": {"keyData": "str"}, - "description": "str", - "userPrincipalName": "str", - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "azureGroupId": "str", + "expiration": "2020-02-20 00:00:00", + "jumpHostsAllowed": ["str"], + "privilegeLevel": "str", + "userList": [ + { + "azureUserName": "str", + "sshPublicKey": {"keyData": "str"}, + "description": "str", + "userPrincipalName": "str", + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "lastValidation": "2020-02-20 00:00:00", + "osGroupName": "str", + "privilegeLevelName": "str", + "provisioningState": "str", + "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], + }, "etag": "str", "id": "str", - "lastValidation": "2020-02-20 00:00:00", "name": "str", - "osGroupName": "str", - "privilegeLevelName": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -86,9 +76,7 @@ async def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource }, "tags": {"str": "str"}, "type": "str", - "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -97,13 +85,12 @@ async def test_bare_metal_machine_key_sets_begin_create_or_update(self, resource @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): + async def test_bare_metal_machine_key_sets_begin_update(self, resource_group): response = await ( - await self.client.bare_metal_machine_key_sets.begin_delete( + await self.client.bare_metal_machine_key_sets.begin_update( resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -112,15 +99,25 @@ async def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bare_metal_machine_key_sets_begin_update(self, resource_group): + async def test_bare_metal_machine_key_sets_begin_delete(self, resource_group): response = await ( - await self.client.bare_metal_machine_key_sets.begin_update( + await self.client.bare_metal_machine_key_sets.begin_delete( resource_group_name=resource_group.name, cluster_name="str", bare_metal_machine_key_set_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bare_metal_machine_key_sets_list_by_cluster(self, resource_group): + response = self.client.bare_metal_machine_key_sets.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations.py index b3ae718b9308..397eea1d761c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,34 +18,12 @@ class TestNetworkCloudMgmtBareMetalMachinesOperations(AzureMgmtRecordedTestCase) def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_bare_metal_machines_list_by_subscription(self, resource_group): - response = self.client.bare_metal_machines.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_bare_metal_machines_list_by_resource_group(self, resource_group): - response = self.client.bare_metal_machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_bare_metal_machines_get(self, resource_group): response = self.client.bare_metal_machines.get( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,92 +36,101 @@ def test_bare_metal_machines_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, bare_metal_machine_name="str", bare_metal_machine_parameters={ - "bmcConnectionString": "str", - "bmcCredentials": {"password": "str", "username": "str"}, - "bmcMacAddress": "str", - "bootMacAddress": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "machineDetails": "str", - "machineName": "str", - "machineSkuId": "str", - "rackId": "str", - "rackSlot": 0, - "serialNumber": "str", - "actionStates": [ - { - "actionType": "str", - "correlationId": "str", - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepStates": [ - {"endTime": "str", "message": "str", "startTime": "str", "status": "str", "stepName": "str"} - ], - } - ], - "associatedResourceIds": ["str"], - "caCertificate": {"hash": "str", "value": "str"}, - "clusterId": "str", - "cordonStatus": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "etag": "str", - "hardwareInventory": { - "additionalHostInformation": "str", - "interfaces": [ - {"linkStatus": "str", "macAddress": "str", "name": "str", "networkInterfaceId": "str"} + "properties": { + "bmcConnectionString": "str", + "bmcCredentials": {"password": "str", "username": "str"}, + "bmcMacAddress": "str", + "bootMacAddress": "str", + "machineDetails": "str", + "machineName": "str", + "machineSkuId": "str", + "rackId": "str", + "rackSlot": 0, + "serialNumber": "str", + "actionStates": [ + { + "actionType": "str", + "correlationId": "str", + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepStates": [ + { + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepName": "str", + } + ], + } ], - "nics": [ + "associatedResourceIds": ["str"], + "caCertificate": {"hash": "str", "value": "str"}, + "clusterId": "str", + "cordonStatus": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hardwareInventory": { + "additionalHostInformation": "str", + "interfaces": [ + {"linkStatus": "str", "macAddress": "str", "name": "str", "networkInterfaceId": "str"} + ], + "nics": [ + { + "lldpNeighbor": { + "portDescription": "str", + "portName": "str", + "systemDescription": "str", + "systemName": "str", + }, + "macAddress": "str", + "name": "str", + } + ], + }, + "hardwareValidationStatus": {"lastValidationTime": "2020-02-20 00:00:00", "result": "str"}, + "hybridAksClustersAssociatedIds": ["str"], + "kubernetesNodeName": "str", + "kubernetesVersion": "str", + "machineClusterVersion": "str", + "machineRoles": ["str"], + "oamIpv4Address": "str", + "oamIpv6Address": "str", + "osImage": "str", + "powerState": "str", + "provisioningState": "str", + "readyState": "str", + "runtimeProtectionStatus": { + "definitionsLastUpdated": "2020-02-20 00:00:00", + "definitionsVersion": "str", + "scanCompletedTime": "2020-02-20 00:00:00", + "scanScheduledTime": "2020-02-20 00:00:00", + "scanStartedTime": "2020-02-20 00:00:00", + }, + "secretRotationStatus": [ { - "lldpNeighbor": { - "portDescription": "str", - "portName": "str", - "systemDescription": "str", - "systemName": "str", + "expirePeriodDays": 0, + "lastRotationTime": "2020-02-20 00:00:00", + "rotationPeriodDays": 0, + "secretArchiveReference": { + "keyVaultId": "str", + "keyVaultUri": "str", + "secretName": "str", + "secretVersion": "str", }, - "macAddress": "str", - "name": "str", + "secretType": "str", } ], + "serviceTag": "str", + "virtualMachinesAssociatedIds": ["str"], }, - "hardwareValidationStatus": {"lastValidationTime": "2020-02-20 00:00:00", "result": "str"}, - "hybridAksClustersAssociatedIds": ["str"], + "etag": "str", "id": "str", - "kubernetesNodeName": "str", - "kubernetesVersion": "str", - "machineClusterVersion": "str", - "machineRoles": ["str"], "name": "str", - "oamIpv4Address": "str", - "oamIpv6Address": "str", - "osImage": "str", - "powerState": "str", - "provisioningState": "str", - "readyState": "str", - "runtimeProtectionStatus": { - "definitionsLastUpdated": "2020-02-20 00:00:00", - "definitionsVersion": "str", - "scanCompletedTime": "2020-02-20 00:00:00", - "scanScheduledTime": "2020-02-20 00:00:00", - "scanStartedTime": "2020-02-20 00:00:00", - }, - "secretRotationStatus": [ - { - "expirePeriodDays": 0, - "lastRotationTime": "2020-02-20 00:00:00", - "rotationPeriodDays": 0, - "secretArchiveReference": { - "keyVaultId": "str", - "keyVaultUri": "str", - "secretName": "str", - "secretVersion": "str", - }, - "secretType": "str", - } - ], - "serviceTag": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -154,9 +141,7 @@ def test_bare_metal_machines_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -164,11 +149,10 @@ def test_bare_metal_machines_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bare_metal_machines_begin_delete(self, resource_group): - response = self.client.bare_metal_machines.begin_delete( + def test_bare_metal_machines_begin_update(self, resource_group): + response = self.client.bare_metal_machines.begin_update( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -176,23 +160,39 @@ def test_bare_metal_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bare_metal_machines_begin_update(self, resource_group): - response = self.client.bare_metal_machines.begin_update( + def test_bare_metal_machines_begin_delete(self, resource_group): + response = self.client.bare_metal_machines.begin_delete( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bare_metal_machines_list_by_resource_group(self, resource_group): + response = self.client.bare_metal_machines.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_bare_metal_machines_list_by_subscription(self, resource_group): + response = self.client.bare_metal_machines.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_bare_metal_machines_begin_cordon(self, resource_group): response = self.client.bare_metal_machines.begin_cordon( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -204,7 +204,6 @@ def test_bare_metal_machines_begin_power_off(self, resource_group): response = self.client.bare_metal_machines.begin_power_off( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -216,7 +215,6 @@ def test_bare_metal_machines_begin_reimage(self, resource_group): response = self.client.bare_metal_machines.begin_reimage( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -228,7 +226,6 @@ def test_bare_metal_machines_begin_replace(self, resource_group): response = self.client.bare_metal_machines.begin_replace( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -240,7 +237,6 @@ def test_bare_metal_machines_begin_restart(self, resource_group): response = self.client.bare_metal_machines.begin_restart( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -253,7 +249,6 @@ def test_bare_metal_machines_begin_run_command(self, resource_group): resource_group_name=resource_group.name, bare_metal_machine_name="str", bare_metal_machine_run_command_parameters={"limitTimeSeconds": 0, "script": "str", "arguments": ["str"]}, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -269,7 +264,6 @@ def test_bare_metal_machines_begin_run_data_extracts(self, resource_group): "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -285,7 +279,6 @@ def test_bare_metal_machines_begin_run_data_extracts_restricted(self, resource_g "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -301,7 +294,6 @@ def test_bare_metal_machines_begin_run_read_commands(self, resource_group): "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -313,7 +305,6 @@ def test_bare_metal_machines_begin_start(self, resource_group): response = self.client.bare_metal_machines.begin_start( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -325,7 +316,6 @@ def test_bare_metal_machines_begin_uncordon(self, resource_group): response = self.client.bare_metal_machines.begin_uncordon( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations_async.py index 3aab085c5af2..83c32aff837a 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bare_metal_machines_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,34 +19,12 @@ class TestNetworkCloudMgmtBareMetalMachinesOperationsAsync(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_bare_metal_machines_list_by_subscription(self, resource_group): - response = self.client.bare_metal_machines.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_bare_metal_machines_list_by_resource_group(self, resource_group): - response = self.client.bare_metal_machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_bare_metal_machines_get(self, resource_group): response = await self.client.bare_metal_machines.get( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,98 +38,101 @@ async def test_bare_metal_machines_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, bare_metal_machine_name="str", bare_metal_machine_parameters={ - "bmcConnectionString": "str", - "bmcCredentials": {"password": "str", "username": "str"}, - "bmcMacAddress": "str", - "bootMacAddress": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "machineDetails": "str", - "machineName": "str", - "machineSkuId": "str", - "rackId": "str", - "rackSlot": 0, - "serialNumber": "str", - "actionStates": [ - { - "actionType": "str", - "correlationId": "str", - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepStates": [ + "properties": { + "bmcConnectionString": "str", + "bmcCredentials": {"password": "str", "username": "str"}, + "bmcMacAddress": "str", + "bootMacAddress": "str", + "machineDetails": "str", + "machineName": "str", + "machineSkuId": "str", + "rackId": "str", + "rackSlot": 0, + "serialNumber": "str", + "actionStates": [ + { + "actionType": "str", + "correlationId": "str", + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepStates": [ + { + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepName": "str", + } + ], + } + ], + "associatedResourceIds": ["str"], + "caCertificate": {"hash": "str", "value": "str"}, + "clusterId": "str", + "cordonStatus": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hardwareInventory": { + "additionalHostInformation": "str", + "interfaces": [ + {"linkStatus": "str", "macAddress": "str", "name": "str", "networkInterfaceId": "str"} + ], + "nics": [ { - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepName": "str", + "lldpNeighbor": { + "portDescription": "str", + "portName": "str", + "systemDescription": "str", + "systemName": "str", + }, + "macAddress": "str", + "name": "str", } ], - } - ], - "associatedResourceIds": ["str"], - "caCertificate": {"hash": "str", "value": "str"}, - "clusterId": "str", - "cordonStatus": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "etag": "str", - "hardwareInventory": { - "additionalHostInformation": "str", - "interfaces": [ - {"linkStatus": "str", "macAddress": "str", "name": "str", "networkInterfaceId": "str"} - ], - "nics": [ + }, + "hardwareValidationStatus": {"lastValidationTime": "2020-02-20 00:00:00", "result": "str"}, + "hybridAksClustersAssociatedIds": ["str"], + "kubernetesNodeName": "str", + "kubernetesVersion": "str", + "machineClusterVersion": "str", + "machineRoles": ["str"], + "oamIpv4Address": "str", + "oamIpv6Address": "str", + "osImage": "str", + "powerState": "str", + "provisioningState": "str", + "readyState": "str", + "runtimeProtectionStatus": { + "definitionsLastUpdated": "2020-02-20 00:00:00", + "definitionsVersion": "str", + "scanCompletedTime": "2020-02-20 00:00:00", + "scanScheduledTime": "2020-02-20 00:00:00", + "scanStartedTime": "2020-02-20 00:00:00", + }, + "secretRotationStatus": [ { - "lldpNeighbor": { - "portDescription": "str", - "portName": "str", - "systemDescription": "str", - "systemName": "str", + "expirePeriodDays": 0, + "lastRotationTime": "2020-02-20 00:00:00", + "rotationPeriodDays": 0, + "secretArchiveReference": { + "keyVaultId": "str", + "keyVaultUri": "str", + "secretName": "str", + "secretVersion": "str", }, - "macAddress": "str", - "name": "str", + "secretType": "str", } ], + "serviceTag": "str", + "virtualMachinesAssociatedIds": ["str"], }, - "hardwareValidationStatus": {"lastValidationTime": "2020-02-20 00:00:00", "result": "str"}, - "hybridAksClustersAssociatedIds": ["str"], + "etag": "str", "id": "str", - "kubernetesNodeName": "str", - "kubernetesVersion": "str", - "machineClusterVersion": "str", - "machineRoles": ["str"], "name": "str", - "oamIpv4Address": "str", - "oamIpv6Address": "str", - "osImage": "str", - "powerState": "str", - "provisioningState": "str", - "readyState": "str", - "runtimeProtectionStatus": { - "definitionsLastUpdated": "2020-02-20 00:00:00", - "definitionsVersion": "str", - "scanCompletedTime": "2020-02-20 00:00:00", - "scanScheduledTime": "2020-02-20 00:00:00", - "scanStartedTime": "2020-02-20 00:00:00", - }, - "secretRotationStatus": [ - { - "expirePeriodDays": 0, - "lastRotationTime": "2020-02-20 00:00:00", - "rotationPeriodDays": 0, - "secretArchiveReference": { - "keyVaultId": "str", - "keyVaultUri": "str", - "secretName": "str", - "secretVersion": "str", - }, - "secretType": "str", - } - ], - "serviceTag": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -162,9 +143,7 @@ async def test_bare_metal_machines_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -173,12 +152,11 @@ async def test_bare_metal_machines_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bare_metal_machines_begin_delete(self, resource_group): + async def test_bare_metal_machines_begin_update(self, resource_group): response = await ( - await self.client.bare_metal_machines.begin_delete( + await self.client.bare_metal_machines.begin_update( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -187,18 +165,35 @@ async def test_bare_metal_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bare_metal_machines_begin_update(self, resource_group): + async def test_bare_metal_machines_begin_delete(self, resource_group): response = await ( - await self.client.bare_metal_machines.begin_update( + await self.client.bare_metal_machines.begin_delete( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bare_metal_machines_list_by_resource_group(self, resource_group): + response = self.client.bare_metal_machines.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_bare_metal_machines_list_by_subscription(self, resource_group): + response = self.client.bare_metal_machines.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_bare_metal_machines_begin_cordon(self, resource_group): @@ -206,7 +201,6 @@ async def test_bare_metal_machines_begin_cordon(self, resource_group): await self.client.bare_metal_machines.begin_cordon( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -220,7 +214,6 @@ async def test_bare_metal_machines_begin_power_off(self, resource_group): await self.client.bare_metal_machines.begin_power_off( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -234,7 +227,6 @@ async def test_bare_metal_machines_begin_reimage(self, resource_group): await self.client.bare_metal_machines.begin_reimage( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -248,7 +240,6 @@ async def test_bare_metal_machines_begin_replace(self, resource_group): await self.client.bare_metal_machines.begin_replace( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -262,7 +253,6 @@ async def test_bare_metal_machines_begin_restart(self, resource_group): await self.client.bare_metal_machines.begin_restart( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -281,7 +271,6 @@ async def test_bare_metal_machines_begin_run_command(self, resource_group): "script": "str", "arguments": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -299,7 +288,6 @@ async def test_bare_metal_machines_begin_run_data_extracts(self, resource_group) "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -317,7 +305,6 @@ async def test_bare_metal_machines_begin_run_data_extracts_restricted(self, reso "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -335,7 +322,6 @@ async def test_bare_metal_machines_begin_run_read_commands(self, resource_group) "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -349,7 +335,6 @@ async def test_bare_metal_machines_begin_start(self, resource_group): await self.client.bare_metal_machines.begin_start( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -363,7 +348,6 @@ async def test_bare_metal_machines_begin_uncordon(self, resource_group): await self.client.bare_metal_machines.begin_uncordon( resource_group_name=resource_group.name, bare_metal_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations.py index 9bab7c56b2e5..ac063937883e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_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,18 +18,6 @@ class TestNetworkCloudMgmtBmcKeySetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_bmc_key_sets_list_by_cluster(self, resource_group): - response = self.client.bmc_key_sets.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_bmc_key_sets_get(self, resource_group): @@ -37,7 +25,6 @@ def test_bmc_key_sets_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -51,26 +38,29 @@ def test_bmc_key_sets_begin_create_or_update(self, resource_group): cluster_name="str", bmc_key_set_name="str", bmc_key_set_parameters={ - "azureGroupId": "str", - "expiration": "2020-02-20 00:00:00", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "privilegeLevel": "str", - "userList": [ - { - "azureUserName": "str", - "sshPublicKey": {"keyData": "str"}, - "description": "str", - "userPrincipalName": "str", - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "azureGroupId": "str", + "expiration": "2020-02-20 00:00:00", + "privilegeLevel": "str", + "userList": [ + { + "azureUserName": "str", + "sshPublicKey": {"keyData": "str"}, + "description": "str", + "userPrincipalName": "str", + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "lastValidation": "2020-02-20 00:00:00", + "provisioningState": "str", + "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], + }, "etag": "str", "id": "str", - "lastValidation": "2020-02-20 00:00:00", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -81,9 +71,7 @@ def test_bmc_key_sets_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,12 +79,11 @@ def test_bmc_key_sets_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bmc_key_sets_begin_delete(self, resource_group): - response = self.client.bmc_key_sets.begin_delete( + def test_bmc_key_sets_begin_update(self, resource_group): + response = self.client.bmc_key_sets.begin_update( resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -104,13 +91,23 @@ def test_bmc_key_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_bmc_key_sets_begin_update(self, resource_group): - response = self.client.bmc_key_sets.begin_update( + def test_bmc_key_sets_begin_delete(self, resource_group): + response = self.client.bmc_key_sets.begin_delete( resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bmc_key_sets_list_by_cluster(self, resource_group): + response = self.client.bmc_key_sets.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations_async.py index cac09792fb75..c32cff508b38 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_bmc_key_sets_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,18 +19,6 @@ class TestNetworkCloudMgmtBmcKeySetsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_bmc_key_sets_list_by_cluster(self, resource_group): - response = self.client.bmc_key_sets.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_bmc_key_sets_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_bmc_key_sets_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -53,26 +40,29 @@ async def test_bmc_key_sets_begin_create_or_update(self, resource_group): cluster_name="str", bmc_key_set_name="str", bmc_key_set_parameters={ - "azureGroupId": "str", - "expiration": "2020-02-20 00:00:00", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "privilegeLevel": "str", - "userList": [ - { - "azureUserName": "str", - "sshPublicKey": {"keyData": "str"}, - "description": "str", - "userPrincipalName": "str", - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "azureGroupId": "str", + "expiration": "2020-02-20 00:00:00", + "privilegeLevel": "str", + "userList": [ + { + "azureUserName": "str", + "sshPublicKey": {"keyData": "str"}, + "description": "str", + "userPrincipalName": "str", + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "lastValidation": "2020-02-20 00:00:00", + "provisioningState": "str", + "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], + }, "etag": "str", "id": "str", - "lastValidation": "2020-02-20 00:00:00", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,9 +73,7 @@ async def test_bmc_key_sets_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "userListStatus": [{"azureUserName": "str", "status": "str", "statusMessage": "str"}], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -94,13 +82,12 @@ async def test_bmc_key_sets_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bmc_key_sets_begin_delete(self, resource_group): + async def test_bmc_key_sets_begin_update(self, resource_group): response = await ( - await self.client.bmc_key_sets.begin_delete( + await self.client.bmc_key_sets.begin_update( resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -109,15 +96,25 @@ async def test_bmc_key_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_bmc_key_sets_begin_update(self, resource_group): + async def test_bmc_key_sets_begin_delete(self, resource_group): response = await ( - await self.client.bmc_key_sets.begin_update( + await self.client.bmc_key_sets.begin_delete( resource_group_name=resource_group.name, cluster_name="str", bmc_key_set_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bmc_key_sets_list_by_cluster(self, resource_group): + response = self.client.bmc_key_sets.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations.py index c0df88270152..46a3e3f2f175 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_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 TestNetworkCloudMgmtCloudServicesNetworksOperations(AzureMgmtRecordedTestC def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_networks_list_by_subscription(self, resource_group): - response = self.client.cloud_services_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_services_networks_list_by_resource_group(self, resource_group): - response = self.client.cloud_services_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_cloud_services_networks_get(self, resource_group): response = self.client.cloud_services_networks.get( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,26 +38,29 @@ def test_cloud_services_networks_begin_create_or_update(self, resource_group): cloud_services_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "additionalEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "enableDefaultEgressEndpoints": "str", - "enabledEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", - "storageOptions": {"mode": "str", "sizeMiB": 0, "storageApplianceId": "str"}, - "storageStatus": { - "mode": "str", - "sizeMiB": 0, - "status": "str", - "statusMessage": "str", - "volumeId": "str", + "properties": { + "additionalEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "enableDefaultEgressEndpoints": "str", + "enabledEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], + "hybridAksClustersAssociatedIds": ["str"], + "interfaceName": "str", + "provisioningState": "str", + "storageOptions": {"mode": "str", "sizeMiB": 0, "storageApplianceId": "str"}, + "storageStatus": { + "mode": "str", + "sizeMiB": 0, + "status": "str", + "statusMessage": "str", + "volumeId": "str", + }, + "virtualMachinesAssociatedIds": ["str"], }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -91,9 +72,7 @@ def test_cloud_services_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -101,11 +80,10 @@ def test_cloud_services_networks_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_cloud_services_networks_begin_delete(self, resource_group): - response = self.client.cloud_services_networks.begin_delete( + def test_cloud_services_networks_begin_update(self, resource_group): + response = self.client.cloud_services_networks.begin_update( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -113,12 +91,29 @@ def test_cloud_services_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_cloud_services_networks_begin_update(self, resource_group): - response = self.client.cloud_services_networks.begin_update( + def test_cloud_services_networks_begin_delete(self, resource_group): + response = self.client.cloud_services_networks.begin_delete( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_services_networks_list_by_resource_group(self, resource_group): + response = self.client.cloud_services_networks.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_cloud_services_networks_list_by_subscription(self, resource_group): + response = self.client.cloud_services_networks.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations_async.py index ad8d6e6ae3b4..5a414239e289 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cloud_services_networks_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 TestNetworkCloudMgmtCloudServicesNetworksOperationsAsync(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_networks_list_by_subscription(self, resource_group): - response = self.client.cloud_services_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_services_networks_list_by_resource_group(self, resource_group): - response = self.client.cloud_services_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_cloud_services_networks_get(self, resource_group): response = await self.client.cloud_services_networks.get( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -62,26 +40,33 @@ async def test_cloud_services_networks_begin_create_or_update(self, resource_gro cloud_services_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "additionalEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "enableDefaultEgressEndpoints": "str", - "enabledEgressEndpoints": [{"category": "str", "endpoints": [{"domainName": "str", "port": 0}]}], "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", - "storageOptions": {"mode": "str", "sizeMiB": 0, "storageApplianceId": "str"}, - "storageStatus": { - "mode": "str", - "sizeMiB": 0, - "status": "str", - "statusMessage": "str", - "volumeId": "str", + "properties": { + "additionalEgressEndpoints": [ + {"category": "str", "endpoints": [{"domainName": "str", "port": 0}]} + ], + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "enableDefaultEgressEndpoints": "str", + "enabledEgressEndpoints": [ + {"category": "str", "endpoints": [{"domainName": "str", "port": 0}]} + ], + "hybridAksClustersAssociatedIds": ["str"], + "interfaceName": "str", + "provisioningState": "str", + "storageOptions": {"mode": "str", "sizeMiB": 0, "storageApplianceId": "str"}, + "storageStatus": { + "mode": "str", + "sizeMiB": 0, + "status": "str", + "statusMessage": "str", + "volumeId": "str", + }, + "virtualMachinesAssociatedIds": ["str"], }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -93,9 +78,7 @@ async def test_cloud_services_networks_begin_create_or_update(self, resource_gro }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -104,12 +87,11 @@ async def test_cloud_services_networks_begin_create_or_update(self, resource_gro @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_cloud_services_networks_begin_delete(self, resource_group): + async def test_cloud_services_networks_begin_update(self, resource_group): response = await ( - await self.client.cloud_services_networks.begin_delete( + await self.client.cloud_services_networks.begin_update( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -118,14 +100,31 @@ async def test_cloud_services_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_cloud_services_networks_begin_update(self, resource_group): + async def test_cloud_services_networks_begin_delete(self, resource_group): response = await ( - await self.client.cloud_services_networks.begin_update( + await self.client.cloud_services_networks.begin_delete( resource_group_name=resource_group.name, cloud_services_network_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_services_networks_list_by_resource_group(self, resource_group): + response = self.client.cloud_services_networks.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_cloud_services_networks_list_by_subscription(self, resource_group): + response = self.client.cloud_services_networks.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations.py index c8c64650471d..6dffeafeb92c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_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 TestNetworkCloudMgmtClusterManagersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cluster_managers_list_by_subscription(self, resource_group): - response = self.client.cluster_managers.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cluster_managers_list_by_resource_group(self, resource_group): - response = self.client.cluster_managers.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_cluster_managers_get(self, resource_group): response = self.client.cluster_managers.get( resource_group_name=resource_group.name, cluster_manager_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,13 +36,19 @@ def test_cluster_managers_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, cluster_manager_name="str", cluster_manager_parameters={ - "fabricControllerId": "str", "location": "str", - "analyticsWorkspaceId": "str", - "availabilityZones": ["str"], - "clusterVersions": [{"supportExpiryDate": "str", "targetClusterVersion": "str"}], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "fabricControllerId": "str", + "analyticsWorkspaceId": "str", + "availabilityZones": ["str"], + "clusterVersions": [{"supportExpiryDate": "str", "targetClusterVersion": "str"}], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "managerExtendedLocation": {"name": "str", "type": "str"}, + "provisioningState": "str", + "vmSize": "str", + }, "etag": "str", "id": "str", "identity": { @@ -73,10 +57,7 @@ def test_cluster_managers_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, - "managerExtendedLocation": {"name": "str", "type": "str"}, "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,21 +68,29 @@ def test_cluster_managers_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "vmSize": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cluster_managers_update(self, resource_group): + response = self.client.cluster_managers.update( + resource_group_name=resource_group.name, + cluster_manager_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_cluster_managers_begin_delete(self, resource_group): response = self.client.cluster_managers.begin_delete( resource_group_name=resource_group.name, cluster_manager_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -109,12 +98,18 @@ def test_cluster_managers_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_cluster_managers_update(self, resource_group): - response = self.client.cluster_managers.update( + def test_cluster_managers_list_by_resource_group(self, resource_group): + response = self.client.cluster_managers.list_by_resource_group( resource_group_name=resource_group.name, - cluster_manager_name="str", - api_version="2025-09-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cluster_managers_list_by_subscription(self, resource_group): + response = self.client.cluster_managers.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations_async.py index da242adfb831..535d5fbcf7cd 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_cluster_managers_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 TestNetworkCloudMgmtClusterManagersOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cluster_managers_list_by_subscription(self, resource_group): - response = self.client.cluster_managers.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cluster_managers_list_by_resource_group(self, resource_group): - response = self.client.cluster_managers.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_cluster_managers_get(self, resource_group): response = await self.client.cluster_managers.get( resource_group_name=resource_group.name, cluster_manager_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,13 +38,19 @@ async def test_cluster_managers_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, cluster_manager_name="str", cluster_manager_parameters={ - "fabricControllerId": "str", "location": "str", - "analyticsWorkspaceId": "str", - "availabilityZones": ["str"], - "clusterVersions": [{"supportExpiryDate": "str", "targetClusterVersion": "str"}], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "fabricControllerId": "str", + "analyticsWorkspaceId": "str", + "availabilityZones": ["str"], + "clusterVersions": [{"supportExpiryDate": "str", "targetClusterVersion": "str"}], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "managerExtendedLocation": {"name": "str", "type": "str"}, + "provisioningState": "str", + "vmSize": "str", + }, "etag": "str", "id": "str", "identity": { @@ -75,10 +59,7 @@ async def test_cluster_managers_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, - "managerExtendedLocation": {"name": "str", "type": "str"}, "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -89,15 +70,24 @@ async def test_cluster_managers_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "vmSize": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cluster_managers_update(self, resource_group): + response = await self.client.cluster_managers.update( + resource_group_name=resource_group.name, + cluster_manager_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_cluster_managers_begin_delete(self, resource_group): @@ -105,7 +95,6 @@ async def test_cluster_managers_begin_delete(self, resource_group): await self.client.cluster_managers.begin_delete( resource_group_name=resource_group.name, cluster_manager_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -114,12 +103,18 @@ async def test_cluster_managers_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_cluster_managers_update(self, resource_group): - response = await self.client.cluster_managers.update( + async def test_cluster_managers_list_by_resource_group(self, resource_group): + response = self.client.cluster_managers.list_by_resource_group( resource_group_name=resource_group.name, - cluster_manager_name="str", - api_version="2025-09-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cluster_managers_list_by_subscription(self, resource_group): + response = self.client.cluster_managers.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations.py index f82f423ba7ad..fc8cc3bb6664 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_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 TestNetworkCloudMgmtClustersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_clusters_list_by_subscription(self, resource_group): - response = self.client.clusters.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_clusters_list_by_resource_group(self, resource_group): - response = self.client.clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_clusters_get(self, resource_group): response = self.client.clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,101 +36,10 @@ def test_clusters_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", cluster_parameters={ - "aggregatorOrSingleRackDefinition": { - "networkRackId": "str", - "rackSerialNumber": "str", - "rackSkuId": "str", - "availabilityZone": "str", - "bareMetalMachineConfigurationData": [ - { - "bmcCredentials": {"password": "str", "username": "str"}, - "bmcMacAddress": "str", - "bootMacAddress": "str", - "rackSlot": 0, - "serialNumber": "str", - "bmcConnectionString": "str", - "machineDetails": "str", - "machineName": "str", - } - ], - "rackLocation": "str", - "storageApplianceConfigurationData": [ - { - "adminCredentials": {"password": "str", "username": "str"}, - "rackSlot": 0, - "serialNumber": "str", - "storageApplianceName": "str", - } - ], - }, - "clusterType": "str", - "clusterVersion": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "networkFabricId": "str", - "actionStates": [ - { - "actionType": "str", - "correlationId": "str", - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepStates": [ - {"endTime": "str", "message": "str", "startTime": "str", "status": "str", "stepName": "str"} - ], - } - ], - "analyticsOutputSettings": { - "analyticsWorkspaceId": "str", - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - }, - "analyticsWorkspaceId": "str", - "availableUpgradeVersions": [ - { - "controlImpact": "str", - "expectedDuration": "str", - "impactDescription": "str", - "supportExpiryDate": "str", - "targetClusterVersion": "str", - "workloadImpact": "str", - } - ], - "clusterCapacity": { - "availableApplianceStorageGB": 0, - "availableCoreCount": 0, - "availableHostStorageGB": 0, - "availableMemoryGB": 0, - "totalApplianceStorageGB": 0, - "totalCoreCount": 0, - "totalHostStorageGB": 0, - "totalMemoryGB": 0, - }, - "clusterConnectionStatus": "str", - "clusterExtendedLocation": {"name": "str", "type": "str"}, - "clusterLocation": "str", - "clusterManagerConnectionStatus": "str", - "clusterManagerId": "str", - "clusterServicePrincipal": { - "applicationId": "str", - "password": "str", - "principalId": "str", - "tenantId": "str", - }, - "commandOutputSettings": { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "containerUrl": "str", - "overrides": [ - { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "commandOutputType": "str", - "containerUrl": "str", - } - ], - }, - "computeDeploymentThreshold": {"grouping": "str", "type": "str", "value": 0}, - "computeRackDefinitions": [ - { + "properties": { + "aggregatorOrSingleRackDefinition": { "networkRackId": "str", "rackSerialNumber": "str", "rackSkuId": "str", @@ -178,12 +65,130 @@ def test_clusters_begin_create_or_update(self, resource_group): "storageApplianceName": "str", } ], - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + }, + "clusterType": "str", + "clusterVersion": "str", + "networkFabricId": "str", + "actionStates": [ + { + "actionType": "str", + "correlationId": "str", + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepStates": [ + { + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepName": "str", + } + ], + } + ], + "analyticsOutputSettings": { + "analyticsWorkspaceId": "str", + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + }, + "analyticsWorkspaceId": "str", + "availableUpgradeVersions": [ + { + "controlImpact": "str", + "expectedDuration": "str", + "impactDescription": "str", + "supportExpiryDate": "str", + "targetClusterVersion": "str", + "workloadImpact": "str", + } + ], + "clusterCapacity": { + "availableApplianceStorageGB": 0, + "availableCoreCount": 0, + "availableHostStorageGB": 0, + "availableMemoryGB": 0, + "totalApplianceStorageGB": 0, + "totalCoreCount": 0, + "totalHostStorageGB": 0, + "totalMemoryGB": 0, + }, + "clusterConnectionStatus": "str", + "clusterExtendedLocation": {"name": "str", "type": "str"}, + "clusterLocation": "str", + "clusterManagerConnectionStatus": "str", + "clusterManagerId": "str", + "clusterServicePrincipal": { + "applicationId": "str", + "password": "str", + "principalId": "str", + "tenantId": "str", + }, + "commandOutputSettings": { + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + "containerUrl": "str", + "overrides": [ + { + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + "commandOutputType": "str", + "containerUrl": "str", + } + ], + }, + "computeDeploymentThreshold": {"grouping": "str", "type": "str", "value": 0}, + "computeRackDefinitions": [ + { + "networkRackId": "str", + "rackSerialNumber": "str", + "rackSkuId": "str", + "availabilityZone": "str", + "bareMetalMachineConfigurationData": [ + { + "bmcCredentials": {"password": "str", "username": "str"}, + "bmcMacAddress": "str", + "bootMacAddress": "str", + "rackSlot": 0, + "serialNumber": "str", + "bmcConnectionString": "str", + "machineDetails": "str", + "machineName": "str", + } + ], + "rackLocation": "str", + "storageApplianceConfigurationData": [ + { + "adminCredentials": {"password": "str", "username": "str"}, + "rackSlot": 0, + "serialNumber": "str", + "storageApplianceName": "str", + } + ], + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksExtendedLocation": {"name": "str", "type": "str"}, + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "manualActionCount": 0, + "provisioningState": "str", + "runtimeProtectionConfiguration": {"enforcementLevel": "str"}, + "secretArchive": {"keyVaultId": "str", "useKeyVault": "str"}, + "secretArchiveSettings": { + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + "vaultUri": "str", + }, + "supportExpiryDate": "str", + "updateStrategy": { + "strategyType": "str", + "thresholdType": "str", + "thresholdValue": 0, + "maxUnavailable": 0, + "waitTimeMinutes": 0, + }, + "vulnerabilityScanningSettings": {"containerScan": "str"}, + "workloadResourceIds": ["str"], + }, "etag": "str", - "hybridAksExtendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -191,17 +196,7 @@ def test_clusters_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, - "manualActionCount": 0, "name": "str", - "provisioningState": "str", - "runtimeProtectionConfiguration": {"enforcementLevel": "Disabled"}, - "secretArchive": {"keyVaultId": "str", "useKeyVault": "False"}, - "secretArchiveSettings": { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "vaultUri": "str", - }, - "supportExpiryDate": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -212,17 +207,7 @@ def test_clusters_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "updateStrategy": { - "strategyType": "str", - "thresholdType": "str", - "thresholdValue": 0, - "maxUnavailable": 0, - "waitTimeMinutes": 15, - }, - "vulnerabilityScanningSettings": {"containerScan": "str"}, - "workloadResourceIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -230,11 +215,10 @@ def test_clusters_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_clusters_begin_delete(self, resource_group): - response = self.client.clusters.begin_delete( + def test_clusters_begin_update(self, resource_group): + response = self.client.clusters.begin_update( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -242,24 +226,40 @@ def test_clusters_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_clusters_begin_update(self, resource_group): - response = self.client.clusters.begin_update( + def test_clusters_begin_delete(self, resource_group): + response = self.client.clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clusters_list_by_resource_group(self, resource_group): + response = self.client.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_clusters_list_by_subscription(self, resource_group): + response = self.client.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_clusters_begin_continue_update_version(self, resource_group): response = self.client.clusters.begin_continue_update_version( resource_group_name=resource_group.name, cluster_name="str", - cluster_continue_update_version_parameters={"machineGroupTargetingMode": "AlphaByRack"}, - api_version="2025-09-01", + cluster_continue_update_version_parameters={"machineGroupTargetingMode": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -271,7 +271,6 @@ def test_clusters_begin_deploy(self, resource_group): response = self.client.clusters.begin_deploy( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -283,7 +282,6 @@ def test_clusters_begin_scan_runtime(self, resource_group): response = self.client.clusters.begin_scan_runtime( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -296,7 +294,6 @@ def test_clusters_begin_update_version(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", cluster_update_version_parameters={"targetClusterVersion": "str"}, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations_async.py index 6c2646ca2960..deb11be0a0fc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_clusters_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_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 TestNetworkCloudMgmtClustersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_clusters_list_by_subscription(self, resource_group): - response = self.client.clusters.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_clusters_list_by_resource_group(self, resource_group): - response = self.client.clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_clusters_get(self, resource_group): response = await self.client.clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,107 +38,10 @@ async def test_clusters_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", cluster_parameters={ - "aggregatorOrSingleRackDefinition": { - "networkRackId": "str", - "rackSerialNumber": "str", - "rackSkuId": "str", - "availabilityZone": "str", - "bareMetalMachineConfigurationData": [ - { - "bmcCredentials": {"password": "str", "username": "str"}, - "bmcMacAddress": "str", - "bootMacAddress": "str", - "rackSlot": 0, - "serialNumber": "str", - "bmcConnectionString": "str", - "machineDetails": "str", - "machineName": "str", - } - ], - "rackLocation": "str", - "storageApplianceConfigurationData": [ - { - "adminCredentials": {"password": "str", "username": "str"}, - "rackSlot": 0, - "serialNumber": "str", - "storageApplianceName": "str", - } - ], - }, - "clusterType": "str", - "clusterVersion": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "networkFabricId": "str", - "actionStates": [ - { - "actionType": "str", - "correlationId": "str", - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepStates": [ - { - "endTime": "str", - "message": "str", - "startTime": "str", - "status": "str", - "stepName": "str", - } - ], - } - ], - "analyticsOutputSettings": { - "analyticsWorkspaceId": "str", - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - }, - "analyticsWorkspaceId": "str", - "availableUpgradeVersions": [ - { - "controlImpact": "str", - "expectedDuration": "str", - "impactDescription": "str", - "supportExpiryDate": "str", - "targetClusterVersion": "str", - "workloadImpact": "str", - } - ], - "clusterCapacity": { - "availableApplianceStorageGB": 0, - "availableCoreCount": 0, - "availableHostStorageGB": 0, - "availableMemoryGB": 0, - "totalApplianceStorageGB": 0, - "totalCoreCount": 0, - "totalHostStorageGB": 0, - "totalMemoryGB": 0, - }, - "clusterConnectionStatus": "str", - "clusterExtendedLocation": {"name": "str", "type": "str"}, - "clusterLocation": "str", - "clusterManagerConnectionStatus": "str", - "clusterManagerId": "str", - "clusterServicePrincipal": { - "applicationId": "str", - "password": "str", - "principalId": "str", - "tenantId": "str", - }, - "commandOutputSettings": { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "containerUrl": "str", - "overrides": [ - { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "commandOutputType": "str", - "containerUrl": "str", - } - ], - }, - "computeDeploymentThreshold": {"grouping": "str", "type": "str", "value": 0}, - "computeRackDefinitions": [ - { + "properties": { + "aggregatorOrSingleRackDefinition": { "networkRackId": "str", "rackSerialNumber": "str", "rackSkuId": "str", @@ -186,12 +67,133 @@ async def test_clusters_begin_create_or_update(self, resource_group): "storageApplianceName": "str", } ], - } - ], - "detailedStatus": "str", - "detailedStatusMessage": "str", + }, + "clusterType": "str", + "clusterVersion": "str", + "networkFabricId": "str", + "actionStates": [ + { + "actionType": "str", + "correlationId": "str", + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepStates": [ + { + "endTime": "str", + "message": "str", + "startTime": "str", + "status": "str", + "stepName": "str", + } + ], + } + ], + "analyticsOutputSettings": { + "analyticsWorkspaceId": "str", + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + }, + "analyticsWorkspaceId": "str", + "availableUpgradeVersions": [ + { + "controlImpact": "str", + "expectedDuration": "str", + "impactDescription": "str", + "supportExpiryDate": "str", + "targetClusterVersion": "str", + "workloadImpact": "str", + } + ], + "clusterCapacity": { + "availableApplianceStorageGB": 0, + "availableCoreCount": 0, + "availableHostStorageGB": 0, + "availableMemoryGB": 0, + "totalApplianceStorageGB": 0, + "totalCoreCount": 0, + "totalHostStorageGB": 0, + "totalMemoryGB": 0, + }, + "clusterConnectionStatus": "str", + "clusterExtendedLocation": {"name": "str", "type": "str"}, + "clusterLocation": "str", + "clusterManagerConnectionStatus": "str", + "clusterManagerId": "str", + "clusterServicePrincipal": { + "applicationId": "str", + "password": "str", + "principalId": "str", + "tenantId": "str", + }, + "commandOutputSettings": { + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + "containerUrl": "str", + "overrides": [ + { + "associatedIdentity": { + "identityType": "str", + "userAssignedIdentityResourceId": "str", + }, + "commandOutputType": "str", + "containerUrl": "str", + } + ], + }, + "computeDeploymentThreshold": {"grouping": "str", "type": "str", "value": 0}, + "computeRackDefinitions": [ + { + "networkRackId": "str", + "rackSerialNumber": "str", + "rackSkuId": "str", + "availabilityZone": "str", + "bareMetalMachineConfigurationData": [ + { + "bmcCredentials": {"password": "str", "username": "str"}, + "bmcMacAddress": "str", + "bootMacAddress": "str", + "rackSlot": 0, + "serialNumber": "str", + "bmcConnectionString": "str", + "machineDetails": "str", + "machineName": "str", + } + ], + "rackLocation": "str", + "storageApplianceConfigurationData": [ + { + "adminCredentials": {"password": "str", "username": "str"}, + "rackSlot": 0, + "serialNumber": "str", + "storageApplianceName": "str", + } + ], + } + ], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksExtendedLocation": {"name": "str", "type": "str"}, + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "manualActionCount": 0, + "provisioningState": "str", + "runtimeProtectionConfiguration": {"enforcementLevel": "str"}, + "secretArchive": {"keyVaultId": "str", "useKeyVault": "str"}, + "secretArchiveSettings": { + "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, + "vaultUri": "str", + }, + "supportExpiryDate": "str", + "updateStrategy": { + "strategyType": "str", + "thresholdType": "str", + "thresholdValue": 0, + "maxUnavailable": 0, + "waitTimeMinutes": 0, + }, + "vulnerabilityScanningSettings": {"containerScan": "str"}, + "workloadResourceIds": ["str"], + }, "etag": "str", - "hybridAksExtendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -199,17 +201,7 @@ async def test_clusters_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, - "manualActionCount": 0, "name": "str", - "provisioningState": "str", - "runtimeProtectionConfiguration": {"enforcementLevel": "Disabled"}, - "secretArchive": {"keyVaultId": "str", "useKeyVault": "False"}, - "secretArchiveSettings": { - "associatedIdentity": {"identityType": "str", "userAssignedIdentityResourceId": "str"}, - "vaultUri": "str", - }, - "supportExpiryDate": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -220,17 +212,7 @@ async def test_clusters_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "updateStrategy": { - "strategyType": "str", - "thresholdType": "str", - "thresholdValue": 0, - "maxUnavailable": 0, - "waitTimeMinutes": 15, - }, - "vulnerabilityScanningSettings": {"containerScan": "str"}, - "workloadResourceIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -239,12 +221,11 @@ async def test_clusters_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_clusters_begin_delete(self, resource_group): + async def test_clusters_begin_update(self, resource_group): response = await ( - await self.client.clusters.begin_delete( + await self.client.clusters.begin_update( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -253,18 +234,35 @@ async def test_clusters_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_clusters_begin_update(self, resource_group): + async def test_clusters_begin_delete(self, resource_group): response = await ( - await self.client.clusters.begin_update( + await self.client.clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clusters_list_by_resource_group(self, resource_group): + response = self.client.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_clusters_list_by_subscription(self, resource_group): + response = self.client.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_clusters_begin_continue_update_version(self, resource_group): @@ -272,8 +270,7 @@ async def test_clusters_begin_continue_update_version(self, resource_group): await self.client.clusters.begin_continue_update_version( resource_group_name=resource_group.name, cluster_name="str", - cluster_continue_update_version_parameters={"machineGroupTargetingMode": "AlphaByRack"}, - api_version="2025-09-01", + cluster_continue_update_version_parameters={"machineGroupTargetingMode": "str"}, ) ).result() # call '.result()' to poll until service return final result @@ -287,7 +284,6 @@ async def test_clusters_begin_deploy(self, resource_group): await self.client.clusters.begin_deploy( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -301,7 +297,6 @@ async def test_clusters_begin_scan_runtime(self, resource_group): await self.client.clusters.begin_scan_runtime( resource_group_name=resource_group.name, cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -316,7 +311,6 @@ async def test_clusters_begin_update_version(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", cluster_update_version_parameters={"targetClusterVersion": "str"}, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations.py index ce101d1562f4..75d97c1db633 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_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,18 +18,6 @@ class TestNetworkCloudMgmtConsolesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_consoles_list_by_virtual_machine(self, resource_group): - response = self.client.consoles.list_by_virtual_machine( - resource_group_name=resource_group.name, - virtual_machine_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_consoles_get(self, resource_group): @@ -37,7 +25,6 @@ def test_consoles_get(self, resource_group): resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -51,18 +38,21 @@ def test_consoles_begin_create_or_update(self, resource_group): virtual_machine_name="str", console_name="str", console_parameters={ - "enabled": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "sshPublicKey": {"keyData": "str"}, - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "enabled": "str", + "sshPublicKey": {"keyData": "str"}, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "expiration": "2020-02-20 00:00:00", + "privateLinkServiceId": "str", + "provisioningState": "str", + "virtualMachineAccessId": "str", + }, "etag": "str", - "expiration": "2020-02-20 00:00:00", "id": "str", "name": "str", - "privateLinkServiceId": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -73,9 +63,7 @@ def test_consoles_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachineAccessId": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -83,12 +71,11 @@ def test_consoles_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_consoles_begin_delete(self, resource_group): - response = self.client.consoles.begin_delete( + def test_consoles_begin_update(self, resource_group): + response = self.client.consoles.begin_update( resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,13 +83,23 @@ def test_consoles_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_consoles_begin_update(self, resource_group): - response = self.client.consoles.begin_update( + def test_consoles_begin_delete(self, resource_group): + response = self.client.consoles.begin_delete( resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_consoles_list_by_virtual_machine(self, resource_group): + response = self.client.consoles.list_by_virtual_machine( + resource_group_name=resource_group.name, + virtual_machine_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations_async.py index e660574dd825..0d8f6663d678 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_consoles_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,18 +19,6 @@ class TestNetworkCloudMgmtConsolesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_consoles_list_by_virtual_machine(self, resource_group): - response = self.client.consoles.list_by_virtual_machine( - resource_group_name=resource_group.name, - virtual_machine_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_consoles_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_consoles_get(self, resource_group): resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -53,18 +40,21 @@ async def test_consoles_begin_create_or_update(self, resource_group): virtual_machine_name="str", console_name="str", console_parameters={ - "enabled": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "sshPublicKey": {"keyData": "str"}, - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "enabled": "str", + "sshPublicKey": {"keyData": "str"}, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "expiration": "2020-02-20 00:00:00", + "privateLinkServiceId": "str", + "provisioningState": "str", + "virtualMachineAccessId": "str", + }, "etag": "str", - "expiration": "2020-02-20 00:00:00", "id": "str", "name": "str", - "privateLinkServiceId": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -75,9 +65,7 @@ async def test_consoles_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachineAccessId": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -86,13 +74,12 @@ async def test_consoles_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_consoles_begin_delete(self, resource_group): + async def test_consoles_begin_update(self, resource_group): response = await ( - await self.client.consoles.begin_delete( + await self.client.consoles.begin_update( resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -101,15 +88,25 @@ async def test_consoles_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_consoles_begin_update(self, resource_group): + async def test_consoles_begin_delete(self, resource_group): response = await ( - await self.client.consoles.begin_update( + await self.client.consoles.begin_delete( resource_group_name=resource_group.name, virtual_machine_name="str", console_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_consoles_list_by_virtual_machine(self, resource_group): + response = self.client.consoles.list_by_virtual_machine( + resource_group_name=resource_group.name, + virtual_machine_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations.py index 3800da9a2f58..947071333754 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_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,18 +18,6 @@ class TestNetworkCloudMgmtKubernetesClusterFeaturesOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_kubernetes_cluster_features_list_by_kubernetes_cluster(self, resource_group): - response = self.client.kubernetes_cluster_features.list_by_kubernetes_cluster( - resource_group_name=resource_group.name, - kubernetes_cluster_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_kubernetes_cluster_features_get(self, resource_group): @@ -37,7 +25,6 @@ def test_kubernetes_cluster_features_get(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -52,15 +39,18 @@ def test_kubernetes_cluster_features_begin_create_or_update(self, resource_group feature_name="str", kubernetes_cluster_feature_parameters={ "location": "str", - "availabilityLifecycle": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "id": "str", "name": "str", - "options": [{"key": "str", "value": "str"}], - "provisioningState": "str", - "required": "str", + "properties": { + "availabilityLifecycle": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "options": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "required": "str", + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,9 +61,7 @@ def test_kubernetes_cluster_features_begin_create_or_update(self, resource_group }, "tags": {"str": "str"}, "type": "str", - "version": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,12 +69,11 @@ def test_kubernetes_cluster_features_begin_create_or_update(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_kubernetes_cluster_features_begin_delete(self, resource_group): - response = self.client.kubernetes_cluster_features.begin_delete( + def test_kubernetes_cluster_features_begin_update(self, resource_group): + response = self.client.kubernetes_cluster_features.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,13 +81,23 @@ def test_kubernetes_cluster_features_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_kubernetes_cluster_features_begin_update(self, resource_group): - response = self.client.kubernetes_cluster_features.begin_update( + def test_kubernetes_cluster_features_begin_delete(self, resource_group): + response = self.client.kubernetes_cluster_features.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_kubernetes_cluster_features_list_by_kubernetes_cluster(self, resource_group): + response = self.client.kubernetes_cluster_features.list_by_kubernetes_cluster( + resource_group_name=resource_group.name, + kubernetes_cluster_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations_async.py index b54a8e4e13a8..5a5787e7bf7c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_cluster_features_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,18 +19,6 @@ class TestNetworkCloudMgmtKubernetesClusterFeaturesOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_kubernetes_cluster_features_list_by_kubernetes_cluster(self, resource_group): - response = self.client.kubernetes_cluster_features.list_by_kubernetes_cluster( - resource_group_name=resource_group.name, - kubernetes_cluster_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_kubernetes_cluster_features_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_kubernetes_cluster_features_get(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -54,15 +41,18 @@ async def test_kubernetes_cluster_features_begin_create_or_update(self, resource feature_name="str", kubernetes_cluster_feature_parameters={ "location": "str", - "availabilityLifecycle": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "id": "str", "name": "str", - "options": [{"key": "str", "value": "str"}], - "provisioningState": "str", - "required": "str", + "properties": { + "availabilityLifecycle": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "options": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "required": "str", + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -73,9 +63,7 @@ async def test_kubernetes_cluster_features_begin_create_or_update(self, resource }, "tags": {"str": "str"}, "type": "str", - "version": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -84,13 +72,12 @@ async def test_kubernetes_cluster_features_begin_create_or_update(self, resource @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_kubernetes_cluster_features_begin_delete(self, resource_group): + async def test_kubernetes_cluster_features_begin_update(self, resource_group): response = await ( - await self.client.kubernetes_cluster_features.begin_delete( + await self.client.kubernetes_cluster_features.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -99,15 +86,25 @@ async def test_kubernetes_cluster_features_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_kubernetes_cluster_features_begin_update(self, resource_group): + async def test_kubernetes_cluster_features_begin_delete(self, resource_group): response = await ( - await self.client.kubernetes_cluster_features.begin_update( + await self.client.kubernetes_cluster_features.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", feature_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_kubernetes_cluster_features_list_by_kubernetes_cluster(self, resource_group): + response = self.client.kubernetes_cluster_features.list_by_kubernetes_cluster( + resource_group_name=resource_group.name, + kubernetes_cluster_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations.py index 63f6c1fa6e65..8a253d487042 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_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 TestNetworkCloudMgmtKubernetesClustersOperations(AzureMgmtRecordedTestCase def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_kubernetes_clusters_list_by_subscription(self, resource_group): - response = self.client.kubernetes_clusters.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_kubernetes_clusters_list_by_resource_group(self, resource_group): - response = self.client.kubernetes_clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_kubernetes_clusters_get(self, resource_group): response = self.client.kubernetes_clusters.get( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,128 +36,133 @@ def test_kubernetes_clusters_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", kubernetes_cluster_parameters={ - "controlPlaneNodeConfiguration": { - "count": 0, - "vmSkuName": "str", - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "availabilityZones": ["str"], - }, "extendedLocation": {"name": "str", "type": "str"}, - "initialAgentPoolConfigurations": [ - { + "location": "str", + "properties": { + "controlPlaneNodeConfiguration": { "count": 0, - "mode": "str", - "name": "str", "vmSkuName": "str", "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "2M"}, + "availabilityZones": ["str"], + }, + "initialAgentPoolConfigurations": [ + { + "count": 0, + "mode": "str", + "name": "str", + "vmSkuName": "str", + "administratorConfiguration": { + "adminUsername": "str", + "sshPublicKeys": [{"keyData": "str"}], + }, + "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "str"}, + "attachedNetworkConfiguration": { + "l2Networks": [{"networkId": "str", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], + "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + }, + "availabilityZones": ["str"], + "labels": [{"key": "str", "value": "str"}], + "taints": [{"key": "str", "value": "str"}], + "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, + } + ], + "kubernetesVersion": "str", + "networkConfiguration": { + "cloudServicesNetworkId": "str", + "cniNetworkId": "str", "attachedNetworkConfiguration": { "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], }, - "availabilityZones": ["str"], - "labels": [{"key": "str", "value": "str"}], - "taints": [{"key": "str", "value": "str"}], - "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, - } - ], - "kubernetesVersion": "str", - "location": "str", - "networkConfiguration": { - "cloudServicesNetworkId": "str", - "cniNetworkId": "str", - "attachedNetworkConfiguration": { - "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], - "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], - }, - "bgpServiceLoadBalancerConfiguration": { - "bgpAdvertisements": [ - { - "ipAddressPools": ["str"], - "advertiseToFabric": "True", - "communities": ["str"], - "peers": ["str"], - } - ], - "bgpPeers": [ - { - "name": "str", - "peerAddress": "str", - "peerAsn": 0, - "bfdEnabled": "str", - "bgpMultiHop": "False", - "holdTime": "str", - "keepAliveTime": "str", - "myAsn": 0, - "password": "str", - "peerPort": 179, - } - ], - "fabricPeeringEnabled": "True", - "ipAddressPools": [ - {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} - ], - }, - "dnsServiceIp": "str", - "l2ServiceLoadBalancerConfiguration": { - "ipAddressPools": [ - {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} - ] + "bgpServiceLoadBalancerConfiguration": { + "bgpAdvertisements": [ + { + "ipAddressPools": ["str"], + "advertiseToFabric": "str", + "communities": ["str"], + "peers": ["str"], + } + ], + "bgpPeers": [ + { + "name": "str", + "peerAddress": "str", + "peerAsn": 0, + "bfdEnabled": "str", + "bgpMultiHop": "str", + "holdTime": "str", + "keepAliveTime": "str", + "myAsn": 0, + "password": "str", + "peerPort": 0, + } + ], + "fabricPeeringEnabled": "str", + "ipAddressPools": [ + {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} + ], + }, + "dnsServiceIp": "str", + "l2ServiceLoadBalancerConfiguration": { + "ipAddressPools": [ + {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} + ] + }, + "podCidrs": ["str"], + "serviceCidrs": ["str"], }, - "podCidrs": ["str"], - "serviceCidrs": ["str"], + "aadConfiguration": {"adminGroupObjectIds": ["str"]}, + "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, + "attachedNetworkIds": ["str"], + "availableUpgrades": [{"availabilityLifecycle": "str", "version": "str"}], + "clusterId": "str", + "connectedClusterId": "str", + "controlPlaneKubernetesVersion": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "featureStatuses": [ + {"detailedStatus": "str", "detailedStatusMessage": "str", "name": "str", "version": "str"} + ], + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "nodes": [ + { + "agentPoolId": "str", + "availabilityZone": "str", + "bareMetalMachineId": "str", + "cpuCores": 0, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "diskSizeGB": 0, + "image": "str", + "kubernetesVersion": "str", + "labels": [{"key": "str", "value": "str"}], + "memorySizeGB": 0, + "mode": "str", + "name": "str", + "networkAttachments": [ + { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + } + ], + "powerState": "str", + "role": "str", + "taints": [{"key": "str", "value": "str"}], + "vmSkuName": "str", + } + ], + "provisioningState": "str", }, - "aadConfiguration": {"adminGroupObjectIds": ["str"]}, - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "attachedNetworkIds": ["str"], - "availableUpgrades": [{"availabilityLifecycle": "str", "version": "str"}], - "clusterId": "str", - "connectedClusterId": "str", - "controlPlaneKubernetesVersion": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", - "featureStatuses": [ - {"detailedStatus": "str", "detailedStatusMessage": "str", "name": "str", "version": "str"} - ], "id": "str", - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, "name": "str", - "nodes": [ - { - "agentPoolId": "str", - "availabilityZone": "str", - "bareMetalMachineId": "str", - "cpuCores": 0, - "detailedStatus": "str", - "detailedStatusMessage": "str", - "diskSizeGB": 0, - "image": "str", - "kubernetesVersion": "str", - "labels": [{"key": "str", "value": "str"}], - "memorySizeGB": 0, - "mode": "str", - "name": "str", - "networkAttachments": [ - { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - } - ], - "powerState": "str", - "role": "str", - "taints": [{"key": "str", "value": "str"}], - "vmSkuName": "str", - } - ], - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -191,7 +174,6 @@ def test_kubernetes_clusters_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -199,11 +181,10 @@ def test_kubernetes_clusters_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_kubernetes_clusters_begin_delete(self, resource_group): - response = self.client.kubernetes_clusters.begin_delete( + def test_kubernetes_clusters_begin_update(self, resource_group): + response = self.client.kubernetes_clusters.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -211,16 +192,33 @@ def test_kubernetes_clusters_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_kubernetes_clusters_begin_update(self, resource_group): - response = self.client.kubernetes_clusters.begin_update( + def test_kubernetes_clusters_begin_delete(self, resource_group): + response = self.client.kubernetes_clusters.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_kubernetes_clusters_list_by_resource_group(self, resource_group): + response = self.client.kubernetes_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_kubernetes_clusters_list_by_subscription(self, resource_group): + response = self.client.kubernetes_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_kubernetes_clusters_begin_restart_node(self, resource_group): @@ -228,7 +226,6 @@ def test_kubernetes_clusters_begin_restart_node(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", kubernetes_cluster_restart_node_parameters={"nodeName": "str"}, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations_async.py index e3b3b9b248b6..10e5116cc16e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_clusters_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_kubernetes_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 TestNetworkCloudMgmtKubernetesClustersOperationsAsync(AzureMgmtRecordedTes def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_kubernetes_clusters_list_by_subscription(self, resource_group): - response = self.client.kubernetes_clusters.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_kubernetes_clusters_list_by_resource_group(self, resource_group): - response = self.client.kubernetes_clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_kubernetes_clusters_get(self, resource_group): response = await self.client.kubernetes_clusters.get( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,131 +38,136 @@ async def test_kubernetes_clusters_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", kubernetes_cluster_parameters={ - "controlPlaneNodeConfiguration": { - "count": 0, - "vmSkuName": "str", - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "availabilityZones": ["str"], - }, "extendedLocation": {"name": "str", "type": "str"}, - "initialAgentPoolConfigurations": [ - { + "location": "str", + "properties": { + "controlPlaneNodeConfiguration": { "count": 0, - "mode": "str", - "name": "str", "vmSkuName": "str", "administratorConfiguration": { "adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}], }, - "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "2M"}, + "availabilityZones": ["str"], + }, + "initialAgentPoolConfigurations": [ + { + "count": 0, + "mode": "str", + "name": "str", + "vmSkuName": "str", + "administratorConfiguration": { + "adminUsername": "str", + "sshPublicKeys": [{"keyData": "str"}], + }, + "agentOptions": {"hugepagesCount": 0, "hugepagesSize": "str"}, + "attachedNetworkConfiguration": { + "l2Networks": [{"networkId": "str", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], + "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], + }, + "availabilityZones": ["str"], + "labels": [{"key": "str", "value": "str"}], + "taints": [{"key": "str", "value": "str"}], + "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, + } + ], + "kubernetesVersion": "str", + "networkConfiguration": { + "cloudServicesNetworkId": "str", + "cniNetworkId": "str", "attachedNetworkConfiguration": { "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], + "l3Networks": [{"networkId": "str", "ipamEnabled": "str", "pluginType": "str"}], "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], }, - "availabilityZones": ["str"], - "labels": [{"key": "str", "value": "str"}], - "taints": [{"key": "str", "value": "str"}], - "upgradeSettings": {"drainTimeout": 0, "maxSurge": "str", "maxUnavailable": "str"}, - } - ], - "kubernetesVersion": "str", - "location": "str", - "networkConfiguration": { - "cloudServicesNetworkId": "str", - "cniNetworkId": "str", - "attachedNetworkConfiguration": { - "l2Networks": [{"networkId": "str", "pluginType": "str"}], - "l3Networks": [{"networkId": "str", "ipamEnabled": "False", "pluginType": "str"}], - "trunkedNetworks": [{"networkId": "str", "pluginType": "str"}], - }, - "bgpServiceLoadBalancerConfiguration": { - "bgpAdvertisements": [ - { - "ipAddressPools": ["str"], - "advertiseToFabric": "True", - "communities": ["str"], - "peers": ["str"], - } - ], - "bgpPeers": [ - { - "name": "str", - "peerAddress": "str", - "peerAsn": 0, - "bfdEnabled": "str", - "bgpMultiHop": "False", - "holdTime": "str", - "keepAliveTime": "str", - "myAsn": 0, - "password": "str", - "peerPort": 179, - } - ], - "fabricPeeringEnabled": "True", - "ipAddressPools": [ - {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} - ], - }, - "dnsServiceIp": "str", - "l2ServiceLoadBalancerConfiguration": { - "ipAddressPools": [ - {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} - ] + "bgpServiceLoadBalancerConfiguration": { + "bgpAdvertisements": [ + { + "ipAddressPools": ["str"], + "advertiseToFabric": "str", + "communities": ["str"], + "peers": ["str"], + } + ], + "bgpPeers": [ + { + "name": "str", + "peerAddress": "str", + "peerAsn": 0, + "bfdEnabled": "str", + "bgpMultiHop": "str", + "holdTime": "str", + "keepAliveTime": "str", + "myAsn": 0, + "password": "str", + "peerPort": 0, + } + ], + "fabricPeeringEnabled": "str", + "ipAddressPools": [ + {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} + ], + }, + "dnsServiceIp": "str", + "l2ServiceLoadBalancerConfiguration": { + "ipAddressPools": [ + {"addresses": ["str"], "name": "str", "autoAssign": "str", "onlyUseHostIps": "str"} + ] + }, + "podCidrs": ["str"], + "serviceCidrs": ["str"], }, - "podCidrs": ["str"], - "serviceCidrs": ["str"], + "aadConfiguration": {"adminGroupObjectIds": ["str"]}, + "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, + "attachedNetworkIds": ["str"], + "availableUpgrades": [{"availabilityLifecycle": "str", "version": "str"}], + "clusterId": "str", + "connectedClusterId": "str", + "controlPlaneKubernetesVersion": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "featureStatuses": [ + {"detailedStatus": "str", "detailedStatusMessage": "str", "name": "str", "version": "str"} + ], + "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, + "nodes": [ + { + "agentPoolId": "str", + "availabilityZone": "str", + "bareMetalMachineId": "str", + "cpuCores": 0, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "diskSizeGB": 0, + "image": "str", + "kubernetesVersion": "str", + "labels": [{"key": "str", "value": "str"}], + "memorySizeGB": 0, + "mode": "str", + "name": "str", + "networkAttachments": [ + { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + } + ], + "powerState": "str", + "role": "str", + "taints": [{"key": "str", "value": "str"}], + "vmSkuName": "str", + } + ], + "provisioningState": "str", }, - "aadConfiguration": {"adminGroupObjectIds": ["str"]}, - "administratorConfiguration": {"adminUsername": "str", "sshPublicKeys": [{"keyData": "str"}]}, - "attachedNetworkIds": ["str"], - "availableUpgrades": [{"availabilityLifecycle": "str", "version": "str"}], - "clusterId": "str", - "connectedClusterId": "str", - "controlPlaneKubernetesVersion": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", - "featureStatuses": [ - {"detailedStatus": "str", "detailedStatusMessage": "str", "name": "str", "version": "str"} - ], "id": "str", - "managedResourceGroupConfiguration": {"location": "str", "name": "str"}, "name": "str", - "nodes": [ - { - "agentPoolId": "str", - "availabilityZone": "str", - "bareMetalMachineId": "str", - "cpuCores": 0, - "detailedStatus": "str", - "detailedStatusMessage": "str", - "diskSizeGB": 0, - "image": "str", - "kubernetesVersion": "str", - "labels": [{"key": "str", "value": "str"}], - "memorySizeGB": 0, - "mode": "str", - "name": "str", - "networkAttachments": [ - { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - } - ], - "powerState": "str", - "role": "str", - "taints": [{"key": "str", "value": "str"}], - "vmSkuName": "str", - } - ], - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -196,7 +179,6 @@ async def test_kubernetes_clusters_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -205,12 +187,11 @@ async def test_kubernetes_clusters_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_kubernetes_clusters_begin_delete(self, resource_group): + async def test_kubernetes_clusters_begin_update(self, resource_group): response = await ( - await self.client.kubernetes_clusters.begin_delete( + await self.client.kubernetes_clusters.begin_update( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -219,18 +200,35 @@ async def test_kubernetes_clusters_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_kubernetes_clusters_begin_update(self, resource_group): + async def test_kubernetes_clusters_begin_delete(self, resource_group): response = await ( - await self.client.kubernetes_clusters.begin_update( + await self.client.kubernetes_clusters.begin_delete( resource_group_name=resource_group.name, kubernetes_cluster_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_kubernetes_clusters_list_by_resource_group(self, resource_group): + response = self.client.kubernetes_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_kubernetes_clusters_list_by_subscription(self, resource_group): + response = self.client.kubernetes_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_kubernetes_clusters_begin_restart_node(self, resource_group): @@ -239,7 +237,6 @@ async def test_kubernetes_clusters_begin_restart_node(self, resource_group): resource_group_name=resource_group.name, kubernetes_cluster_name="str", kubernetes_cluster_restart_node_parameters={"nodeName": "str"}, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations.py index 9a87a47d2911..f31425d4ebd0 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_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 TestNetworkCloudMgmtL2NetworksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_l2_networks_list_by_subscription(self, resource_group): - response = self.client.l2_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_l2_networks_list_by_resource_group(self, resource_group): - response = self.client.l2_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_l2_networks_get(self, resource_group): response = self.client.l2_networks.get( resource_group_name=resource_group.name, l2_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -59,19 +37,22 @@ def test_l2_networks_begin_create_or_update(self, resource_group): l2_network_name="str", l2_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "l2IsolationDomainId": "str", "location": "str", - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "l2IsolationDomainId": "str", + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksPluginType": "str", + "interfaceName": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -82,21 +63,29 @@ def test_l2_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_l2_networks_update(self, resource_group): + response = self.client.l2_networks.update( + resource_group_name=resource_group.name, + l2_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_l2_networks_begin_delete(self, resource_group): response = self.client.l2_networks.begin_delete( resource_group_name=resource_group.name, l2_network_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -104,12 +93,18 @@ def test_l2_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_l2_networks_update(self, resource_group): - response = self.client.l2_networks.update( + def test_l2_networks_list_by_resource_group(self, resource_group): + response = self.client.l2_networks.list_by_resource_group( resource_group_name=resource_group.name, - l2_network_name="str", - api_version="2025-09-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_l2_networks_list_by_subscription(self, resource_group): + response = self.client.l2_networks.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations_async.py index 916c22877a17..53be8b42269e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l2_networks_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 TestNetworkCloudMgmtL2NetworksOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_l2_networks_list_by_subscription(self, resource_group): - response = self.client.l2_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_l2_networks_list_by_resource_group(self, resource_group): - response = self.client.l2_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_l2_networks_get(self, resource_group): response = await self.client.l2_networks.get( resource_group_name=resource_group.name, l2_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -61,19 +39,22 @@ async def test_l2_networks_begin_create_or_update(self, resource_group): l2_network_name="str", l2_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "l2IsolationDomainId": "str", "location": "str", - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "l2IsolationDomainId": "str", + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksPluginType": "str", + "interfaceName": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -84,15 +65,24 @@ async def test_l2_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_l2_networks_update(self, resource_group): + response = await self.client.l2_networks.update( + resource_group_name=resource_group.name, + l2_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_l2_networks_begin_delete(self, resource_group): @@ -100,7 +90,6 @@ async def test_l2_networks_begin_delete(self, resource_group): await self.client.l2_networks.begin_delete( resource_group_name=resource_group.name, l2_network_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -109,12 +98,18 @@ async def test_l2_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_l2_networks_update(self, resource_group): - response = await self.client.l2_networks.update( + async def test_l2_networks_list_by_resource_group(self, resource_group): + response = self.client.l2_networks.list_by_resource_group( resource_group_name=resource_group.name, - l2_network_name="str", - api_version="2025-09-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_l2_networks_list_by_subscription(self, resource_group): + response = self.client.l2_networks.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations.py index 8e1821135f88..fa8a5539f6b6 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_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 TestNetworkCloudMgmtL3NetworksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_l3_networks_list_by_subscription(self, resource_group): - response = self.client.l3_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_l3_networks_list_by_resource_group(self, resource_group): - response = self.client.l3_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_l3_networks_get(self, resource_group): response = self.client.l3_networks.get( resource_group_name=resource_group.name, l3_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -59,24 +37,27 @@ def test_l3_networks_begin_create_or_update(self, resource_group): l3_network_name="str", l3_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "l3IsolationDomainId": "str", "location": "str", - "vlan": 0, - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "l3IsolationDomainId": "str", + "vlan": 0, + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksIpamEnabled": "str", + "hybridAksPluginType": "str", + "interfaceName": "str", + "ipAllocationType": "str", + "ipv4ConnectedPrefix": "str", + "ipv6ConnectedPrefix": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksIpamEnabled": "True", - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", - "ipAllocationType": "DualStack", - "ipv4ConnectedPrefix": "str", - "ipv6ConnectedPrefix": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,21 +68,29 @@ def test_l3_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_l3_networks_update(self, resource_group): + response = self.client.l3_networks.update( + resource_group_name=resource_group.name, + l3_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_l3_networks_begin_delete(self, resource_group): response = self.client.l3_networks.begin_delete( resource_group_name=resource_group.name, l3_network_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -109,12 +98,18 @@ def test_l3_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_l3_networks_update(self, resource_group): - response = self.client.l3_networks.update( + def test_l3_networks_list_by_resource_group(self, resource_group): + response = self.client.l3_networks.list_by_resource_group( resource_group_name=resource_group.name, - l3_network_name="str", - api_version="2025-09-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_l3_networks_list_by_subscription(self, resource_group): + response = self.client.l3_networks.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations_async.py index ae470e6ef54b..d4b56159af36 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_l3_networks_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 TestNetworkCloudMgmtL3NetworksOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_l3_networks_list_by_subscription(self, resource_group): - response = self.client.l3_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_l3_networks_list_by_resource_group(self, resource_group): - response = self.client.l3_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_l3_networks_get(self, resource_group): response = await self.client.l3_networks.get( resource_group_name=resource_group.name, l3_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -61,24 +39,27 @@ async def test_l3_networks_begin_create_or_update(self, resource_group): l3_network_name="str", l3_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "l3IsolationDomainId": "str", "location": "str", - "vlan": 0, - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "l3IsolationDomainId": "str", + "vlan": 0, + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksIpamEnabled": "str", + "hybridAksPluginType": "str", + "interfaceName": "str", + "ipAllocationType": "str", + "ipv4ConnectedPrefix": "str", + "ipv6ConnectedPrefix": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksIpamEnabled": "True", - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", - "ipAllocationType": "DualStack", - "ipv4ConnectedPrefix": "str", - "ipv6ConnectedPrefix": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -89,15 +70,24 @@ async def test_l3_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_l3_networks_update(self, resource_group): + response = await self.client.l3_networks.update( + resource_group_name=resource_group.name, + l3_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_l3_networks_begin_delete(self, resource_group): @@ -105,7 +95,6 @@ async def test_l3_networks_begin_delete(self, resource_group): await self.client.l3_networks.begin_delete( resource_group_name=resource_group.name, l3_network_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -114,12 +103,18 @@ async def test_l3_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_l3_networks_update(self, resource_group): - response = await self.client.l3_networks.update( + async def test_l3_networks_list_by_resource_group(self, resource_group): + response = self.client.l3_networks.list_by_resource_group( resource_group_name=resource_group.name, - l3_network_name="str", - api_version="2025-09-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_l3_networks_list_by_subscription(self, resource_group): + response = self.client.l3_networks.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations.py index 084ac03fd19b..1c72326f5adc 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestNetworkCloudMgmtMetricsConfigurationsOperations(AzureMgmtRecordedTestC def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metrics_configurations_list_by_cluster(self, resource_group): - response = self.client.metrics_configurations.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_metrics_configurations_get(self, resource_group): @@ -37,7 +25,6 @@ def test_metrics_configurations_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -51,17 +38,19 @@ def test_metrics_configurations_begin_create_or_update(self, resource_group): cluster_name="str", metrics_configuration_name="str", metrics_configuration_parameters={ - "collectionInterval": 0, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "disabledMetrics": ["str"], - "enabledMetrics": ["str"], + "properties": { + "collectionInterval": 0, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "disabledMetrics": ["str"], + "enabledMetrics": ["str"], + "provisioningState": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -73,7 +62,6 @@ def test_metrics_configurations_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,12 +69,11 @@ def test_metrics_configurations_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_metrics_configurations_begin_delete(self, resource_group): - response = self.client.metrics_configurations.begin_delete( + def test_metrics_configurations_begin_update(self, resource_group): + response = self.client.metrics_configurations.begin_update( resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,13 +81,23 @@ def test_metrics_configurations_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_metrics_configurations_begin_update(self, resource_group): - response = self.client.metrics_configurations.begin_update( + def test_metrics_configurations_begin_delete(self, resource_group): + response = self.client.metrics_configurations.begin_delete( resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_metrics_configurations_list_by_cluster(self, resource_group): + response = self.client.metrics_configurations.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations_async.py index 4ac21836dbca..621a7190c856 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_metrics_configurations_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestNetworkCloudMgmtMetricsConfigurationsOperationsAsync(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metrics_configurations_list_by_cluster(self, resource_group): - response = self.client.metrics_configurations.list_by_cluster( - resource_group_name=resource_group.name, - cluster_name="str", - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_metrics_configurations_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_metrics_configurations_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -53,17 +40,19 @@ async def test_metrics_configurations_begin_create_or_update(self, resource_grou cluster_name="str", metrics_configuration_name="str", metrics_configuration_parameters={ - "collectionInterval": 0, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", - "disabledMetrics": ["str"], - "enabledMetrics": ["str"], + "properties": { + "collectionInterval": 0, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "disabledMetrics": ["str"], + "enabledMetrics": ["str"], + "provisioningState": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -75,7 +64,6 @@ async def test_metrics_configurations_begin_create_or_update(self, resource_grou "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -84,13 +72,12 @@ async def test_metrics_configurations_begin_create_or_update(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_metrics_configurations_begin_delete(self, resource_group): + async def test_metrics_configurations_begin_update(self, resource_group): response = await ( - await self.client.metrics_configurations.begin_delete( + await self.client.metrics_configurations.begin_update( resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -99,15 +86,25 @@ async def test_metrics_configurations_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_metrics_configurations_begin_update(self, resource_group): + async def test_metrics_configurations_begin_delete(self, resource_group): response = await ( - await self.client.metrics_configurations.begin_update( + await self.client.metrics_configurations.begin_delete( resource_group_name=resource_group.name, cluster_name="str", metrics_configuration_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_metrics_configurations_list_by_cluster(self, resource_group): + response = self.client.metrics_configurations.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations.py index 805b9886499d..e8f1506c8e4c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-09-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations_async.py index 9744bb1ccb61..e7870b045c66 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-09-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations.py index 75914b5bd6a4..cc39f9a87c1d 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_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 @@ -20,21 +20,18 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_rack_skus_list_by_subscription(self, resource_group): - response = self.client.rack_skus.list_by_subscription( - api_version="2025-09-01", + def test_rack_skus_get(self, resource_group): + response = self.client.rack_skus.get( + rack_sku_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_rack_skus_get(self, resource_group): - response = self.client.rack_skus.get( - rack_sku_name="str", - api_version="2025-09-01", - ) - + def test_rack_skus_list_by_subscription(self, resource_group): + response = self.client.rack_skus.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations_async.py index 92bcde53c6b2..36b53eb95833 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_skus_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_rack_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 @@ -21,21 +21,18 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_rack_skus_list_by_subscription(self, resource_group): - response = self.client.rack_skus.list_by_subscription( - api_version="2025-09-01", + async def test_rack_skus_get(self, resource_group): + response = await self.client.rack_skus.get( + rack_sku_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_rack_skus_get(self, resource_group): - response = await self.client.rack_skus.get( - rack_sku_name="str", - api_version="2025-09-01", - ) - + async def test_rack_skus_list_by_subscription(self, resource_group): + response = self.client.rack_skus.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations.py index 44fb0f866aa2..03df86d21aff 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_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 TestNetworkCloudMgmtRacksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_racks_list_by_subscription(self, resource_group): - response = self.client.racks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_racks_list_by_resource_group(self, resource_group): - response = self.client.racks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_racks_get(self, resource_group): response = self.client.racks.get( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,19 +36,21 @@ def test_racks_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, rack_name="str", rack_parameters={ - "availabilityZone": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "rackLocation": "str", - "rackSerialNumber": "str", - "rackSkuId": "str", - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "availabilityZone": "str", + "rackLocation": "str", + "rackSerialNumber": "str", + "rackSkuId": "str", + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "provisioningState": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -82,7 +62,6 @@ def test_racks_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -90,11 +69,10 @@ def test_racks_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_racks_begin_delete(self, resource_group): - response = self.client.racks.begin_delete( + def test_racks_begin_update(self, resource_group): + response = self.client.racks.begin_update( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -102,12 +80,29 @@ def test_racks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_racks_begin_update(self, resource_group): - response = self.client.racks.begin_update( + def test_racks_begin_delete(self, resource_group): + response = self.client.racks.begin_delete( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_racks_list_by_resource_group(self, resource_group): + response = self.client.racks.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_racks_list_by_subscription(self, resource_group): + response = self.client.racks.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations_async.py index 460eddd40c11..f1ccbdd434c6 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_racks_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 TestNetworkCloudMgmtRacksOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_racks_list_by_subscription(self, resource_group): - response = self.client.racks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_racks_list_by_resource_group(self, resource_group): - response = self.client.racks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_racks_get(self, resource_group): response = await self.client.racks.get( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,19 +38,21 @@ async def test_racks_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, rack_name="str", rack_parameters={ - "availabilityZone": "str", "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "rackLocation": "str", - "rackSerialNumber": "str", - "rackSkuId": "str", - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "availabilityZone": "str", + "rackLocation": "str", + "rackSerialNumber": "str", + "rackSkuId": "str", + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "provisioningState": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -84,7 +64,6 @@ async def test_racks_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -93,12 +72,11 @@ async def test_racks_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_racks_begin_delete(self, resource_group): + async def test_racks_begin_update(self, resource_group): response = await ( - await self.client.racks.begin_delete( + await self.client.racks.begin_update( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -107,14 +85,31 @@ async def test_racks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_racks_begin_update(self, resource_group): + async def test_racks_begin_delete(self, resource_group): response = await ( - await self.client.racks.begin_update( + await self.client.racks.begin_delete( resource_group_name=resource_group.name, rack_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_racks_list_by_resource_group(self, resource_group): + response = self.client.racks.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_racks_list_by_subscription(self, resource_group): + response = self.client.racks.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations.py index 71c813179e85..8ffe181cc344 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_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 TestNetworkCloudMgmtStorageAppliancesOperations(AzureMgmtRecordedTestCase) def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_storage_appliances_list_by_subscription(self, resource_group): - response = self.client.storage_appliances.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_storage_appliances_list_by_resource_group(self, resource_group): - response = self.client.storage_appliances.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_storage_appliances_get(self, resource_group): response = self.client.storage_appliances.get( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,42 +36,45 @@ def test_storage_appliances_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, storage_appliance_name="str", storage_appliance_parameters={ - "administratorCredentials": {"password": "str", "username": "str"}, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "rackId": "str", - "rackSlot": 0, - "serialNumber": "str", - "storageApplianceSkuId": "str", - "caCertificate": {"hash": "str", "value": "str"}, - "capacity": 0, - "capacityUsed": 0, - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "administratorCredentials": {"password": "str", "username": "str"}, + "rackId": "str", + "rackSlot": 0, + "serialNumber": "str", + "storageApplianceSkuId": "str", + "caCertificate": {"hash": "str", "value": "str"}, + "capacity": 0, + "capacityUsed": 0, + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "managementIpv4Address": "str", + "manufacturer": "str", + "model": "str", + "provisioningState": "str", + "remoteVendorManagementFeature": "str", + "remoteVendorManagementStatus": "str", + "secretRotationStatus": [ + { + "expirePeriodDays": 0, + "lastRotationTime": "2020-02-20 00:00:00", + "rotationPeriodDays": 0, + "secretArchiveReference": { + "keyVaultId": "str", + "keyVaultUri": "str", + "secretName": "str", + "secretVersion": "str", + }, + "secretType": "str", + } + ], + "version": "str", + }, "etag": "str", "id": "str", - "managementIpv4Address": "str", - "manufacturer": "str", - "model": "str", "name": "str", - "provisioningState": "str", - "remoteVendorManagementFeature": "str", - "remoteVendorManagementStatus": "str", - "secretRotationStatus": [ - { - "expirePeriodDays": 0, - "lastRotationTime": "2020-02-20 00:00:00", - "rotationPeriodDays": 0, - "secretArchiveReference": { - "keyVaultId": "str", - "keyVaultUri": "str", - "secretName": "str", - "secretVersion": "str", - }, - "secretType": "str", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -104,9 +85,7 @@ def test_storage_appliances_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "version": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -114,11 +93,10 @@ def test_storage_appliances_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_storage_appliances_begin_delete(self, resource_group): - response = self.client.storage_appliances.begin_delete( + def test_storage_appliances_begin_update(self, resource_group): + response = self.client.storage_appliances.begin_update( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -126,23 +104,39 @@ def test_storage_appliances_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_storage_appliances_begin_update(self, resource_group): - response = self.client.storage_appliances.begin_update( + def test_storage_appliances_begin_delete(self, resource_group): + response = self.client.storage_appliances.begin_delete( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_appliances_list_by_resource_group(self, resource_group): + response = self.client.storage_appliances.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_storage_appliances_list_by_subscription(self, resource_group): + response = self.client.storage_appliances.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_storage_appliances_begin_disable_remote_vendor_management(self, resource_group): response = self.client.storage_appliances.begin_disable_remote_vendor_management( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -154,7 +148,6 @@ def test_storage_appliances_begin_enable_remote_vendor_management(self, resource response = self.client.storage_appliances.begin_enable_remote_vendor_management( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -170,7 +163,6 @@ def test_storage_appliances_begin_run_read_commands(self, resource_group): "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations_async.py index 183ab7f28e0c..e74d6c939e9f 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_storage_appliances_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 TestNetworkCloudMgmtStorageAppliancesOperationsAsync(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_storage_appliances_list_by_subscription(self, resource_group): - response = self.client.storage_appliances.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_storage_appliances_list_by_resource_group(self, resource_group): - response = self.client.storage_appliances.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_storage_appliances_get(self, resource_group): response = await self.client.storage_appliances.get( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,42 +38,45 @@ async def test_storage_appliances_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, storage_appliance_name="str", storage_appliance_parameters={ - "administratorCredentials": {"password": "str", "username": "str"}, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "rackId": "str", - "rackSlot": 0, - "serialNumber": "str", - "storageApplianceSkuId": "str", - "caCertificate": {"hash": "str", "value": "str"}, - "capacity": 0, - "capacityUsed": 0, - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "administratorCredentials": {"password": "str", "username": "str"}, + "rackId": "str", + "rackSlot": 0, + "serialNumber": "str", + "storageApplianceSkuId": "str", + "caCertificate": {"hash": "str", "value": "str"}, + "capacity": 0, + "capacityUsed": 0, + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "managementIpv4Address": "str", + "manufacturer": "str", + "model": "str", + "provisioningState": "str", + "remoteVendorManagementFeature": "str", + "remoteVendorManagementStatus": "str", + "secretRotationStatus": [ + { + "expirePeriodDays": 0, + "lastRotationTime": "2020-02-20 00:00:00", + "rotationPeriodDays": 0, + "secretArchiveReference": { + "keyVaultId": "str", + "keyVaultUri": "str", + "secretName": "str", + "secretVersion": "str", + }, + "secretType": "str", + } + ], + "version": "str", + }, "etag": "str", "id": "str", - "managementIpv4Address": "str", - "manufacturer": "str", - "model": "str", "name": "str", - "provisioningState": "str", - "remoteVendorManagementFeature": "str", - "remoteVendorManagementStatus": "str", - "secretRotationStatus": [ - { - "expirePeriodDays": 0, - "lastRotationTime": "2020-02-20 00:00:00", - "rotationPeriodDays": 0, - "secretArchiveReference": { - "keyVaultId": "str", - "keyVaultUri": "str", - "secretName": "str", - "secretVersion": "str", - }, - "secretType": "str", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -106,9 +87,7 @@ async def test_storage_appliances_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "version": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -117,12 +96,11 @@ async def test_storage_appliances_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_storage_appliances_begin_delete(self, resource_group): + async def test_storage_appliances_begin_update(self, resource_group): response = await ( - await self.client.storage_appliances.begin_delete( + await self.client.storage_appliances.begin_update( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -131,18 +109,35 @@ async def test_storage_appliances_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_storage_appliances_begin_update(self, resource_group): + async def test_storage_appliances_begin_delete(self, resource_group): response = await ( - await self.client.storage_appliances.begin_update( + await self.client.storage_appliances.begin_delete( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_appliances_list_by_resource_group(self, resource_group): + response = self.client.storage_appliances.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_storage_appliances_list_by_subscription(self, resource_group): + response = self.client.storage_appliances.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_storage_appliances_begin_disable_remote_vendor_management(self, resource_group): @@ -150,7 +145,6 @@ async def test_storage_appliances_begin_disable_remote_vendor_management(self, r await self.client.storage_appliances.begin_disable_remote_vendor_management( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -164,7 +158,6 @@ async def test_storage_appliances_begin_enable_remote_vendor_management(self, re await self.client.storage_appliances.begin_enable_remote_vendor_management( resource_group_name=resource_group.name, storage_appliance_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -182,7 +175,6 @@ async def test_storage_appliances_begin_run_read_commands(self, resource_group): "commands": [{"command": "str", "arguments": ["str"]}], "limitTimeSeconds": 0, }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations.py index 94013e7184e6..953be3a31eff 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_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 TestNetworkCloudMgmtTrunkedNetworksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_trunked_networks_list_by_subscription(self, resource_group): - response = self.client.trunked_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_trunked_networks_list_by_resource_group(self, resource_group): - response = self.client.trunked_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_trunked_networks_get(self, resource_group): response = self.client.trunked_networks.get( resource_group_name=resource_group.name, trunked_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -59,20 +37,23 @@ def test_trunked_networks_begin_create_or_update(self, resource_group): trunked_network_name="str", trunked_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "isolationDomainIds": ["str"], "location": "str", - "vlans": [0], - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "isolationDomainIds": ["str"], + "vlans": [0], + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksPluginType": "str", + "interfaceName": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,21 +64,29 @@ def test_trunked_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_trunked_networks_update(self, resource_group): + response = self.client.trunked_networks.update( + resource_group_name=resource_group.name, + trunked_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_trunked_networks_begin_delete(self, resource_group): response = self.client.trunked_networks.begin_delete( resource_group_name=resource_group.name, trunked_network_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -105,12 +94,18 @@ def test_trunked_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_trunked_networks_update(self, resource_group): - response = self.client.trunked_networks.update( + def test_trunked_networks_list_by_resource_group(self, resource_group): + response = self.client.trunked_networks.list_by_resource_group( resource_group_name=resource_group.name, - trunked_network_name="str", - api_version="2025-09-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_trunked_networks_list_by_subscription(self, resource_group): + response = self.client.trunked_networks.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations_async.py index 1163ed9c60ab..7e5a19eeb901 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_trunked_networks_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 TestNetworkCloudMgmtTrunkedNetworksOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_trunked_networks_list_by_subscription(self, resource_group): - response = self.client.trunked_networks.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_trunked_networks_list_by_resource_group(self, resource_group): - response = self.client.trunked_networks.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_trunked_networks_get(self, resource_group): response = await self.client.trunked_networks.get( resource_group_name=resource_group.name, trunked_network_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -61,20 +39,23 @@ async def test_trunked_networks_begin_create_or_update(self, resource_group): trunked_network_name="str", trunked_network_parameters={ "extendedLocation": {"name": "str", "type": "str"}, - "isolationDomainIds": ["str"], "location": "str", - "vlans": [0], - "associatedResourceIds": ["str"], - "clusterId": "str", - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "isolationDomainIds": ["str"], + "vlans": [0], + "associatedResourceIds": ["str"], + "clusterId": "str", + "detailedStatus": "str", + "detailedStatusMessage": "str", + "hybridAksClustersAssociatedIds": ["str"], + "hybridAksPluginType": "str", + "interfaceName": "str", + "provisioningState": "str", + "virtualMachinesAssociatedIds": ["str"], + }, "etag": "str", - "hybridAksClustersAssociatedIds": ["str"], - "hybridAksPluginType": "str", "id": "str", - "interfaceName": "str", "name": "str", - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -85,15 +66,24 @@ async def test_trunked_networks_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "virtualMachinesAssociatedIds": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_trunked_networks_update(self, resource_group): + response = await self.client.trunked_networks.update( + resource_group_name=resource_group.name, + trunked_network_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_trunked_networks_begin_delete(self, resource_group): @@ -101,7 +91,6 @@ async def test_trunked_networks_begin_delete(self, resource_group): await self.client.trunked_networks.begin_delete( resource_group_name=resource_group.name, trunked_network_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -110,12 +99,18 @@ async def test_trunked_networks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_trunked_networks_update(self, resource_group): - response = await self.client.trunked_networks.update( + async def test_trunked_networks_list_by_resource_group(self, resource_group): + response = self.client.trunked_networks.list_by_resource_group( resource_group_name=resource_group.name, - trunked_network_name="str", - api_version="2025-09-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_trunked_networks_list_by_subscription(self, resource_group): + response = self.client.trunked_networks.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations.py index 8c6d22fdbd74..94549fd2e11e 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,34 +18,12 @@ class TestNetworkCloudMgmtVirtualMachinesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_by_subscription(self, resource_group): - response = self.client.virtual_machines.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_by_resource_group(self, resource_group): - response = self.client.virtual_machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machines_get(self, resource_group): response = self.client.virtual_machines.get( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -58,32 +36,60 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, virtual_machine_name="str", virtual_machine_parameters={ - "adminUsername": "str", - "cloudServicesNetworkAttachment": { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - }, - "cpuCores": 0, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "memorySizeGB": 0, - "storageProfile": { - "osDisk": {"diskSizeGB": 0, "createOption": "Ephemeral", "deleteOption": "Delete"}, - "volumeAttachments": ["str"], + "properties": { + "adminUsername": "str", + "cloudServicesNetworkAttachment": { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + }, + "cpuCores": 0, + "memorySizeGB": 0, + "storageProfile": { + "osDisk": {"diskSizeGB": 0, "createOption": "str", "deleteOption": "str"}, + "volumeAttachments": ["str"], + }, + "vmImage": "str", + "availabilityZone": "str", + "bareMetalMachineId": "str", + "bootMethod": "str", + "clusterId": "str", + "consoleExtendedLocation": {"name": "str", "type": "str"}, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "isolateEmulatorThread": "str", + "networkAttachments": [ + { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + } + ], + "networkData": "str", + "networkDataContent": "str", + "placementHints": [ + {"hintType": "str", "resourceId": "str", "schedulingExecution": "str", "scope": "str"} + ], + "powerState": "str", + "provisioningState": "str", + "sshPublicKeys": [{"keyData": "str"}], + "userData": "str", + "userDataContent": "str", + "virtioInterface": "str", + "vmDeviceModel": "str", + "vmImageRepositoryCredentials": {"password": "str", "registryUrl": "str", "username": "str"}, + "volumes": ["str"], }, - "vmImage": "str", - "availabilityZone": "str", - "bareMetalMachineId": "str", - "bootMethod": "UEFI", - "clusterId": "str", - "consoleExtendedLocation": {"name": "str", "type": "str"}, - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "id": "str", "identity": { @@ -92,27 +98,7 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "isolateEmulatorThread": "True", "name": "str", - "networkAttachments": [ - { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - } - ], - "networkData": "str", - "networkDataContent": "str", - "placementHints": [ - {"hintType": "str", "resourceId": "str", "schedulingExecution": "str", "scope": "str"} - ], - "powerState": "str", - "provisioningState": "str", - "sshPublicKeys": [{"keyData": "str"}], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -123,14 +109,7 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "userData": "str", - "userDataContent": "str", - "virtioInterface": "Modern", - "vmDeviceModel": "T2", - "vmImageRepositoryCredentials": {"password": "str", "registryUrl": "str", "username": "str"}, - "volumes": ["str"], }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -138,11 +117,10 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_delete(self, resource_group): - response = self.client.virtual_machines.begin_delete( + def test_virtual_machines_begin_update(self, resource_group): + response = self.client.virtual_machines.begin_update( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -150,23 +128,39 @@ def test_virtual_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_update(self, resource_group): - response = self.client.virtual_machines.begin_update( + def test_virtual_machines_begin_delete(self, resource_group): + response = self.client.virtual_machines.begin_delete( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_list_by_resource_group(self, resource_group): + response = self.client.virtual_machines.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_virtual_machines_list_by_subscription(self, resource_group): + response = self.client.virtual_machines.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_virtual_machines_begin_assign_relay(self, resource_group): response = self.client.virtual_machines.begin_assign_relay( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -178,7 +172,6 @@ def test_virtual_machines_begin_power_off(self, resource_group): response = self.client.virtual_machines.begin_power_off( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -190,7 +183,6 @@ def test_virtual_machines_begin_reimage(self, resource_group): response = self.client.virtual_machines.begin_reimage( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -202,7 +194,6 @@ def test_virtual_machines_begin_restart(self, resource_group): response = self.client.virtual_machines.begin_restart( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -214,7 +205,6 @@ def test_virtual_machines_begin_start(self, resource_group): response = self.client.virtual_machines.begin_start( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations_async.py index 3442b67dc982..79ea9227449c 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_virtual_machines_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,34 +19,12 @@ class TestNetworkCloudMgmtVirtualMachinesOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_by_subscription(self, resource_group): - response = self.client.virtual_machines.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_by_resource_group(self, resource_group): - response = self.client.virtual_machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machines_get(self, resource_group): response = await self.client.virtual_machines.get( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,32 +38,60 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, virtual_machine_name="str", virtual_machine_parameters={ - "adminUsername": "str", - "cloudServicesNetworkAttachment": { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - }, - "cpuCores": 0, "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "memorySizeGB": 0, - "storageProfile": { - "osDisk": {"diskSizeGB": 0, "createOption": "Ephemeral", "deleteOption": "Delete"}, - "volumeAttachments": ["str"], + "properties": { + "adminUsername": "str", + "cloudServicesNetworkAttachment": { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + }, + "cpuCores": 0, + "memorySizeGB": 0, + "storageProfile": { + "osDisk": {"diskSizeGB": 0, "createOption": "str", "deleteOption": "str"}, + "volumeAttachments": ["str"], + }, + "vmImage": "str", + "availabilityZone": "str", + "bareMetalMachineId": "str", + "bootMethod": "str", + "clusterId": "str", + "consoleExtendedLocation": {"name": "str", "type": "str"}, + "detailedStatus": "str", + "detailedStatusMessage": "str", + "isolateEmulatorThread": "str", + "networkAttachments": [ + { + "attachedNetworkId": "str", + "ipAllocationMethod": "str", + "defaultGateway": "str", + "ipv4Address": "str", + "ipv6Address": "str", + "macAddress": "str", + "networkAttachmentName": "str", + } + ], + "networkData": "str", + "networkDataContent": "str", + "placementHints": [ + {"hintType": "str", "resourceId": "str", "schedulingExecution": "str", "scope": "str"} + ], + "powerState": "str", + "provisioningState": "str", + "sshPublicKeys": [{"keyData": "str"}], + "userData": "str", + "userDataContent": "str", + "virtioInterface": "str", + "vmDeviceModel": "str", + "vmImageRepositoryCredentials": {"password": "str", "registryUrl": "str", "username": "str"}, + "volumes": ["str"], }, - "vmImage": "str", - "availabilityZone": "str", - "bareMetalMachineId": "str", - "bootMethod": "UEFI", - "clusterId": "str", - "consoleExtendedLocation": {"name": "str", "type": "str"}, - "detailedStatus": "str", - "detailedStatusMessage": "str", "etag": "str", "id": "str", "identity": { @@ -94,27 +100,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "isolateEmulatorThread": "True", "name": "str", - "networkAttachments": [ - { - "attachedNetworkId": "str", - "ipAllocationMethod": "str", - "defaultGateway": "str", - "ipv4Address": "str", - "ipv6Address": "str", - "macAddress": "str", - "networkAttachmentName": "str", - } - ], - "networkData": "str", - "networkDataContent": "str", - "placementHints": [ - {"hintType": "str", "resourceId": "str", "schedulingExecution": "str", "scope": "str"} - ], - "powerState": "str", - "provisioningState": "str", - "sshPublicKeys": [{"keyData": "str"}], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -125,14 +111,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "userData": "str", - "userDataContent": "str", - "virtioInterface": "Modern", - "vmDeviceModel": "T2", - "vmImageRepositoryCredentials": {"password": "str", "registryUrl": "str", "username": "str"}, - "volumes": ["str"], }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -141,12 +120,11 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_delete(self, resource_group): + async def test_virtual_machines_begin_update(self, resource_group): response = await ( - await self.client.virtual_machines.begin_delete( + await self.client.virtual_machines.begin_update( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -155,18 +133,35 @@ async def test_virtual_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_update(self, resource_group): + async def test_virtual_machines_begin_delete(self, resource_group): response = await ( - await self.client.virtual_machines.begin_update( + await self.client.virtual_machines.begin_delete( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machines_list_by_resource_group(self, resource_group): + response = self.client.virtual_machines.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_virtual_machines_list_by_subscription(self, resource_group): + response = self.client.virtual_machines.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_virtual_machines_begin_assign_relay(self, resource_group): @@ -174,7 +169,6 @@ async def test_virtual_machines_begin_assign_relay(self, resource_group): await self.client.virtual_machines.begin_assign_relay( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -188,7 +182,6 @@ async def test_virtual_machines_begin_power_off(self, resource_group): await self.client.virtual_machines.begin_power_off( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -202,7 +195,6 @@ async def test_virtual_machines_begin_reimage(self, resource_group): await self.client.virtual_machines.begin_reimage( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -216,7 +208,6 @@ async def test_virtual_machines_begin_restart(self, resource_group): await self.client.virtual_machines.begin_restart( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -230,7 +221,6 @@ async def test_virtual_machines_begin_start(self, resource_group): await self.client.virtual_machines.begin_start( resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations.py index e1e4d0009e2d..6f5b27456406 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_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 TestNetworkCloudMgmtVolumesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_volumes_list_by_subscription(self, resource_group): - response = self.client.volumes.list_by_subscription( - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_volumes_list_by_resource_group(self, resource_group): - response = self.client.volumes.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_volumes_get(self, resource_group): response = self.client.volumes.get( resource_group_name=resource_group.name, volume_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -60,17 +38,19 @@ def test_volumes_begin_create_or_update(self, resource_group): volume_parameters={ "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "sizeMiB": 0, - "allocatedSizeMiB": 0, - "attachedTo": ["str"], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "sizeMiB": 0, + "allocatedSizeMiB": 0, + "attachedTo": ["str"], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "provisioningState": "str", + "serialNumber": "str", + "storageApplianceId": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", - "serialNumber": "str", - "storageApplianceId": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -82,19 +62,28 @@ def test_volumes_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_volumes_update(self, resource_group): + response = self.client.volumes.update( + resource_group_name=resource_group.name, + volume_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_volumes_begin_delete(self, resource_group): response = self.client.volumes.begin_delete( resource_group_name=resource_group.name, volume_name="str", - api_version="2025-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -102,12 +91,18 @@ def test_volumes_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_volumes_update(self, resource_group): - response = self.client.volumes.update( + def test_volumes_list_by_resource_group(self, resource_group): + response = self.client.volumes.list_by_resource_group( resource_group_name=resource_group.name, - volume_name="str", - api_version="2025-09-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_volumes_list_by_subscription(self, resource_group): + response = self.client.volumes.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations_async.py b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations_async.py index 3612d7be9cc3..6ecd15aaa83b 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_operations_async.py +++ b/sdk/networkcloud/azure-mgmt-networkcloud/generated_tests/test_network_cloud_mgmt_volumes_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 TestNetworkCloudMgmtVolumesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(NetworkCloudMgmtClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_volumes_list_by_subscription(self, resource_group): - response = self.client.volumes.list_by_subscription( - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_volumes_list_by_resource_group(self, resource_group): - response = self.client.volumes.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_volumes_get(self, resource_group): response = await self.client.volumes.get( resource_group_name=resource_group.name, volume_name="str", - api_version="2025-09-01", ) # please add some check logic here by yourself @@ -62,17 +40,19 @@ async def test_volumes_begin_create_or_update(self, resource_group): volume_parameters={ "extendedLocation": {"name": "str", "type": "str"}, "location": "str", - "sizeMiB": 0, - "allocatedSizeMiB": 0, - "attachedTo": ["str"], - "detailedStatus": "str", - "detailedStatusMessage": "str", + "properties": { + "sizeMiB": 0, + "allocatedSizeMiB": 0, + "attachedTo": ["str"], + "detailedStatus": "str", + "detailedStatusMessage": "str", + "provisioningState": "str", + "serialNumber": "str", + "storageApplianceId": "str", + }, "etag": "str", "id": "str", "name": "str", - "provisioningState": "str", - "serialNumber": "str", - "storageApplianceId": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -84,13 +64,23 @@ async def test_volumes_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_volumes_update(self, resource_group): + response = await self.client.volumes.update( + resource_group_name=resource_group.name, + volume_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_volumes_begin_delete(self, resource_group): @@ -98,7 +88,6 @@ async def test_volumes_begin_delete(self, resource_group): await self.client.volumes.begin_delete( resource_group_name=resource_group.name, volume_name="str", - api_version="2025-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -107,12 +96,18 @@ async def test_volumes_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_volumes_update(self, resource_group): - response = await self.client.volumes.update( + async def test_volumes_list_by_resource_group(self, resource_group): + response = self.client.volumes.list_by_resource_group( resource_group_name=resource_group.name, - volume_name="str", - api_version="2025-09-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_volumes_list_by_subscription(self, resource_group): + response = self.client.volumes.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml b/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml index a4fc5f7c0a65..6999289278de 100644 --- a/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml +++ b/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml @@ -13,7 +13,7 @@ authors = [ description = "Microsoft Azure Networkcloud Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -79,7 +79,7 @@ package_name = "azure-mgmt-networkcloud" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Networkcloud Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/tsp-location.yaml b/sdk/networkcloud/azure-mgmt-networkcloud/tsp-location.yaml new file mode 100644 index 000000000000..41c926b7fb5c --- /dev/null +++ b/sdk/networkcloud/azure-mgmt-networkcloud/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/networkcloud/NetworkCloud.Management +commit: 0b5796a12cf5dca2f6b8ec3dce4566806497986c +repo: Azure/azure-rest-api-specs +additionalDirectories: