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# -------------------------------------------------------------------------- 8from typing import TYPE_CHECKING 9import warnings 10 11from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 12from azure.core.paging import ItemPaged 13from azure.core.pipeline import PipelineResponse 14from azure.core.pipeline.transport import HttpRequest, HttpResponse 15from azure.core.polling import LROPoller, NoPolling, PollingMethod 16from azure.mgmt.core.exceptions import ARMErrorFormat 17from azure.mgmt.core.polling.arm_polling import ARMPolling 18 19from .. import models as _models 20 21if TYPE_CHECKING: 22 # pylint: disable=unused-import,ungrouped-imports 23 from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 24 25 T = TypeVar('T') 26 ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 27 28class NetworkInterfacesOperations(object): 29 """NetworkInterfacesOperations operations. 30 31 You should not instantiate this class directly. Instead, you should create a Client instance that 32 instantiates it for you and attaches it as an attribute. 33 34 :ivar models: Alias to model classes used in this operation group. 35 :type models: ~azure.mgmt.network.v2019_11_01.models 36 :param client: Client for service requests. 37 :param config: Configuration of service client. 38 :param serializer: An object model serializer. 39 :param deserializer: An object model deserializer. 40 """ 41 42 models = _models 43 44 def __init__(self, client, config, serializer, deserializer): 45 self._client = client 46 self._serialize = serializer 47 self._deserialize = deserializer 48 self._config = config 49 50 def _delete_initial( 51 self, 52 resource_group_name, # type: str 53 network_interface_name, # type: str 54 **kwargs # type: Any 55 ): 56 # type: (...) -> None 57 cls = kwargs.pop('cls', None) # type: ClsType[None] 58 error_map = { 59 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 60 } 61 error_map.update(kwargs.pop('error_map', {})) 62 api_version = "2019-11-01" 63 accept = "application/json" 64 65 # Construct URL 66 url = self._delete_initial.metadata['url'] # type: ignore 67 path_format_arguments = { 68 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 69 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 70 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 71 } 72 url = self._client.format_url(url, **path_format_arguments) 73 74 # Construct parameters 75 query_parameters = {} # type: Dict[str, Any] 76 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 77 78 # Construct headers 79 header_parameters = {} # type: Dict[str, Any] 80 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 81 82 request = self._client.delete(url, query_parameters, header_parameters) 83 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 84 response = pipeline_response.http_response 85 86 if response.status_code not in [200, 202, 204]: 87 map_error(status_code=response.status_code, response=response, error_map=error_map) 88 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 89 90 if cls: 91 return cls(pipeline_response, None, {}) 92 93 _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 94 95 def begin_delete( 96 self, 97 resource_group_name, # type: str 98 network_interface_name, # type: str 99 **kwargs # type: Any 100 ): 101 # type: (...) -> LROPoller[None] 102 """Deletes the specified network interface. 103 104 :param resource_group_name: The name of the resource group. 105 :type resource_group_name: str 106 :param network_interface_name: The name of the network interface. 107 :type network_interface_name: str 108 :keyword callable cls: A custom type or function that will be passed the direct response 109 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 110 :keyword polling: Pass in True if you'd like the ARMPolling polling method, 111 False for no polling, or your own initialized polling object for a personal polling strategy. 112 :paramtype polling: bool or ~azure.core.polling.PollingMethod 113 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. 114 :return: An instance of LROPoller that returns either None or the result of cls(response) 115 :rtype: ~azure.core.polling.LROPoller[None] 116 :raises ~azure.core.exceptions.HttpResponseError: 117 """ 118 polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 119 cls = kwargs.pop('cls', None) # type: ClsType[None] 120 lro_delay = kwargs.pop( 121 'polling_interval', 122 self._config.polling_interval 123 ) 124 cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] 125 if cont_token is None: 126 raw_result = self._delete_initial( 127 resource_group_name=resource_group_name, 128 network_interface_name=network_interface_name, 129 cls=lambda x,y,z: x, 130 **kwargs 131 ) 132 133 kwargs.pop('error_map', None) 134 kwargs.pop('content_type', None) 135 136 def get_long_running_output(pipeline_response): 137 if cls: 138 return cls(pipeline_response, None, {}) 139 140 path_format_arguments = { 141 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 142 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 143 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 144 } 145 146 if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) 147 elif polling is False: polling_method = NoPolling() 148 else: polling_method = polling 149 if cont_token: 150 return LROPoller.from_continuation_token( 151 polling_method=polling_method, 152 continuation_token=cont_token, 153 client=self._client, 154 deserialization_callback=get_long_running_output 155 ) 156 else: 157 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) 158 begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 159 160 def get( 161 self, 162 resource_group_name, # type: str 163 network_interface_name, # type: str 164 expand=None, # type: Optional[str] 165 **kwargs # type: Any 166 ): 167 # type: (...) -> "_models.NetworkInterface" 168 """Gets information about the specified network interface. 169 170 :param resource_group_name: The name of the resource group. 171 :type resource_group_name: str 172 :param network_interface_name: The name of the network interface. 173 :type network_interface_name: str 174 :param expand: Expands referenced resources. 175 :type expand: str 176 :keyword callable cls: A custom type or function that will be passed the direct response 177 :return: NetworkInterface, or the result of cls(response) 178 :rtype: ~azure.mgmt.network.v2019_11_01.models.NetworkInterface 179 :raises: ~azure.core.exceptions.HttpResponseError 180 """ 181 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterface"] 182 error_map = { 183 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 184 } 185 error_map.update(kwargs.pop('error_map', {})) 186 api_version = "2019-11-01" 187 accept = "application/json" 188 189 # Construct URL 190 url = self.get.metadata['url'] # type: ignore 191 path_format_arguments = { 192 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 193 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 194 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 195 } 196 url = self._client.format_url(url, **path_format_arguments) 197 198 # Construct parameters 199 query_parameters = {} # type: Dict[str, Any] 200 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 201 if expand is not None: 202 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 203 204 # Construct headers 205 header_parameters = {} # type: Dict[str, Any] 206 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 207 208 request = self._client.get(url, query_parameters, header_parameters) 209 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 210 response = pipeline_response.http_response 211 212 if response.status_code not in [200]: 213 map_error(status_code=response.status_code, response=response, error_map=error_map) 214 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 215 216 deserialized = self._deserialize('NetworkInterface', pipeline_response) 217 218 if cls: 219 return cls(pipeline_response, deserialized, {}) 220 221 return deserialized 222 get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 223 224 def _create_or_update_initial( 225 self, 226 resource_group_name, # type: str 227 network_interface_name, # type: str 228 parameters, # type: "_models.NetworkInterface" 229 **kwargs # type: Any 230 ): 231 # type: (...) -> "_models.NetworkInterface" 232 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterface"] 233 error_map = { 234 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 235 } 236 error_map.update(kwargs.pop('error_map', {})) 237 api_version = "2019-11-01" 238 content_type = kwargs.pop("content_type", "application/json") 239 accept = "application/json" 240 241 # Construct URL 242 url = self._create_or_update_initial.metadata['url'] # type: ignore 243 path_format_arguments = { 244 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 245 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 246 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 247 } 248 url = self._client.format_url(url, **path_format_arguments) 249 250 # Construct parameters 251 query_parameters = {} # type: Dict[str, Any] 252 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 253 254 # Construct headers 255 header_parameters = {} # type: Dict[str, Any] 256 header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') 257 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 258 259 body_content_kwargs = {} # type: Dict[str, Any] 260 body_content = self._serialize.body(parameters, 'NetworkInterface') 261 body_content_kwargs['content'] = body_content 262 request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) 263 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 264 response = pipeline_response.http_response 265 266 if response.status_code not in [200, 201]: 267 map_error(status_code=response.status_code, response=response, error_map=error_map) 268 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 269 270 if response.status_code == 200: 271 deserialized = self._deserialize('NetworkInterface', pipeline_response) 272 273 if response.status_code == 201: 274 deserialized = self._deserialize('NetworkInterface', pipeline_response) 275 276 if cls: 277 return cls(pipeline_response, deserialized, {}) 278 279 return deserialized 280 _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 281 282 def begin_create_or_update( 283 self, 284 resource_group_name, # type: str 285 network_interface_name, # type: str 286 parameters, # type: "_models.NetworkInterface" 287 **kwargs # type: Any 288 ): 289 # type: (...) -> LROPoller["_models.NetworkInterface"] 290 """Creates or updates a network interface. 291 292 :param resource_group_name: The name of the resource group. 293 :type resource_group_name: str 294 :param network_interface_name: The name of the network interface. 295 :type network_interface_name: str 296 :param parameters: Parameters supplied to the create or update network interface operation. 297 :type parameters: ~azure.mgmt.network.v2019_11_01.models.NetworkInterface 298 :keyword callable cls: A custom type or function that will be passed the direct response 299 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 300 :keyword polling: Pass in True if you'd like the ARMPolling polling method, 301 False for no polling, or your own initialized polling object for a personal polling strategy. 302 :paramtype polling: bool or ~azure.core.polling.PollingMethod 303 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. 304 :return: An instance of LROPoller that returns either NetworkInterface or the result of cls(response) 305 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2019_11_01.models.NetworkInterface] 306 :raises ~azure.core.exceptions.HttpResponseError: 307 """ 308 polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 309 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterface"] 310 lro_delay = kwargs.pop( 311 'polling_interval', 312 self._config.polling_interval 313 ) 314 cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] 315 if cont_token is None: 316 raw_result = self._create_or_update_initial( 317 resource_group_name=resource_group_name, 318 network_interface_name=network_interface_name, 319 parameters=parameters, 320 cls=lambda x,y,z: x, 321 **kwargs 322 ) 323 324 kwargs.pop('error_map', None) 325 kwargs.pop('content_type', None) 326 327 def get_long_running_output(pipeline_response): 328 deserialized = self._deserialize('NetworkInterface', pipeline_response) 329 330 if cls: 331 return cls(pipeline_response, deserialized, {}) 332 return deserialized 333 334 path_format_arguments = { 335 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 336 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 337 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 338 } 339 340 if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) 341 elif polling is False: polling_method = NoPolling() 342 else: polling_method = polling 343 if cont_token: 344 return LROPoller.from_continuation_token( 345 polling_method=polling_method, 346 continuation_token=cont_token, 347 client=self._client, 348 deserialization_callback=get_long_running_output 349 ) 350 else: 351 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) 352 begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 353 354 def update_tags( 355 self, 356 resource_group_name, # type: str 357 network_interface_name, # type: str 358 parameters, # type: "_models.TagsObject" 359 **kwargs # type: Any 360 ): 361 # type: (...) -> "_models.NetworkInterface" 362 """Updates a network interface tags. 363 364 :param resource_group_name: The name of the resource group. 365 :type resource_group_name: str 366 :param network_interface_name: The name of the network interface. 367 :type network_interface_name: str 368 :param parameters: Parameters supplied to update network interface tags. 369 :type parameters: ~azure.mgmt.network.v2019_11_01.models.TagsObject 370 :keyword callable cls: A custom type or function that will be passed the direct response 371 :return: NetworkInterface, or the result of cls(response) 372 :rtype: ~azure.mgmt.network.v2019_11_01.models.NetworkInterface 373 :raises: ~azure.core.exceptions.HttpResponseError 374 """ 375 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterface"] 376 error_map = { 377 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 378 } 379 error_map.update(kwargs.pop('error_map', {})) 380 api_version = "2019-11-01" 381 content_type = kwargs.pop("content_type", "application/json") 382 accept = "application/json" 383 384 # Construct URL 385 url = self.update_tags.metadata['url'] # type: ignore 386 path_format_arguments = { 387 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 388 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 389 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 390 } 391 url = self._client.format_url(url, **path_format_arguments) 392 393 # Construct parameters 394 query_parameters = {} # type: Dict[str, Any] 395 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 396 397 # Construct headers 398 header_parameters = {} # type: Dict[str, Any] 399 header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') 400 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 401 402 body_content_kwargs = {} # type: Dict[str, Any] 403 body_content = self._serialize.body(parameters, 'TagsObject') 404 body_content_kwargs['content'] = body_content 405 request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) 406 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 407 response = pipeline_response.http_response 408 409 if response.status_code not in [200]: 410 map_error(status_code=response.status_code, response=response, error_map=error_map) 411 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 412 413 deserialized = self._deserialize('NetworkInterface', pipeline_response) 414 415 if cls: 416 return cls(pipeline_response, deserialized, {}) 417 418 return deserialized 419 update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} # type: ignore 420 421 def list_all( 422 self, 423 **kwargs # type: Any 424 ): 425 # type: (...) -> Iterable["_models.NetworkInterfaceListResult"] 426 """Gets all network interfaces in a subscription. 427 428 :keyword callable cls: A custom type or function that will be passed the direct response 429 :return: An iterator like instance of either NetworkInterfaceListResult or the result of cls(response) 430 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceListResult] 431 :raises: ~azure.core.exceptions.HttpResponseError 432 """ 433 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceListResult"] 434 error_map = { 435 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 436 } 437 error_map.update(kwargs.pop('error_map', {})) 438 api_version = "2019-11-01" 439 accept = "application/json" 440 441 def prepare_request(next_link=None): 442 # Construct headers 443 header_parameters = {} # type: Dict[str, Any] 444 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 445 446 if not next_link: 447 # Construct URL 448 url = self.list_all.metadata['url'] # type: ignore 449 path_format_arguments = { 450 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 451 } 452 url = self._client.format_url(url, **path_format_arguments) 453 # Construct parameters 454 query_parameters = {} # type: Dict[str, Any] 455 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 456 457 request = self._client.get(url, query_parameters, header_parameters) 458 else: 459 url = next_link 460 query_parameters = {} # type: Dict[str, Any] 461 request = self._client.get(url, query_parameters, header_parameters) 462 return request 463 464 def extract_data(pipeline_response): 465 deserialized = self._deserialize('NetworkInterfaceListResult', pipeline_response) 466 list_of_elem = deserialized.value 467 if cls: 468 list_of_elem = cls(list_of_elem) 469 return deserialized.next_link or None, iter(list_of_elem) 470 471 def get_next(next_link=None): 472 request = prepare_request(next_link) 473 474 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 475 response = pipeline_response.http_response 476 477 if response.status_code not in [200]: 478 map_error(status_code=response.status_code, response=response, error_map=error_map) 479 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 480 481 return pipeline_response 482 483 return ItemPaged( 484 get_next, extract_data 485 ) 486 list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces'} # type: ignore 487 488 def list( 489 self, 490 resource_group_name, # type: str 491 **kwargs # type: Any 492 ): 493 # type: (...) -> Iterable["_models.NetworkInterfaceListResult"] 494 """Gets all network interfaces in a resource group. 495 496 :param resource_group_name: The name of the resource group. 497 :type resource_group_name: str 498 :keyword callable cls: A custom type or function that will be passed the direct response 499 :return: An iterator like instance of either NetworkInterfaceListResult or the result of cls(response) 500 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceListResult] 501 :raises: ~azure.core.exceptions.HttpResponseError 502 """ 503 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceListResult"] 504 error_map = { 505 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 506 } 507 error_map.update(kwargs.pop('error_map', {})) 508 api_version = "2019-11-01" 509 accept = "application/json" 510 511 def prepare_request(next_link=None): 512 # Construct headers 513 header_parameters = {} # type: Dict[str, Any] 514 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 515 516 if not next_link: 517 # Construct URL 518 url = self.list.metadata['url'] # type: ignore 519 path_format_arguments = { 520 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 521 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 522 } 523 url = self._client.format_url(url, **path_format_arguments) 524 # Construct parameters 525 query_parameters = {} # type: Dict[str, Any] 526 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 527 528 request = self._client.get(url, query_parameters, header_parameters) 529 else: 530 url = next_link 531 query_parameters = {} # type: Dict[str, Any] 532 request = self._client.get(url, query_parameters, header_parameters) 533 return request 534 535 def extract_data(pipeline_response): 536 deserialized = self._deserialize('NetworkInterfaceListResult', pipeline_response) 537 list_of_elem = deserialized.value 538 if cls: 539 list_of_elem = cls(list_of_elem) 540 return deserialized.next_link or None, iter(list_of_elem) 541 542 def get_next(next_link=None): 543 request = prepare_request(next_link) 544 545 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 546 response = pipeline_response.http_response 547 548 if response.status_code not in [200]: 549 map_error(status_code=response.status_code, response=response, error_map=error_map) 550 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 551 552 return pipeline_response 553 554 return ItemPaged( 555 get_next, extract_data 556 ) 557 list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces'} # type: ignore 558 559 def _get_effective_route_table_initial( 560 self, 561 resource_group_name, # type: str 562 network_interface_name, # type: str 563 **kwargs # type: Any 564 ): 565 # type: (...) -> Optional["_models.EffectiveRouteListResult"] 566 cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EffectiveRouteListResult"]] 567 error_map = { 568 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 569 } 570 error_map.update(kwargs.pop('error_map', {})) 571 api_version = "2019-11-01" 572 accept = "application/json" 573 574 # Construct URL 575 url = self._get_effective_route_table_initial.metadata['url'] # type: ignore 576 path_format_arguments = { 577 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 578 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 579 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 580 } 581 url = self._client.format_url(url, **path_format_arguments) 582 583 # Construct parameters 584 query_parameters = {} # type: Dict[str, Any] 585 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 586 587 # Construct headers 588 header_parameters = {} # type: Dict[str, Any] 589 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 590 591 request = self._client.post(url, query_parameters, header_parameters) 592 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 593 response = pipeline_response.http_response 594 595 if response.status_code not in [200, 202]: 596 map_error(status_code=response.status_code, response=response, error_map=error_map) 597 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 598 599 deserialized = None 600 if response.status_code == 200: 601 deserialized = self._deserialize('EffectiveRouteListResult', pipeline_response) 602 603 if cls: 604 return cls(pipeline_response, deserialized, {}) 605 606 return deserialized 607 _get_effective_route_table_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable'} # type: ignore 608 609 def begin_get_effective_route_table( 610 self, 611 resource_group_name, # type: str 612 network_interface_name, # type: str 613 **kwargs # type: Any 614 ): 615 # type: (...) -> LROPoller["_models.EffectiveRouteListResult"] 616 """Gets all route tables applied to a network interface. 617 618 :param resource_group_name: The name of the resource group. 619 :type resource_group_name: str 620 :param network_interface_name: The name of the network interface. 621 :type network_interface_name: str 622 :keyword callable cls: A custom type or function that will be passed the direct response 623 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 624 :keyword polling: Pass in True if you'd like the ARMPolling polling method, 625 False for no polling, or your own initialized polling object for a personal polling strategy. 626 :paramtype polling: bool or ~azure.core.polling.PollingMethod 627 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. 628 :return: An instance of LROPoller that returns either EffectiveRouteListResult or the result of cls(response) 629 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2019_11_01.models.EffectiveRouteListResult] 630 :raises ~azure.core.exceptions.HttpResponseError: 631 """ 632 polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 633 cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveRouteListResult"] 634 lro_delay = kwargs.pop( 635 'polling_interval', 636 self._config.polling_interval 637 ) 638 cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] 639 if cont_token is None: 640 raw_result = self._get_effective_route_table_initial( 641 resource_group_name=resource_group_name, 642 network_interface_name=network_interface_name, 643 cls=lambda x,y,z: x, 644 **kwargs 645 ) 646 647 kwargs.pop('error_map', None) 648 kwargs.pop('content_type', None) 649 650 def get_long_running_output(pipeline_response): 651 deserialized = self._deserialize('EffectiveRouteListResult', pipeline_response) 652 653 if cls: 654 return cls(pipeline_response, deserialized, {}) 655 return deserialized 656 657 path_format_arguments = { 658 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 659 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 660 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 661 } 662 663 if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) 664 elif polling is False: polling_method = NoPolling() 665 else: polling_method = polling 666 if cont_token: 667 return LROPoller.from_continuation_token( 668 polling_method=polling_method, 669 continuation_token=cont_token, 670 client=self._client, 671 deserialization_callback=get_long_running_output 672 ) 673 else: 674 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) 675 begin_get_effective_route_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable'} # type: ignore 676 677 def _list_effective_network_security_groups_initial( 678 self, 679 resource_group_name, # type: str 680 network_interface_name, # type: str 681 **kwargs # type: Any 682 ): 683 # type: (...) -> Optional["_models.EffectiveNetworkSecurityGroupListResult"] 684 cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EffectiveNetworkSecurityGroupListResult"]] 685 error_map = { 686 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 687 } 688 error_map.update(kwargs.pop('error_map', {})) 689 api_version = "2019-11-01" 690 accept = "application/json" 691 692 # Construct URL 693 url = self._list_effective_network_security_groups_initial.metadata['url'] # type: ignore 694 path_format_arguments = { 695 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 696 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 697 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 698 } 699 url = self._client.format_url(url, **path_format_arguments) 700 701 # Construct parameters 702 query_parameters = {} # type: Dict[str, Any] 703 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 704 705 # Construct headers 706 header_parameters = {} # type: Dict[str, Any] 707 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 708 709 request = self._client.post(url, query_parameters, header_parameters) 710 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 711 response = pipeline_response.http_response 712 713 if response.status_code not in [200, 202]: 714 map_error(status_code=response.status_code, response=response, error_map=error_map) 715 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 716 717 deserialized = None 718 if response.status_code == 200: 719 deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', pipeline_response) 720 721 if cls: 722 return cls(pipeline_response, deserialized, {}) 723 724 return deserialized 725 _list_effective_network_security_groups_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups'} # type: ignore 726 727 def begin_list_effective_network_security_groups( 728 self, 729 resource_group_name, # type: str 730 network_interface_name, # type: str 731 **kwargs # type: Any 732 ): 733 # type: (...) -> LROPoller["_models.EffectiveNetworkSecurityGroupListResult"] 734 """Gets all network security groups applied to a network interface. 735 736 :param resource_group_name: The name of the resource group. 737 :type resource_group_name: str 738 :param network_interface_name: The name of the network interface. 739 :type network_interface_name: str 740 :keyword callable cls: A custom type or function that will be passed the direct response 741 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 742 :keyword polling: Pass in True if you'd like the ARMPolling polling method, 743 False for no polling, or your own initialized polling object for a personal polling strategy. 744 :paramtype polling: bool or ~azure.core.polling.PollingMethod 745 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. 746 :return: An instance of LROPoller that returns either EffectiveNetworkSecurityGroupListResult or the result of cls(response) 747 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2019_11_01.models.EffectiveNetworkSecurityGroupListResult] 748 :raises ~azure.core.exceptions.HttpResponseError: 749 """ 750 polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 751 cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveNetworkSecurityGroupListResult"] 752 lro_delay = kwargs.pop( 753 'polling_interval', 754 self._config.polling_interval 755 ) 756 cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] 757 if cont_token is None: 758 raw_result = self._list_effective_network_security_groups_initial( 759 resource_group_name=resource_group_name, 760 network_interface_name=network_interface_name, 761 cls=lambda x,y,z: x, 762 **kwargs 763 ) 764 765 kwargs.pop('error_map', None) 766 kwargs.pop('content_type', None) 767 768 def get_long_running_output(pipeline_response): 769 deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', pipeline_response) 770 771 if cls: 772 return cls(pipeline_response, deserialized, {}) 773 return deserialized 774 775 path_format_arguments = { 776 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 777 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 778 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 779 } 780 781 if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) 782 elif polling is False: polling_method = NoPolling() 783 else: polling_method = polling 784 if cont_token: 785 return LROPoller.from_continuation_token( 786 polling_method=polling_method, 787 continuation_token=cont_token, 788 client=self._client, 789 deserialization_callback=get_long_running_output 790 ) 791 else: 792 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) 793 begin_list_effective_network_security_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups'} # type: ignore 794 795 def list_virtual_machine_scale_set_vm_network_interfaces( 796 self, 797 resource_group_name, # type: str 798 virtual_machine_scale_set_name, # type: str 799 virtualmachine_index, # type: str 800 **kwargs # type: Any 801 ): 802 # type: (...) -> Iterable["_models.NetworkInterfaceListResult"] 803 """Gets information about all network interfaces in a virtual machine in a virtual machine scale 804 set. 805 806 :param resource_group_name: The name of the resource group. 807 :type resource_group_name: str 808 :param virtual_machine_scale_set_name: The name of the virtual machine scale set. 809 :type virtual_machine_scale_set_name: str 810 :param virtualmachine_index: The virtual machine index. 811 :type virtualmachine_index: str 812 :keyword callable cls: A custom type or function that will be passed the direct response 813 :return: An iterator like instance of either NetworkInterfaceListResult or the result of cls(response) 814 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceListResult] 815 :raises: ~azure.core.exceptions.HttpResponseError 816 """ 817 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceListResult"] 818 error_map = { 819 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 820 } 821 error_map.update(kwargs.pop('error_map', {})) 822 api_version = "2018-10-01" 823 accept = "application/json" 824 825 def prepare_request(next_link=None): 826 # Construct headers 827 header_parameters = {} # type: Dict[str, Any] 828 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 829 830 if not next_link: 831 # Construct URL 832 url = self.list_virtual_machine_scale_set_vm_network_interfaces.metadata['url'] # type: ignore 833 path_format_arguments = { 834 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 835 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), 836 'virtualmachineIndex': self._serialize.url("virtualmachine_index", virtualmachine_index, 'str'), 837 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 838 } 839 url = self._client.format_url(url, **path_format_arguments) 840 # Construct parameters 841 query_parameters = {} # type: Dict[str, Any] 842 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 843 844 request = self._client.get(url, query_parameters, header_parameters) 845 else: 846 url = next_link 847 query_parameters = {} # type: Dict[str, Any] 848 request = self._client.get(url, query_parameters, header_parameters) 849 return request 850 851 def extract_data(pipeline_response): 852 deserialized = self._deserialize('NetworkInterfaceListResult', pipeline_response) 853 list_of_elem = deserialized.value 854 if cls: 855 list_of_elem = cls(list_of_elem) 856 return deserialized.next_link or None, iter(list_of_elem) 857 858 def get_next(next_link=None): 859 request = prepare_request(next_link) 860 861 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 862 response = pipeline_response.http_response 863 864 if response.status_code not in [200]: 865 map_error(status_code=response.status_code, response=response, error_map=error_map) 866 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 867 868 return pipeline_response 869 870 return ItemPaged( 871 get_next, extract_data 872 ) 873 list_virtual_machine_scale_set_vm_network_interfaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces'} # type: ignore 874 875 def list_virtual_machine_scale_set_network_interfaces( 876 self, 877 resource_group_name, # type: str 878 virtual_machine_scale_set_name, # type: str 879 **kwargs # type: Any 880 ): 881 # type: (...) -> Iterable["_models.NetworkInterfaceListResult"] 882 """Gets all network interfaces in a virtual machine scale set. 883 884 :param resource_group_name: The name of the resource group. 885 :type resource_group_name: str 886 :param virtual_machine_scale_set_name: The name of the virtual machine scale set. 887 :type virtual_machine_scale_set_name: str 888 :keyword callable cls: A custom type or function that will be passed the direct response 889 :return: An iterator like instance of either NetworkInterfaceListResult or the result of cls(response) 890 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceListResult] 891 :raises: ~azure.core.exceptions.HttpResponseError 892 """ 893 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceListResult"] 894 error_map = { 895 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 896 } 897 error_map.update(kwargs.pop('error_map', {})) 898 api_version = "2018-10-01" 899 accept = "application/json" 900 901 def prepare_request(next_link=None): 902 # Construct headers 903 header_parameters = {} # type: Dict[str, Any] 904 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 905 906 if not next_link: 907 # Construct URL 908 url = self.list_virtual_machine_scale_set_network_interfaces.metadata['url'] # type: ignore 909 path_format_arguments = { 910 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 911 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), 912 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 913 } 914 url = self._client.format_url(url, **path_format_arguments) 915 # Construct parameters 916 query_parameters = {} # type: Dict[str, Any] 917 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 918 919 request = self._client.get(url, query_parameters, header_parameters) 920 else: 921 url = next_link 922 query_parameters = {} # type: Dict[str, Any] 923 request = self._client.get(url, query_parameters, header_parameters) 924 return request 925 926 def extract_data(pipeline_response): 927 deserialized = self._deserialize('NetworkInterfaceListResult', pipeline_response) 928 list_of_elem = deserialized.value 929 if cls: 930 list_of_elem = cls(list_of_elem) 931 return deserialized.next_link or None, iter(list_of_elem) 932 933 def get_next(next_link=None): 934 request = prepare_request(next_link) 935 936 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 937 response = pipeline_response.http_response 938 939 if response.status_code not in [200]: 940 map_error(status_code=response.status_code, response=response, error_map=error_map) 941 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 942 943 return pipeline_response 944 945 return ItemPaged( 946 get_next, extract_data 947 ) 948 list_virtual_machine_scale_set_network_interfaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces'} # type: ignore 949 950 def get_virtual_machine_scale_set_network_interface( 951 self, 952 resource_group_name, # type: str 953 virtual_machine_scale_set_name, # type: str 954 virtualmachine_index, # type: str 955 network_interface_name, # type: str 956 expand=None, # type: Optional[str] 957 **kwargs # type: Any 958 ): 959 # type: (...) -> "_models.NetworkInterface" 960 """Get the specified network interface in a virtual machine scale set. 961 962 :param resource_group_name: The name of the resource group. 963 :type resource_group_name: str 964 :param virtual_machine_scale_set_name: The name of the virtual machine scale set. 965 :type virtual_machine_scale_set_name: str 966 :param virtualmachine_index: The virtual machine index. 967 :type virtualmachine_index: str 968 :param network_interface_name: The name of the network interface. 969 :type network_interface_name: str 970 :param expand: Expands referenced resources. 971 :type expand: str 972 :keyword callable cls: A custom type or function that will be passed the direct response 973 :return: NetworkInterface, or the result of cls(response) 974 :rtype: ~azure.mgmt.network.v2019_11_01.models.NetworkInterface 975 :raises: ~azure.core.exceptions.HttpResponseError 976 """ 977 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterface"] 978 error_map = { 979 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 980 } 981 error_map.update(kwargs.pop('error_map', {})) 982 api_version = "2018-10-01" 983 accept = "application/json" 984 985 # Construct URL 986 url = self.get_virtual_machine_scale_set_network_interface.metadata['url'] # type: ignore 987 path_format_arguments = { 988 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 989 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), 990 'virtualmachineIndex': self._serialize.url("virtualmachine_index", virtualmachine_index, 'str'), 991 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 992 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 993 } 994 url = self._client.format_url(url, **path_format_arguments) 995 996 # Construct parameters 997 query_parameters = {} # type: Dict[str, Any] 998 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 999 if expand is not None: 1000 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 1001 1002 # Construct headers 1003 header_parameters = {} # type: Dict[str, Any] 1004 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 1005 1006 request = self._client.get(url, query_parameters, header_parameters) 1007 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 1008 response = pipeline_response.http_response 1009 1010 if response.status_code not in [200]: 1011 map_error(status_code=response.status_code, response=response, error_map=error_map) 1012 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 1013 1014 deserialized = self._deserialize('NetworkInterface', pipeline_response) 1015 1016 if cls: 1017 return cls(pipeline_response, deserialized, {}) 1018 1019 return deserialized 1020 get_virtual_machine_scale_set_network_interface.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}'} # type: ignore 1021 1022 def list_virtual_machine_scale_set_ip_configurations( 1023 self, 1024 resource_group_name, # type: str 1025 virtual_machine_scale_set_name, # type: str 1026 virtualmachine_index, # type: str 1027 network_interface_name, # type: str 1028 expand=None, # type: Optional[str] 1029 **kwargs # type: Any 1030 ): 1031 # type: (...) -> Iterable["_models.NetworkInterfaceIPConfigurationListResult"] 1032 """Get the specified network interface ip configuration in a virtual machine scale set. 1033 1034 :param resource_group_name: The name of the resource group. 1035 :type resource_group_name: str 1036 :param virtual_machine_scale_set_name: The name of the virtual machine scale set. 1037 :type virtual_machine_scale_set_name: str 1038 :param virtualmachine_index: The virtual machine index. 1039 :type virtualmachine_index: str 1040 :param network_interface_name: The name of the network interface. 1041 :type network_interface_name: str 1042 :param expand: Expands referenced resources. 1043 :type expand: str 1044 :keyword callable cls: A custom type or function that will be passed the direct response 1045 :return: An iterator like instance of either NetworkInterfaceIPConfigurationListResult or the result of cls(response) 1046 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceIPConfigurationListResult] 1047 :raises: ~azure.core.exceptions.HttpResponseError 1048 """ 1049 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceIPConfigurationListResult"] 1050 error_map = { 1051 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 1052 } 1053 error_map.update(kwargs.pop('error_map', {})) 1054 api_version = "2018-10-01" 1055 accept = "application/json" 1056 1057 def prepare_request(next_link=None): 1058 # Construct headers 1059 header_parameters = {} # type: Dict[str, Any] 1060 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 1061 1062 if not next_link: 1063 # Construct URL 1064 url = self.list_virtual_machine_scale_set_ip_configurations.metadata['url'] # type: ignore 1065 path_format_arguments = { 1066 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 1067 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), 1068 'virtualmachineIndex': self._serialize.url("virtualmachine_index", virtualmachine_index, 'str'), 1069 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 1070 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 1071 } 1072 url = self._client.format_url(url, **path_format_arguments) 1073 # Construct parameters 1074 query_parameters = {} # type: Dict[str, Any] 1075 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 1076 if expand is not None: 1077 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 1078 1079 request = self._client.get(url, query_parameters, header_parameters) 1080 else: 1081 url = next_link 1082 query_parameters = {} # type: Dict[str, Any] 1083 request = self._client.get(url, query_parameters, header_parameters) 1084 return request 1085 1086 def extract_data(pipeline_response): 1087 deserialized = self._deserialize('NetworkInterfaceIPConfigurationListResult', pipeline_response) 1088 list_of_elem = deserialized.value 1089 if cls: 1090 list_of_elem = cls(list_of_elem) 1091 return deserialized.next_link or None, iter(list_of_elem) 1092 1093 def get_next(next_link=None): 1094 request = prepare_request(next_link) 1095 1096 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 1097 response = pipeline_response.http_response 1098 1099 if response.status_code not in [200]: 1100 map_error(status_code=response.status_code, response=response, error_map=error_map) 1101 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 1102 1103 return pipeline_response 1104 1105 return ItemPaged( 1106 get_next, extract_data 1107 ) 1108 list_virtual_machine_scale_set_ip_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations'} # type: ignore 1109 1110 def get_virtual_machine_scale_set_ip_configuration( 1111 self, 1112 resource_group_name, # type: str 1113 virtual_machine_scale_set_name, # type: str 1114 virtualmachine_index, # type: str 1115 network_interface_name, # type: str 1116 ip_configuration_name, # type: str 1117 expand=None, # type: Optional[str] 1118 **kwargs # type: Any 1119 ): 1120 # type: (...) -> "_models.NetworkInterfaceIPConfiguration" 1121 """Get the specified network interface ip configuration in a virtual machine scale set. 1122 1123 :param resource_group_name: The name of the resource group. 1124 :type resource_group_name: str 1125 :param virtual_machine_scale_set_name: The name of the virtual machine scale set. 1126 :type virtual_machine_scale_set_name: str 1127 :param virtualmachine_index: The virtual machine index. 1128 :type virtualmachine_index: str 1129 :param network_interface_name: The name of the network interface. 1130 :type network_interface_name: str 1131 :param ip_configuration_name: The name of the ip configuration. 1132 :type ip_configuration_name: str 1133 :param expand: Expands referenced resources. 1134 :type expand: str 1135 :keyword callable cls: A custom type or function that will be passed the direct response 1136 :return: NetworkInterfaceIPConfiguration, or the result of cls(response) 1137 :rtype: ~azure.mgmt.network.v2019_11_01.models.NetworkInterfaceIPConfiguration 1138 :raises: ~azure.core.exceptions.HttpResponseError 1139 """ 1140 cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkInterfaceIPConfiguration"] 1141 error_map = { 1142 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError 1143 } 1144 error_map.update(kwargs.pop('error_map', {})) 1145 api_version = "2018-10-01" 1146 accept = "application/json" 1147 1148 # Construct URL 1149 url = self.get_virtual_machine_scale_set_ip_configuration.metadata['url'] # type: ignore 1150 path_format_arguments = { 1151 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 1152 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), 1153 'virtualmachineIndex': self._serialize.url("virtualmachine_index", virtualmachine_index, 'str'), 1154 'networkInterfaceName': self._serialize.url("network_interface_name", network_interface_name, 'str'), 1155 'ipConfigurationName': self._serialize.url("ip_configuration_name", ip_configuration_name, 'str'), 1156 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 1157 } 1158 url = self._client.format_url(url, **path_format_arguments) 1159 1160 # Construct parameters 1161 query_parameters = {} # type: Dict[str, Any] 1162 query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') 1163 if expand is not None: 1164 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') 1165 1166 # Construct headers 1167 header_parameters = {} # type: Dict[str, Any] 1168 header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') 1169 1170 request = self._client.get(url, query_parameters, header_parameters) 1171 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 1172 response = pipeline_response.http_response 1173 1174 if response.status_code not in [200]: 1175 map_error(status_code=response.status_code, response=response, error_map=error_map) 1176 raise HttpResponseError(response=response, error_format=ARMErrorFormat) 1177 1178 deserialized = self._deserialize('NetworkInterfaceIPConfiguration', pipeline_response) 1179 1180 if cls: 1181 return cls(pipeline_response, deserialized, {}) 1182 1183 return deserialized 1184 get_virtual_machine_scale_set_ip_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}'} # type: ignore 1185