|
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 AzureOrbitalConfiguration |
22 |
| -from .operations import Operations |
23 |
| -from .operations import SpacecraftsOperations |
24 |
| -from .operations import ContactsOperations |
25 |
| -from .operations import ContactProfilesOperations |
26 |
| -from .operations import AvailableGroundStationsOperations |
27 | 17 | from . import models
|
| 18 | +from ._configuration import AzureOrbitalConfiguration |
| 19 | +from .operations import AvailableGroundStationsOperations, ContactProfilesOperations, ContactsOperations, Operations, OperationsResultsOperations, SpacecraftsOperations |
28 | 20 |
|
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
29 | 24 |
|
30 |
| -class AzureOrbital(object): |
| 25 | +class AzureOrbital: |
31 | 26 | """Azure Orbital service.
|
32 | 27 |
|
33 | 28 | :ivar operations: Operations operations
|
34 |
| - :vartype operations: azure_orbital.operations.Operations |
| 29 | + :vartype operations: azure.mgmt.orbital.operations.Operations |
35 | 30 | :ivar spacecrafts: SpacecraftsOperations operations
|
36 |
| - :vartype spacecrafts: azure_orbital.operations.SpacecraftsOperations |
| 31 | + :vartype spacecrafts: azure.mgmt.orbital.operations.SpacecraftsOperations |
37 | 32 | :ivar contacts: ContactsOperations operations
|
38 |
| - :vartype contacts: azure_orbital.operations.ContactsOperations |
| 33 | + :vartype contacts: azure.mgmt.orbital.operations.ContactsOperations |
39 | 34 | :ivar contact_profiles: ContactProfilesOperations operations
|
40 |
| - :vartype contact_profiles: azure_orbital.operations.ContactProfilesOperations |
| 35 | + :vartype contact_profiles: azure.mgmt.orbital.operations.ContactProfilesOperations |
41 | 36 | :ivar available_ground_stations: AvailableGroundStationsOperations operations
|
42 |
| - :vartype available_ground_stations: azure_orbital.operations.AvailableGroundStationsOperations |
| 37 | + :vartype available_ground_stations: |
| 38 | + azure.mgmt.orbital.operations.AvailableGroundStationsOperations |
| 39 | + :ivar operations_results: OperationsResultsOperations operations |
| 40 | + :vartype operations_results: azure.mgmt.orbital.operations.OperationsResultsOperations |
43 | 41 | :param credential: Credential needed for the client to connect to Azure.
|
44 | 42 | :type credential: ~azure.core.credentials.TokenCredential
|
45 | 43 | :param subscription_id: The ID of the target subscription.
|
46 | 44 | :type subscription_id: str
|
47 |
| - :param str base_url: Service URL |
48 |
| - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. |
| 45 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 46 | + :type base_url: str |
| 47 | + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this |
| 48 | + default value may result in unsupported behavior. |
| 49 | + :paramtype api_version: str |
| 50 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 51 | + Retry-After header is present. |
49 | 52 | """
|
50 | 53 |
|
51 | 54 | def __init__(
|
52 | 55 | self,
|
53 |
| - credential, # type: "TokenCredential" |
54 |
| - subscription_id, # type: str |
55 |
| - base_url=None, # type: Optional[str] |
56 |
| - **kwargs # type: Any |
57 |
| - ): |
58 |
| - # type: (...) -> None |
59 |
| - if not base_url: |
60 |
| - base_url = 'https://management.azure.com' |
61 |
| - self._config = AzureOrbitalConfiguration(credential, subscription_id, **kwargs) |
| 56 | + credential: "TokenCredential", |
| 57 | + subscription_id: str, |
| 58 | + base_url: str = "https://management.azure.com", |
| 59 | + **kwargs: Any |
| 60 | + ) -> None: |
| 61 | + self._config = AzureOrbitalConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
62 | 62 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
|
63 | 63 |
|
64 | 64 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
|
65 | 65 | self._serialize = Serializer(client_models)
|
66 |
| - self._serialize.client_side_validation = False |
67 | 66 | self._deserialize = Deserializer(client_models)
|
| 67 | + self._serialize.client_side_validation = False |
| 68 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 69 | + self.spacecrafts = SpacecraftsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 70 | + self.contacts = ContactsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 71 | + self.contact_profiles = ContactProfilesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 72 | + self.available_ground_stations = AvailableGroundStationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 73 | + self.operations_results = OperationsResultsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 74 | + |
68 | 75 |
|
69 |
| - self.operations = Operations( |
70 |
| - self._client, self._config, self._serialize, self._deserialize) |
71 |
| - self.spacecrafts = SpacecraftsOperations( |
72 |
| - self._client, self._config, self._serialize, self._deserialize) |
73 |
| - self.contacts = ContactsOperations( |
74 |
| - self._client, self._config, self._serialize, self._deserialize) |
75 |
| - self.contact_profiles = ContactProfilesOperations( |
76 |
| - self._client, self._config, self._serialize, self._deserialize) |
77 |
| - self.available_ground_stations = AvailableGroundStationsOperations( |
78 |
| - self._client, self._config, self._serialize, self._deserialize) |
79 |
| - |
80 |
| - def _send_request(self, http_request, **kwargs): |
81 |
| - # type: (HttpRequest, Any) -> HttpResponse |
| 76 | + def _send_request( |
| 77 | + self, |
| 78 | + request: HttpRequest, |
| 79 | + **kwargs: Any |
| 80 | + ) -> HttpResponse: |
82 | 81 | """Runs the network request through the client's chained policies.
|
83 | 82 |
|
84 |
| - :param http_request: The network request you want to make. Required. |
85 |
| - :type http_request: ~azure.core.pipeline.transport.HttpRequest |
86 |
| - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. |
| 83 | + >>> from azure.core.rest import HttpRequest |
| 84 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 85 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 86 | + >>> response = client._send_request(request) |
| 87 | + <HttpResponse: 200 OK> |
| 88 | +
|
| 89 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 90 | +
|
| 91 | + :param request: The network request you want to make. Required. |
| 92 | + :type request: ~azure.core.rest.HttpRequest |
| 93 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
87 | 94 | :return: The response of your network call. Does not do error handling on your response.
|
88 |
| - :rtype: ~azure.core.pipeline.transport.HttpResponse |
| 95 | + :rtype: ~azure.core.rest.HttpResponse |
89 | 96 | """
|
90 |
| - path_format_arguments = { |
91 |
| - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), |
92 |
| - } |
93 |
| - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) |
94 |
| - stream = kwargs.pop("stream", True) |
95 |
| - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) |
96 |
| - return pipeline_response.http_response |
| 97 | + |
| 98 | + request_copy = deepcopy(request) |
| 99 | + request_copy.url = self._client.format_url(request_copy.url) |
| 100 | + return self._client.send_request(request_copy, **kwargs) |
97 | 101 |
|
98 | 102 | def close(self):
|
99 | 103 | # type: () -> None
|
|
0 commit comments