diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index ea0ff82817fc..6cb02e78acc9 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,12 +1,12 @@ { - "commit": "416353cabfea1fc7a1c7c46ba3340408a2618de1", + "commit": "bd796bcef2f6eb1541dab608e5b81770c164846d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.2", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.27.2 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/compute/resource-manager/readme.md", "package-2024-03-02-only": "2024-07-16 12:23:13 -0400 602fb5144a226577186e35845422c11db9067cf8 Microsoft.Compute/DiskRP/stable/2024-03-02/snapshot.json", "package-2024-03-01-only": "2024-06-05 15:03:47 -0700 491e00d17f24909ecf5e1030b3833bed51224e92 Microsoft.Compute/ComputeRP/stable/2024-03-01/virtualMachineScaleSet.json", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index c89ea853fefd..f9c483849c14 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -56,19 +56,19 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-07-01' + DEFAULT_API_VERSION = '2024-11-04' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'cloud_service_operating_systems': '2022-09-04', - 'cloud_service_role_instances': '2022-09-04', - 'cloud_service_roles': '2022-09-04', - 'cloud_services': '2022-09-04', - 'cloud_services_update_domain': '2022-09-04', + 'availability_sets': '2024-07-01', + 'capacity_reservation_groups': '2024-07-01', + 'capacity_reservations': '2024-07-01', 'community_galleries': '2024-03-03', 'community_gallery_image_versions': '2024-03-03', 'community_gallery_images': '2024-03-03', + 'dedicated_host_groups': '2024-07-01', + 'dedicated_hosts': '2024-07-01', 'disk_accesses': '2024-03-02', 'disk_encryption_sets': '2024-03-02', 'disk_restore_point': '2024-03-02', @@ -81,12 +81,33 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'gallery_in_vm_access_control_profile_versions': '2024-03-03', 'gallery_in_vm_access_control_profiles': '2024-03-03', 'gallery_sharing_profile': '2024-03-03', + 'images': '2024-07-01', + 'log_analytics': '2024-07-01', + 'operations': '2024-07-01', + 'proximity_placement_groups': '2024-07-01', 'resource_skus': '2021-07-01', + 'restore_point_collections': '2024-07-01', + 'restore_points': '2024-07-01', 'shared_galleries': '2024-03-03', 'shared_gallery_image_versions': '2024-03-03', 'shared_gallery_images': '2024-03-03', 'snapshots': '2024-03-02', 'soft_deleted_resource': '2024-03-03', + 'ssh_public_keys': '2024-07-01', + 'usage': '2024-07-01', + 'virtual_machine_extension_images': '2024-07-01', + 'virtual_machine_extensions': '2024-07-01', + 'virtual_machine_images': '2024-07-01', + 'virtual_machine_images_edge_zone': '2024-07-01', + 'virtual_machine_run_commands': '2024-07-01', + 'virtual_machine_scale_set_extensions': '2024-07-01', + 'virtual_machine_scale_set_rolling_upgrades': '2024-07-01', + 'virtual_machine_scale_set_vm_extensions': '2024-07-01', + 'virtual_machine_scale_set_vm_run_commands': '2024-07-01', + 'virtual_machine_scale_set_vms': '2024-07-01', + 'virtual_machine_scale_sets': '2024-07-01', + 'virtual_machine_sizes': '2024-07-01', + 'virtual_machines': '2024-07-01', }}, _PROFILE_TAG + " latest" ) @@ -121,7 +142,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) super(ComputeManagementClient, self).__init__( api_version=api_version, profile=profile @@ -184,6 +205,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2024-03-02: :mod:`v2024_03_02.models` * 2024-03-03: :mod:`v2024_03_03.models` * 2024-07-01: :mod:`v2024_07_01.models` + * 2024-11-04: :mod:`v2024_11_04.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -332,6 +354,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2024-07-01': from .v2024_07_01 import models return models + elif api_version == '2024-11-04': + from .v2024_11_04 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -515,6 +540,7 @@ def cloud_service_operating_systems(self): * 2021-03-01: :class:`CloudServiceOperatingSystemsOperations` * 2022-04-04: :class:`CloudServiceOperatingSystemsOperations` * 2022-09-04: :class:`CloudServiceOperatingSystemsOperations` + * 2024-11-04: :class:`CloudServiceOperatingSystemsOperations` """ api_version = self._get_api_version('cloud_service_operating_systems') if api_version == '2021-03-01': @@ -523,6 +549,8 @@ def cloud_service_operating_systems(self): from .v2022_04_04.operations import CloudServiceOperatingSystemsOperations as OperationClass elif api_version == '2022-09-04': from .v2022_09_04.operations import CloudServiceOperatingSystemsOperations as OperationClass + elif api_version == '2024-11-04': + from .v2024_11_04.operations import CloudServiceOperatingSystemsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_operating_systems'".format(api_version)) self._config.api_version = api_version @@ -536,6 +564,7 @@ def cloud_service_role_instances(self): * 2021-03-01: :class:`CloudServiceRoleInstancesOperations` * 2022-04-04: :class:`CloudServiceRoleInstancesOperations` * 2022-09-04: :class:`CloudServiceRoleInstancesOperations` + * 2024-11-04: :class:`CloudServiceRoleInstancesOperations` """ api_version = self._get_api_version('cloud_service_role_instances') if api_version == '2020-10-01-preview': @@ -546,6 +575,8 @@ def cloud_service_role_instances(self): from .v2022_04_04.operations import CloudServiceRoleInstancesOperations as OperationClass elif api_version == '2022-09-04': from .v2022_09_04.operations import CloudServiceRoleInstancesOperations as OperationClass + elif api_version == '2024-11-04': + from .v2024_11_04.operations import CloudServiceRoleInstancesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_role_instances'".format(api_version)) self._config.api_version = api_version @@ -559,6 +590,7 @@ def cloud_service_roles(self): * 2021-03-01: :class:`CloudServiceRolesOperations` * 2022-04-04: :class:`CloudServiceRolesOperations` * 2022-09-04: :class:`CloudServiceRolesOperations` + * 2024-11-04: :class:`CloudServiceRolesOperations` """ api_version = self._get_api_version('cloud_service_roles') if api_version == '2020-10-01-preview': @@ -569,6 +601,8 @@ def cloud_service_roles(self): from .v2022_04_04.operations import CloudServiceRolesOperations as OperationClass elif api_version == '2022-09-04': from .v2022_09_04.operations import CloudServiceRolesOperations as OperationClass + elif api_version == '2024-11-04': + from .v2024_11_04.operations import CloudServiceRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_roles'".format(api_version)) self._config.api_version = api_version @@ -582,6 +616,7 @@ def cloud_services(self): * 2021-03-01: :class:`CloudServicesOperations` * 2022-04-04: :class:`CloudServicesOperations` * 2022-09-04: :class:`CloudServicesOperations` + * 2024-11-04: :class:`CloudServicesOperations` """ api_version = self._get_api_version('cloud_services') if api_version == '2020-10-01-preview': @@ -592,6 +627,8 @@ def cloud_services(self): from .v2022_04_04.operations import CloudServicesOperations as OperationClass elif api_version == '2022-09-04': from .v2022_09_04.operations import CloudServicesOperations as OperationClass + elif api_version == '2024-11-04': + from .v2024_11_04.operations import CloudServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_services'".format(api_version)) self._config.api_version = api_version @@ -605,6 +642,7 @@ def cloud_services_update_domain(self): * 2021-03-01: :class:`CloudServicesUpdateDomainOperations` * 2022-04-04: :class:`CloudServicesUpdateDomainOperations` * 2022-09-04: :class:`CloudServicesUpdateDomainOperations` + * 2024-11-04: :class:`CloudServicesUpdateDomainOperations` """ api_version = self._get_api_version('cloud_services_update_domain') if api_version == '2020-10-01-preview': @@ -615,6 +653,8 @@ def cloud_services_update_domain(self): from .v2022_04_04.operations import CloudServicesUpdateDomainOperations as OperationClass elif api_version == '2022-09-04': from .v2022_09_04.operations import CloudServicesUpdateDomainOperations as OperationClass + elif api_version == '2024-11-04': + from .v2024_11_04.operations import CloudServicesUpdateDomainOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_services_update_domain'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py index 744e5bb7c07f..23c61a309fdb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py @@ -56,19 +56,19 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-07-01' + DEFAULT_API_VERSION = '2024-11-04' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'cloud_service_operating_systems': '2022-09-04', - 'cloud_service_role_instances': '2022-09-04', - 'cloud_service_roles': '2022-09-04', - 'cloud_services': '2022-09-04', - 'cloud_services_update_domain': '2022-09-04', + 'availability_sets': '2024-07-01', + 'capacity_reservation_groups': '2024-07-01', + 'capacity_reservations': '2024-07-01', 'community_galleries': '2024-03-03', 'community_gallery_image_versions': '2024-03-03', 'community_gallery_images': '2024-03-03', + 'dedicated_host_groups': '2024-07-01', + 'dedicated_hosts': '2024-07-01', 'disk_accesses': '2024-03-02', 'disk_encryption_sets': '2024-03-02', 'disk_restore_point': '2024-03-02', @@ -81,12 +81,33 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'gallery_in_vm_access_control_profile_versions': '2024-03-03', 'gallery_in_vm_access_control_profiles': '2024-03-03', 'gallery_sharing_profile': '2024-03-03', + 'images': '2024-07-01', + 'log_analytics': '2024-07-01', + 'operations': '2024-07-01', + 'proximity_placement_groups': '2024-07-01', 'resource_skus': '2021-07-01', + 'restore_point_collections': '2024-07-01', + 'restore_points': '2024-07-01', 'shared_galleries': '2024-03-03', 'shared_gallery_image_versions': '2024-03-03', 'shared_gallery_images': '2024-03-03', 'snapshots': '2024-03-02', 'soft_deleted_resource': '2024-03-03', + 'ssh_public_keys': '2024-07-01', + 'usage': '2024-07-01', + 'virtual_machine_extension_images': '2024-07-01', + 'virtual_machine_extensions': '2024-07-01', + 'virtual_machine_images': '2024-07-01', + 'virtual_machine_images_edge_zone': '2024-07-01', + 'virtual_machine_run_commands': '2024-07-01', + 'virtual_machine_scale_set_extensions': '2024-07-01', + 'virtual_machine_scale_set_rolling_upgrades': '2024-07-01', + 'virtual_machine_scale_set_vm_extensions': '2024-07-01', + 'virtual_machine_scale_set_vm_run_commands': '2024-07-01', + 'virtual_machine_scale_set_vms': '2024-07-01', + 'virtual_machine_scale_sets': '2024-07-01', + 'virtual_machine_sizes': '2024-07-01', + 'virtual_machines': '2024-07-01', }}, _PROFILE_TAG + " latest" ) @@ -121,7 +142,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) super(ComputeManagementClient, self).__init__( api_version=api_version, profile=profile @@ -184,6 +205,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2024-03-02: :mod:`v2024_03_02.models` * 2024-03-03: :mod:`v2024_03_03.models` * 2024-07-01: :mod:`v2024_07_01.models` + * 2024-11-04: :mod:`v2024_11_04.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -332,6 +354,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2024-07-01': from ..v2024_07_01 import models return models + elif api_version == '2024-11-04': + from ..v2024_11_04 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -515,6 +540,7 @@ def cloud_service_operating_systems(self): * 2021-03-01: :class:`CloudServiceOperatingSystemsOperations` * 2022-04-04: :class:`CloudServiceOperatingSystemsOperations` * 2022-09-04: :class:`CloudServiceOperatingSystemsOperations` + * 2024-11-04: :class:`CloudServiceOperatingSystemsOperations` """ api_version = self._get_api_version('cloud_service_operating_systems') if api_version == '2021-03-01': @@ -523,6 +549,8 @@ def cloud_service_operating_systems(self): from ..v2022_04_04.aio.operations import CloudServiceOperatingSystemsOperations as OperationClass elif api_version == '2022-09-04': from ..v2022_09_04.aio.operations import CloudServiceOperatingSystemsOperations as OperationClass + elif api_version == '2024-11-04': + from ..v2024_11_04.aio.operations import CloudServiceOperatingSystemsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_operating_systems'".format(api_version)) self._config.api_version = api_version @@ -536,6 +564,7 @@ def cloud_service_role_instances(self): * 2021-03-01: :class:`CloudServiceRoleInstancesOperations` * 2022-04-04: :class:`CloudServiceRoleInstancesOperations` * 2022-09-04: :class:`CloudServiceRoleInstancesOperations` + * 2024-11-04: :class:`CloudServiceRoleInstancesOperations` """ api_version = self._get_api_version('cloud_service_role_instances') if api_version == '2020-10-01-preview': @@ -546,6 +575,8 @@ def cloud_service_role_instances(self): from ..v2022_04_04.aio.operations import CloudServiceRoleInstancesOperations as OperationClass elif api_version == '2022-09-04': from ..v2022_09_04.aio.operations import CloudServiceRoleInstancesOperations as OperationClass + elif api_version == '2024-11-04': + from ..v2024_11_04.aio.operations import CloudServiceRoleInstancesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_role_instances'".format(api_version)) self._config.api_version = api_version @@ -559,6 +590,7 @@ def cloud_service_roles(self): * 2021-03-01: :class:`CloudServiceRolesOperations` * 2022-04-04: :class:`CloudServiceRolesOperations` * 2022-09-04: :class:`CloudServiceRolesOperations` + * 2024-11-04: :class:`CloudServiceRolesOperations` """ api_version = self._get_api_version('cloud_service_roles') if api_version == '2020-10-01-preview': @@ -569,6 +601,8 @@ def cloud_service_roles(self): from ..v2022_04_04.aio.operations import CloudServiceRolesOperations as OperationClass elif api_version == '2022-09-04': from ..v2022_09_04.aio.operations import CloudServiceRolesOperations as OperationClass + elif api_version == '2024-11-04': + from ..v2024_11_04.aio.operations import CloudServiceRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_service_roles'".format(api_version)) self._config.api_version = api_version @@ -582,6 +616,7 @@ def cloud_services(self): * 2021-03-01: :class:`CloudServicesOperations` * 2022-04-04: :class:`CloudServicesOperations` * 2022-09-04: :class:`CloudServicesOperations` + * 2024-11-04: :class:`CloudServicesOperations` """ api_version = self._get_api_version('cloud_services') if api_version == '2020-10-01-preview': @@ -592,6 +627,8 @@ def cloud_services(self): from ..v2022_04_04.aio.operations import CloudServicesOperations as OperationClass elif api_version == '2022-09-04': from ..v2022_09_04.aio.operations import CloudServicesOperations as OperationClass + elif api_version == '2024-11-04': + from ..v2024_11_04.aio.operations import CloudServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_services'".format(api_version)) self._config.api_version = api_version @@ -605,6 +642,7 @@ def cloud_services_update_domain(self): * 2021-03-01: :class:`CloudServicesUpdateDomainOperations` * 2022-04-04: :class:`CloudServicesUpdateDomainOperations` * 2022-09-04: :class:`CloudServicesUpdateDomainOperations` + * 2024-11-04: :class:`CloudServicesUpdateDomainOperations` """ api_version = self._get_api_version('cloud_services_update_domain') if api_version == '2020-10-01-preview': @@ -615,6 +653,8 @@ def cloud_services_update_domain(self): from ..v2022_04_04.aio.operations import CloudServicesUpdateDomainOperations as OperationClass elif api_version == '2022-09-04': from ..v2022_09_04.aio.operations import CloudServicesUpdateDomainOperations as OperationClass + elif api_version == '2024-11-04': + from ..v2024_11_04.aio.operations import CloudServicesUpdateDomainOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'cloud_services_update_domain'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index fbb7cd03f8df..3f6fc3345420 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -5,7 +5,7 @@ # license information. # -------------------------------------------------------------------------- from .v2021_07_01.models import * -from .v2022_09_04.models import * from .v2024_03_02.models import * from .v2024_03_03.models import * from .v2024_07_01.models import * +from .v2024_11_04.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_07_01/_version.py index 1e427b1dadf4..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "33.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/__init__.py new file mode 100644 index 000000000000..ab7c46e8991d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._compute_management_client import ComputeManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComputeManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py new file mode 100644 index 000000000000..0d0b931edf80 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ComputeManagementClientConfiguration +from .operations import ( + CloudServiceOperatingSystemsOperations, + CloudServiceRoleInstancesOperations, + CloudServiceRolesOperations, + CloudServicesOperations, + CloudServicesUpdateDomainOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ComputeManagementClient: + """Compute Client. + + :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2024_11_04.operations.CloudServiceRoleInstancesOperations + :ivar cloud_service_roles: CloudServiceRolesOperations operations + :vartype cloud_service_roles: + azure.mgmt.compute.v2024_11_04.operations.CloudServiceRolesOperations + :ivar cloud_services: CloudServicesOperations operations + :vartype cloud_services: azure.mgmt.compute.v2024_11_04.operations.CloudServicesOperations + :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations + :vartype cloud_services_update_domain: + azure.mgmt.compute.v2024_11_04.operations.CloudServicesUpdateDomainOperations + :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations + :vartype cloud_service_operating_systems: + azure.mgmt.compute.v2024_11_04.operations.CloudServiceOperatingSystemsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_service_roles = CloudServiceRolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_services = CloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + + 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) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_configuration.py new file mode 100644 index 000000000000..9af0bcfe4c13 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ComputeManagementClient. + + 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. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-11-04") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-compute/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json new file mode 100644 index 000000000000..3c5000da56ef --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json @@ -0,0 +1,114 @@ +{ + "chosen_version": "2024-11-04", + "total_api_version_list": ["2024-11-04"], + "client": { + "name": "ComputeManagementClient", + "filename": "_compute_management_client", + "description": "Compute Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_public_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "cloud_service_role_instances": "CloudServiceRoleInstancesOperations", + "cloud_service_roles": "CloudServiceRolesOperations", + "cloud_services": "CloudServicesOperations", + "cloud_services_update_domain": "CloudServicesUpdateDomainOperations", + "cloud_service_operating_systems": "CloudServiceOperatingSystemsOperations" + } +} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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 + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/__init__.py new file mode 100644 index 000000000000..d3fd1ba93379 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._compute_management_client import ComputeManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComputeManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py new file mode 100644 index 000000000000..906e76addcff --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import ComputeManagementClientConfiguration +from .operations import ( + CloudServiceOperatingSystemsOperations, + CloudServiceRoleInstancesOperations, + CloudServiceRolesOperations, + CloudServicesOperations, + CloudServicesUpdateDomainOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ComputeManagementClient: + """Compute Client. + + :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations + :vartype cloud_service_role_instances: + azure.mgmt.compute.v2024_11_04.aio.operations.CloudServiceRoleInstancesOperations + :ivar cloud_service_roles: CloudServiceRolesOperations operations + :vartype cloud_service_roles: + azure.mgmt.compute.v2024_11_04.aio.operations.CloudServiceRolesOperations + :ivar cloud_services: CloudServicesOperations operations + :vartype cloud_services: azure.mgmt.compute.v2024_11_04.aio.operations.CloudServicesOperations + :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations + :vartype cloud_services_update_domain: + azure.mgmt.compute.v2024_11_04.aio.operations.CloudServicesUpdateDomainOperations + :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations + :vartype cloud_service_operating_systems: + azure.mgmt.compute.v2024_11_04.aio.operations.CloudServiceOperatingSystemsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_service_roles = CloudServiceRolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_services = CloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-04" + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_configuration.py new file mode 100644 index 000000000000..b3b6ccf587d8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ComputeManagementClient. + + 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. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-11-04") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-compute/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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 + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/__init__.py new file mode 100644 index 000000000000..6422d5c48bb1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import CloudServiceRoleInstancesOperations # type: ignore +from ._operations import CloudServiceRolesOperations # type: ignore +from ._operations import CloudServicesOperations # type: ignore +from ._operations import CloudServicesUpdateDomainOperations # type: ignore +from ._operations import CloudServiceOperatingSystemsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "CloudServiceRoleInstancesOperations", + "CloudServiceRolesOperations", + "CloudServicesOperations", + "CloudServicesUpdateDomainOperations", + "CloudServiceOperatingSystemsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py new file mode 100644 index 000000000000..0f2f5cf59c24 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py @@ -0,0 +1,3378 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._operations import ( + build_cloud_service_operating_systems_get_os_family_request, + build_cloud_service_operating_systems_get_os_version_request, + build_cloud_service_operating_systems_list_os_families_request, + build_cloud_service_operating_systems_list_os_versions_request, + build_cloud_service_role_instances_delete_request, + build_cloud_service_role_instances_get_instance_view_request, + build_cloud_service_role_instances_get_remote_desktop_file_request, + build_cloud_service_role_instances_get_request, + build_cloud_service_role_instances_list_request, + build_cloud_service_role_instances_rebuild_request, + build_cloud_service_role_instances_reimage_request, + build_cloud_service_role_instances_restart_request, + build_cloud_service_roles_get_request, + build_cloud_service_roles_list_request, + build_cloud_services_create_or_update_request, + build_cloud_services_delete_instances_request, + build_cloud_services_delete_request, + build_cloud_services_get_instance_view_request, + build_cloud_services_get_request, + build_cloud_services_list_all_request, + build_cloud_services_list_request, + build_cloud_services_power_off_request, + build_cloud_services_rebuild_request, + build_cloud_services_reimage_request, + build_cloud_services_restart_request, + build_cloud_services_start_request, + build_cloud_services_update_domain_get_update_domain_request, + build_cloud_services_update_domain_list_update_domains_request, + build_cloud_services_update_domain_walk_update_domain_request, + build_cloud_services_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CloudServiceRoleInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.aio.ComputeManagementClient`'s + :attr:`cloud_service_role_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_delete_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.RoleInstance: + """Gets a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :keyword expand: The expand expression to apply to the operation. 'UserData' is not supported + for cloud services. Known values are: "instanceView" and "userData". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_04.models.InstanceViewTypes + :return: RoleInstance or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.RoleInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoleInstance", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_instance_view( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.RoleInstanceView: + """Retrieves information about the run-time state of a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: RoleInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstanceView] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoleInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cloud_service_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RoleInstance"]: + """Gets the list of all role instances in a cloud service. Use nextLink property in the response + to get the next page of role instances. Do this till nextLink is null to fetch all the role + instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :keyword expand: The expand expression to apply to the operation. 'UserData' is not supported + for cloud services. Known values are: "instanceView" and "userData". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_04.models.InstanceViewTypes + :return: An iterator like instance of either RoleInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.RoleInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstanceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_role_instances_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("RoleInstanceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _restart_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_restart_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the + cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_reimage_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reimage( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _rebuild_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_rebuild_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_rebuild( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles and initializes the storage resources that are used by them. If + you do not want to initialize storage resources, you can use Reimage Role Instance. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._rebuild_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_remote_desktop_file( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + """Gets a remote desktop file for a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: AsyncIterator[bytes] or the result of cls(response) + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CloudServiceRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.aio.ComputeManagementClient`'s + :attr:`cloud_service_roles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, role_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.CloudServiceRole: + """Gets a role from a cloud service. + + :param role_name: Name of the role. Required. + :type role_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudServiceRole or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceRole] = kwargs.pop("cls", None) + + _request = build_cloud_service_roles_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudServiceRole", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CloudServiceRole"]: + """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the + next page of roles. Do this till nextLink is null to fetch all the roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An iterator like instance of either CloudServiceRole or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceRoleListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_roles_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("CloudServiceRoleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CloudServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.aio.ComputeManagementClient`'s + :attr:`cloud_services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudService, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "CloudService") + else: + _json = None + + _request = build_cloud_services_create_or_update_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.CloudService] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudService + :keyword content_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 CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Is either a CloudService type or a IO[bytes] type. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudService or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("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_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudServiceUpdate, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "CloudServiceUpdate") + else: + _json = None + + _request = build_cloud_services_update_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.CloudServiceUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpdate + :keyword content_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 CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Is either a CloudServiceUpdate type or a IO[bytes] + type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("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_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_delete_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> _models.CloudService: + """Display information about a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudService or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + + _request = build_cloud_services_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_instance_view( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.CloudServiceInstanceView: + """Gets the status of a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudServiceInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceInstanceView] = kwargs.pop("cls", None) + + _request = build_cloud_services_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudServiceInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.CloudService"]: + """Gets a list of all cloud services in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of Cloud Services. Do this + till nextLink is null to fetch all the Cloud Services. + + :return: An iterator like instance of either CloudService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_list_all_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._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("CloudServiceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.CloudService"]: + """Gets a list of all cloud services under a resource group. Use nextLink property in the response + to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud + Services. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("CloudServiceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_start_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts the cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _power_off_initial( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_power_off_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_power_off( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Power off the cloud service. Note that resources are still attached and you are getting charged + for the resources. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_restart_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_reimage_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _rebuild_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_rebuild_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._rebuild_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_instances_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_delete_instances_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_instances_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CloudServicesUpdateDomainOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.aio.ComputeManagementClient`'s + :attr:`cloud_services_update_domain` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _walk_update_domain_initial( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[Union[_models.UpdateDomain, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateDomain") + else: + _json = None + + _request = build_cloud_services_update_domain_walk_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[_models.UpdateDomain] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Is either a UpdateDomain type or a IO[bytes] type. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._walk_update_domain_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_update_domain( + self, resource_group_name: str, cloud_service_name: str, update_domain: int, **kwargs: Any + ) -> _models.UpdateDomain: + """Gets the specified update domain of a cloud service. Use nextLink property in the response to + get the next page of update domains. Do this till nextLink is null to fetch all the update + domains. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :return: UpdateDomain or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.UpdateDomain] = kwargs.pop("cls", None) + + _request = build_cloud_services_update_domain_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UpdateDomain", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_update_domains( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UpdateDomain"]: + """Gets a list of all update domains in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An iterator like instance of either UpdateDomain or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.UpdateDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.UpdateDomainListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_update_domain_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("UpdateDomainListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CloudServiceOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.aio.ComputeManagementClient`'s + :attr:`cloud_service_operating_systems` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get_os_version(self, location: str, os_version_name: str, **kwargs: Any) -> _models.OSVersion: + """Gets properties of a guest operating system version that can be specified in the XML service + configuration (.cscfg) for a cloud service. + + :param location: Name of the location that the OS version pertains to. Required. + :type location: str + :param os_version_name: Name of the OS version. Required. + :type os_version_name: str + :return: OSVersion or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.OSVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSVersion] = kwargs.pop("cls", None) + + _request = build_cloud_service_operating_systems_get_os_version_request( + location=location, + os_version_name=os_version_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_os_versions(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OSVersion"]: + """Gets a list of all guest operating system versions available to be specified in the XML service + configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the + next page of OS versions. Do this till nextLink is null to fetch all the OS versions. + + :param location: Name of the location that the OS versions pertain to. Required. + :type location: str + :return: An iterator like instance of either OSVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.OSVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_operating_systems_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("OSVersionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_os_family(self, location: str, os_family_name: str, **kwargs: Any) -> _models.OSFamily: + """Gets properties of a guest operating system family that can be specified in the XML service + configuration (.cscfg) for a cloud service. + + :param location: Name of the location that the OS family pertains to. Required. + :type location: str + :param os_family_name: Name of the OS family. Required. + :type os_family_name: str + :return: OSFamily or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.OSFamily + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSFamily] = kwargs.pop("cls", None) + + _request = build_cloud_service_operating_systems_get_os_family_request( + location=location, + os_family_name=os_family_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSFamily", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_os_families(self, location: str, **kwargs: Any) -> AsyncIterable["_models.OSFamily"]: + """Gets a list of all guest operating system families available to be specified in the XML service + configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the + next page of OS Families. Do this till nextLink is null to fetch all the OS Families. + + :param location: Name of the location that the OS families pertain to. Required. + :type location: str + :return: An iterator like instance of either OSFamily or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_04.models.OSFamily] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSFamilyListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_operating_systems_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("OSFamilyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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 + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py new file mode 100644 index 000000000000..c38558c72df3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py @@ -0,0 +1,142 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ApiError, + ApiErrorBase, + CloudService, + CloudServiceExtensionProfile, + CloudServiceExtensionProperties, + CloudServiceInstanceView, + CloudServiceListResult, + CloudServiceNetworkProfile, + CloudServiceOsProfile, + CloudServiceProperties, + CloudServiceRole, + CloudServiceRoleListResult, + CloudServiceRoleProfile, + CloudServiceRoleProfileProperties, + CloudServiceRoleProperties, + CloudServiceRoleSku, + CloudServiceUpdate, + CloudServiceVaultAndSecretReference, + CloudServiceVaultCertificate, + CloudServiceVaultSecretGroup, + ExtendedLocation, + Extension, + InnerError, + InstanceSku, + InstanceViewStatusesSummary, + LoadBalancerConfiguration, + LoadBalancerConfigurationProperties, + LoadBalancerFrontendIpConfiguration, + LoadBalancerFrontendIpConfigurationProperties, + OSFamily, + OSFamilyListResult, + OSFamilyProperties, + OSVersion, + OSVersionListResult, + OSVersionProperties, + OSVersionPropertiesBase, + Resource, + ResourceInstanceViewStatus, + ResourceWithOptionalLocation, + RoleInstance, + RoleInstanceListResult, + RoleInstanceNetworkProfile, + RoleInstanceProperties, + RoleInstanceView, + RoleInstances, + StatusCodeCount, + SubResource, + SubResourceReadOnly, + SystemData, + UpdateDomain, + UpdateDomainListResult, + UserAssignedIdentitiesValue, +) + +from ._compute_management_client_enums import ( # type: ignore + CloudServiceSlotType, + CloudServiceUpgradeMode, + ExtendedLocationTypes, + InstanceViewTypes, + StatusLevelTypes, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApiError", + "ApiErrorBase", + "CloudService", + "CloudServiceExtensionProfile", + "CloudServiceExtensionProperties", + "CloudServiceInstanceView", + "CloudServiceListResult", + "CloudServiceNetworkProfile", + "CloudServiceOsProfile", + "CloudServiceProperties", + "CloudServiceRole", + "CloudServiceRoleListResult", + "CloudServiceRoleProfile", + "CloudServiceRoleProfileProperties", + "CloudServiceRoleProperties", + "CloudServiceRoleSku", + "CloudServiceUpdate", + "CloudServiceVaultAndSecretReference", + "CloudServiceVaultCertificate", + "CloudServiceVaultSecretGroup", + "ExtendedLocation", + "Extension", + "InnerError", + "InstanceSku", + "InstanceViewStatusesSummary", + "LoadBalancerConfiguration", + "LoadBalancerConfigurationProperties", + "LoadBalancerFrontendIpConfiguration", + "LoadBalancerFrontendIpConfigurationProperties", + "OSFamily", + "OSFamilyListResult", + "OSFamilyProperties", + "OSVersion", + "OSVersionListResult", + "OSVersionProperties", + "OSVersionPropertiesBase", + "Resource", + "ResourceInstanceViewStatus", + "ResourceWithOptionalLocation", + "RoleInstance", + "RoleInstanceListResult", + "RoleInstanceNetworkProfile", + "RoleInstanceProperties", + "RoleInstanceView", + "RoleInstances", + "StatusCodeCount", + "SubResource", + "SubResourceReadOnly", + "SystemData", + "UpdateDomain", + "UpdateDomainListResult", + "UserAssignedIdentitiesValue", + "CloudServiceSlotType", + "CloudServiceUpgradeMode", + "ExtendedLocationTypes", + "InstanceViewTypes", + "StatusLevelTypes", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..8447b6e04823 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CloudServiceSlotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Slot type for the cloud service. + Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ + :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` + If not specified, the default value is Production. + """ + + PRODUCTION = "Production" + STAGING = "Staging" + + +class CloudServiceUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Update mode for the cloud service. Role instances are allocated to update domains when the + service is deployed. Updates can be initiated manually in each update domain or initiated + automatically in all update domains. + Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ + :code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. + """ + + AUTO = "Auto" + MANUAL = "Manual" + SIMULTANEOUS = "Simultaneous" + + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation.""" + + EDGE_ZONE = "EdgeZone" + + +class InstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """InstanceViewTypes.""" + + INSTANCE_VIEW = "instanceView" + USER_DATA = "userData" + + +class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level code.""" + + INFO = "Info" + WARNING = "Warning" + ERROR = "Error" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py new file mode 100644 index 000000000000..7c7b0dca974a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py @@ -0,0 +1,2109 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class ApiError(_serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2024_11_04.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2024_11_04.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + "details": {"key": "details", "type": "[ApiErrorBase]"}, + "innererror": {"key": "innererror", "type": "InnerError"}, + "code": {"key": "code", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + details: Optional[List["_models.ApiErrorBase"]] = None, + innererror: Optional["_models.InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2024_11_04.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2024_11_04.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorBase(_serialization.Model): + """Api error base. + + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, target: Optional[str] = None, message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class CloudService(_serialization.Model): + """Describes the cloud service. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Cloud service properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceProperties + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.compute.v2024_11_04.models.SystemData + :ivar zones: List of logical availability zone of the resource. List should contain only 1 zone + where cloud service should be provisioned. This field is optional. + :vartype zones: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "CloudServiceProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "zones": {"key": "zones", "type": "[str]"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudServiceProperties"] = None, + system_data: Optional["_models.SystemData"] = None, + zones: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Cloud service properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceProperties + :keyword system_data: The system meta data relating to this resource. + :paramtype system_data: ~azure.mgmt.compute.v2024_11_04.models.SystemData + :keyword zones: List of logical availability zone of the resource. List should contain only 1 + zone where cloud service should be provisioned. This field is optional. + :paramtype zones: list[str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + self.system_data = system_data + self.zones = zones + + +class CloudServiceExtensionProfile(_serialization.Model): + """Describes a cloud service extension profile. + + :ivar extensions: List of extensions for the cloud service. + :vartype extensions: list[~azure.mgmt.compute.v2024_11_04.models.Extension] + """ + + _attribute_map = { + "extensions": {"key": "extensions", "type": "[Extension]"}, + } + + def __init__(self, *, extensions: Optional[List["_models.Extension"]] = None, **kwargs: Any) -> None: + """ + :keyword extensions: List of extensions for the cloud service. + :paramtype extensions: list[~azure.mgmt.compute.v2024_11_04.models.Extension] + """ + super().__init__(**kwargs) + self.extensions = extensions + + +class CloudServiceExtensionProperties(_serialization.Model): + """Extension Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension. + :vartype type: str + :ivar type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Explicitly specify whether platform can automatically upgrade + typeHandlerVersion to higher minor versions when they become available. + :vartype auto_upgrade_minor_version: bool + :ivar settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :vartype settings: JSON + :ivar protected_settings: Protected settings for the extension which are encrypted before sent + to the role instance. + :vartype protected_settings: JSON + :ivar protected_settings_from_key_vault: Protected settings for the extension, referenced using + KeyVault which are encrypted before sent to the role instance. + :vartype protected_settings_from_key_vault: + ~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultAndSecretReference + :ivar force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :vartype force_update_tag: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :vartype roles_applied_to: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "publisher": {"key": "publisher", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, + "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, + "settings": {"key": "settings", "type": "object"}, + "protected_settings": {"key": "protectedSettings", "type": "object"}, + "protected_settings_from_key_vault": { + "key": "protectedSettingsFromKeyVault", + "type": "CloudServiceVaultAndSecretReference", + }, + "force_update_tag": {"key": "forceUpdateTag", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "roles_applied_to": {"key": "rolesAppliedTo", "type": "[str]"}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[JSON] = None, + protected_settings: Optional[JSON] = None, + protected_settings_from_key_vault: Optional["_models.CloudServiceVaultAndSecretReference"] = None, + force_update_tag: Optional[str] = None, + roles_applied_to: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension. + :paramtype type: str + :keyword type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :paramtype settings: JSON + :keyword protected_settings: Protected settings for the extension which are encrypted before + sent to the role instance. + :paramtype protected_settings: JSON + :keyword protected_settings_from_key_vault: Protected settings for the extension, referenced + using KeyVault which are encrypted before sent to the role instance. + :paramtype protected_settings_from_key_vault: + ~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultAndSecretReference + :keyword force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :paramtype force_update_tag: str + :keyword roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :paramtype roles_applied_to: list[str] + """ + super().__init__(**kwargs) + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings + self.protected_settings_from_key_vault = protected_settings_from_key_vault + self.force_update_tag = force_update_tag + self.provisioning_state = None + self.roles_applied_to = roles_applied_to + + +class CloudServiceInstanceView(_serialization.Model): + """InstanceView of CloudService as a whole. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar role_instance: Instance view statuses. + :vartype role_instance: ~azure.mgmt.compute.v2024_11_04.models.InstanceViewStatusesSummary + :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud + service. + :vartype sdk_version: str + :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud + service. :code:`
`\\ :code:`
` NOTE: If you are using Azure Diagnostics extension, + this property can be used as 'DeploymentId' for querying details. + :vartype private_ids: list[str] + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2024_11_04.models.ResourceInstanceViewStatus] + """ + + _validation = { + "sdk_version": {"readonly": True}, + "private_ids": {"readonly": True}, + "statuses": {"readonly": True}, + } + + _attribute_map = { + "role_instance": {"key": "roleInstance", "type": "InstanceViewStatusesSummary"}, + "sdk_version": {"key": "sdkVersion", "type": "str"}, + "private_ids": {"key": "privateIds", "type": "[str]"}, + "statuses": {"key": "statuses", "type": "[ResourceInstanceViewStatus]"}, + } + + def __init__(self, *, role_instance: Optional["_models.InstanceViewStatusesSummary"] = None, **kwargs: Any) -> None: + """ + :keyword role_instance: Instance view statuses. + :paramtype role_instance: ~azure.mgmt.compute.v2024_11_04.models.InstanceViewStatusesSummary + """ + super().__init__(**kwargs) + self.role_instance = role_instance + self.sdk_version = None + self.private_ids = None + self.statuses = None + + +class CloudServiceListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CloudService]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.CloudService"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceNetworkProfile(_serialization.Model): + """Network Profile for the cloud service. + + :ivar load_balancer_configurations: List of Load balancer configurations. Cloud service can + have up to two load balancer configurations, corresponding to a Public Load Balancer and an + Internal Load Balancer. + :vartype load_balancer_configurations: + list[~azure.mgmt.compute.v2024_11_04.models.LoadBalancerConfiguration] + :ivar slot_type: Slot type for the cloud service. + Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ + :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` + If not specified, the default value is Production. Known values are: "Production" and + "Staging". + :vartype slot_type: str or ~azure.mgmt.compute.v2024_11_04.models.CloudServiceSlotType + :ivar swappable_cloud_service: The id reference of the cloud service containing the target IP + with which the subject cloud service can perform a swap. This property cannot be updated once + it is set. The swappable cloud service referred by this id must be present otherwise an error + will be thrown. + :vartype swappable_cloud_service: ~azure.mgmt.compute.v2024_11_04.models.SubResource + """ + + _attribute_map = { + "load_balancer_configurations": {"key": "loadBalancerConfigurations", "type": "[LoadBalancerConfiguration]"}, + "slot_type": {"key": "slotType", "type": "str"}, + "swappable_cloud_service": {"key": "swappableCloudService", "type": "SubResource"}, + } + + def __init__( + self, + *, + load_balancer_configurations: Optional[List["_models.LoadBalancerConfiguration"]] = None, + slot_type: Optional[Union[str, "_models.CloudServiceSlotType"]] = None, + swappable_cloud_service: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword load_balancer_configurations: List of Load balancer configurations. Cloud service can + have up to two load balancer configurations, corresponding to a Public Load Balancer and an + Internal Load Balancer. + :paramtype load_balancer_configurations: + list[~azure.mgmt.compute.v2024_11_04.models.LoadBalancerConfiguration] + :keyword slot_type: Slot type for the cloud service. + Possible values are :code:`
`\\ :code:`
`\\ **Production**\\ :code:`
`\\ + :code:`
`\\ **Staging**\\ :code:`
`\\ :code:`
` + If not specified, the default value is Production. Known values are: "Production" and + "Staging". + :paramtype slot_type: str or ~azure.mgmt.compute.v2024_11_04.models.CloudServiceSlotType + :keyword swappable_cloud_service: The id reference of the cloud service containing the target + IP with which the subject cloud service can perform a swap. This property cannot be updated + once it is set. The swappable cloud service referred by this id must be present otherwise an + error will be thrown. + :paramtype swappable_cloud_service: ~azure.mgmt.compute.v2024_11_04.models.SubResource + """ + super().__init__(**kwargs) + self.load_balancer_configurations = load_balancer_configurations + self.slot_type = slot_type + self.swappable_cloud_service = swappable_cloud_service + + +class CloudServiceOsProfile(_serialization.Model): + """Describes the OS profile for the cloud service. + + :ivar secrets: Specifies set of certificates that should be installed onto the role instances. + :vartype secrets: list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultSecretGroup] + """ + + _attribute_map = { + "secrets": {"key": "secrets", "type": "[CloudServiceVaultSecretGroup]"}, + } + + def __init__( + self, *, secrets: Optional[List["_models.CloudServiceVaultSecretGroup"]] = None, **kwargs: Any + ) -> None: + """ + :keyword secrets: Specifies set of certificates that should be installed onto the role + instances. + :paramtype secrets: list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultSecretGroup] + """ + super().__init__(**kwargs) + self.secrets = secrets + + +class CloudServiceProperties(_serialization.Model): + """Cloud service properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar package_url: Specifies a URL that refers to the location of the service package in the + Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage + account. + This is a write-only property and is not returned in GET calls. + :vartype package_url: str + :ivar configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :vartype configuration: str + :ivar configuration_url: Specifies a URL that refers to the location of the service + configuration in the Blob service. The service package URL can be Shared Access Signature + (SAS) URI from any storage account. + This is a write-only property and is not returned in GET calls. + :vartype configuration_url: str + :ivar start_cloud_service: (Optional) Indicates whether to start the cloud service immediately + after it is created. The default value is ``true``. + If false, the service model is still deployed, but the code is not run immediately. Instead, + the service is PoweredOff until you call Start, at which time the service will be started. A + deployed service still incurs charges, even if it is poweredoff. + :vartype start_cloud_service: bool + :ivar allow_model_override: (Optional) Indicates whether the role sku properties + (roleProfile.roles.sku) specified in the model/template should override the role instance count + and vm size specified in the .cscfg and .csdef respectively. + The default value is ``false``. + :vartype allow_model_override: bool + :ivar upgrade_mode: Update mode for the cloud service. Role instances are allocated to update + domains when the service is deployed. Updates can be initiated manually in each update domain + or initiated automatically in all update domains. + Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ + :code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. Known values are: "Auto", "Manual", and "Simultaneous". + :vartype upgrade_mode: str or ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpgradeMode + :ivar role_profile: Describes the role profile for the cloud service. + :vartype role_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProfile + :ivar os_profile: Describes the OS profile for the cloud service. + :vartype os_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceOsProfile + :ivar network_profile: Network Profile for the cloud service. + :vartype network_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceNetworkProfile + :ivar extension_profile: Describes a cloud service extension profile. + :vartype extension_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceExtensionProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar unique_id: The unique identifier for the cloud service. + :vartype unique_id: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "unique_id": {"readonly": True}, + } + + _attribute_map = { + "package_url": {"key": "packageUrl", "type": "str"}, + "configuration": {"key": "configuration", "type": "str"}, + "configuration_url": {"key": "configurationUrl", "type": "str"}, + "start_cloud_service": {"key": "startCloudService", "type": "bool"}, + "allow_model_override": {"key": "allowModelOverride", "type": "bool"}, + "upgrade_mode": {"key": "upgradeMode", "type": "str"}, + "role_profile": {"key": "roleProfile", "type": "CloudServiceRoleProfile"}, + "os_profile": {"key": "osProfile", "type": "CloudServiceOsProfile"}, + "network_profile": {"key": "networkProfile", "type": "CloudServiceNetworkProfile"}, + "extension_profile": {"key": "extensionProfile", "type": "CloudServiceExtensionProfile"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "unique_id": {"key": "uniqueId", "type": "str"}, + } + + def __init__( + self, + *, + package_url: Optional[str] = None, + configuration: Optional[str] = None, + configuration_url: Optional[str] = None, + start_cloud_service: Optional[bool] = None, + allow_model_override: Optional[bool] = None, + upgrade_mode: Optional[Union[str, "_models.CloudServiceUpgradeMode"]] = None, + role_profile: Optional["_models.CloudServiceRoleProfile"] = None, + os_profile: Optional["_models.CloudServiceOsProfile"] = None, + network_profile: Optional["_models.CloudServiceNetworkProfile"] = None, + extension_profile: Optional["_models.CloudServiceExtensionProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword package_url: Specifies a URL that refers to the location of the service package in the + Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage + account. + This is a write-only property and is not returned in GET calls. + :paramtype package_url: str + :keyword configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :paramtype configuration: str + :keyword configuration_url: Specifies a URL that refers to the location of the service + configuration in the Blob service. The service package URL can be Shared Access Signature + (SAS) URI from any storage account. + This is a write-only property and is not returned in GET calls. + :paramtype configuration_url: str + :keyword start_cloud_service: (Optional) Indicates whether to start the cloud service + immediately after it is created. The default value is ``true``. + If false, the service model is still deployed, but the code is not run immediately. Instead, + the service is PoweredOff until you call Start, at which time the service will be started. A + deployed service still incurs charges, even if it is poweredoff. + :paramtype start_cloud_service: bool + :keyword allow_model_override: (Optional) Indicates whether the role sku properties + (roleProfile.roles.sku) specified in the model/template should override the role instance count + and vm size specified in the .cscfg and .csdef respectively. + The default value is ``false``. + :paramtype allow_model_override: bool + :keyword upgrade_mode: Update mode for the cloud service. Role instances are allocated to + update domains when the service is deployed. Updates can be initiated manually in each update + domain or initiated automatically in all update domains. + Possible Values are :code:`
`\\ :code:`
`\\ **Auto**\\ :code:`
`\\ :code:`
`\\ **Manual** :code:`
`\\ :code:`
`\\ **Simultaneous**\\ :code:`
`\\ + :code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. Known values are: "Auto", "Manual", and "Simultaneous". + :paramtype upgrade_mode: str or ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpgradeMode + :keyword role_profile: Describes the role profile for the cloud service. + :paramtype role_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProfile + :keyword os_profile: Describes the OS profile for the cloud service. + :paramtype os_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceOsProfile + :keyword network_profile: Network Profile for the cloud service. + :paramtype network_profile: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceNetworkProfile + :keyword extension_profile: Describes a cloud service extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2024_11_04.models.CloudServiceExtensionProfile + """ + super().__init__(**kwargs) + self.package_url = package_url + self.configuration = configuration + self.configuration_url = configuration_url + self.start_cloud_service = start_cloud_service + self.allow_model_override = allow_model_override + self.upgrade_mode = upgrade_mode + self.role_profile = role_profile + self.os_profile = os_profile + self.network_profile = network_profile + self.extension_profile = extension_profile + self.provisioning_state = None + self.unique_id = None + + +class CloudServiceRole(_serialization.Model): + """Describes a role of the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleSku + :ivar properties: The cloud service role properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "CloudServiceRoleSku"}, + "properties": {"key": "properties", "type": "CloudServiceRoleProperties"}, + } + + def __init__( + self, + *, + sku: Optional["_models.CloudServiceRoleSku"] = None, + properties: Optional["_models.CloudServiceRoleProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleSku + :keyword properties: The cloud service role properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.sku = sku + self.properties = properties + + +class CloudServiceRoleListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CloudServiceRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.CloudServiceRole"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceRoleProfile(_serialization.Model): + """Describes the role profile for the cloud service. + + :ivar roles: List of roles for the cloud service. + :vartype roles: list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProfileProperties] + """ + + _attribute_map = { + "roles": {"key": "roles", "type": "[CloudServiceRoleProfileProperties]"}, + } + + def __init__( + self, *, roles: Optional[List["_models.CloudServiceRoleProfileProperties"]] = None, **kwargs: Any + ) -> None: + """ + :keyword roles: List of roles for the cloud service. + :paramtype roles: + list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProfileProperties] + """ + super().__init__(**kwargs) + self.roles = roles + + +class CloudServiceRoleProfileProperties(_serialization.Model): + """Describes the role properties. + + :ivar name: Resource name. + :vartype name: str + :ivar sku: Describes the cloud service role sku. + :vartype sku: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleSku + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "sku": {"key": "sku", "type": "CloudServiceRoleSku"}, + } + + def __init__( + self, *, name: Optional[str] = None, sku: Optional["_models.CloudServiceRoleSku"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Resource name. + :paramtype name: str + :keyword sku: Describes the cloud service role sku. + :paramtype sku: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleSku + """ + super().__init__(**kwargs) + self.name = name + self.sku = sku + + +class CloudServiceRoleProperties(_serialization.Model): + """The cloud service role properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. + :vartype unique_id: str + """ + + _validation = { + "unique_id": {"readonly": True}, + } + + _attribute_map = { + "unique_id": {"key": "uniqueId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.unique_id = None + + +class CloudServiceRoleSku(_serialization.Model): + """Describes the cloud service role sku. + + :ivar name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud + service is currently on, you need to delete and recreate the cloud service or move back to the + old sku. + :vartype name: str + :ivar tier: Specifies the tier of the cloud service. Possible Values are :code:`
`\\ + :code:`
` **Standard** :code:`
`\\ :code:`
` **Basic**. + :vartype tier: str + :ivar capacity: Specifies the number of role instances in the cloud service. + :vartype capacity: int + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, *, name: Optional[str] = None, tier: Optional[str] = None, capacity: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud + service is currently on, you need to delete and recreate the cloud service or move back to the + old sku. + :paramtype name: str + :keyword tier: Specifies the tier of the cloud service. Possible Values are :code:`
`\\ + :code:`
` **Standard** :code:`
`\\ :code:`
` **Basic**. + :paramtype tier: str + :keyword capacity: Specifies the number of role instances in the cloud service. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class CloudServiceUpdate(_serialization.Model): + """CloudServiceUpdate. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class CloudServiceVaultAndSecretReference(_serialization.Model): + """Protected settings for the extension, referenced using KeyVault which are encrypted before sent + to the role instance. + + :ivar source_vault: The ARM Resource ID of the Key Vault. + :vartype source_vault: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :ivar secret_url: Secret URL which contains the protected settings of the extension. + :vartype secret_url: str + """ + + _attribute_map = { + "source_vault": {"key": "sourceVault", "type": "SubResource"}, + "secret_url": {"key": "secretUrl", "type": "str"}, + } + + def __init__( + self, *, source_vault: Optional["_models.SubResource"] = None, secret_url: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword source_vault: The ARM Resource ID of the Key Vault. + :paramtype source_vault: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :keyword secret_url: Secret URL which contains the protected settings of the extension. + :paramtype secret_url: str + """ + super().__init__(**kwargs) + self.source_vault = source_vault + self.secret_url = secret_url + + +class CloudServiceVaultCertificate(_serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should + reside on the role instance. + + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. + :vartype certificate_url: str + :ivar is_bootstrap_certificate: Flag indicating if the certificate provided is a bootstrap + certificate to be used by the Key Vault Extension to fetch the remaining certificates. + :vartype is_bootstrap_certificate: bool + """ + + _attribute_map = { + "certificate_url": {"key": "certificateUrl", "type": "str"}, + "is_bootstrap_certificate": {"key": "isBootstrapCertificate", "type": "bool"}, + } + + def __init__( + self, *, certificate_url: Optional[str] = None, is_bootstrap_certificate: Optional[bool] = None, **kwargs: Any + ) -> None: + """ + :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault + as a secret. + :paramtype certificate_url: str + :keyword is_bootstrap_certificate: Flag indicating if the certificate provided is a bootstrap + certificate to be used by the Key Vault Extension to fetch the remaining certificates. + :paramtype is_bootstrap_certificate: bool + """ + super().__init__(**kwargs) + self.certificate_url = certificate_url + self.is_bootstrap_certificate = is_bootstrap_certificate + + +class CloudServiceVaultSecretGroup(_serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :vartype source_vault: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :vartype vault_certificates: + list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultCertificate] + """ + + _attribute_map = { + "source_vault": {"key": "sourceVault", "type": "SubResource"}, + "vault_certificates": {"key": "vaultCertificates", "type": "[CloudServiceVaultCertificate]"}, + } + + def __init__( + self, + *, + source_vault: Optional["_models.SubResource"] = None, + vault_certificates: Optional[List["_models.CloudServiceVaultCertificate"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: + list[~azure.mgmt.compute.v2024_11_04.models.CloudServiceVaultCertificate] + """ + super().__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or ~azure.mgmt.compute.v2024_11_04.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or ~azure.mgmt.compute.v2024_11_04.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class Extension(_serialization.Model): + """Describes a cloud service Extension. + + :ivar name: The name of the extension. + :vartype name: str + :ivar properties: Extension Properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceExtensionProperties + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "CloudServiceExtensionProperties"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.CloudServiceExtensionProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword properties: Extension Properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceExtensionProperties + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + + +class InnerError(_serialization.Model): + """Inner error details. + + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str + """ + + _attribute_map = { + "exceptiontype": {"key": "exceptiontype", "type": "str"}, + "errordetail": {"key": "errordetail", "type": "str"}, + } + + def __init__( + self, *, exceptiontype: Optional[str] = None, errordetail: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ + super().__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class InstanceSku(_serialization.Model): + """The role instance SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: The tier of the cloud service role instance. + :vartype tier: str + """ + + _validation = { + "name": {"readonly": True}, + "tier": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.tier = None + + +class InstanceViewStatusesSummary(_serialization.Model): + """Instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: The summary. + :vartype statuses_summary: list[~azure.mgmt.compute.v2024_11_04.models.StatusCodeCount] + """ + + _validation = { + "statuses_summary": {"readonly": True}, + } + + _attribute_map = { + "statuses_summary": {"key": "statusesSummary", "type": "[StatusCodeCount]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.statuses_summary = None + + +class LoadBalancerConfiguration(_serialization.Model): + """Describes the load balancer configuration. + + All required parameters must be populated in order to send to server. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the Load balancer. Required. + :vartype name: str + :ivar properties: Properties of the load balancer configuration. Required. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.LoadBalancerConfigurationProperties + """ + + _validation = { + "name": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "LoadBalancerConfigurationProperties"}, + } + + def __init__( + self, + *, + name: str, + properties: "_models.LoadBalancerConfigurationProperties", + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword id: Resource Id. + :paramtype id: str + :keyword name: The name of the Load balancer. Required. + :paramtype name: str + :keyword properties: Properties of the load balancer configuration. Required. + :paramtype properties: + ~azure.mgmt.compute.v2024_11_04.models.LoadBalancerConfigurationProperties + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.properties = properties + + +class LoadBalancerConfigurationProperties(_serialization.Model): + """Describes the properties of the load balancer configuration. + + All required parameters must be populated in order to send to server. + + :ivar frontend_ip_configurations: Specifies the frontend IP to be used for the load balancer. + Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly + one frontend IP configuration. Required. + :vartype frontend_ip_configurations: + list[~azure.mgmt.compute.v2024_11_04.models.LoadBalancerFrontendIpConfiguration] + """ + + _validation = { + "frontend_ip_configurations": {"required": True}, + } + + _attribute_map = { + "frontend_ip_configurations": { + "key": "frontendIpConfigurations", + "type": "[LoadBalancerFrontendIpConfiguration]", + }, + } + + def __init__( + self, *, frontend_ip_configurations: List["_models.LoadBalancerFrontendIpConfiguration"], **kwargs: Any + ) -> None: + """ + :keyword frontend_ip_configurations: Specifies the frontend IP to be used for the load + balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must + have exactly one frontend IP configuration. Required. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.compute.v2024_11_04.models.LoadBalancerFrontendIpConfiguration] + """ + super().__init__(**kwargs) + self.frontend_ip_configurations = frontend_ip_configurations + + +class LoadBalancerFrontendIpConfiguration(_serialization.Model): + """Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is + supported. Each load balancer configuration must have exactly one frontend IP configuration. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + Required. + :vartype name: str + :ivar properties: Properties of load balancer frontend ip configuration. Required. + :vartype properties: + ~azure.mgmt.compute.v2024_11_04.models.LoadBalancerFrontendIpConfigurationProperties + """ + + _validation = { + "name": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "LoadBalancerFrontendIpConfigurationProperties"}, + } + + def __init__( + self, *, name: str, properties: "_models.LoadBalancerFrontendIpConfigurationProperties", **kwargs: Any + ) -> None: + """ + :keyword name: The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + Required. + :paramtype name: str + :keyword properties: Properties of load balancer frontend ip configuration. Required. + :paramtype properties: + ~azure.mgmt.compute.v2024_11_04.models.LoadBalancerFrontendIpConfigurationProperties + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + + +class LoadBalancerFrontendIpConfigurationProperties(_serialization.Model): # pylint: disable=name-too-long + """Describes a cloud service IP Configuration. + + :ivar public_ip_address: The reference to the public ip address resource. + :vartype public_ip_address: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :ivar subnet: The reference to the virtual network subnet resource. + :vartype subnet: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :ivar private_ip_address: The virtual network private IP address of the IP configuration. + :vartype private_ip_address: str + """ + + _attribute_map = { + "public_ip_address": {"key": "publicIPAddress", "type": "SubResource"}, + "subnet": {"key": "subnet", "type": "SubResource"}, + "private_ip_address": {"key": "privateIPAddress", "type": "str"}, + } + + def __init__( + self, + *, + public_ip_address: Optional["_models.SubResource"] = None, + subnet: Optional["_models.SubResource"] = None, + private_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword public_ip_address: The reference to the public ip address resource. + :paramtype public_ip_address: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :keyword subnet: The reference to the virtual network subnet resource. + :paramtype subnet: ~azure.mgmt.compute.v2024_11_04.models.SubResource + :keyword private_ip_address: The virtual network private IP address of the IP configuration. + :paramtype private_ip_address: str + """ + super().__init__(**kwargs) + self.public_ip_address = public_ip_address + self.subnet = subnet + self.private_ip_address = private_ip_address + + +class OSFamily(_serialization.Model): + """Describes a cloud service OS family. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar properties: OS family properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.OSFamilyProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "OSFamilyProperties"}, + } + + def __init__(self, *, properties: Optional["_models.OSFamilyProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: OS family properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.OSFamilyProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class OSFamilyListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.OSFamily] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OSFamily]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.OSFamily"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.OSFamily] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OSFamilyProperties(_serialization.Model): + """OS family properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The OS family name. + :vartype name: str + :ivar label: The OS family label. + :vartype label: str + :ivar versions: List of OS versions belonging to this family. + :vartype versions: list[~azure.mgmt.compute.v2024_11_04.models.OSVersionPropertiesBase] + """ + + _validation = { + "name": {"readonly": True}, + "label": {"readonly": True}, + "versions": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "versions": {"key": "versions", "type": "[OSVersionPropertiesBase]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.label = None + self.versions = None + + +class OSVersion(_serialization.Model): + """Describes a cloud service OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar properties: OS version properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.OSVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "OSVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.OSVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: OS version properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.OSVersionProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class OSVersionListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.OSVersion] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OSVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.OSVersion"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.OSVersion] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OSVersionProperties(_serialization.Model): + """OS version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar family: The family of this OS version. + :vartype family: str + :ivar family_label: The family label of this OS version. + :vartype family_label: str + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + "family": {"readonly": True}, + "family_label": {"readonly": True}, + "version": {"readonly": True}, + "label": {"readonly": True}, + "is_default": {"readonly": True}, + "is_active": {"readonly": True}, + } + + _attribute_map = { + "family": {"key": "family", "type": "str"}, + "family_label": {"key": "familyLabel", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "is_default": {"key": "isDefault", "type": "bool"}, + "is_active": {"key": "isActive", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.family = None + self.family_label = None + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class OSVersionPropertiesBase(_serialization.Model): + """Configuration view of an OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + "version": {"readonly": True}, + "label": {"readonly": True}, + "is_default": {"readonly": True}, + "is_active": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "is_default": {"key": "isDefault", "type": "bool"}, + "is_active": {"key": "isActive", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class Resource(_serialization.Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ResourceInstanceViewStatus(_serialization.Model): + """Instance view status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The status code. + :vartype code: str + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.compute.v2024_11_04.models.StatusLevelTypes + """ + + _validation = { + "code": {"readonly": True}, + "display_status": {"readonly": True}, + "message": {"readonly": True}, + "time": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "time": {"key": "time", "type": "iso-8601"}, + "level": {"key": "level", "type": "str"}, + } + + def __init__(self, *, level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, **kwargs: Any) -> None: + """ + :keyword level: The level code. Known values are: "Info", "Warning", and "Error". + :paramtype level: str or ~azure.mgmt.compute.v2024_11_04.models.StatusLevelTypes + """ + super().__init__(**kwargs) + self.code = None + self.display_status = None + self.message = None + self.time = None + self.level = level + + +class ResourceWithOptionalLocation(_serialization.Model): + """The Resource model definition with location property as optional. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.type = None + self.tags = tags + + +class RoleInstance(_serialization.Model): + """Describes the cloud service role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :ivar type: Resource Type. + :vartype type: str + :ivar location: Resource Location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The role instance SKU. + :vartype sku: ~azure.mgmt.compute.v2024_11_04.models.InstanceSku + :ivar properties: Role instance properties. + :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "tags": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "InstanceSku"}, + "properties": {"key": "properties", "type": "RoleInstanceProperties"}, + } + + def __init__( + self, + *, + sku: Optional["_models.InstanceSku"] = None, + properties: Optional["_models.RoleInstanceProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The role instance SKU. + :paramtype sku: ~azure.mgmt.compute.v2024_11_04.models.InstanceSku + :keyword properties: Role instance properties. + :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + self.sku = sku + self.properties = properties + + +class RoleInstanceListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.RoleInstance] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RoleInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.RoleInstance"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.RoleInstance] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RoleInstanceNetworkProfile(_serialization.Model): + """Describes the network profile for the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the role instance. + :vartype network_interfaces: list[~azure.mgmt.compute.v2024_11_04.models.SubResource] + """ + + _validation = { + "network_interfaces": {"readonly": True}, + } + + _attribute_map = { + "network_interfaces": {"key": "networkInterfaces", "type": "[SubResource]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.network_interfaces = None + + +class RoleInstanceProperties(_serialization.Model): + """Role instance properties. + + :ivar network_profile: Describes the network profile for the role instance. + :vartype network_profile: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceNetworkProfile + :ivar instance_view: The instance view of the role instance. + :vartype instance_view: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceView + """ + + _attribute_map = { + "network_profile": {"key": "networkProfile", "type": "RoleInstanceNetworkProfile"}, + "instance_view": {"key": "instanceView", "type": "RoleInstanceView"}, + } + + def __init__( + self, + *, + network_profile: Optional["_models.RoleInstanceNetworkProfile"] = None, + instance_view: Optional["_models.RoleInstanceView"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_profile: Describes the network profile for the role instance. + :paramtype network_profile: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceNetworkProfile + :keyword instance_view: The instance view of the role instance. + :paramtype instance_view: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceView + """ + super().__init__(**kwargs) + self.network_profile = network_profile + self.instance_view = instance_view + + +class RoleInstances(_serialization.Model): + """Specifies a list of role instances from the cloud service. + + All required parameters must be populated in order to send to server. + + :ivar role_instances: List of cloud service role instance names. Value of '*' will signify all + role instances of the cloud service. Required. + :vartype role_instances: list[str] + """ + + _validation = { + "role_instances": {"required": True}, + } + + _attribute_map = { + "role_instances": {"key": "roleInstances", "type": "[str]"}, + } + + def __init__(self, *, role_instances: List[str], **kwargs: Any) -> None: + """ + :keyword role_instances: List of cloud service role instance names. Value of '*' will signify + all role instances of the cloud service. Required. + :paramtype role_instances: list[str] + """ + super().__init__(**kwargs) + self.role_instances = role_instances + + +class RoleInstanceView(_serialization.Model): + """The instance view of the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar platform_update_domain: The Update Domain. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain. + :vartype platform_fault_domain: int + :ivar private_id: Specifies a unique identifier generated internally for the cloud service + associated with this role instance. :code:`
`\\ :code:`
` NOTE: If you are using + Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + :vartype private_id: str + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2024_11_04.models.ResourceInstanceViewStatus] + """ + + _validation = { + "platform_update_domain": {"readonly": True}, + "platform_fault_domain": {"readonly": True}, + "private_id": {"readonly": True}, + "statuses": {"readonly": True}, + } + + _attribute_map = { + "platform_update_domain": {"key": "platformUpdateDomain", "type": "int"}, + "platform_fault_domain": {"key": "platformFaultDomain", "type": "int"}, + "private_id": {"key": "privateId", "type": "str"}, + "statuses": {"key": "statuses", "type": "[ResourceInstanceViewStatus]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.platform_update_domain = None + self.platform_fault_domain = None + self.private_id = None + self.statuses = None + + +class StatusCodeCount(_serialization.Model): + """The status code and count of the cloud service instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: Number of instances having this status code. + :vartype count: int + """ + + _validation = { + "code": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.count = None + + +class SubResource(_serialization.Model): + """SubResource. + + :ivar id: Resource Id. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class SubResourceReadOnly(_serialization.Model): + """SubResourceReadOnly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class SystemData(_serialization.Model): + """The system meta data relating to this resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_at: Specifies the time in UTC at which the Cloud Service (extended support) + resource was created. :code:`
`Minimum api-version: 2022-04-04. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: Specifies the time in UTC at which the Cloud Service (extended support) + resource was last modified. :code:`
`Minimum api-version: 2022-04-04. + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_at = None + self.last_modified_at = None + + +class UpdateDomain(_serialization.Model): + """Defines an update domain for the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + + +class UpdateDomainListResult(_serialization.Model): + """The list operation result. + + All required parameters must be populated in order to send to server. + + :ivar value: The list of resources. Required. + :vartype value: list[~azure.mgmt.compute.v2024_11_04.models.UpdateDomain] + :ivar next_link: The URI to fetch the next page of resources. Use this to get the next page of + resources. Do this till nextLink is null to fetch all the resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[UpdateDomain]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.UpdateDomain"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of resources. Required. + :paramtype value: list[~azure.mgmt.compute.v2024_11_04.models.UpdateDomain] + :keyword next_link: The URI to fetch the next page of resources. Use this to get the next page + of resources. Do this till nextLink is null to fetch all the resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UserAssignedIdentitiesValue(_serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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 + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/__init__.py new file mode 100644 index 000000000000..6422d5c48bb1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import CloudServiceRoleInstancesOperations # type: ignore +from ._operations import CloudServiceRolesOperations # type: ignore +from ._operations import CloudServicesOperations # type: ignore +from ._operations import CloudServicesUpdateDomainOperations # type: ignore +from ._operations import CloudServiceOperatingSystemsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "CloudServiceRoleInstancesOperations", + "CloudServiceRolesOperations", + "CloudServicesOperations", + "CloudServicesUpdateDomainOperations", + "CloudServiceOperatingSystemsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py new file mode 100644 index 000000000000..48e68f9fb9c9 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py @@ -0,0 +1,4294 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_cloud_service_role_instances_delete_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_get_request( # pylint: disable=name-too-long + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_get_instance_view_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_list_request( # pylint: disable=name-too-long + resource_group_name: str, + cloud_service_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_restart_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_reimage_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_rebuild_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_role_instances_get_remote_desktop_file_request( # pylint: disable=name-too-long + role_instance_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/x-rdp") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_roles_get_request( + role_name: str, resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "roleName": _SERIALIZER.url("role_name", role_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_roles_list_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_update_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_delete_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_get_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices") + 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_cloud_services_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_start_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_power_off_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_restart_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_reimage_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}/reimage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_rebuild_request( + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}/rebuild", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_delete_instances_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}/delete", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_update_domain_walk_update_domain_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, update_domain: int, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + 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.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, "int"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_services_update_domain_get_update_domain_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, update_domain: int, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "updateDomain": _SERIALIZER.url("update_domain", update_domain, "int"), + "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_cloud_services_update_domain_list_update_domains_request( # pylint: disable=name-too-long + resource_group_name: str, cloud_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_operating_systems_get_os_version_request( # pylint: disable=name-too-long + location: str, os_version_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_operating_systems_list_os_versions_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_operating_systems_get_os_family_request( # pylint: disable=name-too-long + location: str, os_family_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_service_operating_systems_list_os_families_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CloudServiceRoleInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.ComputeManagementClient`'s + :attr:`cloud_service_role_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_delete_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.RoleInstance: + """Gets a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :keyword expand: The expand expression to apply to the operation. 'UserData' is not supported + for cloud services. Known values are: "instanceView" and "userData". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_04.models.InstanceViewTypes + :return: RoleInstance or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.RoleInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstance] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoleInstance", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_instance_view( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.RoleInstanceView: + """Retrieves information about the run-time state of a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: RoleInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstanceView] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_instance_view_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoleInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + cloud_service_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> Iterable["_models.RoleInstance"]: + """Gets the list of all role instances in a cloud service. Use nextLink property in the response + to get the next page of role instances. Do this till nextLink is null to fetch all the role + instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :keyword expand: The expand expression to apply to the operation. 'UserData' is not supported + for cloud services. Known values are: "instanceView" and "userData". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_04.models.InstanceViewTypes + :return: An iterator like instance of either RoleInstance or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.RoleInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.RoleInstanceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_role_instances_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("RoleInstanceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _restart_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_restart_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the + cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _reimage_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_reimage_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reimage( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _rebuild_initial( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_rebuild_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_rebuild( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles and initializes the storage resources that are used by them. If + you do not want to initialize storage resources, you can use Reimage Role Instance. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._rebuild_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_remote_desktop_file( + self, role_instance_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + """Gets a remote desktop file for a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. Required. + :type role_instance_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: Iterator[bytes] or the result of cls(response) + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_service_role_instances_get_remote_desktop_file_request( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CloudServiceRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.ComputeManagementClient`'s + :attr:`cloud_service_roles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, role_name: str, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.CloudServiceRole: + """Gets a role from a cloud service. + + :param role_name: Name of the role. Required. + :type role_name: str + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudServiceRole or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceRole] = kwargs.pop("cls", None) + + _request = build_cloud_service_roles_get_request( + role_name=role_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudServiceRole", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterable["_models.CloudServiceRole"]: + """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the + next page of roles. Do this till nextLink is null to fetch all the roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An iterator like instance of either CloudServiceRole or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudServiceRole] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceRoleListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_roles_list_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("CloudServiceRoleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CloudServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.ComputeManagementClient`'s + :attr:`cloud_services` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudService, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "CloudService") + else: + _json = None + + _request = build_cloud_services_create_or_update_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.CloudService] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudService + :keyword content_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 CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudService, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Is either a CloudService type or a IO[bytes] type. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudService or IO[bytes] + :return: An instance of LROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.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_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudServiceUpdate, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "CloudServiceUpdate") + else: + _json = None + + _request = build_cloud_services_update_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.CloudServiceUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpdate + :keyword content_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 CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.CloudServiceUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.CloudService]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: The cloud service object. Is either a CloudServiceUpdate type or a IO[bytes] + type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceUpdate or IO[bytes] + :return: An instance of LROPoller that returns either CloudService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.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_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_delete_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> _models.CloudService: + """Display information about a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudService or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudService] = kwargs.pop("cls", None) + + _request = build_cloud_services_get_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudService", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_instance_view( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> _models.CloudServiceInstanceView: + """Gets the status of a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: CloudServiceInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceInstanceView] = kwargs.pop("cls", None) + + _request = build_cloud_services_get_instance_view_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudServiceInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.CloudService"]: + """Gets a list of all cloud services in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of Cloud Services. Do this + till nextLink is null to fetch all the Cloud Services. + + :return: An iterator like instance of either CloudService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_list_all_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._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("CloudServiceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.CloudService"]: + """Gets a list of all cloud services under a resource group. Use nextLink property in the response + to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud + Services. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.CloudServiceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("CloudServiceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_start_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts the cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_services_power_off_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_power_off(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Power off the cloud service. Note that resources are still attached and you are getting charged + for the resources. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_restart_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _reimage_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_reimage_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _rebuild_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_rebuild_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._rebuild_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_instances_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "RoleInstances") + else: + _json = None + + _request = build_cloud_services_delete_instances_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[_models.RoleInstances] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional[Union[_models.RoleInstances, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. Is either a RoleInstances type or + a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.RoleInstances or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_instances_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CloudServicesUpdateDomainOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.ComputeManagementClient`'s + :attr:`cloud_services_update_domain` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _walk_update_domain_initial( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[Union[_models.UpdateDomain, 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._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "UpdateDomain") + else: + _json = None + + _request = build_cloud_services_update_domain_walk_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[_models.UpdateDomain] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional[Union[_models.UpdateDomain, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :param parameters: The update domain object. Is either a UpdateDomain type or a IO[bytes] type. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._walk_update_domain_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_update_domain( + self, resource_group_name: str, cloud_service_name: str, update_domain: int, **kwargs: Any + ) -> _models.UpdateDomain: + """Gets the specified update domain of a cloud service. Use nextLink property in the response to + get the next page of update domains. Do this till nextLink is null to fetch all the update + domains. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. Required. + :type update_domain: int + :return: UpdateDomain or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.UpdateDomain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.UpdateDomain] = kwargs.pop("cls", None) + + _request = build_cloud_services_update_domain_get_update_domain_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UpdateDomain", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_update_domains( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterable["_models.UpdateDomain"]: + """Gets a list of all update domains in a cloud service. + + :param resource_group_name: Name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. Required. + :type cloud_service_name: str + :return: An iterator like instance of either UpdateDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.UpdateDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.UpdateDomainListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_update_domain_list_update_domains_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("UpdateDomainListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CloudServiceOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_04.ComputeManagementClient`'s + :attr:`cloud_service_operating_systems` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get_os_version(self, location: str, os_version_name: str, **kwargs: Any) -> _models.OSVersion: + """Gets properties of a guest operating system version that can be specified in the XML service + configuration (.cscfg) for a cloud service. + + :param location: Name of the location that the OS version pertains to. Required. + :type location: str + :param os_version_name: Name of the OS version. Required. + :type os_version_name: str + :return: OSVersion or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.OSVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSVersion] = kwargs.pop("cls", None) + + _request = build_cloud_service_operating_systems_get_os_version_request( + location=location, + os_version_name=os_version_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_os_versions(self, location: str, **kwargs: Any) -> Iterable["_models.OSVersion"]: + """Gets a list of all guest operating system versions available to be specified in the XML service + configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the + next page of OS versions. Do this till nextLink is null to fetch all the OS versions. + + :param location: Name of the location that the OS versions pertain to. Required. + :type location: str + :return: An iterator like instance of either OSVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.OSVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_operating_systems_list_os_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("OSVersionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_os_family(self, location: str, os_family_name: str, **kwargs: Any) -> _models.OSFamily: + """Gets properties of a guest operating system family that can be specified in the XML service + configuration (.cscfg) for a cloud service. + + :param location: Name of the location that the OS family pertains to. Required. + :type location: str + :param os_family_name: Name of the OS family. Required. + :type os_family_name: str + :return: OSFamily or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_04.models.OSFamily + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSFamily] = kwargs.pop("cls", None) + + _request = build_cloud_service_operating_systems_get_os_family_request( + location=location, + os_family_name=os_family_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSFamily", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_os_families(self, location: str, **kwargs: Any) -> Iterable["_models.OSFamily"]: + """Gets a list of all guest operating system families available to be specified in the XML service + configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the + next page of OS Families. Do this till nextLink is null to fetch all the OS Families. + + :param location: Name of the location that the OS families pertain to. Required. + :type location: str + :return: An iterator like instance of either OSFamily or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_04.models.OSFamily] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-04")) + cls: ClsType[_models.OSFamilyListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 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_service_operating_systems_list_os_families_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._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("OSFamilyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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 + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py new file mode 100644 index 000000000000..bf3a8452b426 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_create_with_multi_role.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_create_or_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py new file mode 100644 index 000000000000..d57098825ef3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_multi_role_with_zones.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_create_with_multi_role_with_zones.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_create_or_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole_WithZones.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py new file mode 100644 index 000000000000..86e162ab72e4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_create_with_single_role.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_create_or_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRole.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py new file mode 100644 index 000000000000..af69aef19276 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_certificate.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_create_with_single_role_and_certificate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_create_or_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py new file mode 100644 index 000000000000..7ab165b9c9e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_create_with_single_role_and_rdp.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_create_with_single_role_and_rdp.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_create_or_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndRDP.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py new file mode 100644 index 000000000000..2851b5b04159 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_delete( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py new file mode 100644 index 000000000000..bf29b73f203c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_instance_view_with_multi_role.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_get_instance_view_with_multi_role.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.get_instance_view( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_InstanceViewWithMultiRole.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py new file mode 100644 index 000000000000..9b55d77c548a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_get_with_multi_role_and_rdp.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_get_with_multi_role_and_rdp.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.get( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Get_WithMultiRoleAndRDP.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py new file mode 100644 index 000000000000..d6dd72634a30 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.list( + resource_group_name="ConstosoRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_ByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py new file mode 100644 index 000000000000..b6f2275d3fcf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_List_BySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py new file mode 100644 index 000000000000..9b3e32b5a128 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_families_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_os_families_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_operating_systems.list_os_families( + location="westus2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamilies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py new file mode 100644 index 000000000000..49bad03daf85 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_family_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_os_family_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_operating_systems.get_os_family( + location="westus2", + os_family_name="3", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSFamily_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py new file mode 100644 index 000000000000..95a788765ee0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_os_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_operating_systems.get_os_version( + location="westus2", + os_version_name="WA-GUEST-OS-3.90_202010-02", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py new file mode 100644 index 000000000000..8cba44e533f3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_os_version_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_os_version_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_operating_systems.list_os_versions( + location="westus2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceOSVersion_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py new file mode 100644 index 000000000000..0fc51f290487 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_power_off.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_power_off.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_power_off( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_PowerOff.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py new file mode 100644 index 000000000000..e16ce8b338cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_roles.get( + role_name="{role-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py new file mode 100644 index 000000000000..4e596e423902 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_service_role_instances.begin_delete( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py new file mode 100644 index 000000000000..bf45db6f130b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_delete_by_cloud_service.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_delete_by_cloud_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_delete_instances( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py new file mode 100644 index 000000000000..6236d2409659 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_role_instances.get( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py new file mode 100644 index 000000000000..c27e710d4bf5 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_instance_view.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_get_instance_view.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_role_instances.get_instance_view( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_InstanceView.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py new file mode 100644 index 000000000000..5f122dd40bc5 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_get_remote_desktop_file.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_get_remote_desktop_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_role_instances.get_remote_desktop_file( + role_instance_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + resource_group_name="rgcloudService", + cloud_service_name="aaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py new file mode 100644 index 000000000000..5c7e04dcd164 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_rebuild.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_service_role_instances.begin_rebuild( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py new file mode 100644 index 000000000000..ebd2113a3901 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_rebuild_by_cloud_service.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_rebuild_by_cloud_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_rebuild( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py new file mode 100644 index 000000000000..a4081cb64ebd --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_reimage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_service_role_instances.begin_reimage( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py new file mode 100644 index 000000000000..539fa11c3f93 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_reimage_by_cloud_service.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_reimage_by_cloud_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_reimage( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py new file mode 100644 index 000000000000..6c36d7239411 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_restart.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_service_role_instances.begin_restart( + role_instance_name="{roleInstance-name}", + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py new file mode 100644 index 000000000000..f0c5b3eabd81 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_instance_restart_by_cloud_service.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_instance_restart_by_cloud_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_restart( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py new file mode 100644 index 000000000000..0ecc989267ef --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_role_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_role_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_roles.list( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRole_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py new file mode 100644 index 000000000000..cce48fed1e7c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_roles_instance_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_roles_instance_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_service_role_instances.list( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceRolesInstance_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py new file mode 100644 index 000000000000..cdc2f6174d63 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_start.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_start.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services.begin_start( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Start.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py new file mode 100644 index 000000000000..dc4235f6dfd6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_update_domain_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services_update_domain.get_update_domain( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + update_domain=1, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py new file mode 100644 index 000000000000..6cf055f2fa5f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_update_domain_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services_update_domain.list_update_domains( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_List.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py new file mode 100644 index 000000000000..814f70dd7a63 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_domain_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_update_domain_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.cloud_services_update_domain.begin_walk_update_domain( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + update_domain=1, + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudServiceUpdateDomain_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py new file mode 100644 index 000000000000..7a7a2458ef37 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/cloud_service_update_to_include_tags.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python cloud_service_update_to_include_tags.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.cloud_services.begin_update( + resource_group_name="ConstosoRG", + cloud_service_name="{cs-name}", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Update_ToIncludeTags.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py index 4d4398f20fd7..20a0a6ae4058 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_os_version(self, resource_group): + def test_cloud_service_operating_systems_get_os_version(self, resource_group): response = self.client.cloud_service_operating_systems.get_os_version( location="str", os_version_name="str", - api_version="2021-03-01", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -32,10 +32,10 @@ def test_get_os_version(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_os_versions(self, resource_group): + def test_cloud_service_operating_systems_list_os_versions(self, resource_group): response = self.client.cloud_service_operating_systems.list_os_versions( location="str", - api_version="2021-03-01", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself @@ -43,11 +43,11 @@ def test_list_os_versions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_os_family(self, resource_group): + def test_cloud_service_operating_systems_get_os_family(self, resource_group): response = self.client.cloud_service_operating_systems.get_os_family( location="str", os_family_name="str", - api_version="2021-03-01", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -55,10 +55,10 @@ def test_get_os_family(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_os_families(self, resource_group): + def test_cloud_service_operating_systems_list_os_families(self, resource_group): response = self.client.cloud_service_operating_systems.list_os_families( location="str", - api_version="2021-03-01", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py index 853422e75346..57b7b4e8c2a5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_operating_systems_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_os_version(self, resource_group): + async def test_cloud_service_operating_systems_get_os_version(self, resource_group): response = await self.client.cloud_service_operating_systems.get_os_version( location="str", os_version_name="str", - api_version="2021-03-01", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -33,10 +33,10 @@ async def test_get_os_version(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_os_versions(self, resource_group): + async def test_cloud_service_operating_systems_list_os_versions(self, resource_group): response = self.client.cloud_service_operating_systems.list_os_versions( location="str", - api_version="2021-03-01", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself @@ -44,11 +44,11 @@ async def test_list_os_versions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_os_family(self, resource_group): + async def test_cloud_service_operating_systems_get_os_family(self, resource_group): response = await self.client.cloud_service_operating_systems.get_os_family( location="str", os_family_name="str", - api_version="2021-03-01", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -56,10 +56,10 @@ async def test_get_os_family(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_os_families(self, resource_group): + async def test_cloud_service_operating_systems_list_os_families(self, resource_group): response = self.client.cloud_service_operating_systems.list_os_families( location="str", - api_version="2021-03-01", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py index 87eb08d644ea..bd075118a29d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_cloud_service_role_instances_begin_delete(self, resource_group): response = self.client.cloud_service_role_instances.begin_delete( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_cloud_service_role_instances_get(self, resource_group): response = self.client.cloud_service_role_instances.get( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -46,12 +46,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_instance_view(self, resource_group): + def test_cloud_service_role_instances_get_instance_view(self, resource_group): response = self.client.cloud_service_role_instances.get_instance_view( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -59,11 +59,11 @@ def test_get_instance_view(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_cloud_service_role_instances_list(self, resource_group): response = self.client.cloud_service_role_instances.list( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself @@ -71,12 +71,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_restart(self, resource_group): + def test_cloud_service_role_instances_begin_restart(self, resource_group): response = self.client.cloud_service_role_instances.begin_restart( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -84,12 +84,12 @@ def test_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_reimage(self, resource_group): + def test_cloud_service_role_instances_begin_reimage(self, resource_group): response = self.client.cloud_service_role_instances.begin_reimage( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -97,12 +97,12 @@ def test_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_rebuild(self, resource_group): + def test_cloud_service_role_instances_begin_rebuild(self, resource_group): response = self.client.cloud_service_role_instances.begin_rebuild( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -110,12 +110,12 @@ def test_begin_rebuild(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_remote_desktop_file(self, resource_group): + def test_cloud_service_role_instances_get_remote_desktop_file(self, resource_group): response = self.client.cloud_service_role_instances.get_remote_desktop_file( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py index 9752de0af4ea..41a423723d1c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_role_instances_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_cloud_service_role_instances_begin_delete(self, resource_group): response = await ( await self.client.cloud_service_role_instances.begin_delete( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -36,12 +36,12 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_cloud_service_role_instances_get(self, resource_group): response = await self.client.cloud_service_role_instances.get( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -49,12 +49,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_instance_view(self, resource_group): + async def test_cloud_service_role_instances_get_instance_view(self, resource_group): response = await self.client.cloud_service_role_instances.get_instance_view( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -62,11 +62,11 @@ async def test_get_instance_view(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_cloud_service_role_instances_list(self, resource_group): response = self.client.cloud_service_role_instances.list( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself @@ -74,13 +74,13 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_restart(self, resource_group): + async def test_cloud_service_role_instances_begin_restart(self, resource_group): response = await ( await self.client.cloud_service_role_instances.begin_restart( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -89,13 +89,13 @@ async def test_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_reimage(self, resource_group): + async def test_cloud_service_role_instances_begin_reimage(self, resource_group): response = await ( await self.client.cloud_service_role_instances.begin_reimage( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -104,13 +104,13 @@ async def test_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_rebuild(self, resource_group): + async def test_cloud_service_role_instances_begin_rebuild(self, resource_group): response = await ( await self.client.cloud_service_role_instances.begin_rebuild( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -119,12 +119,12 @@ async def test_begin_rebuild(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_remote_desktop_file(self, resource_group): + async def test_cloud_service_role_instances_get_remote_desktop_file(self, resource_group): response = await self.client.cloud_service_role_instances.get_remote_desktop_file( role_instance_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py index 1a027f7e4de0..60efffd99f02 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_cloud_service_roles_get(self, resource_group): response = self.client.cloud_service_roles.get( role_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -33,11 +33,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_cloud_service_roles_list(self, resource_group): response = self.client.cloud_service_roles.list( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py index 8b23ad317993..179c7e979563 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_service_roles_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_cloud_service_roles_get(self, resource_group): response = await self.client.cloud_service_roles.get( role_name="str", resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -34,11 +34,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_cloud_service_roles_list(self, resource_group): response = self.client.cloud_service_roles.list( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py index accdbb3c4863..5a3f00457ffd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_cloud_services_begin_create_or_update(self, resource_group): response = self.client.cloud_services.begin_create_or_update( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -32,11 +32,11 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_cloud_services_begin_update(self, resource_group): response = self.client.cloud_services.begin_update( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -44,11 +44,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_cloud_services_begin_delete(self, resource_group): response = self.client.cloud_services.begin_delete( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -56,11 +56,11 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_cloud_services_get(self, resource_group): response = self.client.cloud_services.get( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -68,11 +68,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_instance_view(self, resource_group): + def test_cloud_services_get_instance_view(self, resource_group): response = self.client.cloud_services.get_instance_view( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -80,9 +80,9 @@ def test_get_instance_view(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_all(self, resource_group): + def test_cloud_services_list_all(self, resource_group): response = self.client.cloud_services.list_all( - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself @@ -90,10 +90,10 @@ def test_list_all(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_cloud_services_list(self, resource_group): response = self.client.cloud_services.list( resource_group_name=resource_group.name, - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself @@ -101,11 +101,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_start(self, resource_group): + def test_cloud_services_begin_start(self, resource_group): response = self.client.cloud_services.begin_start( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -113,11 +113,11 @@ def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_power_off(self, resource_group): + def test_cloud_services_begin_power_off(self, resource_group): response = self.client.cloud_services.begin_power_off( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -125,11 +125,11 @@ def test_begin_power_off(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_restart(self, resource_group): + def test_cloud_services_begin_restart(self, resource_group): response = self.client.cloud_services.begin_restart( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -137,11 +137,11 @@ def test_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_reimage(self, resource_group): + def test_cloud_services_begin_reimage(self, resource_group): response = self.client.cloud_services.begin_reimage( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -149,11 +149,11 @@ def test_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_rebuild(self, resource_group): + def test_cloud_services_begin_rebuild(self, resource_group): response = self.client.cloud_services.begin_rebuild( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -161,11 +161,11 @@ def test_begin_rebuild(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_instances(self, resource_group): + def test_cloud_services_begin_delete_instances(self, resource_group): response = self.client.cloud_services.begin_delete_instances( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py index af141697543d..9cb662e43bba 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_cloud_services_begin_create_or_update(self, resource_group): response = await ( await self.client.cloud_services.begin_create_or_update( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -35,12 +35,12 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_cloud_services_begin_update(self, resource_group): response = await ( await self.client.cloud_services.begin_update( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -49,12 +49,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_cloud_services_begin_delete(self, resource_group): response = await ( await self.client.cloud_services.begin_delete( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -63,11 +63,11 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_cloud_services_get(self, resource_group): response = await self.client.cloud_services.get( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -75,11 +75,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_instance_view(self, resource_group): + async def test_cloud_services_get_instance_view(self, resource_group): response = await self.client.cloud_services.get_instance_view( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -87,9 +87,9 @@ async def test_get_instance_view(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_all(self, resource_group): + async def test_cloud_services_list_all(self, resource_group): response = self.client.cloud_services.list_all( - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself @@ -97,10 +97,10 @@ async def test_list_all(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_cloud_services_list(self, resource_group): response = self.client.cloud_services.list( resource_group_name=resource_group.name, - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself @@ -108,12 +108,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_start(self, resource_group): + async def test_cloud_services_begin_start(self, resource_group): response = await ( await self.client.cloud_services.begin_start( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -122,12 +122,12 @@ async def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_power_off(self, resource_group): + async def test_cloud_services_begin_power_off(self, resource_group): response = await ( await self.client.cloud_services.begin_power_off( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -136,12 +136,12 @@ async def test_begin_power_off(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_restart(self, resource_group): + async def test_cloud_services_begin_restart(self, resource_group): response = await ( await self.client.cloud_services.begin_restart( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -150,12 +150,12 @@ async def test_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_reimage(self, resource_group): + async def test_cloud_services_begin_reimage(self, resource_group): response = await ( await self.client.cloud_services.begin_reimage( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -164,12 +164,12 @@ async def test_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_rebuild(self, resource_group): + async def test_cloud_services_begin_rebuild(self, resource_group): response = await ( await self.client.cloud_services.begin_rebuild( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -178,12 +178,12 @@ async def test_begin_rebuild(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_instances(self, resource_group): + async def test_cloud_services_begin_delete_instances(self, resource_group): response = await ( await self.client.cloud_services.begin_delete_instances( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py index f5b6e2c63fea..7482e2c75eef 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_walk_update_domain(self, resource_group): + def test_cloud_services_update_domain_begin_walk_update_domain(self, resource_group): response = self.client.cloud_services_update_domain.begin_walk_update_domain( resource_group_name=resource_group.name, cloud_service_name="str", update_domain=0, - api_version="2020-10-01-preview", + api_version="2024-11-04", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_begin_walk_update_domain(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_update_domain(self, resource_group): + def test_cloud_services_update_domain_get_update_domain(self, resource_group): response = self.client.cloud_services_update_domain.get_update_domain( resource_group_name=resource_group.name, cloud_service_name="str", update_domain=0, - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -46,11 +46,11 @@ def test_get_update_domain(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_update_domains(self, resource_group): + def test_cloud_services_update_domain_list_update_domains(self, resource_group): response = self.client.cloud_services_update_domain.list_update_domains( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py index d01e77674eb7..59df1d30db4d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_cloud_services_update_domain_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_walk_update_domain(self, resource_group): + async def test_cloud_services_update_domain_begin_walk_update_domain(self, resource_group): response = await ( await self.client.cloud_services_update_domain.begin_walk_update_domain( resource_group_name=resource_group.name, cloud_service_name="str", update_domain=0, - api_version="2020-10-01-preview", + api_version="2024-11-04", ) ).result() # call '.result()' to poll until service return final result @@ -36,12 +36,12 @@ async def test_begin_walk_update_domain(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_update_domain(self, resource_group): + async def test_cloud_services_update_domain_get_update_domain(self, resource_group): response = await self.client.cloud_services_update_domain.get_update_domain( resource_group_name=resource_group.name, cloud_service_name="str", update_domain=0, - api_version="2020-10-01-preview", + api_version="2024-11-04", ) # please add some check logic here by yourself @@ -49,11 +49,11 @@ async def test_get_update_domain(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_update_domains(self, resource_group): + async def test_cloud_services_update_domain_list_update_domains(self, resource_group): response = self.client.cloud_services_update_domain.list_update_domains( resource_group_name=resource_group.name, cloud_service_name="str", - api_version="2020-10-01-preview", + api_version="2024-11-04", ) result = [r async for r in response] # please add some check logic here by yourself