|
6 | 6 | # Changes may cause incorrect behavior and will be lost if the code is regenerated. |
7 | 7 | # -------------------------------------------------------------------------- |
8 | 8 |
|
| 9 | +from copy import deepcopy |
9 | 10 | from typing import TYPE_CHECKING |
10 | 11 |
|
11 | 12 | from azure.mgmt.core import ARMPipelineClient |
12 | 13 | from msrest import Deserializer, Serializer |
13 | 14 |
|
| 15 | +from . import models |
| 16 | +from ._configuration import ApplicationInsightsManagementClientConfiguration |
| 17 | +from .operations import APIKeysOperations, AnalyticsItemsOperations, AnnotationsOperations, ComponentAvailableFeaturesOperations, ComponentCurrentBillingFeaturesOperations, ComponentFeatureCapabilitiesOperations, ComponentQuotaStatusOperations, ComponentsOperations, ExportConfigurationsOperations, FavoritesOperations, MyWorkbooksOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestLocationsOperations, WebTestsOperations, WorkItemConfigurationsOperations, WorkbooksOperations |
| 18 | + |
14 | 19 | if TYPE_CHECKING: |
15 | 20 | # pylint: disable=unused-import,ungrouped-imports |
16 | 21 | from typing import Any, Optional |
17 | 22 |
|
18 | 23 | from azure.core.credentials import TokenCredential |
19 | | - from azure.core.pipeline.transport import HttpRequest, HttpResponse |
20 | | - |
21 | | -from ._configuration import ApplicationInsightsManagementClientConfiguration |
22 | | -from .operations import Operations |
23 | | -from .operations import AnnotationsOperations |
24 | | -from .operations import APIKeysOperations |
25 | | -from .operations import ExportConfigurationsOperations |
26 | | -from .operations import ComponentCurrentBillingFeaturesOperations |
27 | | -from .operations import ComponentQuotaStatusOperations |
28 | | -from .operations import ComponentFeatureCapabilitiesOperations |
29 | | -from .operations import ComponentAvailableFeaturesOperations |
30 | | -from .operations import ProactiveDetectionConfigurationsOperations |
31 | | -from .operations import ComponentsOperations |
32 | | -from .operations import WorkItemConfigurationsOperations |
33 | | -from .operations import FavoritesOperations |
34 | | -from .operations import WebTestLocationsOperations |
35 | | -from .operations import WebTestsOperations |
36 | | -from .operations import AnalyticsItemsOperations |
37 | | -from .operations import WorkbooksOperations |
38 | | -from .operations import MyWorkbooksOperations |
39 | | -from . import models |
40 | | - |
| 24 | + from azure.core.rest import HttpRequest, HttpResponse |
41 | 25 |
|
42 | 26 | class ApplicationInsightsManagementClient(object): |
43 | 27 | """Composite Swagger for Application Insights Management Client. |
44 | 28 |
|
45 | 29 | :ivar operations: Operations operations |
46 | 30 | :vartype operations: azure.mgmt.applicationinsights.v2015_05_01.operations.Operations |
47 | 31 | :ivar annotations: AnnotationsOperations operations |
48 | | - :vartype annotations: azure.mgmt.applicationinsights.v2015_05_01.operations.AnnotationsOperations |
| 32 | + :vartype annotations: |
| 33 | + azure.mgmt.applicationinsights.v2015_05_01.operations.AnnotationsOperations |
49 | 34 | :ivar api_keys: APIKeysOperations operations |
50 | 35 | :vartype api_keys: azure.mgmt.applicationinsights.v2015_05_01.operations.APIKeysOperations |
51 | 36 | :ivar export_configurations: ExportConfigurationsOperations operations |
52 | | - :vartype export_configurations: azure.mgmt.applicationinsights.v2015_05_01.operations.ExportConfigurationsOperations |
| 37 | + :vartype export_configurations: |
| 38 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ExportConfigurationsOperations |
53 | 39 | :ivar component_current_billing_features: ComponentCurrentBillingFeaturesOperations operations |
54 | | - :vartype component_current_billing_features: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentCurrentBillingFeaturesOperations |
| 40 | + :vartype component_current_billing_features: |
| 41 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentCurrentBillingFeaturesOperations |
55 | 42 | :ivar component_quota_status: ComponentQuotaStatusOperations operations |
56 | | - :vartype component_quota_status: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentQuotaStatusOperations |
| 43 | + :vartype component_quota_status: |
| 44 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentQuotaStatusOperations |
57 | 45 | :ivar component_feature_capabilities: ComponentFeatureCapabilitiesOperations operations |
58 | | - :vartype component_feature_capabilities: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentFeatureCapabilitiesOperations |
| 46 | + :vartype component_feature_capabilities: |
| 47 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentFeatureCapabilitiesOperations |
59 | 48 | :ivar component_available_features: ComponentAvailableFeaturesOperations operations |
60 | | - :vartype component_available_features: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentAvailableFeaturesOperations |
| 49 | + :vartype component_available_features: |
| 50 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentAvailableFeaturesOperations |
61 | 51 | :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations |
62 | | - :vartype proactive_detection_configurations: azure.mgmt.applicationinsights.v2015_05_01.operations.ProactiveDetectionConfigurationsOperations |
| 52 | + :vartype proactive_detection_configurations: |
| 53 | + azure.mgmt.applicationinsights.v2015_05_01.operations.ProactiveDetectionConfigurationsOperations |
63 | 54 | :ivar components: ComponentsOperations operations |
64 | 55 | :vartype components: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentsOperations |
65 | 56 | :ivar work_item_configurations: WorkItemConfigurationsOperations operations |
66 | | - :vartype work_item_configurations: azure.mgmt.applicationinsights.v2015_05_01.operations.WorkItemConfigurationsOperations |
| 57 | + :vartype work_item_configurations: |
| 58 | + azure.mgmt.applicationinsights.v2015_05_01.operations.WorkItemConfigurationsOperations |
67 | 59 | :ivar favorites: FavoritesOperations operations |
68 | 60 | :vartype favorites: azure.mgmt.applicationinsights.v2015_05_01.operations.FavoritesOperations |
69 | 61 | :ivar web_test_locations: WebTestLocationsOperations operations |
70 | | - :vartype web_test_locations: azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestLocationsOperations |
| 62 | + :vartype web_test_locations: |
| 63 | + azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestLocationsOperations |
71 | 64 | :ivar web_tests: WebTestsOperations operations |
72 | 65 | :vartype web_tests: azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestsOperations |
73 | 66 | :ivar analytics_items: AnalyticsItemsOperations operations |
74 | | - :vartype analytics_items: azure.mgmt.applicationinsights.v2015_05_01.operations.AnalyticsItemsOperations |
| 67 | + :vartype analytics_items: |
| 68 | + azure.mgmt.applicationinsights.v2015_05_01.operations.AnalyticsItemsOperations |
75 | 69 | :ivar workbooks: WorkbooksOperations operations |
76 | 70 | :vartype workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.WorkbooksOperations |
77 | 71 | :ivar my_workbooks: MyWorkbooksOperations operations |
78 | | - :vartype my_workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations |
| 72 | + :vartype my_workbooks: |
| 73 | + azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations |
79 | 74 | :param credential: Credential needed for the client to connect to Azure. |
80 | 75 | :type credential: ~azure.core.credentials.TokenCredential |
81 | 76 | :param subscription_id: The ID of the target subscription. |
82 | 77 | :type subscription_id: str |
83 | | - :param str base_url: Service URL |
| 78 | + :param base_url: Service URL. Default value is 'https://management.azure.com'. |
| 79 | + :type base_url: str |
84 | 80 | """ |
85 | 81 |
|
86 | 82 | def __init__( |
87 | 83 | self, |
88 | 84 | credential, # type: "TokenCredential" |
89 | 85 | subscription_id, # type: str |
90 | | - base_url=None, # type: Optional[str] |
| 86 | + base_url="https://management.azure.com", # type: str |
91 | 87 | **kwargs # type: Any |
92 | 88 | ): |
93 | 89 | # type: (...) -> None |
94 | | - if not base_url: |
95 | | - base_url = 'https://management.azure.com' |
96 | | - self._config = ApplicationInsightsManagementClientConfiguration(credential, subscription_id, **kwargs) |
| 90 | + self._config = ApplicationInsightsManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
97 | 91 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
98 | 92 |
|
99 | 93 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
100 | 94 | self._serialize = Serializer(client_models) |
101 | | - self._serialize.client_side_validation = False |
102 | 95 | self._deserialize = Deserializer(client_models) |
103 | | - |
104 | | - self.operations = Operations( |
105 | | - self._client, self._config, self._serialize, self._deserialize) |
106 | | - self.annotations = AnnotationsOperations( |
107 | | - self._client, self._config, self._serialize, self._deserialize) |
108 | | - self.api_keys = APIKeysOperations( |
109 | | - self._client, self._config, self._serialize, self._deserialize) |
110 | | - self.export_configurations = ExportConfigurationsOperations( |
111 | | - self._client, self._config, self._serialize, self._deserialize) |
112 | | - self.component_current_billing_features = ComponentCurrentBillingFeaturesOperations( |
113 | | - self._client, self._config, self._serialize, self._deserialize) |
114 | | - self.component_quota_status = ComponentQuotaStatusOperations( |
115 | | - self._client, self._config, self._serialize, self._deserialize) |
116 | | - self.component_feature_capabilities = ComponentFeatureCapabilitiesOperations( |
117 | | - self._client, self._config, self._serialize, self._deserialize) |
118 | | - self.component_available_features = ComponentAvailableFeaturesOperations( |
119 | | - self._client, self._config, self._serialize, self._deserialize) |
120 | | - self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( |
121 | | - self._client, self._config, self._serialize, self._deserialize) |
122 | | - self.components = ComponentsOperations( |
123 | | - self._client, self._config, self._serialize, self._deserialize) |
124 | | - self.work_item_configurations = WorkItemConfigurationsOperations( |
125 | | - self._client, self._config, self._serialize, self._deserialize) |
126 | | - self.favorites = FavoritesOperations( |
127 | | - self._client, self._config, self._serialize, self._deserialize) |
128 | | - self.web_test_locations = WebTestLocationsOperations( |
129 | | - self._client, self._config, self._serialize, self._deserialize) |
130 | | - self.web_tests = WebTestsOperations( |
131 | | - self._client, self._config, self._serialize, self._deserialize) |
132 | | - self.analytics_items = AnalyticsItemsOperations( |
133 | | - self._client, self._config, self._serialize, self._deserialize) |
134 | | - self.workbooks = WorkbooksOperations( |
135 | | - self._client, self._config, self._serialize, self._deserialize) |
136 | | - self.my_workbooks = MyWorkbooksOperations( |
137 | | - self._client, self._config, self._serialize, self._deserialize) |
138 | | - |
139 | | - def _send_request(self, http_request, **kwargs): |
140 | | - # type: (HttpRequest, Any) -> HttpResponse |
| 96 | + self._serialize.client_side_validation = False |
| 97 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 98 | + self.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 99 | + self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) |
| 100 | + self.export_configurations = ExportConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 101 | + self.component_current_billing_features = ComponentCurrentBillingFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 102 | + self.component_quota_status = ComponentQuotaStatusOperations(self._client, self._config, self._serialize, self._deserialize) |
| 103 | + self.component_feature_capabilities = ComponentFeatureCapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 104 | + self.component_available_features = ComponentAvailableFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 105 | + self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 106 | + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 107 | + self.work_item_configurations = WorkItemConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 108 | + self.favorites = FavoritesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 109 | + self.web_test_locations = WebTestLocationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 110 | + self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 111 | + self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 112 | + self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) |
| 113 | + self.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) |
| 114 | + |
| 115 | + |
| 116 | + def _send_request( |
| 117 | + self, |
| 118 | + request, # type: HttpRequest |
| 119 | + **kwargs # type: Any |
| 120 | + ): |
| 121 | + # type: (...) -> HttpResponse |
141 | 122 | """Runs the network request through the client's chained policies. |
142 | 123 |
|
143 | | - :param http_request: The network request you want to make. Required. |
144 | | - :type http_request: ~azure.core.pipeline.transport.HttpRequest |
145 | | - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. |
| 124 | + >>> from azure.core.rest import HttpRequest |
| 125 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 126 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 127 | + >>> response = client._send_request(request) |
| 128 | + <HttpResponse: 200 OK> |
| 129 | +
|
| 130 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 131 | +
|
| 132 | + :param request: The network request you want to make. Required. |
| 133 | + :type request: ~azure.core.rest.HttpRequest |
| 134 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
146 | 135 | :return: The response of your network call. Does not do error handling on your response. |
147 | | - :rtype: ~azure.core.pipeline.transport.HttpResponse |
| 136 | + :rtype: ~azure.core.rest.HttpResponse |
148 | 137 | """ |
149 | | - path_format_arguments = { |
150 | | - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), |
151 | | - } |
152 | | - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) |
153 | | - stream = kwargs.pop("stream", True) |
154 | | - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) |
155 | | - return pipeline_response.http_response |
| 138 | + |
| 139 | + request_copy = deepcopy(request) |
| 140 | + request_copy.url = self._client.format_url(request_copy.url) |
| 141 | + return self._client.send_request(request_copy, **kwargs) |
156 | 142 |
|
157 | 143 | def close(self): |
158 | 144 | # type: () -> None |
|
0 commit comments