|
6 | 6 | # Changes may cause incorrect behavior and will be lost if the code is regenerated. |
7 | 7 | # -------------------------------------------------------------------------- |
8 | 8 |
|
9 | | -from typing import TYPE_CHECKING |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
10 | 11 |
|
11 | | -from azure.mgmt.core import ARMPipelineClient |
12 | 12 | from msrest import Deserializer, Serializer |
13 | 13 |
|
14 | | -if TYPE_CHECKING: |
15 | | - # pylint: disable=unused-import,ungrouped-imports |
16 | | - from typing import Any, Optional |
17 | | - |
18 | | - from azure.core.credentials import TokenCredential |
19 | | - from azure.core.pipeline.transport import HttpRequest, HttpResponse |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
20 | 16 |
|
21 | | -from ._configuration import FluidRelayManagementClientConfiguration |
22 | | -from .operations import FluidRelayOperationsOperations |
23 | | -from .operations import FluidRelayServersOperations |
24 | 17 | from . import models |
| 18 | +from ._configuration import FluidRelayManagementClientConfiguration |
| 19 | +from .operations import FluidRelayContainersOperations, FluidRelayOperationsOperations, FluidRelayServersOperations |
25 | 20 |
|
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
26 | 24 |
|
27 | | -class FluidRelayManagementClient(object): |
| 25 | +class FluidRelayManagementClient: |
28 | 26 | """FluidRelayManagementClient. |
29 | 27 |
|
30 | 28 | :ivar fluid_relay_operations: FluidRelayOperationsOperations operations |
31 | | - :vartype fluid_relay_operations: fluid_relay_management_client.operations.FluidRelayOperationsOperations |
| 29 | + :vartype fluid_relay_operations: |
| 30 | + azure.mgmt.fluidrelay.operations.FluidRelayOperationsOperations |
32 | 31 | :ivar fluid_relay_servers: FluidRelayServersOperations operations |
33 | | - :vartype fluid_relay_servers: fluid_relay_management_client.operations.FluidRelayServersOperations |
| 32 | + :vartype fluid_relay_servers: azure.mgmt.fluidrelay.operations.FluidRelayServersOperations |
| 33 | + :ivar fluid_relay_containers: FluidRelayContainersOperations operations |
| 34 | + :vartype fluid_relay_containers: |
| 35 | + azure.mgmt.fluidrelay.operations.FluidRelayContainersOperations |
34 | 36 | :param credential: Credential needed for the client to connect to Azure. |
35 | 37 | :type credential: ~azure.core.credentials.TokenCredential |
36 | 38 | :param subscription_id: The subscription id (GUID) for this resource. |
37 | 39 | :type subscription_id: str |
38 | | - :param str base_url: Service URL |
| 40 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 41 | + :type base_url: str |
| 42 | + :keyword api_version: Api Version. Default value is "2022-05-26". Note that overriding this |
| 43 | + default value may result in unsupported behavior. |
| 44 | + :paramtype api_version: str |
39 | 45 | """ |
40 | 46 |
|
41 | 47 | def __init__( |
42 | 48 | self, |
43 | | - credential, # type: "TokenCredential" |
44 | | - subscription_id, # type: str |
45 | | - base_url=None, # type: Optional[str] |
46 | | - **kwargs # type: Any |
47 | | - ): |
48 | | - # type: (...) -> None |
49 | | - if not base_url: |
50 | | - base_url = 'https://management.azure.com' |
51 | | - self._config = FluidRelayManagementClientConfiguration(credential, subscription_id, **kwargs) |
| 49 | + credential: "TokenCredential", |
| 50 | + subscription_id: str, |
| 51 | + base_url: str = "https://management.azure.com", |
| 52 | + **kwargs: Any |
| 53 | + ) -> None: |
| 54 | + self._config = FluidRelayManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
52 | 55 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
53 | 56 |
|
54 | 57 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
55 | 58 | self._serialize = Serializer(client_models) |
56 | | - self._serialize.client_side_validation = False |
57 | 59 | self._deserialize = Deserializer(client_models) |
| 60 | + self._serialize.client_side_validation = False |
| 61 | + self.fluid_relay_operations = FluidRelayOperationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 62 | + self.fluid_relay_servers = FluidRelayServersOperations(self._client, self._config, self._serialize, self._deserialize) |
| 63 | + self.fluid_relay_containers = FluidRelayContainersOperations(self._client, self._config, self._serialize, self._deserialize) |
58 | 64 |
|
59 | | - self.fluid_relay_operations = FluidRelayOperationsOperations( |
60 | | - self._client, self._config, self._serialize, self._deserialize) |
61 | | - self.fluid_relay_servers = FluidRelayServersOperations( |
62 | | - self._client, self._config, self._serialize, self._deserialize) |
63 | 65 |
|
64 | | - def _send_request(self, http_request, **kwargs): |
65 | | - # type: (HttpRequest, Any) -> HttpResponse |
| 66 | + def _send_request( |
| 67 | + self, |
| 68 | + request: HttpRequest, |
| 69 | + **kwargs: Any |
| 70 | + ) -> HttpResponse: |
66 | 71 | """Runs the network request through the client's chained policies. |
67 | 72 |
|
68 | | - :param http_request: The network request you want to make. Required. |
69 | | - :type http_request: ~azure.core.pipeline.transport.HttpRequest |
70 | | - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. |
| 73 | + >>> from azure.core.rest import HttpRequest |
| 74 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 75 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 76 | + >>> response = client._send_request(request) |
| 77 | + <HttpResponse: 200 OK> |
| 78 | +
|
| 79 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 80 | +
|
| 81 | + :param request: The network request you want to make. Required. |
| 82 | + :type request: ~azure.core.rest.HttpRequest |
| 83 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
71 | 84 | :return: The response of your network call. Does not do error handling on your response. |
72 | | - :rtype: ~azure.core.pipeline.transport.HttpResponse |
| 85 | + :rtype: ~azure.core.rest.HttpResponse |
73 | 86 | """ |
74 | | - path_format_arguments = { |
75 | | - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), |
76 | | - } |
77 | | - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) |
78 | | - stream = kwargs.pop("stream", True) |
79 | | - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) |
80 | | - return pipeline_response.http_response |
| 87 | + |
| 88 | + request_copy = deepcopy(request) |
| 89 | + request_copy.url = self._client.format_url(request_copy.url) |
| 90 | + return self._client.send_request(request_copy, **kwargs) |
81 | 91 |
|
82 | 92 | def close(self): |
83 | 93 | # type: () -> None |
|
0 commit comments