|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
| 11 | + |
| 12 | +from azure.core.rest import HttpRequest, HttpResponse |
| 13 | +from azure.mgmt.core import ARMPipelineClient |
| 14 | + |
| 15 | +from . import models as _models |
| 16 | +from .._serialization import Deserializer, Serializer |
| 17 | +from ._configuration import ComputeManagementClientConfiguration |
| 18 | +from .operations import ( |
| 19 | + AvailabilitySetsOperations, |
| 20 | + CapacityReservationGroupsOperations, |
| 21 | + CapacityReservationsOperations, |
| 22 | + DedicatedHostGroupsOperations, |
| 23 | + DedicatedHostsOperations, |
| 24 | + ImagesOperations, |
| 25 | + LogAnalyticsOperations, |
| 26 | + Operations, |
| 27 | + ProximityPlacementGroupsOperations, |
| 28 | + RestorePointCollectionsOperations, |
| 29 | + RestorePointsOperations, |
| 30 | + SshPublicKeysOperations, |
| 31 | + UsageOperations, |
| 32 | + VirtualMachineExtensionImagesOperations, |
| 33 | + VirtualMachineExtensionsOperations, |
| 34 | + VirtualMachineImagesEdgeZoneOperations, |
| 35 | + VirtualMachineImagesOperations, |
| 36 | + VirtualMachineRunCommandsOperations, |
| 37 | + VirtualMachineScaleSetExtensionsOperations, |
| 38 | + VirtualMachineScaleSetRollingUpgradesOperations, |
| 39 | + VirtualMachineScaleSetVMExtensionsOperations, |
| 40 | + VirtualMachineScaleSetVMRunCommandsOperations, |
| 41 | + VirtualMachineScaleSetVMsOperations, |
| 42 | + VirtualMachineScaleSetsOperations, |
| 43 | + VirtualMachineSizesOperations, |
| 44 | + VirtualMachinesOperations, |
| 45 | +) |
| 46 | + |
| 47 | +if TYPE_CHECKING: |
| 48 | + # pylint: disable=unused-import,ungrouped-imports |
| 49 | + from azure.core.credentials import TokenCredential |
| 50 | + |
| 51 | + |
| 52 | +class ComputeManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes |
| 53 | + """Compute Client. |
| 54 | +
|
| 55 | + :ivar operations: Operations operations |
| 56 | + :vartype operations: azure.mgmt.compute.v2023_07_01.operations.Operations |
| 57 | + :ivar usage: UsageOperations operations |
| 58 | + :vartype usage: azure.mgmt.compute.v2023_07_01.operations.UsageOperations |
| 59 | + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations |
| 60 | + :vartype virtual_machine_sizes: |
| 61 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineSizesOperations |
| 62 | + :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations |
| 63 | + :vartype virtual_machine_scale_sets: |
| 64 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetsOperations |
| 65 | + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations |
| 66 | + operations |
| 67 | + :vartype virtual_machine_scale_set_extensions: |
| 68 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetExtensionsOperations |
| 69 | + :ivar virtual_machine_scale_set_rolling_upgrades: |
| 70 | + VirtualMachineScaleSetRollingUpgradesOperations operations |
| 71 | + :vartype virtual_machine_scale_set_rolling_upgrades: |
| 72 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetRollingUpgradesOperations |
| 73 | + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations |
| 74 | + operations |
| 75 | + :vartype virtual_machine_scale_set_vm_extensions: |
| 76 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetVMExtensionsOperations |
| 77 | + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations |
| 78 | + :vartype virtual_machine_scale_set_vms: |
| 79 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetVMsOperations |
| 80 | + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations |
| 81 | + :vartype virtual_machine_extensions: |
| 82 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineExtensionsOperations |
| 83 | + :ivar virtual_machines: VirtualMachinesOperations operations |
| 84 | + :vartype virtual_machines: azure.mgmt.compute.v2023_07_01.operations.VirtualMachinesOperations |
| 85 | + :ivar virtual_machine_images: VirtualMachineImagesOperations operations |
| 86 | + :vartype virtual_machine_images: |
| 87 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineImagesOperations |
| 88 | + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations |
| 89 | + :vartype virtual_machine_images_edge_zone: |
| 90 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineImagesEdgeZoneOperations |
| 91 | + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations |
| 92 | + :vartype virtual_machine_extension_images: |
| 93 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineExtensionImagesOperations |
| 94 | + :ivar availability_sets: AvailabilitySetsOperations operations |
| 95 | + :vartype availability_sets: |
| 96 | + azure.mgmt.compute.v2023_07_01.operations.AvailabilitySetsOperations |
| 97 | + :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations |
| 98 | + :vartype proximity_placement_groups: |
| 99 | + azure.mgmt.compute.v2023_07_01.operations.ProximityPlacementGroupsOperations |
| 100 | + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations |
| 101 | + :vartype dedicated_host_groups: |
| 102 | + azure.mgmt.compute.v2023_07_01.operations.DedicatedHostGroupsOperations |
| 103 | + :ivar dedicated_hosts: DedicatedHostsOperations operations |
| 104 | + :vartype dedicated_hosts: azure.mgmt.compute.v2023_07_01.operations.DedicatedHostsOperations |
| 105 | + :ivar ssh_public_keys: SshPublicKeysOperations operations |
| 106 | + :vartype ssh_public_keys: azure.mgmt.compute.v2023_07_01.operations.SshPublicKeysOperations |
| 107 | + :ivar images: ImagesOperations operations |
| 108 | + :vartype images: azure.mgmt.compute.v2023_07_01.operations.ImagesOperations |
| 109 | + :ivar restore_point_collections: RestorePointCollectionsOperations operations |
| 110 | + :vartype restore_point_collections: |
| 111 | + azure.mgmt.compute.v2023_07_01.operations.RestorePointCollectionsOperations |
| 112 | + :ivar restore_points: RestorePointsOperations operations |
| 113 | + :vartype restore_points: azure.mgmt.compute.v2023_07_01.operations.RestorePointsOperations |
| 114 | + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations |
| 115 | + :vartype capacity_reservation_groups: |
| 116 | + azure.mgmt.compute.v2023_07_01.operations.CapacityReservationGroupsOperations |
| 117 | + :ivar capacity_reservations: CapacityReservationsOperations operations |
| 118 | + :vartype capacity_reservations: |
| 119 | + azure.mgmt.compute.v2023_07_01.operations.CapacityReservationsOperations |
| 120 | + :ivar log_analytics: LogAnalyticsOperations operations |
| 121 | + :vartype log_analytics: azure.mgmt.compute.v2023_07_01.operations.LogAnalyticsOperations |
| 122 | + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations |
| 123 | + :vartype virtual_machine_run_commands: |
| 124 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineRunCommandsOperations |
| 125 | + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations |
| 126 | + operations |
| 127 | + :vartype virtual_machine_scale_set_vm_run_commands: |
| 128 | + azure.mgmt.compute.v2023_07_01.operations.VirtualMachineScaleSetVMRunCommandsOperations |
| 129 | + :param credential: Credential needed for the client to connect to Azure. Required. |
| 130 | + :type credential: ~azure.core.credentials.TokenCredential |
| 131 | + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure |
| 132 | + subscription. The subscription ID forms part of the URI for every service call. Required. |
| 133 | + :type subscription_id: str |
| 134 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 135 | + :type base_url: str |
| 136 | + :keyword api_version: Api Version. Default value is "2023-07-01". Note that overriding this |
| 137 | + default value may result in unsupported behavior. |
| 138 | + :paramtype api_version: str |
| 139 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 140 | + Retry-After header is present. |
| 141 | + """ |
| 142 | + |
| 143 | + def __init__( |
| 144 | + self, |
| 145 | + credential: "TokenCredential", |
| 146 | + subscription_id: str, |
| 147 | + base_url: str = "https://management.azure.com", |
| 148 | + **kwargs: Any |
| 149 | + ) -> None: |
| 150 | + self._config = ComputeManagementClientConfiguration( |
| 151 | + credential=credential, subscription_id=subscription_id, **kwargs |
| 152 | + ) |
| 153 | + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 154 | + |
| 155 | + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} |
| 156 | + self._serialize = Serializer(client_models) |
| 157 | + self._deserialize = Deserializer(client_models) |
| 158 | + self._serialize.client_side_validation = False |
| 159 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01") |
| 160 | + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01") |
| 161 | + self.virtual_machine_sizes = VirtualMachineSizesOperations( |
| 162 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 163 | + ) |
| 164 | + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( |
| 165 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 166 | + ) |
| 167 | + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( |
| 168 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 169 | + ) |
| 170 | + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( |
| 171 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 172 | + ) |
| 173 | + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( |
| 174 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 175 | + ) |
| 176 | + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( |
| 177 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 178 | + ) |
| 179 | + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( |
| 180 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 181 | + ) |
| 182 | + self.virtual_machines = VirtualMachinesOperations( |
| 183 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 184 | + ) |
| 185 | + self.virtual_machine_images = VirtualMachineImagesOperations( |
| 186 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 187 | + ) |
| 188 | + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( |
| 189 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 190 | + ) |
| 191 | + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( |
| 192 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 193 | + ) |
| 194 | + self.availability_sets = AvailabilitySetsOperations( |
| 195 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 196 | + ) |
| 197 | + self.proximity_placement_groups = ProximityPlacementGroupsOperations( |
| 198 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 199 | + ) |
| 200 | + self.dedicated_host_groups = DedicatedHostGroupsOperations( |
| 201 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 202 | + ) |
| 203 | + self.dedicated_hosts = DedicatedHostsOperations( |
| 204 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 205 | + ) |
| 206 | + self.ssh_public_keys = SshPublicKeysOperations( |
| 207 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 208 | + ) |
| 209 | + self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-07-01") |
| 210 | + self.restore_point_collections = RestorePointCollectionsOperations( |
| 211 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 212 | + ) |
| 213 | + self.restore_points = RestorePointsOperations( |
| 214 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 215 | + ) |
| 216 | + self.capacity_reservation_groups = CapacityReservationGroupsOperations( |
| 217 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 218 | + ) |
| 219 | + self.capacity_reservations = CapacityReservationsOperations( |
| 220 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 221 | + ) |
| 222 | + self.log_analytics = LogAnalyticsOperations( |
| 223 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 224 | + ) |
| 225 | + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( |
| 226 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 227 | + ) |
| 228 | + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( |
| 229 | + self._client, self._config, self._serialize, self._deserialize, "2023-07-01" |
| 230 | + ) |
| 231 | + |
| 232 | + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: |
| 233 | + """Runs the network request through the client's chained policies. |
| 234 | +
|
| 235 | + >>> from azure.core.rest import HttpRequest |
| 236 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 237 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 238 | + >>> response = client._send_request(request) |
| 239 | + <HttpResponse: 200 OK> |
| 240 | +
|
| 241 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 242 | +
|
| 243 | + :param request: The network request you want to make. Required. |
| 244 | + :type request: ~azure.core.rest.HttpRequest |
| 245 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 246 | + :return: The response of your network call. Does not do error handling on your response. |
| 247 | + :rtype: ~azure.core.rest.HttpResponse |
| 248 | + """ |
| 249 | + |
| 250 | + request_copy = deepcopy(request) |
| 251 | + request_copy.url = self._client.format_url(request_copy.url) |
| 252 | + return self._client.send_request(request_copy, **kwargs) |
| 253 | + |
| 254 | + def close(self) -> None: |
| 255 | + self._client.close() |
| 256 | + |
| 257 | + def __enter__(self) -> "ComputeManagementClient": |
| 258 | + self._client.__enter__() |
| 259 | + return self |
| 260 | + |
| 261 | + def __exit__(self, *exc_details: Any) -> None: |
| 262 | + self._client.__exit__(*exc_details) |
0 commit comments