azure-mgmt-networkfunction 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/mgmt/networkfunction/__init__.py +32 -0
- azure/mgmt/networkfunction/_client.py +172 -0
- azure/mgmt/networkfunction/_configuration.py +80 -0
- azure/mgmt/networkfunction/_patch.py +21 -0
- azure/mgmt/networkfunction/_utils/__init__.py +6 -0
- azure/mgmt/networkfunction/_utils/model_base.py +1770 -0
- azure/mgmt/networkfunction/_utils/serialization.py +2175 -0
- azure/mgmt/networkfunction/_version.py +9 -0
- azure/mgmt/networkfunction/aio/__init__.py +29 -0
- azure/mgmt/networkfunction/aio/_client.py +177 -0
- azure/mgmt/networkfunction/aio/_configuration.py +80 -0
- azure/mgmt/networkfunction/aio/_patch.py +21 -0
- azure/mgmt/networkfunction/aio/operations/__init__.py +33 -0
- azure/mgmt/networkfunction/aio/operations/_operations.py +1780 -0
- azure/mgmt/networkfunction/aio/operations/_patch.py +21 -0
- azure/mgmt/networkfunction/models/__init__.py +74 -0
- azure/mgmt/networkfunction/models/_enums.py +64 -0
- azure/mgmt/networkfunction/models/_models.py +718 -0
- azure/mgmt/networkfunction/models/_patch.py +21 -0
- azure/mgmt/networkfunction/operations/__init__.py +33 -0
- azure/mgmt/networkfunction/operations/_operations.py +2123 -0
- azure/mgmt/networkfunction/operations/_patch.py +21 -0
- azure/mgmt/networkfunction/py.typed +1 -0
- azure_mgmt_networkfunction-1.0.0.dist-info/METADATA +126 -0
- azure_mgmt_networkfunction-1.0.0.dist-info/RECORD +28 -0
- azure_mgmt_networkfunction-1.0.0.dist-info/WHEEL +5 -0
- azure_mgmt_networkfunction-1.0.0.dist-info/licenses/LICENSE +21 -0
- azure_mgmt_networkfunction-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2123 @@
|
|
|
1
|
+
# pylint: disable=line-too-long,useless-suppression,too-many-lines
|
|
2
|
+
# coding=utf-8
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
7
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
|
+
# --------------------------------------------------------------------------
|
|
9
|
+
from collections.abc import MutableMapping
|
|
10
|
+
from io import IOBase
|
|
11
|
+
import json
|
|
12
|
+
from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload
|
|
13
|
+
import urllib.parse
|
|
14
|
+
|
|
15
|
+
from azure.core import PipelineClient
|
|
16
|
+
from azure.core.exceptions import (
|
|
17
|
+
ClientAuthenticationError,
|
|
18
|
+
HttpResponseError,
|
|
19
|
+
ResourceExistsError,
|
|
20
|
+
ResourceNotFoundError,
|
|
21
|
+
ResourceNotModifiedError,
|
|
22
|
+
StreamClosedError,
|
|
23
|
+
StreamConsumedError,
|
|
24
|
+
map_error,
|
|
25
|
+
)
|
|
26
|
+
from azure.core.paging import ItemPaged
|
|
27
|
+
from azure.core.pipeline import PipelineResponse
|
|
28
|
+
from azure.core.polling import LROPoller, NoPolling, PollingMethod
|
|
29
|
+
from azure.core.rest import HttpRequest, HttpResponse
|
|
30
|
+
from azure.core.tracing.decorator import distributed_trace
|
|
31
|
+
from azure.core.utils import case_insensitive_dict
|
|
32
|
+
from azure.mgmt.core.exceptions import ARMErrorFormat
|
|
33
|
+
from azure.mgmt.core.polling.arm_polling import ARMPolling
|
|
34
|
+
|
|
35
|
+
from .. import models as _models
|
|
36
|
+
from .._configuration import TrafficCollectorMgmtClientConfiguration
|
|
37
|
+
from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
|
|
38
|
+
from .._utils.serialization import Deserializer, Serializer
|
|
39
|
+
|
|
40
|
+
JSON = MutableMapping[str, Any]
|
|
41
|
+
T = TypeVar("T")
|
|
42
|
+
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]]
|
|
43
|
+
List = list
|
|
44
|
+
|
|
45
|
+
_SERIALIZER = Serializer()
|
|
46
|
+
_SERIALIZER.client_side_validation = False
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def build_azure_traffic_collectors_get_request( # pylint: disable=name-too-long
|
|
50
|
+
resource_group_name: str, azure_traffic_collector_name: str, subscription_id: str, **kwargs: Any
|
|
51
|
+
) -> HttpRequest:
|
|
52
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
53
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
54
|
+
|
|
55
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
56
|
+
accept = _headers.pop("Accept", "application/json")
|
|
57
|
+
|
|
58
|
+
# Construct URL
|
|
59
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}"
|
|
60
|
+
path_format_arguments = {
|
|
61
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
62
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
63
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
64
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
65
|
+
),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
69
|
+
|
|
70
|
+
# Construct parameters
|
|
71
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
72
|
+
|
|
73
|
+
# Construct headers
|
|
74
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
75
|
+
|
|
76
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def build_azure_traffic_collectors_create_or_update_request( # pylint: disable=name-too-long
|
|
80
|
+
resource_group_name: str, azure_traffic_collector_name: str, subscription_id: str, **kwargs: Any
|
|
81
|
+
) -> HttpRequest:
|
|
82
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
83
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
84
|
+
|
|
85
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
86
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
87
|
+
accept = _headers.pop("Accept", "application/json")
|
|
88
|
+
|
|
89
|
+
# Construct URL
|
|
90
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}"
|
|
91
|
+
path_format_arguments = {
|
|
92
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
93
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
94
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
95
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
100
|
+
|
|
101
|
+
# Construct parameters
|
|
102
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
103
|
+
|
|
104
|
+
# Construct headers
|
|
105
|
+
if content_type is not None:
|
|
106
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
107
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
108
|
+
|
|
109
|
+
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def build_azure_traffic_collectors_update_tags_request( # pylint: disable=name-too-long
|
|
113
|
+
resource_group_name: str, azure_traffic_collector_name: str, subscription_id: str, **kwargs: Any
|
|
114
|
+
) -> HttpRequest:
|
|
115
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
116
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
117
|
+
|
|
118
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
119
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
120
|
+
accept = _headers.pop("Accept", "application/json")
|
|
121
|
+
|
|
122
|
+
# Construct URL
|
|
123
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}"
|
|
124
|
+
path_format_arguments = {
|
|
125
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
126
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
127
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
128
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
129
|
+
),
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
133
|
+
|
|
134
|
+
# Construct parameters
|
|
135
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
136
|
+
|
|
137
|
+
# Construct headers
|
|
138
|
+
if content_type is not None:
|
|
139
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
140
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
141
|
+
|
|
142
|
+
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def build_azure_traffic_collectors_delete_request( # pylint: disable=name-too-long
|
|
146
|
+
resource_group_name: str, azure_traffic_collector_name: str, subscription_id: str, **kwargs: Any
|
|
147
|
+
) -> HttpRequest:
|
|
148
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
149
|
+
|
|
150
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
151
|
+
# Construct URL
|
|
152
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}"
|
|
153
|
+
path_format_arguments = {
|
|
154
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
155
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
156
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
157
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
158
|
+
),
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
162
|
+
|
|
163
|
+
# Construct parameters
|
|
164
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
165
|
+
|
|
166
|
+
return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def build_collector_policies_get_request(
|
|
170
|
+
resource_group_name: str,
|
|
171
|
+
azure_traffic_collector_name: str,
|
|
172
|
+
collector_policy_name: str,
|
|
173
|
+
subscription_id: str,
|
|
174
|
+
**kwargs: Any
|
|
175
|
+
) -> HttpRequest:
|
|
176
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
177
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
178
|
+
|
|
179
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
180
|
+
accept = _headers.pop("Accept", "application/json")
|
|
181
|
+
|
|
182
|
+
# Construct URL
|
|
183
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}"
|
|
184
|
+
path_format_arguments = {
|
|
185
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
186
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
187
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
188
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
189
|
+
),
|
|
190
|
+
"collectorPolicyName": _SERIALIZER.url("collector_policy_name", collector_policy_name, "str"),
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
194
|
+
|
|
195
|
+
# Construct parameters
|
|
196
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
197
|
+
|
|
198
|
+
# Construct headers
|
|
199
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
200
|
+
|
|
201
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def build_collector_policies_create_or_update_request( # pylint: disable=name-too-long
|
|
205
|
+
resource_group_name: str,
|
|
206
|
+
azure_traffic_collector_name: str,
|
|
207
|
+
collector_policy_name: str,
|
|
208
|
+
subscription_id: str,
|
|
209
|
+
**kwargs: Any
|
|
210
|
+
) -> HttpRequest:
|
|
211
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
212
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
213
|
+
|
|
214
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
215
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
216
|
+
accept = _headers.pop("Accept", "application/json")
|
|
217
|
+
|
|
218
|
+
# Construct URL
|
|
219
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}"
|
|
220
|
+
path_format_arguments = {
|
|
221
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
222
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
223
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
224
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
225
|
+
),
|
|
226
|
+
"collectorPolicyName": _SERIALIZER.url("collector_policy_name", collector_policy_name, "str"),
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
230
|
+
|
|
231
|
+
# Construct parameters
|
|
232
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
233
|
+
|
|
234
|
+
# Construct headers
|
|
235
|
+
if content_type is not None:
|
|
236
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
237
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
238
|
+
|
|
239
|
+
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def build_collector_policies_update_tags_request( # pylint: disable=name-too-long
|
|
243
|
+
resource_group_name: str,
|
|
244
|
+
azure_traffic_collector_name: str,
|
|
245
|
+
collector_policy_name: str,
|
|
246
|
+
subscription_id: str,
|
|
247
|
+
**kwargs: Any
|
|
248
|
+
) -> HttpRequest:
|
|
249
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
250
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
251
|
+
|
|
252
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
253
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
254
|
+
accept = _headers.pop("Accept", "application/json")
|
|
255
|
+
|
|
256
|
+
# Construct URL
|
|
257
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}"
|
|
258
|
+
path_format_arguments = {
|
|
259
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
260
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
261
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
262
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
263
|
+
),
|
|
264
|
+
"collectorPolicyName": _SERIALIZER.url("collector_policy_name", collector_policy_name, "str"),
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
268
|
+
|
|
269
|
+
# Construct parameters
|
|
270
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
271
|
+
|
|
272
|
+
# Construct headers
|
|
273
|
+
if content_type is not None:
|
|
274
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
275
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
276
|
+
|
|
277
|
+
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def build_collector_policies_delete_request(
|
|
281
|
+
resource_group_name: str,
|
|
282
|
+
azure_traffic_collector_name: str,
|
|
283
|
+
collector_policy_name: str,
|
|
284
|
+
subscription_id: str,
|
|
285
|
+
**kwargs: Any
|
|
286
|
+
) -> HttpRequest:
|
|
287
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
288
|
+
|
|
289
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
290
|
+
# Construct URL
|
|
291
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}"
|
|
292
|
+
path_format_arguments = {
|
|
293
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
294
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
295
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
296
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
297
|
+
),
|
|
298
|
+
"collectorPolicyName": _SERIALIZER.url("collector_policy_name", collector_policy_name, "str"),
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
302
|
+
|
|
303
|
+
# Construct parameters
|
|
304
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
305
|
+
|
|
306
|
+
return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def build_collector_policies_list_request(
|
|
310
|
+
resource_group_name: str, azure_traffic_collector_name: str, subscription_id: str, **kwargs: Any
|
|
311
|
+
) -> HttpRequest:
|
|
312
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
313
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
314
|
+
|
|
315
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
316
|
+
accept = _headers.pop("Accept", "application/json")
|
|
317
|
+
|
|
318
|
+
# Construct URL
|
|
319
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies"
|
|
320
|
+
path_format_arguments = {
|
|
321
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
322
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
323
|
+
"azureTrafficCollectorName": _SERIALIZER.url(
|
|
324
|
+
"azure_traffic_collector_name", azure_traffic_collector_name, "str"
|
|
325
|
+
),
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
329
|
+
|
|
330
|
+
# Construct parameters
|
|
331
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
332
|
+
|
|
333
|
+
# Construct headers
|
|
334
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
335
|
+
|
|
336
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def build_network_function_list_operations_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
|
|
340
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
341
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
342
|
+
|
|
343
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
344
|
+
accept = _headers.pop("Accept", "application/json")
|
|
345
|
+
|
|
346
|
+
# Construct URL
|
|
347
|
+
_url = "/providers/Microsoft.NetworkFunction/operations"
|
|
348
|
+
|
|
349
|
+
# Construct parameters
|
|
350
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
351
|
+
|
|
352
|
+
# Construct headers
|
|
353
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
354
|
+
|
|
355
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def build_azure_traffic_collectors_by_resource_group_list_request( # pylint: disable=name-too-long
|
|
359
|
+
resource_group_name: str, subscription_id: str, **kwargs: Any
|
|
360
|
+
) -> HttpRequest:
|
|
361
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
362
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
363
|
+
|
|
364
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
365
|
+
accept = _headers.pop("Accept", "application/json")
|
|
366
|
+
|
|
367
|
+
# Construct URL
|
|
368
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors"
|
|
369
|
+
path_format_arguments = {
|
|
370
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
371
|
+
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
375
|
+
|
|
376
|
+
# Construct parameters
|
|
377
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
378
|
+
|
|
379
|
+
# Construct headers
|
|
380
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
381
|
+
|
|
382
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def build_azure_traffic_collectors_by_subscription_list_request( # pylint: disable=name-too-long
|
|
386
|
+
subscription_id: str, **kwargs: Any
|
|
387
|
+
) -> HttpRequest:
|
|
388
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
389
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
390
|
+
|
|
391
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01"))
|
|
392
|
+
accept = _headers.pop("Accept", "application/json")
|
|
393
|
+
|
|
394
|
+
# Construct URL
|
|
395
|
+
_url = "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors"
|
|
396
|
+
path_format_arguments = {
|
|
397
|
+
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
401
|
+
|
|
402
|
+
# Construct parameters
|
|
403
|
+
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
404
|
+
|
|
405
|
+
# Construct headers
|
|
406
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
407
|
+
|
|
408
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class AzureTrafficCollectorsOperations:
|
|
412
|
+
"""
|
|
413
|
+
.. warning::
|
|
414
|
+
**DO NOT** instantiate this class directly.
|
|
415
|
+
|
|
416
|
+
Instead, you should access the following operations through
|
|
417
|
+
:class:`~azure.mgmt.networkfunction.TrafficCollectorMgmtClient`'s
|
|
418
|
+
:attr:`azure_traffic_collectors` attribute.
|
|
419
|
+
"""
|
|
420
|
+
|
|
421
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
422
|
+
input_args = list(args)
|
|
423
|
+
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
424
|
+
self._config: TrafficCollectorMgmtClientConfiguration = (
|
|
425
|
+
input_args.pop(0) if input_args else kwargs.pop("config")
|
|
426
|
+
)
|
|
427
|
+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
428
|
+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
429
|
+
|
|
430
|
+
@distributed_trace
|
|
431
|
+
def get(
|
|
432
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, **kwargs: Any
|
|
433
|
+
) -> _models.AzureTrafficCollector:
|
|
434
|
+
"""Gets the specified Azure Traffic Collector in a specified resource group.
|
|
435
|
+
|
|
436
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
437
|
+
Required.
|
|
438
|
+
:type resource_group_name: str
|
|
439
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
440
|
+
:type azure_traffic_collector_name: str
|
|
441
|
+
:return: AzureTrafficCollector. The AzureTrafficCollector is compatible with MutableMapping
|
|
442
|
+
:rtype: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
443
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
444
|
+
"""
|
|
445
|
+
error_map: MutableMapping = {
|
|
446
|
+
401: ClientAuthenticationError,
|
|
447
|
+
404: ResourceNotFoundError,
|
|
448
|
+
409: ResourceExistsError,
|
|
449
|
+
304: ResourceNotModifiedError,
|
|
450
|
+
}
|
|
451
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
452
|
+
|
|
453
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
454
|
+
_params = kwargs.pop("params", {}) or {}
|
|
455
|
+
|
|
456
|
+
cls: ClsType[_models.AzureTrafficCollector] = kwargs.pop("cls", None)
|
|
457
|
+
|
|
458
|
+
_request = build_azure_traffic_collectors_get_request(
|
|
459
|
+
resource_group_name=resource_group_name,
|
|
460
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
461
|
+
subscription_id=self._config.subscription_id,
|
|
462
|
+
api_version=self._config.api_version,
|
|
463
|
+
headers=_headers,
|
|
464
|
+
params=_params,
|
|
465
|
+
)
|
|
466
|
+
path_format_arguments = {
|
|
467
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
468
|
+
}
|
|
469
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
470
|
+
|
|
471
|
+
_decompress = kwargs.pop("decompress", True)
|
|
472
|
+
_stream = kwargs.pop("stream", False)
|
|
473
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
474
|
+
_request, stream=_stream, **kwargs
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
response = pipeline_response.http_response
|
|
478
|
+
|
|
479
|
+
if response.status_code not in [200]:
|
|
480
|
+
if _stream:
|
|
481
|
+
try:
|
|
482
|
+
response.read() # Load the body in memory and close the socket
|
|
483
|
+
except (StreamConsumedError, StreamClosedError):
|
|
484
|
+
pass
|
|
485
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
486
|
+
error = _failsafe_deserialize(
|
|
487
|
+
_models.CloudError,
|
|
488
|
+
response,
|
|
489
|
+
)
|
|
490
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
491
|
+
|
|
492
|
+
if _stream:
|
|
493
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
494
|
+
else:
|
|
495
|
+
deserialized = _deserialize(_models.AzureTrafficCollector, response.json())
|
|
496
|
+
|
|
497
|
+
if cls:
|
|
498
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
499
|
+
|
|
500
|
+
return deserialized # type: ignore
|
|
501
|
+
|
|
502
|
+
def _create_or_update_initial(
|
|
503
|
+
self,
|
|
504
|
+
resource_group_name: str,
|
|
505
|
+
azure_traffic_collector_name: str,
|
|
506
|
+
parameters: Union[_models.AzureTrafficCollector, JSON, IO[bytes]],
|
|
507
|
+
**kwargs: Any
|
|
508
|
+
) -> Iterator[bytes]:
|
|
509
|
+
error_map: MutableMapping = {
|
|
510
|
+
401: ClientAuthenticationError,
|
|
511
|
+
404: ResourceNotFoundError,
|
|
512
|
+
409: ResourceExistsError,
|
|
513
|
+
304: ResourceNotModifiedError,
|
|
514
|
+
}
|
|
515
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
516
|
+
|
|
517
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
518
|
+
_params = kwargs.pop("params", {}) or {}
|
|
519
|
+
|
|
520
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
521
|
+
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
|
522
|
+
|
|
523
|
+
content_type = content_type or "application/json"
|
|
524
|
+
_content = None
|
|
525
|
+
if isinstance(parameters, (IOBase, bytes)):
|
|
526
|
+
_content = parameters
|
|
527
|
+
else:
|
|
528
|
+
_content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
529
|
+
|
|
530
|
+
_request = build_azure_traffic_collectors_create_or_update_request(
|
|
531
|
+
resource_group_name=resource_group_name,
|
|
532
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
533
|
+
subscription_id=self._config.subscription_id,
|
|
534
|
+
content_type=content_type,
|
|
535
|
+
api_version=self._config.api_version,
|
|
536
|
+
content=_content,
|
|
537
|
+
headers=_headers,
|
|
538
|
+
params=_params,
|
|
539
|
+
)
|
|
540
|
+
path_format_arguments = {
|
|
541
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
542
|
+
}
|
|
543
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
544
|
+
|
|
545
|
+
_decompress = kwargs.pop("decompress", True)
|
|
546
|
+
_stream = True
|
|
547
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
548
|
+
_request, stream=_stream, **kwargs
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
response = pipeline_response.http_response
|
|
552
|
+
|
|
553
|
+
if response.status_code not in [200, 201]:
|
|
554
|
+
try:
|
|
555
|
+
response.read() # Load the body in memory and close the socket
|
|
556
|
+
except (StreamConsumedError, StreamClosedError):
|
|
557
|
+
pass
|
|
558
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
559
|
+
error = _failsafe_deserialize(
|
|
560
|
+
_models.CloudError,
|
|
561
|
+
response,
|
|
562
|
+
)
|
|
563
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
564
|
+
|
|
565
|
+
response_headers = {}
|
|
566
|
+
if response.status_code == 201:
|
|
567
|
+
response_headers["Azure-AsyncOperation"] = self._deserialize(
|
|
568
|
+
"str", response.headers.get("Azure-AsyncOperation")
|
|
569
|
+
)
|
|
570
|
+
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
|
|
571
|
+
|
|
572
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
573
|
+
|
|
574
|
+
if cls:
|
|
575
|
+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
|
576
|
+
|
|
577
|
+
return deserialized # type: ignore
|
|
578
|
+
|
|
579
|
+
@overload
|
|
580
|
+
def begin_create_or_update(
|
|
581
|
+
self,
|
|
582
|
+
resource_group_name: str,
|
|
583
|
+
azure_traffic_collector_name: str,
|
|
584
|
+
parameters: _models.AzureTrafficCollector,
|
|
585
|
+
*,
|
|
586
|
+
content_type: str = "application/json",
|
|
587
|
+
**kwargs: Any
|
|
588
|
+
) -> LROPoller[_models.AzureTrafficCollector]:
|
|
589
|
+
"""Creates or updates a Azure Traffic Collector resource.
|
|
590
|
+
|
|
591
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
592
|
+
Required.
|
|
593
|
+
:type resource_group_name: str
|
|
594
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
595
|
+
:type azure_traffic_collector_name: str
|
|
596
|
+
:param parameters: The parameters to provide for the created Azure Traffic Collector. Required.
|
|
597
|
+
:type parameters: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
598
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
599
|
+
Default value is "application/json".
|
|
600
|
+
:paramtype content_type: str
|
|
601
|
+
:return: An instance of LROPoller that returns AzureTrafficCollector. The AzureTrafficCollector
|
|
602
|
+
is compatible with MutableMapping
|
|
603
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
604
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
605
|
+
"""
|
|
606
|
+
|
|
607
|
+
@overload
|
|
608
|
+
def begin_create_or_update(
|
|
609
|
+
self,
|
|
610
|
+
resource_group_name: str,
|
|
611
|
+
azure_traffic_collector_name: str,
|
|
612
|
+
parameters: JSON,
|
|
613
|
+
*,
|
|
614
|
+
content_type: str = "application/json",
|
|
615
|
+
**kwargs: Any
|
|
616
|
+
) -> LROPoller[_models.AzureTrafficCollector]:
|
|
617
|
+
"""Creates or updates a Azure Traffic Collector resource.
|
|
618
|
+
|
|
619
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
620
|
+
Required.
|
|
621
|
+
:type resource_group_name: str
|
|
622
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
623
|
+
:type azure_traffic_collector_name: str
|
|
624
|
+
:param parameters: The parameters to provide for the created Azure Traffic Collector. Required.
|
|
625
|
+
:type parameters: JSON
|
|
626
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
627
|
+
Default value is "application/json".
|
|
628
|
+
:paramtype content_type: str
|
|
629
|
+
:return: An instance of LROPoller that returns AzureTrafficCollector. The AzureTrafficCollector
|
|
630
|
+
is compatible with MutableMapping
|
|
631
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
632
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
633
|
+
"""
|
|
634
|
+
|
|
635
|
+
@overload
|
|
636
|
+
def begin_create_or_update(
|
|
637
|
+
self,
|
|
638
|
+
resource_group_name: str,
|
|
639
|
+
azure_traffic_collector_name: str,
|
|
640
|
+
parameters: IO[bytes],
|
|
641
|
+
*,
|
|
642
|
+
content_type: str = "application/json",
|
|
643
|
+
**kwargs: Any
|
|
644
|
+
) -> LROPoller[_models.AzureTrafficCollector]:
|
|
645
|
+
"""Creates or updates a Azure Traffic Collector resource.
|
|
646
|
+
|
|
647
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
648
|
+
Required.
|
|
649
|
+
:type resource_group_name: str
|
|
650
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
651
|
+
:type azure_traffic_collector_name: str
|
|
652
|
+
:param parameters: The parameters to provide for the created Azure Traffic Collector. Required.
|
|
653
|
+
:type parameters: IO[bytes]
|
|
654
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
655
|
+
Default value is "application/json".
|
|
656
|
+
:paramtype content_type: str
|
|
657
|
+
:return: An instance of LROPoller that returns AzureTrafficCollector. The AzureTrafficCollector
|
|
658
|
+
is compatible with MutableMapping
|
|
659
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
660
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
661
|
+
"""
|
|
662
|
+
|
|
663
|
+
@distributed_trace
|
|
664
|
+
def begin_create_or_update(
|
|
665
|
+
self,
|
|
666
|
+
resource_group_name: str,
|
|
667
|
+
azure_traffic_collector_name: str,
|
|
668
|
+
parameters: Union[_models.AzureTrafficCollector, JSON, IO[bytes]],
|
|
669
|
+
**kwargs: Any
|
|
670
|
+
) -> LROPoller[_models.AzureTrafficCollector]:
|
|
671
|
+
"""Creates or updates a Azure Traffic Collector resource.
|
|
672
|
+
|
|
673
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
674
|
+
Required.
|
|
675
|
+
:type resource_group_name: str
|
|
676
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
677
|
+
:type azure_traffic_collector_name: str
|
|
678
|
+
:param parameters: The parameters to provide for the created Azure Traffic Collector. Is one of
|
|
679
|
+
the following types: AzureTrafficCollector, JSON, IO[bytes] Required.
|
|
680
|
+
:type parameters: ~azure.mgmt.networkfunction.models.AzureTrafficCollector or JSON or IO[bytes]
|
|
681
|
+
:return: An instance of LROPoller that returns AzureTrafficCollector. The AzureTrafficCollector
|
|
682
|
+
is compatible with MutableMapping
|
|
683
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
684
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
685
|
+
"""
|
|
686
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
687
|
+
_params = kwargs.pop("params", {}) or {}
|
|
688
|
+
|
|
689
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
690
|
+
cls: ClsType[_models.AzureTrafficCollector] = kwargs.pop("cls", None)
|
|
691
|
+
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
|
692
|
+
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
|
693
|
+
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
|
694
|
+
if cont_token is None:
|
|
695
|
+
raw_result = self._create_or_update_initial(
|
|
696
|
+
resource_group_name=resource_group_name,
|
|
697
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
698
|
+
parameters=parameters,
|
|
699
|
+
content_type=content_type,
|
|
700
|
+
cls=lambda x, y, z: x,
|
|
701
|
+
headers=_headers,
|
|
702
|
+
params=_params,
|
|
703
|
+
**kwargs
|
|
704
|
+
)
|
|
705
|
+
raw_result.http_response.read() # type: ignore
|
|
706
|
+
kwargs.pop("error_map", None)
|
|
707
|
+
|
|
708
|
+
def get_long_running_output(pipeline_response):
|
|
709
|
+
response = pipeline_response.http_response
|
|
710
|
+
deserialized = _deserialize(_models.AzureTrafficCollector, response.json())
|
|
711
|
+
if cls:
|
|
712
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
713
|
+
return deserialized
|
|
714
|
+
|
|
715
|
+
path_format_arguments = {
|
|
716
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if polling is True:
|
|
720
|
+
polling_method: PollingMethod = cast(
|
|
721
|
+
PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
|
|
722
|
+
)
|
|
723
|
+
elif polling is False:
|
|
724
|
+
polling_method = cast(PollingMethod, NoPolling())
|
|
725
|
+
else:
|
|
726
|
+
polling_method = polling
|
|
727
|
+
if cont_token:
|
|
728
|
+
return LROPoller[_models.AzureTrafficCollector].from_continuation_token(
|
|
729
|
+
polling_method=polling_method,
|
|
730
|
+
continuation_token=cont_token,
|
|
731
|
+
client=self._client,
|
|
732
|
+
deserialization_callback=get_long_running_output,
|
|
733
|
+
)
|
|
734
|
+
return LROPoller[_models.AzureTrafficCollector](
|
|
735
|
+
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
|
736
|
+
)
|
|
737
|
+
|
|
738
|
+
@overload
|
|
739
|
+
def update_tags(
|
|
740
|
+
self,
|
|
741
|
+
resource_group_name: str,
|
|
742
|
+
azure_traffic_collector_name: str,
|
|
743
|
+
parameters: _models.TagsObject,
|
|
744
|
+
*,
|
|
745
|
+
content_type: str = "application/json",
|
|
746
|
+
**kwargs: Any
|
|
747
|
+
) -> _models.AzureTrafficCollector:
|
|
748
|
+
"""Updates the specified Azure Traffic Collector tags.
|
|
749
|
+
|
|
750
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
751
|
+
Required.
|
|
752
|
+
:type resource_group_name: str
|
|
753
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
754
|
+
:type azure_traffic_collector_name: str
|
|
755
|
+
:param parameters: Parameters supplied to update Azure Traffic Collector tags. Required.
|
|
756
|
+
:type parameters: ~azure.mgmt.networkfunction.models.TagsObject
|
|
757
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
758
|
+
Default value is "application/json".
|
|
759
|
+
:paramtype content_type: str
|
|
760
|
+
:return: AzureTrafficCollector. The AzureTrafficCollector is compatible with MutableMapping
|
|
761
|
+
:rtype: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
762
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
763
|
+
"""
|
|
764
|
+
|
|
765
|
+
@overload
|
|
766
|
+
def update_tags(
|
|
767
|
+
self,
|
|
768
|
+
resource_group_name: str,
|
|
769
|
+
azure_traffic_collector_name: str,
|
|
770
|
+
parameters: JSON,
|
|
771
|
+
*,
|
|
772
|
+
content_type: str = "application/json",
|
|
773
|
+
**kwargs: Any
|
|
774
|
+
) -> _models.AzureTrafficCollector:
|
|
775
|
+
"""Updates the specified Azure Traffic Collector tags.
|
|
776
|
+
|
|
777
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
778
|
+
Required.
|
|
779
|
+
:type resource_group_name: str
|
|
780
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
781
|
+
:type azure_traffic_collector_name: str
|
|
782
|
+
:param parameters: Parameters supplied to update Azure Traffic Collector tags. Required.
|
|
783
|
+
:type parameters: JSON
|
|
784
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
785
|
+
Default value is "application/json".
|
|
786
|
+
:paramtype content_type: str
|
|
787
|
+
:return: AzureTrafficCollector. The AzureTrafficCollector is compatible with MutableMapping
|
|
788
|
+
:rtype: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
789
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
790
|
+
"""
|
|
791
|
+
|
|
792
|
+
@overload
|
|
793
|
+
def update_tags(
|
|
794
|
+
self,
|
|
795
|
+
resource_group_name: str,
|
|
796
|
+
azure_traffic_collector_name: str,
|
|
797
|
+
parameters: IO[bytes],
|
|
798
|
+
*,
|
|
799
|
+
content_type: str = "application/json",
|
|
800
|
+
**kwargs: Any
|
|
801
|
+
) -> _models.AzureTrafficCollector:
|
|
802
|
+
"""Updates the specified Azure Traffic Collector tags.
|
|
803
|
+
|
|
804
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
805
|
+
Required.
|
|
806
|
+
:type resource_group_name: str
|
|
807
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
808
|
+
:type azure_traffic_collector_name: str
|
|
809
|
+
:param parameters: Parameters supplied to update Azure Traffic Collector tags. Required.
|
|
810
|
+
:type parameters: IO[bytes]
|
|
811
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
812
|
+
Default value is "application/json".
|
|
813
|
+
:paramtype content_type: str
|
|
814
|
+
:return: AzureTrafficCollector. The AzureTrafficCollector is compatible with MutableMapping
|
|
815
|
+
:rtype: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
816
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
817
|
+
"""
|
|
818
|
+
|
|
819
|
+
@distributed_trace
|
|
820
|
+
def update_tags(
|
|
821
|
+
self,
|
|
822
|
+
resource_group_name: str,
|
|
823
|
+
azure_traffic_collector_name: str,
|
|
824
|
+
parameters: Union[_models.TagsObject, JSON, IO[bytes]],
|
|
825
|
+
**kwargs: Any
|
|
826
|
+
) -> _models.AzureTrafficCollector:
|
|
827
|
+
"""Updates the specified Azure Traffic Collector tags.
|
|
828
|
+
|
|
829
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
830
|
+
Required.
|
|
831
|
+
:type resource_group_name: str
|
|
832
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
833
|
+
:type azure_traffic_collector_name: str
|
|
834
|
+
:param parameters: Parameters supplied to update Azure Traffic Collector tags. Is one of the
|
|
835
|
+
following types: TagsObject, JSON, IO[bytes] Required.
|
|
836
|
+
:type parameters: ~azure.mgmt.networkfunction.models.TagsObject or JSON or IO[bytes]
|
|
837
|
+
:return: AzureTrafficCollector. The AzureTrafficCollector is compatible with MutableMapping
|
|
838
|
+
:rtype: ~azure.mgmt.networkfunction.models.AzureTrafficCollector
|
|
839
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
840
|
+
"""
|
|
841
|
+
error_map: MutableMapping = {
|
|
842
|
+
401: ClientAuthenticationError,
|
|
843
|
+
404: ResourceNotFoundError,
|
|
844
|
+
409: ResourceExistsError,
|
|
845
|
+
304: ResourceNotModifiedError,
|
|
846
|
+
}
|
|
847
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
848
|
+
|
|
849
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
850
|
+
_params = kwargs.pop("params", {}) or {}
|
|
851
|
+
|
|
852
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
853
|
+
cls: ClsType[_models.AzureTrafficCollector] = kwargs.pop("cls", None)
|
|
854
|
+
|
|
855
|
+
content_type = content_type or "application/json"
|
|
856
|
+
_content = None
|
|
857
|
+
if isinstance(parameters, (IOBase, bytes)):
|
|
858
|
+
_content = parameters
|
|
859
|
+
else:
|
|
860
|
+
_content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
861
|
+
|
|
862
|
+
_request = build_azure_traffic_collectors_update_tags_request(
|
|
863
|
+
resource_group_name=resource_group_name,
|
|
864
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
865
|
+
subscription_id=self._config.subscription_id,
|
|
866
|
+
content_type=content_type,
|
|
867
|
+
api_version=self._config.api_version,
|
|
868
|
+
content=_content,
|
|
869
|
+
headers=_headers,
|
|
870
|
+
params=_params,
|
|
871
|
+
)
|
|
872
|
+
path_format_arguments = {
|
|
873
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
874
|
+
}
|
|
875
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
876
|
+
|
|
877
|
+
_decompress = kwargs.pop("decompress", True)
|
|
878
|
+
_stream = kwargs.pop("stream", False)
|
|
879
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
880
|
+
_request, stream=_stream, **kwargs
|
|
881
|
+
)
|
|
882
|
+
|
|
883
|
+
response = pipeline_response.http_response
|
|
884
|
+
|
|
885
|
+
if response.status_code not in [200]:
|
|
886
|
+
if _stream:
|
|
887
|
+
try:
|
|
888
|
+
response.read() # Load the body in memory and close the socket
|
|
889
|
+
except (StreamConsumedError, StreamClosedError):
|
|
890
|
+
pass
|
|
891
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
892
|
+
error = _failsafe_deserialize(
|
|
893
|
+
_models.CloudError,
|
|
894
|
+
response,
|
|
895
|
+
)
|
|
896
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
897
|
+
|
|
898
|
+
if _stream:
|
|
899
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
900
|
+
else:
|
|
901
|
+
deserialized = _deserialize(_models.AzureTrafficCollector, response.json())
|
|
902
|
+
|
|
903
|
+
if cls:
|
|
904
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
905
|
+
|
|
906
|
+
return deserialized # type: ignore
|
|
907
|
+
|
|
908
|
+
def _delete_initial(
|
|
909
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, **kwargs: Any
|
|
910
|
+
) -> Iterator[bytes]:
|
|
911
|
+
error_map: MutableMapping = {
|
|
912
|
+
401: ClientAuthenticationError,
|
|
913
|
+
404: ResourceNotFoundError,
|
|
914
|
+
409: ResourceExistsError,
|
|
915
|
+
304: ResourceNotModifiedError,
|
|
916
|
+
}
|
|
917
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
918
|
+
|
|
919
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
920
|
+
_params = kwargs.pop("params", {}) or {}
|
|
921
|
+
|
|
922
|
+
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
|
923
|
+
|
|
924
|
+
_request = build_azure_traffic_collectors_delete_request(
|
|
925
|
+
resource_group_name=resource_group_name,
|
|
926
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
927
|
+
subscription_id=self._config.subscription_id,
|
|
928
|
+
api_version=self._config.api_version,
|
|
929
|
+
headers=_headers,
|
|
930
|
+
params=_params,
|
|
931
|
+
)
|
|
932
|
+
path_format_arguments = {
|
|
933
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
934
|
+
}
|
|
935
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
936
|
+
|
|
937
|
+
_decompress = kwargs.pop("decompress", True)
|
|
938
|
+
_stream = True
|
|
939
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
940
|
+
_request, stream=_stream, **kwargs
|
|
941
|
+
)
|
|
942
|
+
|
|
943
|
+
response = pipeline_response.http_response
|
|
944
|
+
|
|
945
|
+
if response.status_code not in [200, 202, 204]:
|
|
946
|
+
try:
|
|
947
|
+
response.read() # Load the body in memory and close the socket
|
|
948
|
+
except (StreamConsumedError, StreamClosedError):
|
|
949
|
+
pass
|
|
950
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
951
|
+
error = _failsafe_deserialize(
|
|
952
|
+
_models.CloudError,
|
|
953
|
+
response,
|
|
954
|
+
)
|
|
955
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
956
|
+
|
|
957
|
+
response_headers = {}
|
|
958
|
+
if response.status_code == 202:
|
|
959
|
+
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
|
960
|
+
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
|
|
961
|
+
|
|
962
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
963
|
+
|
|
964
|
+
if cls:
|
|
965
|
+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
|
966
|
+
|
|
967
|
+
return deserialized # type: ignore
|
|
968
|
+
|
|
969
|
+
@distributed_trace
|
|
970
|
+
def begin_delete(
|
|
971
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, **kwargs: Any
|
|
972
|
+
) -> LROPoller[None]:
|
|
973
|
+
"""Deletes a specified Azure Traffic Collector resource.
|
|
974
|
+
|
|
975
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
976
|
+
Required.
|
|
977
|
+
:type resource_group_name: str
|
|
978
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
979
|
+
:type azure_traffic_collector_name: str
|
|
980
|
+
:return: An instance of LROPoller that returns None
|
|
981
|
+
:rtype: ~azure.core.polling.LROPoller[None]
|
|
982
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
983
|
+
"""
|
|
984
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
985
|
+
_params = kwargs.pop("params", {}) or {}
|
|
986
|
+
|
|
987
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
988
|
+
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
|
989
|
+
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
|
990
|
+
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
|
991
|
+
if cont_token is None:
|
|
992
|
+
raw_result = self._delete_initial(
|
|
993
|
+
resource_group_name=resource_group_name,
|
|
994
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
995
|
+
cls=lambda x, y, z: x,
|
|
996
|
+
headers=_headers,
|
|
997
|
+
params=_params,
|
|
998
|
+
**kwargs
|
|
999
|
+
)
|
|
1000
|
+
raw_result.http_response.read() # type: ignore
|
|
1001
|
+
kwargs.pop("error_map", None)
|
|
1002
|
+
|
|
1003
|
+
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
|
1004
|
+
if cls:
|
|
1005
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
1006
|
+
|
|
1007
|
+
path_format_arguments = {
|
|
1008
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
if polling is True:
|
|
1012
|
+
polling_method: PollingMethod = cast(
|
|
1013
|
+
PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
|
|
1014
|
+
)
|
|
1015
|
+
elif polling is False:
|
|
1016
|
+
polling_method = cast(PollingMethod, NoPolling())
|
|
1017
|
+
else:
|
|
1018
|
+
polling_method = polling
|
|
1019
|
+
if cont_token:
|
|
1020
|
+
return LROPoller[None].from_continuation_token(
|
|
1021
|
+
polling_method=polling_method,
|
|
1022
|
+
continuation_token=cont_token,
|
|
1023
|
+
client=self._client,
|
|
1024
|
+
deserialization_callback=get_long_running_output,
|
|
1025
|
+
)
|
|
1026
|
+
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
class CollectorPoliciesOperations:
|
|
1030
|
+
"""
|
|
1031
|
+
.. warning::
|
|
1032
|
+
**DO NOT** instantiate this class directly.
|
|
1033
|
+
|
|
1034
|
+
Instead, you should access the following operations through
|
|
1035
|
+
:class:`~azure.mgmt.networkfunction.TrafficCollectorMgmtClient`'s
|
|
1036
|
+
:attr:`collector_policies` attribute.
|
|
1037
|
+
"""
|
|
1038
|
+
|
|
1039
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
1040
|
+
input_args = list(args)
|
|
1041
|
+
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
1042
|
+
self._config: TrafficCollectorMgmtClientConfiguration = (
|
|
1043
|
+
input_args.pop(0) if input_args else kwargs.pop("config")
|
|
1044
|
+
)
|
|
1045
|
+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
1046
|
+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1047
|
+
|
|
1048
|
+
@distributed_trace
|
|
1049
|
+
def get(
|
|
1050
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, collector_policy_name: str, **kwargs: Any
|
|
1051
|
+
) -> _models.CollectorPolicy:
|
|
1052
|
+
"""Gets the collector policy in a specified Traffic Collector.
|
|
1053
|
+
|
|
1054
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1055
|
+
Required.
|
|
1056
|
+
:type resource_group_name: str
|
|
1057
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1058
|
+
:type azure_traffic_collector_name: str
|
|
1059
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1060
|
+
:type collector_policy_name: str
|
|
1061
|
+
:return: CollectorPolicy. The CollectorPolicy is compatible with MutableMapping
|
|
1062
|
+
:rtype: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1063
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1064
|
+
"""
|
|
1065
|
+
error_map: MutableMapping = {
|
|
1066
|
+
401: ClientAuthenticationError,
|
|
1067
|
+
404: ResourceNotFoundError,
|
|
1068
|
+
409: ResourceExistsError,
|
|
1069
|
+
304: ResourceNotModifiedError,
|
|
1070
|
+
}
|
|
1071
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1072
|
+
|
|
1073
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1074
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1075
|
+
|
|
1076
|
+
cls: ClsType[_models.CollectorPolicy] = kwargs.pop("cls", None)
|
|
1077
|
+
|
|
1078
|
+
_request = build_collector_policies_get_request(
|
|
1079
|
+
resource_group_name=resource_group_name,
|
|
1080
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1081
|
+
collector_policy_name=collector_policy_name,
|
|
1082
|
+
subscription_id=self._config.subscription_id,
|
|
1083
|
+
api_version=self._config.api_version,
|
|
1084
|
+
headers=_headers,
|
|
1085
|
+
params=_params,
|
|
1086
|
+
)
|
|
1087
|
+
path_format_arguments = {
|
|
1088
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1089
|
+
}
|
|
1090
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1091
|
+
|
|
1092
|
+
_decompress = kwargs.pop("decompress", True)
|
|
1093
|
+
_stream = kwargs.pop("stream", False)
|
|
1094
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1095
|
+
_request, stream=_stream, **kwargs
|
|
1096
|
+
)
|
|
1097
|
+
|
|
1098
|
+
response = pipeline_response.http_response
|
|
1099
|
+
|
|
1100
|
+
if response.status_code not in [200]:
|
|
1101
|
+
if _stream:
|
|
1102
|
+
try:
|
|
1103
|
+
response.read() # Load the body in memory and close the socket
|
|
1104
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1105
|
+
pass
|
|
1106
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1107
|
+
error = _failsafe_deserialize(
|
|
1108
|
+
_models.CloudError,
|
|
1109
|
+
response,
|
|
1110
|
+
)
|
|
1111
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1112
|
+
|
|
1113
|
+
if _stream:
|
|
1114
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
1115
|
+
else:
|
|
1116
|
+
deserialized = _deserialize(_models.CollectorPolicy, response.json())
|
|
1117
|
+
|
|
1118
|
+
if cls:
|
|
1119
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1120
|
+
|
|
1121
|
+
return deserialized # type: ignore
|
|
1122
|
+
|
|
1123
|
+
def _create_or_update_initial(
|
|
1124
|
+
self,
|
|
1125
|
+
resource_group_name: str,
|
|
1126
|
+
azure_traffic_collector_name: str,
|
|
1127
|
+
collector_policy_name: str,
|
|
1128
|
+
parameters: Union[_models.CollectorPolicy, JSON, IO[bytes]],
|
|
1129
|
+
**kwargs: Any
|
|
1130
|
+
) -> Iterator[bytes]:
|
|
1131
|
+
error_map: MutableMapping = {
|
|
1132
|
+
401: ClientAuthenticationError,
|
|
1133
|
+
404: ResourceNotFoundError,
|
|
1134
|
+
409: ResourceExistsError,
|
|
1135
|
+
304: ResourceNotModifiedError,
|
|
1136
|
+
}
|
|
1137
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1138
|
+
|
|
1139
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1140
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1141
|
+
|
|
1142
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1143
|
+
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
|
1144
|
+
|
|
1145
|
+
content_type = content_type or "application/json"
|
|
1146
|
+
_content = None
|
|
1147
|
+
if isinstance(parameters, (IOBase, bytes)):
|
|
1148
|
+
_content = parameters
|
|
1149
|
+
else:
|
|
1150
|
+
_content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
1151
|
+
|
|
1152
|
+
_request = build_collector_policies_create_or_update_request(
|
|
1153
|
+
resource_group_name=resource_group_name,
|
|
1154
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1155
|
+
collector_policy_name=collector_policy_name,
|
|
1156
|
+
subscription_id=self._config.subscription_id,
|
|
1157
|
+
content_type=content_type,
|
|
1158
|
+
api_version=self._config.api_version,
|
|
1159
|
+
content=_content,
|
|
1160
|
+
headers=_headers,
|
|
1161
|
+
params=_params,
|
|
1162
|
+
)
|
|
1163
|
+
path_format_arguments = {
|
|
1164
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1165
|
+
}
|
|
1166
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1167
|
+
|
|
1168
|
+
_decompress = kwargs.pop("decompress", True)
|
|
1169
|
+
_stream = True
|
|
1170
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1171
|
+
_request, stream=_stream, **kwargs
|
|
1172
|
+
)
|
|
1173
|
+
|
|
1174
|
+
response = pipeline_response.http_response
|
|
1175
|
+
|
|
1176
|
+
if response.status_code not in [200, 201]:
|
|
1177
|
+
try:
|
|
1178
|
+
response.read() # Load the body in memory and close the socket
|
|
1179
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1180
|
+
pass
|
|
1181
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1182
|
+
error = _failsafe_deserialize(
|
|
1183
|
+
_models.CloudError,
|
|
1184
|
+
response,
|
|
1185
|
+
)
|
|
1186
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1187
|
+
|
|
1188
|
+
response_headers = {}
|
|
1189
|
+
if response.status_code == 201:
|
|
1190
|
+
response_headers["Azure-AsyncOperation"] = self._deserialize(
|
|
1191
|
+
"str", response.headers.get("Azure-AsyncOperation")
|
|
1192
|
+
)
|
|
1193
|
+
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
|
|
1194
|
+
|
|
1195
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
1196
|
+
|
|
1197
|
+
if cls:
|
|
1198
|
+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
|
1199
|
+
|
|
1200
|
+
return deserialized # type: ignore
|
|
1201
|
+
|
|
1202
|
+
@overload
|
|
1203
|
+
def begin_create_or_update(
|
|
1204
|
+
self,
|
|
1205
|
+
resource_group_name: str,
|
|
1206
|
+
azure_traffic_collector_name: str,
|
|
1207
|
+
collector_policy_name: str,
|
|
1208
|
+
parameters: _models.CollectorPolicy,
|
|
1209
|
+
*,
|
|
1210
|
+
content_type: str = "application/json",
|
|
1211
|
+
**kwargs: Any
|
|
1212
|
+
) -> LROPoller[_models.CollectorPolicy]:
|
|
1213
|
+
"""Creates or updates a Collector Policy resource.
|
|
1214
|
+
|
|
1215
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1216
|
+
Required.
|
|
1217
|
+
:type resource_group_name: str
|
|
1218
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1219
|
+
:type azure_traffic_collector_name: str
|
|
1220
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1221
|
+
:type collector_policy_name: str
|
|
1222
|
+
:param parameters: The parameters to provide for the created Collector Policy. Required.
|
|
1223
|
+
:type parameters: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1224
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1225
|
+
Default value is "application/json".
|
|
1226
|
+
:paramtype content_type: str
|
|
1227
|
+
:return: An instance of LROPoller that returns CollectorPolicy. The CollectorPolicy is
|
|
1228
|
+
compatible with MutableMapping
|
|
1229
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.CollectorPolicy]
|
|
1230
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1231
|
+
"""
|
|
1232
|
+
|
|
1233
|
+
@overload
|
|
1234
|
+
def begin_create_or_update(
|
|
1235
|
+
self,
|
|
1236
|
+
resource_group_name: str,
|
|
1237
|
+
azure_traffic_collector_name: str,
|
|
1238
|
+
collector_policy_name: str,
|
|
1239
|
+
parameters: JSON,
|
|
1240
|
+
*,
|
|
1241
|
+
content_type: str = "application/json",
|
|
1242
|
+
**kwargs: Any
|
|
1243
|
+
) -> LROPoller[_models.CollectorPolicy]:
|
|
1244
|
+
"""Creates or updates a Collector Policy resource.
|
|
1245
|
+
|
|
1246
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1247
|
+
Required.
|
|
1248
|
+
:type resource_group_name: str
|
|
1249
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1250
|
+
:type azure_traffic_collector_name: str
|
|
1251
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1252
|
+
:type collector_policy_name: str
|
|
1253
|
+
:param parameters: The parameters to provide for the created Collector Policy. Required.
|
|
1254
|
+
:type parameters: JSON
|
|
1255
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1256
|
+
Default value is "application/json".
|
|
1257
|
+
:paramtype content_type: str
|
|
1258
|
+
:return: An instance of LROPoller that returns CollectorPolicy. The CollectorPolicy is
|
|
1259
|
+
compatible with MutableMapping
|
|
1260
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.CollectorPolicy]
|
|
1261
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1262
|
+
"""
|
|
1263
|
+
|
|
1264
|
+
@overload
|
|
1265
|
+
def begin_create_or_update(
|
|
1266
|
+
self,
|
|
1267
|
+
resource_group_name: str,
|
|
1268
|
+
azure_traffic_collector_name: str,
|
|
1269
|
+
collector_policy_name: str,
|
|
1270
|
+
parameters: IO[bytes],
|
|
1271
|
+
*,
|
|
1272
|
+
content_type: str = "application/json",
|
|
1273
|
+
**kwargs: Any
|
|
1274
|
+
) -> LROPoller[_models.CollectorPolicy]:
|
|
1275
|
+
"""Creates or updates a Collector Policy resource.
|
|
1276
|
+
|
|
1277
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1278
|
+
Required.
|
|
1279
|
+
:type resource_group_name: str
|
|
1280
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1281
|
+
:type azure_traffic_collector_name: str
|
|
1282
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1283
|
+
:type collector_policy_name: str
|
|
1284
|
+
:param parameters: The parameters to provide for the created Collector Policy. Required.
|
|
1285
|
+
:type parameters: IO[bytes]
|
|
1286
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
1287
|
+
Default value is "application/json".
|
|
1288
|
+
:paramtype content_type: str
|
|
1289
|
+
:return: An instance of LROPoller that returns CollectorPolicy. The CollectorPolicy is
|
|
1290
|
+
compatible with MutableMapping
|
|
1291
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.CollectorPolicy]
|
|
1292
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1293
|
+
"""
|
|
1294
|
+
|
|
1295
|
+
@distributed_trace
|
|
1296
|
+
def begin_create_or_update(
|
|
1297
|
+
self,
|
|
1298
|
+
resource_group_name: str,
|
|
1299
|
+
azure_traffic_collector_name: str,
|
|
1300
|
+
collector_policy_name: str,
|
|
1301
|
+
parameters: Union[_models.CollectorPolicy, JSON, IO[bytes]],
|
|
1302
|
+
**kwargs: Any
|
|
1303
|
+
) -> LROPoller[_models.CollectorPolicy]:
|
|
1304
|
+
"""Creates or updates a Collector Policy resource.
|
|
1305
|
+
|
|
1306
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1307
|
+
Required.
|
|
1308
|
+
:type resource_group_name: str
|
|
1309
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1310
|
+
:type azure_traffic_collector_name: str
|
|
1311
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1312
|
+
:type collector_policy_name: str
|
|
1313
|
+
:param parameters: The parameters to provide for the created Collector Policy. Is one of the
|
|
1314
|
+
following types: CollectorPolicy, JSON, IO[bytes] Required.
|
|
1315
|
+
:type parameters: ~azure.mgmt.networkfunction.models.CollectorPolicy or JSON or IO[bytes]
|
|
1316
|
+
:return: An instance of LROPoller that returns CollectorPolicy. The CollectorPolicy is
|
|
1317
|
+
compatible with MutableMapping
|
|
1318
|
+
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.networkfunction.models.CollectorPolicy]
|
|
1319
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1320
|
+
"""
|
|
1321
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1322
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1323
|
+
|
|
1324
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1325
|
+
cls: ClsType[_models.CollectorPolicy] = kwargs.pop("cls", None)
|
|
1326
|
+
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
|
1327
|
+
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
|
1328
|
+
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
|
1329
|
+
if cont_token is None:
|
|
1330
|
+
raw_result = self._create_or_update_initial(
|
|
1331
|
+
resource_group_name=resource_group_name,
|
|
1332
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1333
|
+
collector_policy_name=collector_policy_name,
|
|
1334
|
+
parameters=parameters,
|
|
1335
|
+
content_type=content_type,
|
|
1336
|
+
cls=lambda x, y, z: x,
|
|
1337
|
+
headers=_headers,
|
|
1338
|
+
params=_params,
|
|
1339
|
+
**kwargs
|
|
1340
|
+
)
|
|
1341
|
+
raw_result.http_response.read() # type: ignore
|
|
1342
|
+
kwargs.pop("error_map", None)
|
|
1343
|
+
|
|
1344
|
+
def get_long_running_output(pipeline_response):
|
|
1345
|
+
response = pipeline_response.http_response
|
|
1346
|
+
deserialized = _deserialize(_models.CollectorPolicy, response.json())
|
|
1347
|
+
if cls:
|
|
1348
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1349
|
+
return deserialized
|
|
1350
|
+
|
|
1351
|
+
path_format_arguments = {
|
|
1352
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
if polling is True:
|
|
1356
|
+
polling_method: PollingMethod = cast(
|
|
1357
|
+
PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
|
|
1358
|
+
)
|
|
1359
|
+
elif polling is False:
|
|
1360
|
+
polling_method = cast(PollingMethod, NoPolling())
|
|
1361
|
+
else:
|
|
1362
|
+
polling_method = polling
|
|
1363
|
+
if cont_token:
|
|
1364
|
+
return LROPoller[_models.CollectorPolicy].from_continuation_token(
|
|
1365
|
+
polling_method=polling_method,
|
|
1366
|
+
continuation_token=cont_token,
|
|
1367
|
+
client=self._client,
|
|
1368
|
+
deserialization_callback=get_long_running_output,
|
|
1369
|
+
)
|
|
1370
|
+
return LROPoller[_models.CollectorPolicy](
|
|
1371
|
+
self._client, raw_result, get_long_running_output, polling_method # type: ignore
|
|
1372
|
+
)
|
|
1373
|
+
|
|
1374
|
+
@overload
|
|
1375
|
+
def update_tags(
|
|
1376
|
+
self,
|
|
1377
|
+
resource_group_name: str,
|
|
1378
|
+
azure_traffic_collector_name: str,
|
|
1379
|
+
collector_policy_name: str,
|
|
1380
|
+
parameters: _models.TagsObject,
|
|
1381
|
+
*,
|
|
1382
|
+
content_type: str = "application/json",
|
|
1383
|
+
**kwargs: Any
|
|
1384
|
+
) -> _models.CollectorPolicy:
|
|
1385
|
+
"""Updates the specified Collector Policy tags.
|
|
1386
|
+
|
|
1387
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1388
|
+
Required.
|
|
1389
|
+
:type resource_group_name: str
|
|
1390
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1391
|
+
:type azure_traffic_collector_name: str
|
|
1392
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1393
|
+
:type collector_policy_name: str
|
|
1394
|
+
:param parameters: The resource properties to be updated. Required.
|
|
1395
|
+
:type parameters: ~azure.mgmt.networkfunction.models.TagsObject
|
|
1396
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1397
|
+
Default value is "application/json".
|
|
1398
|
+
:paramtype content_type: str
|
|
1399
|
+
:return: CollectorPolicy. The CollectorPolicy is compatible with MutableMapping
|
|
1400
|
+
:rtype: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1401
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1402
|
+
"""
|
|
1403
|
+
|
|
1404
|
+
@overload
|
|
1405
|
+
def update_tags(
|
|
1406
|
+
self,
|
|
1407
|
+
resource_group_name: str,
|
|
1408
|
+
azure_traffic_collector_name: str,
|
|
1409
|
+
collector_policy_name: str,
|
|
1410
|
+
parameters: JSON,
|
|
1411
|
+
*,
|
|
1412
|
+
content_type: str = "application/json",
|
|
1413
|
+
**kwargs: Any
|
|
1414
|
+
) -> _models.CollectorPolicy:
|
|
1415
|
+
"""Updates the specified Collector Policy tags.
|
|
1416
|
+
|
|
1417
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1418
|
+
Required.
|
|
1419
|
+
:type resource_group_name: str
|
|
1420
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1421
|
+
:type azure_traffic_collector_name: str
|
|
1422
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1423
|
+
:type collector_policy_name: str
|
|
1424
|
+
:param parameters: The resource properties to be updated. Required.
|
|
1425
|
+
:type parameters: JSON
|
|
1426
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1427
|
+
Default value is "application/json".
|
|
1428
|
+
:paramtype content_type: str
|
|
1429
|
+
:return: CollectorPolicy. The CollectorPolicy is compatible with MutableMapping
|
|
1430
|
+
:rtype: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1431
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1432
|
+
"""
|
|
1433
|
+
|
|
1434
|
+
@overload
|
|
1435
|
+
def update_tags(
|
|
1436
|
+
self,
|
|
1437
|
+
resource_group_name: str,
|
|
1438
|
+
azure_traffic_collector_name: str,
|
|
1439
|
+
collector_policy_name: str,
|
|
1440
|
+
parameters: IO[bytes],
|
|
1441
|
+
*,
|
|
1442
|
+
content_type: str = "application/json",
|
|
1443
|
+
**kwargs: Any
|
|
1444
|
+
) -> _models.CollectorPolicy:
|
|
1445
|
+
"""Updates the specified Collector Policy tags.
|
|
1446
|
+
|
|
1447
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1448
|
+
Required.
|
|
1449
|
+
:type resource_group_name: str
|
|
1450
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1451
|
+
:type azure_traffic_collector_name: str
|
|
1452
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1453
|
+
:type collector_policy_name: str
|
|
1454
|
+
:param parameters: The resource properties to be updated. Required.
|
|
1455
|
+
:type parameters: IO[bytes]
|
|
1456
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
1457
|
+
Default value is "application/json".
|
|
1458
|
+
:paramtype content_type: str
|
|
1459
|
+
:return: CollectorPolicy. The CollectorPolicy is compatible with MutableMapping
|
|
1460
|
+
:rtype: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1461
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1462
|
+
"""
|
|
1463
|
+
|
|
1464
|
+
@distributed_trace
|
|
1465
|
+
def update_tags(
|
|
1466
|
+
self,
|
|
1467
|
+
resource_group_name: str,
|
|
1468
|
+
azure_traffic_collector_name: str,
|
|
1469
|
+
collector_policy_name: str,
|
|
1470
|
+
parameters: Union[_models.TagsObject, JSON, IO[bytes]],
|
|
1471
|
+
**kwargs: Any
|
|
1472
|
+
) -> _models.CollectorPolicy:
|
|
1473
|
+
"""Updates the specified Collector Policy tags.
|
|
1474
|
+
|
|
1475
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1476
|
+
Required.
|
|
1477
|
+
:type resource_group_name: str
|
|
1478
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1479
|
+
:type azure_traffic_collector_name: str
|
|
1480
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1481
|
+
:type collector_policy_name: str
|
|
1482
|
+
:param parameters: The resource properties to be updated. Is one of the following types:
|
|
1483
|
+
TagsObject, JSON, IO[bytes] Required.
|
|
1484
|
+
:type parameters: ~azure.mgmt.networkfunction.models.TagsObject or JSON or IO[bytes]
|
|
1485
|
+
:return: CollectorPolicy. The CollectorPolicy is compatible with MutableMapping
|
|
1486
|
+
:rtype: ~azure.mgmt.networkfunction.models.CollectorPolicy
|
|
1487
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1488
|
+
"""
|
|
1489
|
+
error_map: MutableMapping = {
|
|
1490
|
+
401: ClientAuthenticationError,
|
|
1491
|
+
404: ResourceNotFoundError,
|
|
1492
|
+
409: ResourceExistsError,
|
|
1493
|
+
304: ResourceNotModifiedError,
|
|
1494
|
+
}
|
|
1495
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1496
|
+
|
|
1497
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1498
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1499
|
+
|
|
1500
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1501
|
+
cls: ClsType[_models.CollectorPolicy] = kwargs.pop("cls", None)
|
|
1502
|
+
|
|
1503
|
+
content_type = content_type or "application/json"
|
|
1504
|
+
_content = None
|
|
1505
|
+
if isinstance(parameters, (IOBase, bytes)):
|
|
1506
|
+
_content = parameters
|
|
1507
|
+
else:
|
|
1508
|
+
_content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
1509
|
+
|
|
1510
|
+
_request = build_collector_policies_update_tags_request(
|
|
1511
|
+
resource_group_name=resource_group_name,
|
|
1512
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1513
|
+
collector_policy_name=collector_policy_name,
|
|
1514
|
+
subscription_id=self._config.subscription_id,
|
|
1515
|
+
content_type=content_type,
|
|
1516
|
+
api_version=self._config.api_version,
|
|
1517
|
+
content=_content,
|
|
1518
|
+
headers=_headers,
|
|
1519
|
+
params=_params,
|
|
1520
|
+
)
|
|
1521
|
+
path_format_arguments = {
|
|
1522
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1523
|
+
}
|
|
1524
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1525
|
+
|
|
1526
|
+
_decompress = kwargs.pop("decompress", True)
|
|
1527
|
+
_stream = kwargs.pop("stream", False)
|
|
1528
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1529
|
+
_request, stream=_stream, **kwargs
|
|
1530
|
+
)
|
|
1531
|
+
|
|
1532
|
+
response = pipeline_response.http_response
|
|
1533
|
+
|
|
1534
|
+
if response.status_code not in [200]:
|
|
1535
|
+
if _stream:
|
|
1536
|
+
try:
|
|
1537
|
+
response.read() # Load the body in memory and close the socket
|
|
1538
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1539
|
+
pass
|
|
1540
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1541
|
+
error = _failsafe_deserialize(
|
|
1542
|
+
_models.CloudError,
|
|
1543
|
+
response,
|
|
1544
|
+
)
|
|
1545
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1546
|
+
|
|
1547
|
+
if _stream:
|
|
1548
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
1549
|
+
else:
|
|
1550
|
+
deserialized = _deserialize(_models.CollectorPolicy, response.json())
|
|
1551
|
+
|
|
1552
|
+
if cls:
|
|
1553
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1554
|
+
|
|
1555
|
+
return deserialized # type: ignore
|
|
1556
|
+
|
|
1557
|
+
def _delete_initial(
|
|
1558
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, collector_policy_name: str, **kwargs: Any
|
|
1559
|
+
) -> Iterator[bytes]:
|
|
1560
|
+
error_map: MutableMapping = {
|
|
1561
|
+
401: ClientAuthenticationError,
|
|
1562
|
+
404: ResourceNotFoundError,
|
|
1563
|
+
409: ResourceExistsError,
|
|
1564
|
+
304: ResourceNotModifiedError,
|
|
1565
|
+
}
|
|
1566
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1567
|
+
|
|
1568
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1569
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1570
|
+
|
|
1571
|
+
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
|
|
1572
|
+
|
|
1573
|
+
_request = build_collector_policies_delete_request(
|
|
1574
|
+
resource_group_name=resource_group_name,
|
|
1575
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1576
|
+
collector_policy_name=collector_policy_name,
|
|
1577
|
+
subscription_id=self._config.subscription_id,
|
|
1578
|
+
api_version=self._config.api_version,
|
|
1579
|
+
headers=_headers,
|
|
1580
|
+
params=_params,
|
|
1581
|
+
)
|
|
1582
|
+
path_format_arguments = {
|
|
1583
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1584
|
+
}
|
|
1585
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1586
|
+
|
|
1587
|
+
_decompress = kwargs.pop("decompress", True)
|
|
1588
|
+
_stream = True
|
|
1589
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1590
|
+
_request, stream=_stream, **kwargs
|
|
1591
|
+
)
|
|
1592
|
+
|
|
1593
|
+
response = pipeline_response.http_response
|
|
1594
|
+
|
|
1595
|
+
if response.status_code not in [200, 202, 204]:
|
|
1596
|
+
try:
|
|
1597
|
+
response.read() # Load the body in memory and close the socket
|
|
1598
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1599
|
+
pass
|
|
1600
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1601
|
+
error = _failsafe_deserialize(
|
|
1602
|
+
_models.CloudError,
|
|
1603
|
+
response,
|
|
1604
|
+
)
|
|
1605
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1606
|
+
|
|
1607
|
+
response_headers = {}
|
|
1608
|
+
if response.status_code == 202:
|
|
1609
|
+
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
|
|
1610
|
+
response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
|
|
1611
|
+
|
|
1612
|
+
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
|
|
1613
|
+
|
|
1614
|
+
if cls:
|
|
1615
|
+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
|
1616
|
+
|
|
1617
|
+
return deserialized # type: ignore
|
|
1618
|
+
|
|
1619
|
+
@distributed_trace
|
|
1620
|
+
def begin_delete(
|
|
1621
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, collector_policy_name: str, **kwargs: Any
|
|
1622
|
+
) -> LROPoller[None]:
|
|
1623
|
+
"""Deletes a specified Collector Policy resource.
|
|
1624
|
+
|
|
1625
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1626
|
+
Required.
|
|
1627
|
+
:type resource_group_name: str
|
|
1628
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1629
|
+
:type azure_traffic_collector_name: str
|
|
1630
|
+
:param collector_policy_name: Collector Policy Name. Required.
|
|
1631
|
+
:type collector_policy_name: str
|
|
1632
|
+
:return: An instance of LROPoller that returns None
|
|
1633
|
+
:rtype: ~azure.core.polling.LROPoller[None]
|
|
1634
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1635
|
+
"""
|
|
1636
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1637
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1638
|
+
|
|
1639
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
1640
|
+
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
|
|
1641
|
+
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
|
|
1642
|
+
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
|
|
1643
|
+
if cont_token is None:
|
|
1644
|
+
raw_result = self._delete_initial(
|
|
1645
|
+
resource_group_name=resource_group_name,
|
|
1646
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1647
|
+
collector_policy_name=collector_policy_name,
|
|
1648
|
+
cls=lambda x, y, z: x,
|
|
1649
|
+
headers=_headers,
|
|
1650
|
+
params=_params,
|
|
1651
|
+
**kwargs
|
|
1652
|
+
)
|
|
1653
|
+
raw_result.http_response.read() # type: ignore
|
|
1654
|
+
kwargs.pop("error_map", None)
|
|
1655
|
+
|
|
1656
|
+
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
|
1657
|
+
if cls:
|
|
1658
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
1659
|
+
|
|
1660
|
+
path_format_arguments = {
|
|
1661
|
+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
if polling is True:
|
|
1665
|
+
polling_method: PollingMethod = cast(
|
|
1666
|
+
PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
|
|
1667
|
+
)
|
|
1668
|
+
elif polling is False:
|
|
1669
|
+
polling_method = cast(PollingMethod, NoPolling())
|
|
1670
|
+
else:
|
|
1671
|
+
polling_method = polling
|
|
1672
|
+
if cont_token:
|
|
1673
|
+
return LROPoller[None].from_continuation_token(
|
|
1674
|
+
polling_method=polling_method,
|
|
1675
|
+
continuation_token=cont_token,
|
|
1676
|
+
client=self._client,
|
|
1677
|
+
deserialization_callback=get_long_running_output,
|
|
1678
|
+
)
|
|
1679
|
+
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
|
|
1680
|
+
|
|
1681
|
+
@distributed_trace
|
|
1682
|
+
def list(
|
|
1683
|
+
self, resource_group_name: str, azure_traffic_collector_name: str, **kwargs: Any
|
|
1684
|
+
) -> ItemPaged["_models.CollectorPolicy"]:
|
|
1685
|
+
"""Return list of Collector policies in a Azure Traffic Collector.
|
|
1686
|
+
|
|
1687
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1688
|
+
Required.
|
|
1689
|
+
:type resource_group_name: str
|
|
1690
|
+
:param azure_traffic_collector_name: Azure Traffic Collector name. Required.
|
|
1691
|
+
:type azure_traffic_collector_name: str
|
|
1692
|
+
:return: An iterator like instance of CollectorPolicy
|
|
1693
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkfunction.models.CollectorPolicy]
|
|
1694
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1695
|
+
"""
|
|
1696
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1697
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1698
|
+
|
|
1699
|
+
cls: ClsType[List[_models.CollectorPolicy]] = kwargs.pop("cls", None)
|
|
1700
|
+
|
|
1701
|
+
error_map: MutableMapping = {
|
|
1702
|
+
401: ClientAuthenticationError,
|
|
1703
|
+
404: ResourceNotFoundError,
|
|
1704
|
+
409: ResourceExistsError,
|
|
1705
|
+
304: ResourceNotModifiedError,
|
|
1706
|
+
}
|
|
1707
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1708
|
+
|
|
1709
|
+
def prepare_request(next_link=None):
|
|
1710
|
+
if not next_link:
|
|
1711
|
+
|
|
1712
|
+
_request = build_collector_policies_list_request(
|
|
1713
|
+
resource_group_name=resource_group_name,
|
|
1714
|
+
azure_traffic_collector_name=azure_traffic_collector_name,
|
|
1715
|
+
subscription_id=self._config.subscription_id,
|
|
1716
|
+
api_version=self._config.api_version,
|
|
1717
|
+
headers=_headers,
|
|
1718
|
+
params=_params,
|
|
1719
|
+
)
|
|
1720
|
+
path_format_arguments = {
|
|
1721
|
+
"endpoint": self._serialize.url(
|
|
1722
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1723
|
+
),
|
|
1724
|
+
}
|
|
1725
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1726
|
+
|
|
1727
|
+
else:
|
|
1728
|
+
# make call to next link with the client's api-version
|
|
1729
|
+
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
1730
|
+
_next_request_params = case_insensitive_dict(
|
|
1731
|
+
{
|
|
1732
|
+
key: [urllib.parse.quote(v) for v in value]
|
|
1733
|
+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
1734
|
+
}
|
|
1735
|
+
)
|
|
1736
|
+
_next_request_params["api-version"] = self._config.api_version
|
|
1737
|
+
_request = HttpRequest(
|
|
1738
|
+
"GET",
|
|
1739
|
+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
|
|
1740
|
+
headers=_headers,
|
|
1741
|
+
params=_next_request_params,
|
|
1742
|
+
)
|
|
1743
|
+
path_format_arguments = {
|
|
1744
|
+
"endpoint": self._serialize.url(
|
|
1745
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1746
|
+
),
|
|
1747
|
+
}
|
|
1748
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1749
|
+
|
|
1750
|
+
return _request
|
|
1751
|
+
|
|
1752
|
+
def extract_data(pipeline_response):
|
|
1753
|
+
deserialized = pipeline_response.http_response.json()
|
|
1754
|
+
list_of_elem = _deserialize(
|
|
1755
|
+
List[_models.CollectorPolicy],
|
|
1756
|
+
deserialized.get("value", []),
|
|
1757
|
+
)
|
|
1758
|
+
if cls:
|
|
1759
|
+
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1760
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1761
|
+
|
|
1762
|
+
def get_next(next_link=None):
|
|
1763
|
+
_request = prepare_request(next_link)
|
|
1764
|
+
|
|
1765
|
+
_stream = False
|
|
1766
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1767
|
+
_request, stream=_stream, **kwargs
|
|
1768
|
+
)
|
|
1769
|
+
response = pipeline_response.http_response
|
|
1770
|
+
|
|
1771
|
+
if response.status_code not in [200]:
|
|
1772
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1773
|
+
error = _failsafe_deserialize(
|
|
1774
|
+
_models.CloudError,
|
|
1775
|
+
response,
|
|
1776
|
+
)
|
|
1777
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1778
|
+
|
|
1779
|
+
return pipeline_response
|
|
1780
|
+
|
|
1781
|
+
return ItemPaged(get_next, extract_data)
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
class NetworkFunctionOperations:
|
|
1785
|
+
"""
|
|
1786
|
+
.. warning::
|
|
1787
|
+
**DO NOT** instantiate this class directly.
|
|
1788
|
+
|
|
1789
|
+
Instead, you should access the following operations through
|
|
1790
|
+
:class:`~azure.mgmt.networkfunction.TrafficCollectorMgmtClient`'s
|
|
1791
|
+
:attr:`network_function` attribute.
|
|
1792
|
+
"""
|
|
1793
|
+
|
|
1794
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
1795
|
+
input_args = list(args)
|
|
1796
|
+
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
1797
|
+
self._config: TrafficCollectorMgmtClientConfiguration = (
|
|
1798
|
+
input_args.pop(0) if input_args else kwargs.pop("config")
|
|
1799
|
+
)
|
|
1800
|
+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
1801
|
+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1802
|
+
|
|
1803
|
+
@distributed_trace
|
|
1804
|
+
def list_operations(self, **kwargs: Any) -> ItemPaged["_models.Operation"]:
|
|
1805
|
+
"""Lists all of the available NetworkFunction Rest API operations.
|
|
1806
|
+
|
|
1807
|
+
:return: An iterator like instance of Operation
|
|
1808
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkfunction.models.Operation]
|
|
1809
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1810
|
+
"""
|
|
1811
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1812
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1813
|
+
|
|
1814
|
+
cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None)
|
|
1815
|
+
|
|
1816
|
+
error_map: MutableMapping = {
|
|
1817
|
+
401: ClientAuthenticationError,
|
|
1818
|
+
404: ResourceNotFoundError,
|
|
1819
|
+
409: ResourceExistsError,
|
|
1820
|
+
304: ResourceNotModifiedError,
|
|
1821
|
+
}
|
|
1822
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1823
|
+
|
|
1824
|
+
def prepare_request(next_link=None):
|
|
1825
|
+
if not next_link:
|
|
1826
|
+
|
|
1827
|
+
_request = build_network_function_list_operations_request(
|
|
1828
|
+
api_version=self._config.api_version,
|
|
1829
|
+
headers=_headers,
|
|
1830
|
+
params=_params,
|
|
1831
|
+
)
|
|
1832
|
+
path_format_arguments = {
|
|
1833
|
+
"endpoint": self._serialize.url(
|
|
1834
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1835
|
+
),
|
|
1836
|
+
}
|
|
1837
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1838
|
+
|
|
1839
|
+
else:
|
|
1840
|
+
# make call to next link with the client's api-version
|
|
1841
|
+
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
1842
|
+
_next_request_params = case_insensitive_dict(
|
|
1843
|
+
{
|
|
1844
|
+
key: [urllib.parse.quote(v) for v in value]
|
|
1845
|
+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
1846
|
+
}
|
|
1847
|
+
)
|
|
1848
|
+
_next_request_params["api-version"] = self._config.api_version
|
|
1849
|
+
_request = HttpRequest(
|
|
1850
|
+
"GET",
|
|
1851
|
+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
|
|
1852
|
+
headers=_headers,
|
|
1853
|
+
params=_next_request_params,
|
|
1854
|
+
)
|
|
1855
|
+
path_format_arguments = {
|
|
1856
|
+
"endpoint": self._serialize.url(
|
|
1857
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1858
|
+
),
|
|
1859
|
+
}
|
|
1860
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1861
|
+
|
|
1862
|
+
return _request
|
|
1863
|
+
|
|
1864
|
+
def extract_data(pipeline_response):
|
|
1865
|
+
deserialized = pipeline_response.http_response.json()
|
|
1866
|
+
list_of_elem = _deserialize(
|
|
1867
|
+
List[_models.Operation],
|
|
1868
|
+
deserialized.get("value", []),
|
|
1869
|
+
)
|
|
1870
|
+
if cls:
|
|
1871
|
+
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1872
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1873
|
+
|
|
1874
|
+
def get_next(next_link=None):
|
|
1875
|
+
_request = prepare_request(next_link)
|
|
1876
|
+
|
|
1877
|
+
_stream = False
|
|
1878
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1879
|
+
_request, stream=_stream, **kwargs
|
|
1880
|
+
)
|
|
1881
|
+
response = pipeline_response.http_response
|
|
1882
|
+
|
|
1883
|
+
if response.status_code not in [200]:
|
|
1884
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1885
|
+
error = _failsafe_deserialize(
|
|
1886
|
+
_models.CloudError,
|
|
1887
|
+
response,
|
|
1888
|
+
)
|
|
1889
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
1890
|
+
|
|
1891
|
+
return pipeline_response
|
|
1892
|
+
|
|
1893
|
+
return ItemPaged(get_next, extract_data)
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
class AzureTrafficCollectorsByResourceGroupOperations: # pylint: disable=name-too-long
|
|
1897
|
+
"""
|
|
1898
|
+
.. warning::
|
|
1899
|
+
**DO NOT** instantiate this class directly.
|
|
1900
|
+
|
|
1901
|
+
Instead, you should access the following operations through
|
|
1902
|
+
:class:`~azure.mgmt.networkfunction.TrafficCollectorMgmtClient`'s
|
|
1903
|
+
:attr:`azure_traffic_collectors_by_resource_group` attribute.
|
|
1904
|
+
"""
|
|
1905
|
+
|
|
1906
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
1907
|
+
input_args = list(args)
|
|
1908
|
+
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
1909
|
+
self._config: TrafficCollectorMgmtClientConfiguration = (
|
|
1910
|
+
input_args.pop(0) if input_args else kwargs.pop("config")
|
|
1911
|
+
)
|
|
1912
|
+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
1913
|
+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1914
|
+
|
|
1915
|
+
@distributed_trace
|
|
1916
|
+
def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.AzureTrafficCollector"]:
|
|
1917
|
+
"""Return list of Azure Traffic Collectors in a Resource Group.
|
|
1918
|
+
|
|
1919
|
+
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
|
1920
|
+
Required.
|
|
1921
|
+
:type resource_group_name: str
|
|
1922
|
+
:return: An iterator like instance of AzureTrafficCollector
|
|
1923
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
1924
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1925
|
+
"""
|
|
1926
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1927
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1928
|
+
|
|
1929
|
+
cls: ClsType[List[_models.AzureTrafficCollector]] = kwargs.pop("cls", None)
|
|
1930
|
+
|
|
1931
|
+
error_map: MutableMapping = {
|
|
1932
|
+
401: ClientAuthenticationError,
|
|
1933
|
+
404: ResourceNotFoundError,
|
|
1934
|
+
409: ResourceExistsError,
|
|
1935
|
+
304: ResourceNotModifiedError,
|
|
1936
|
+
}
|
|
1937
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1938
|
+
|
|
1939
|
+
def prepare_request(next_link=None):
|
|
1940
|
+
if not next_link:
|
|
1941
|
+
|
|
1942
|
+
_request = build_azure_traffic_collectors_by_resource_group_list_request(
|
|
1943
|
+
resource_group_name=resource_group_name,
|
|
1944
|
+
subscription_id=self._config.subscription_id,
|
|
1945
|
+
api_version=self._config.api_version,
|
|
1946
|
+
headers=_headers,
|
|
1947
|
+
params=_params,
|
|
1948
|
+
)
|
|
1949
|
+
path_format_arguments = {
|
|
1950
|
+
"endpoint": self._serialize.url(
|
|
1951
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1952
|
+
),
|
|
1953
|
+
}
|
|
1954
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1955
|
+
|
|
1956
|
+
else:
|
|
1957
|
+
# make call to next link with the client's api-version
|
|
1958
|
+
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
1959
|
+
_next_request_params = case_insensitive_dict(
|
|
1960
|
+
{
|
|
1961
|
+
key: [urllib.parse.quote(v) for v in value]
|
|
1962
|
+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
1963
|
+
}
|
|
1964
|
+
)
|
|
1965
|
+
_next_request_params["api-version"] = self._config.api_version
|
|
1966
|
+
_request = HttpRequest(
|
|
1967
|
+
"GET",
|
|
1968
|
+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
|
|
1969
|
+
headers=_headers,
|
|
1970
|
+
params=_next_request_params,
|
|
1971
|
+
)
|
|
1972
|
+
path_format_arguments = {
|
|
1973
|
+
"endpoint": self._serialize.url(
|
|
1974
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
1975
|
+
),
|
|
1976
|
+
}
|
|
1977
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1978
|
+
|
|
1979
|
+
return _request
|
|
1980
|
+
|
|
1981
|
+
def extract_data(pipeline_response):
|
|
1982
|
+
deserialized = pipeline_response.http_response.json()
|
|
1983
|
+
list_of_elem = _deserialize(
|
|
1984
|
+
List[_models.AzureTrafficCollector],
|
|
1985
|
+
deserialized.get("value", []),
|
|
1986
|
+
)
|
|
1987
|
+
if cls:
|
|
1988
|
+
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1989
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1990
|
+
|
|
1991
|
+
def get_next(next_link=None):
|
|
1992
|
+
_request = prepare_request(next_link)
|
|
1993
|
+
|
|
1994
|
+
_stream = False
|
|
1995
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1996
|
+
_request, stream=_stream, **kwargs
|
|
1997
|
+
)
|
|
1998
|
+
response = pipeline_response.http_response
|
|
1999
|
+
|
|
2000
|
+
if response.status_code not in [200]:
|
|
2001
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
2002
|
+
error = _failsafe_deserialize(
|
|
2003
|
+
_models.CloudError,
|
|
2004
|
+
response,
|
|
2005
|
+
)
|
|
2006
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
2007
|
+
|
|
2008
|
+
return pipeline_response
|
|
2009
|
+
|
|
2010
|
+
return ItemPaged(get_next, extract_data)
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
class AzureTrafficCollectorsBySubscriptionOperations: # pylint: disable=name-too-long
|
|
2014
|
+
"""
|
|
2015
|
+
.. warning::
|
|
2016
|
+
**DO NOT** instantiate this class directly.
|
|
2017
|
+
|
|
2018
|
+
Instead, you should access the following operations through
|
|
2019
|
+
:class:`~azure.mgmt.networkfunction.TrafficCollectorMgmtClient`'s
|
|
2020
|
+
:attr:`azure_traffic_collectors_by_subscription` attribute.
|
|
2021
|
+
"""
|
|
2022
|
+
|
|
2023
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
2024
|
+
input_args = list(args)
|
|
2025
|
+
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
2026
|
+
self._config: TrafficCollectorMgmtClientConfiguration = (
|
|
2027
|
+
input_args.pop(0) if input_args else kwargs.pop("config")
|
|
2028
|
+
)
|
|
2029
|
+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
2030
|
+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
2031
|
+
|
|
2032
|
+
@distributed_trace
|
|
2033
|
+
def list(self, **kwargs: Any) -> ItemPaged["_models.AzureTrafficCollector"]:
|
|
2034
|
+
"""Return list of Azure Traffic Collectors in a subscription.
|
|
2035
|
+
|
|
2036
|
+
:return: An iterator like instance of AzureTrafficCollector
|
|
2037
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.networkfunction.models.AzureTrafficCollector]
|
|
2038
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2039
|
+
"""
|
|
2040
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
2041
|
+
_params = kwargs.pop("params", {}) or {}
|
|
2042
|
+
|
|
2043
|
+
cls: ClsType[List[_models.AzureTrafficCollector]] = kwargs.pop("cls", None)
|
|
2044
|
+
|
|
2045
|
+
error_map: MutableMapping = {
|
|
2046
|
+
401: ClientAuthenticationError,
|
|
2047
|
+
404: ResourceNotFoundError,
|
|
2048
|
+
409: ResourceExistsError,
|
|
2049
|
+
304: ResourceNotModifiedError,
|
|
2050
|
+
}
|
|
2051
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
2052
|
+
|
|
2053
|
+
def prepare_request(next_link=None):
|
|
2054
|
+
if not next_link:
|
|
2055
|
+
|
|
2056
|
+
_request = build_azure_traffic_collectors_by_subscription_list_request(
|
|
2057
|
+
subscription_id=self._config.subscription_id,
|
|
2058
|
+
api_version=self._config.api_version,
|
|
2059
|
+
headers=_headers,
|
|
2060
|
+
params=_params,
|
|
2061
|
+
)
|
|
2062
|
+
path_format_arguments = {
|
|
2063
|
+
"endpoint": self._serialize.url(
|
|
2064
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
2065
|
+
),
|
|
2066
|
+
}
|
|
2067
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
2068
|
+
|
|
2069
|
+
else:
|
|
2070
|
+
# make call to next link with the client's api-version
|
|
2071
|
+
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
2072
|
+
_next_request_params = case_insensitive_dict(
|
|
2073
|
+
{
|
|
2074
|
+
key: [urllib.parse.quote(v) for v in value]
|
|
2075
|
+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
2076
|
+
}
|
|
2077
|
+
)
|
|
2078
|
+
_next_request_params["api-version"] = self._config.api_version
|
|
2079
|
+
_request = HttpRequest(
|
|
2080
|
+
"GET",
|
|
2081
|
+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
|
|
2082
|
+
headers=_headers,
|
|
2083
|
+
params=_next_request_params,
|
|
2084
|
+
)
|
|
2085
|
+
path_format_arguments = {
|
|
2086
|
+
"endpoint": self._serialize.url(
|
|
2087
|
+
"self._config.base_url", self._config.base_url, "str", skip_quote=True
|
|
2088
|
+
),
|
|
2089
|
+
}
|
|
2090
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
2091
|
+
|
|
2092
|
+
return _request
|
|
2093
|
+
|
|
2094
|
+
def extract_data(pipeline_response):
|
|
2095
|
+
deserialized = pipeline_response.http_response.json()
|
|
2096
|
+
list_of_elem = _deserialize(
|
|
2097
|
+
List[_models.AzureTrafficCollector],
|
|
2098
|
+
deserialized.get("value", []),
|
|
2099
|
+
)
|
|
2100
|
+
if cls:
|
|
2101
|
+
list_of_elem = cls(list_of_elem) # type: ignore
|
|
2102
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
2103
|
+
|
|
2104
|
+
def get_next(next_link=None):
|
|
2105
|
+
_request = prepare_request(next_link)
|
|
2106
|
+
|
|
2107
|
+
_stream = False
|
|
2108
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
2109
|
+
_request, stream=_stream, **kwargs
|
|
2110
|
+
)
|
|
2111
|
+
response = pipeline_response.http_response
|
|
2112
|
+
|
|
2113
|
+
if response.status_code not in [200]:
|
|
2114
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
2115
|
+
error = _failsafe_deserialize(
|
|
2116
|
+
_models.CloudError,
|
|
2117
|
+
response,
|
|
2118
|
+
)
|
|
2119
|
+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
|
|
2120
|
+
|
|
2121
|
+
return pipeline_response
|
|
2122
|
+
|
|
2123
|
+
return ItemPaged(get_next, extract_data)
|