azure-mgmt-agricultureplatform 1.0.0b1__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.
Files changed (28) hide show
  1. azure/mgmt/agricultureplatform/__init__.py +32 -0
  2. azure/mgmt/agricultureplatform/_client.py +137 -0
  3. azure/mgmt/agricultureplatform/_configuration.py +80 -0
  4. azure/mgmt/agricultureplatform/_patch.py +21 -0
  5. azure/mgmt/agricultureplatform/_utils/__init__.py +6 -0
  6. azure/mgmt/agricultureplatform/_utils/model_base.py +1337 -0
  7. azure/mgmt/agricultureplatform/_utils/serialization.py +2041 -0
  8. azure/mgmt/agricultureplatform/_version.py +9 -0
  9. azure/mgmt/agricultureplatform/aio/__init__.py +29 -0
  10. azure/mgmt/agricultureplatform/aio/_client.py +141 -0
  11. azure/mgmt/agricultureplatform/aio/_configuration.py +80 -0
  12. azure/mgmt/agricultureplatform/aio/_patch.py +21 -0
  13. azure/mgmt/agricultureplatform/aio/operations/__init__.py +27 -0
  14. azure/mgmt/agricultureplatform/aio/operations/_operations.py +1102 -0
  15. azure/mgmt/agricultureplatform/aio/operations/_patch.py +21 -0
  16. azure/mgmt/agricultureplatform/models/__init__.py +92 -0
  17. azure/mgmt/agricultureplatform/models/_enums.py +103 -0
  18. azure/mgmt/agricultureplatform/models/_models.py +1037 -0
  19. azure/mgmt/agricultureplatform/models/_patch.py +21 -0
  20. azure/mgmt/agricultureplatform/operations/__init__.py +27 -0
  21. azure/mgmt/agricultureplatform/operations/_operations.py +1303 -0
  22. azure/mgmt/agricultureplatform/operations/_patch.py +21 -0
  23. azure/mgmt/agricultureplatform/py.typed +1 -0
  24. azure_mgmt_agricultureplatform-1.0.0b1.dist-info/METADATA +94 -0
  25. azure_mgmt_agricultureplatform-1.0.0b1.dist-info/RECORD +28 -0
  26. azure_mgmt_agricultureplatform-1.0.0b1.dist-info/WHEEL +5 -0
  27. azure_mgmt_agricultureplatform-1.0.0b1.dist-info/licenses/LICENSE +21 -0
  28. azure_mgmt_agricultureplatform-1.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1102 @@
1
+ # pylint: disable=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, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload
13
+ import urllib.parse
14
+
15
+ from azure.core import AsyncPipelineClient
16
+ from azure.core.async_paging import AsyncItemPaged, AsyncList
17
+ from azure.core.exceptions import (
18
+ ClientAuthenticationError,
19
+ HttpResponseError,
20
+ ResourceExistsError,
21
+ ResourceNotFoundError,
22
+ ResourceNotModifiedError,
23
+ StreamClosedError,
24
+ StreamConsumedError,
25
+ map_error,
26
+ )
27
+ from azure.core.pipeline import PipelineResponse
28
+ from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
29
+ from azure.core.rest import AsyncHttpResponse, HttpRequest
30
+ from azure.core.tracing.decorator import distributed_trace
31
+ from azure.core.tracing.decorator_async import distributed_trace_async
32
+ from azure.core.utils import case_insensitive_dict
33
+ from azure.mgmt.core.exceptions import ARMErrorFormat
34
+ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
35
+
36
+ from ... import models as _models
37
+ from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
38
+ from ..._utils.serialization import Deserializer, Serializer
39
+ from ...operations._operations import (
40
+ build_agri_service_create_or_update_request,
41
+ build_agri_service_delete_request,
42
+ build_agri_service_get_request,
43
+ build_agri_service_list_available_solutions_request,
44
+ build_agri_service_list_by_resource_group_request,
45
+ build_agri_service_list_by_subscription_request,
46
+ build_agri_service_update_request,
47
+ build_operations_list_request,
48
+ )
49
+ from .._configuration import AgriculturePlatformMgmtClientConfiguration
50
+
51
+ T = TypeVar("T")
52
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]]
53
+ JSON = MutableMapping[str, Any]
54
+ List = list
55
+
56
+
57
+ class Operations:
58
+ """
59
+ .. warning::
60
+ **DO NOT** instantiate this class directly.
61
+
62
+ Instead, you should access the following operations through
63
+ :class:`~azure.mgmt.agricultureplatform.aio.AgriculturePlatformMgmtClient`'s
64
+ :attr:`operations` attribute.
65
+ """
66
+
67
+ def __init__(self, *args, **kwargs) -> None:
68
+ input_args = list(args)
69
+ self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
70
+ self._config: AgriculturePlatformMgmtClientConfiguration = (
71
+ input_args.pop(0) if input_args else kwargs.pop("config")
72
+ )
73
+ self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
74
+ self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
75
+
76
+ @distributed_trace
77
+ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]:
78
+ """List the operations for the provider.
79
+
80
+ :return: An iterator like instance of Operation
81
+ :rtype:
82
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agricultureplatform.models.Operation]
83
+ :raises ~azure.core.exceptions.HttpResponseError:
84
+ """
85
+ _headers = kwargs.pop("headers", {}) or {}
86
+ _params = kwargs.pop("params", {}) or {}
87
+
88
+ cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None)
89
+
90
+ error_map: MutableMapping = {
91
+ 401: ClientAuthenticationError,
92
+ 404: ResourceNotFoundError,
93
+ 409: ResourceExistsError,
94
+ 304: ResourceNotModifiedError,
95
+ }
96
+ error_map.update(kwargs.pop("error_map", {}) or {})
97
+
98
+ def prepare_request(next_link=None):
99
+ if not next_link:
100
+
101
+ _request = build_operations_list_request(
102
+ api_version=self._config.api_version,
103
+ headers=_headers,
104
+ params=_params,
105
+ )
106
+ path_format_arguments = {
107
+ "endpoint": self._serialize.url(
108
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
109
+ ),
110
+ }
111
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
112
+
113
+ else:
114
+ # make call to next link with the client's api-version
115
+ _parsed_next_link = urllib.parse.urlparse(next_link)
116
+ _next_request_params = case_insensitive_dict(
117
+ {
118
+ key: [urllib.parse.quote(v) for v in value]
119
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
120
+ }
121
+ )
122
+ _next_request_params["api-version"] = self._config.api_version
123
+ _request = HttpRequest(
124
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
125
+ )
126
+ path_format_arguments = {
127
+ "endpoint": self._serialize.url(
128
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
129
+ ),
130
+ }
131
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
132
+
133
+ return _request
134
+
135
+ async def extract_data(pipeline_response):
136
+ deserialized = pipeline_response.http_response.json()
137
+ list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", []))
138
+ if cls:
139
+ list_of_elem = cls(list_of_elem) # type: ignore
140
+ return deserialized.get("nextLink") or None, AsyncList(list_of_elem)
141
+
142
+ async def get_next(next_link=None):
143
+ _request = prepare_request(next_link)
144
+
145
+ _stream = False
146
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
147
+ _request, stream=_stream, **kwargs
148
+ )
149
+ response = pipeline_response.http_response
150
+
151
+ if response.status_code not in [200]:
152
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
153
+ error = _failsafe_deserialize(
154
+ _models.ErrorResponse,
155
+ response,
156
+ )
157
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
158
+
159
+ return pipeline_response
160
+
161
+ return AsyncItemPaged(get_next, extract_data)
162
+
163
+
164
+ class AgriServiceOperations:
165
+ """
166
+ .. warning::
167
+ **DO NOT** instantiate this class directly.
168
+
169
+ Instead, you should access the following operations through
170
+ :class:`~azure.mgmt.agricultureplatform.aio.AgriculturePlatformMgmtClient`'s
171
+ :attr:`agri_service` attribute.
172
+ """
173
+
174
+ def __init__(self, *args, **kwargs) -> None:
175
+ input_args = list(args)
176
+ self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
177
+ self._config: AgriculturePlatformMgmtClientConfiguration = (
178
+ input_args.pop(0) if input_args else kwargs.pop("config")
179
+ )
180
+ self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
181
+ self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
182
+
183
+ @distributed_trace_async
184
+ async def get(
185
+ self, resource_group_name: str, agri_service_resource_name: str, **kwargs: Any
186
+ ) -> _models.AgriServiceResource:
187
+ """Get a AgriServiceResource.
188
+
189
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
190
+ Required.
191
+ :type resource_group_name: str
192
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
193
+ :type agri_service_resource_name: str
194
+ :return: AgriServiceResource. The AgriServiceResource is compatible with MutableMapping
195
+ :rtype: ~azure.mgmt.agricultureplatform.models.AgriServiceResource
196
+ :raises ~azure.core.exceptions.HttpResponseError:
197
+ """
198
+ error_map: MutableMapping = {
199
+ 401: ClientAuthenticationError,
200
+ 404: ResourceNotFoundError,
201
+ 409: ResourceExistsError,
202
+ 304: ResourceNotModifiedError,
203
+ }
204
+ error_map.update(kwargs.pop("error_map", {}) or {})
205
+
206
+ _headers = kwargs.pop("headers", {}) or {}
207
+ _params = kwargs.pop("params", {}) or {}
208
+
209
+ cls: ClsType[_models.AgriServiceResource] = kwargs.pop("cls", None)
210
+
211
+ _request = build_agri_service_get_request(
212
+ resource_group_name=resource_group_name,
213
+ agri_service_resource_name=agri_service_resource_name,
214
+ subscription_id=self._config.subscription_id,
215
+ api_version=self._config.api_version,
216
+ headers=_headers,
217
+ params=_params,
218
+ )
219
+ path_format_arguments = {
220
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
221
+ }
222
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
223
+
224
+ _stream = kwargs.pop("stream", False)
225
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
226
+ _request, stream=_stream, **kwargs
227
+ )
228
+
229
+ response = pipeline_response.http_response
230
+
231
+ if response.status_code not in [200]:
232
+ if _stream:
233
+ try:
234
+ await response.read() # Load the body in memory and close the socket
235
+ except (StreamConsumedError, StreamClosedError):
236
+ pass
237
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
238
+ error = _failsafe_deserialize(
239
+ _models.ErrorResponse,
240
+ response,
241
+ )
242
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
243
+
244
+ if _stream:
245
+ deserialized = response.iter_bytes()
246
+ else:
247
+ deserialized = _deserialize(_models.AgriServiceResource, response.json())
248
+
249
+ if cls:
250
+ return cls(pipeline_response, deserialized, {}) # type: ignore
251
+
252
+ return deserialized # type: ignore
253
+
254
+ async def _create_or_update_initial(
255
+ self,
256
+ resource_group_name: str,
257
+ agri_service_resource_name: str,
258
+ resource: Union[_models.AgriServiceResource, JSON, IO[bytes]],
259
+ **kwargs: Any
260
+ ) -> AsyncIterator[bytes]:
261
+ error_map: MutableMapping = {
262
+ 401: ClientAuthenticationError,
263
+ 404: ResourceNotFoundError,
264
+ 409: ResourceExistsError,
265
+ 304: ResourceNotModifiedError,
266
+ }
267
+ error_map.update(kwargs.pop("error_map", {}) or {})
268
+
269
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
270
+ _params = kwargs.pop("params", {}) or {}
271
+
272
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
273
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
274
+
275
+ content_type = content_type or "application/json"
276
+ _content = None
277
+ if isinstance(resource, (IOBase, bytes)):
278
+ _content = resource
279
+ else:
280
+ _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
281
+
282
+ _request = build_agri_service_create_or_update_request(
283
+ resource_group_name=resource_group_name,
284
+ agri_service_resource_name=agri_service_resource_name,
285
+ subscription_id=self._config.subscription_id,
286
+ content_type=content_type,
287
+ api_version=self._config.api_version,
288
+ content=_content,
289
+ headers=_headers,
290
+ params=_params,
291
+ )
292
+ path_format_arguments = {
293
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
294
+ }
295
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
296
+
297
+ _stream = True
298
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
299
+ _request, stream=_stream, **kwargs
300
+ )
301
+
302
+ response = pipeline_response.http_response
303
+
304
+ if response.status_code not in [200, 201]:
305
+ try:
306
+ await response.read() # Load the body in memory and close the socket
307
+ except (StreamConsumedError, StreamClosedError):
308
+ pass
309
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
310
+ error = _failsafe_deserialize(
311
+ _models.ErrorResponse,
312
+ response,
313
+ )
314
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
315
+
316
+ response_headers = {}
317
+ if response.status_code == 201:
318
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
319
+ "str", response.headers.get("Azure-AsyncOperation")
320
+ )
321
+ response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
322
+
323
+ deserialized = response.iter_bytes()
324
+
325
+ if cls:
326
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
327
+
328
+ return deserialized # type: ignore
329
+
330
+ @overload
331
+ async def begin_create_or_update(
332
+ self,
333
+ resource_group_name: str,
334
+ agri_service_resource_name: str,
335
+ resource: _models.AgriServiceResource,
336
+ *,
337
+ content_type: str = "application/json",
338
+ **kwargs: Any
339
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
340
+ """Create a AgriServiceResource.
341
+
342
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
343
+ Required.
344
+ :type resource_group_name: str
345
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
346
+ :type agri_service_resource_name: str
347
+ :param resource: Resource create parameters. Required.
348
+ :type resource: ~azure.mgmt.agricultureplatform.models.AgriServiceResource
349
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
350
+ Default value is "application/json".
351
+ :paramtype content_type: str
352
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
353
+ AgriServiceResource is compatible with MutableMapping
354
+ :rtype:
355
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
356
+ :raises ~azure.core.exceptions.HttpResponseError:
357
+ """
358
+
359
+ @overload
360
+ async def begin_create_or_update(
361
+ self,
362
+ resource_group_name: str,
363
+ agri_service_resource_name: str,
364
+ resource: JSON,
365
+ *,
366
+ content_type: str = "application/json",
367
+ **kwargs: Any
368
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
369
+ """Create a AgriServiceResource.
370
+
371
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
372
+ Required.
373
+ :type resource_group_name: str
374
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
375
+ :type agri_service_resource_name: str
376
+ :param resource: Resource create parameters. Required.
377
+ :type resource: JSON
378
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
379
+ Default value is "application/json".
380
+ :paramtype content_type: str
381
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
382
+ AgriServiceResource is compatible with MutableMapping
383
+ :rtype:
384
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
385
+ :raises ~azure.core.exceptions.HttpResponseError:
386
+ """
387
+
388
+ @overload
389
+ async def begin_create_or_update(
390
+ self,
391
+ resource_group_name: str,
392
+ agri_service_resource_name: str,
393
+ resource: IO[bytes],
394
+ *,
395
+ content_type: str = "application/json",
396
+ **kwargs: Any
397
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
398
+ """Create a AgriServiceResource.
399
+
400
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
401
+ Required.
402
+ :type resource_group_name: str
403
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
404
+ :type agri_service_resource_name: str
405
+ :param resource: Resource create parameters. Required.
406
+ :type resource: IO[bytes]
407
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
408
+ Default value is "application/json".
409
+ :paramtype content_type: str
410
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
411
+ AgriServiceResource is compatible with MutableMapping
412
+ :rtype:
413
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
414
+ :raises ~azure.core.exceptions.HttpResponseError:
415
+ """
416
+
417
+ @distributed_trace_async
418
+ async def begin_create_or_update(
419
+ self,
420
+ resource_group_name: str,
421
+ agri_service_resource_name: str,
422
+ resource: Union[_models.AgriServiceResource, JSON, IO[bytes]],
423
+ **kwargs: Any
424
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
425
+ """Create a AgriServiceResource.
426
+
427
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
428
+ Required.
429
+ :type resource_group_name: str
430
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
431
+ :type agri_service_resource_name: str
432
+ :param resource: Resource create parameters. Is one of the following types:
433
+ AgriServiceResource, JSON, IO[bytes] Required.
434
+ :type resource: ~azure.mgmt.agricultureplatform.models.AgriServiceResource or JSON or IO[bytes]
435
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
436
+ AgriServiceResource is compatible with MutableMapping
437
+ :rtype:
438
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
439
+ :raises ~azure.core.exceptions.HttpResponseError:
440
+ """
441
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
442
+ _params = kwargs.pop("params", {}) or {}
443
+
444
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
445
+ cls: ClsType[_models.AgriServiceResource] = kwargs.pop("cls", None)
446
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
447
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
448
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
449
+ if cont_token is None:
450
+ raw_result = await self._create_or_update_initial(
451
+ resource_group_name=resource_group_name,
452
+ agri_service_resource_name=agri_service_resource_name,
453
+ resource=resource,
454
+ content_type=content_type,
455
+ cls=lambda x, y, z: x,
456
+ headers=_headers,
457
+ params=_params,
458
+ **kwargs
459
+ )
460
+ await raw_result.http_response.read() # type: ignore
461
+ kwargs.pop("error_map", None)
462
+
463
+ def get_long_running_output(pipeline_response):
464
+ response = pipeline_response.http_response
465
+ deserialized = _deserialize(_models.AgriServiceResource, response.json())
466
+ if cls:
467
+ return cls(pipeline_response, deserialized, {}) # type: ignore
468
+ return deserialized
469
+
470
+ path_format_arguments = {
471
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
472
+ }
473
+
474
+ if polling is True:
475
+ polling_method: AsyncPollingMethod = cast(
476
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
477
+ )
478
+ elif polling is False:
479
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
480
+ else:
481
+ polling_method = polling
482
+ if cont_token:
483
+ return AsyncLROPoller[_models.AgriServiceResource].from_continuation_token(
484
+ polling_method=polling_method,
485
+ continuation_token=cont_token,
486
+ client=self._client,
487
+ deserialization_callback=get_long_running_output,
488
+ )
489
+ return AsyncLROPoller[_models.AgriServiceResource](
490
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
491
+ )
492
+
493
+ async def _update_initial(
494
+ self,
495
+ resource_group_name: str,
496
+ agri_service_resource_name: str,
497
+ properties: Union[_models.AgriServiceResourceUpdate, JSON, IO[bytes]],
498
+ **kwargs: Any
499
+ ) -> AsyncIterator[bytes]:
500
+ error_map: MutableMapping = {
501
+ 401: ClientAuthenticationError,
502
+ 404: ResourceNotFoundError,
503
+ 409: ResourceExistsError,
504
+ 304: ResourceNotModifiedError,
505
+ }
506
+ error_map.update(kwargs.pop("error_map", {}) or {})
507
+
508
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
509
+ _params = kwargs.pop("params", {}) or {}
510
+
511
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
512
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
513
+
514
+ content_type = content_type or "application/json"
515
+ _content = None
516
+ if isinstance(properties, (IOBase, bytes)):
517
+ _content = properties
518
+ else:
519
+ _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
520
+
521
+ _request = build_agri_service_update_request(
522
+ resource_group_name=resource_group_name,
523
+ agri_service_resource_name=agri_service_resource_name,
524
+ subscription_id=self._config.subscription_id,
525
+ content_type=content_type,
526
+ api_version=self._config.api_version,
527
+ content=_content,
528
+ headers=_headers,
529
+ params=_params,
530
+ )
531
+ path_format_arguments = {
532
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
533
+ }
534
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
535
+
536
+ _stream = True
537
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
538
+ _request, stream=_stream, **kwargs
539
+ )
540
+
541
+ response = pipeline_response.http_response
542
+
543
+ if response.status_code not in [200, 202]:
544
+ try:
545
+ await response.read() # Load the body in memory and close the socket
546
+ except (StreamConsumedError, StreamClosedError):
547
+ pass
548
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
549
+ error = _failsafe_deserialize(
550
+ _models.ErrorResponse,
551
+ response,
552
+ )
553
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
554
+
555
+ response_headers = {}
556
+ if response.status_code == 202:
557
+ response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
558
+ response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
559
+
560
+ deserialized = response.iter_bytes()
561
+
562
+ if cls:
563
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
564
+
565
+ return deserialized # type: ignore
566
+
567
+ @overload
568
+ async def begin_update(
569
+ self,
570
+ resource_group_name: str,
571
+ agri_service_resource_name: str,
572
+ properties: _models.AgriServiceResourceUpdate,
573
+ *,
574
+ content_type: str = "application/json",
575
+ **kwargs: Any
576
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
577
+ """Update a AgriServiceResource.
578
+
579
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
580
+ Required.
581
+ :type resource_group_name: str
582
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
583
+ :type agri_service_resource_name: str
584
+ :param properties: The resource properties to be updated. Required.
585
+ :type properties: ~azure.mgmt.agricultureplatform.models.AgriServiceResourceUpdate
586
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
587
+ Default value is "application/json".
588
+ :paramtype content_type: str
589
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
590
+ AgriServiceResource is compatible with MutableMapping
591
+ :rtype:
592
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
593
+ :raises ~azure.core.exceptions.HttpResponseError:
594
+ """
595
+
596
+ @overload
597
+ async def begin_update(
598
+ self,
599
+ resource_group_name: str,
600
+ agri_service_resource_name: str,
601
+ properties: JSON,
602
+ *,
603
+ content_type: str = "application/json",
604
+ **kwargs: Any
605
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
606
+ """Update a AgriServiceResource.
607
+
608
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
609
+ Required.
610
+ :type resource_group_name: str
611
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
612
+ :type agri_service_resource_name: str
613
+ :param properties: The resource properties to be updated. Required.
614
+ :type properties: JSON
615
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
616
+ Default value is "application/json".
617
+ :paramtype content_type: str
618
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
619
+ AgriServiceResource is compatible with MutableMapping
620
+ :rtype:
621
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
622
+ :raises ~azure.core.exceptions.HttpResponseError:
623
+ """
624
+
625
+ @overload
626
+ async def begin_update(
627
+ self,
628
+ resource_group_name: str,
629
+ agri_service_resource_name: str,
630
+ properties: IO[bytes],
631
+ *,
632
+ content_type: str = "application/json",
633
+ **kwargs: Any
634
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
635
+ """Update a AgriServiceResource.
636
+
637
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
638
+ Required.
639
+ :type resource_group_name: str
640
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
641
+ :type agri_service_resource_name: str
642
+ :param properties: The resource properties to be updated. Required.
643
+ :type properties: IO[bytes]
644
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
645
+ Default value is "application/json".
646
+ :paramtype content_type: str
647
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
648
+ AgriServiceResource is compatible with MutableMapping
649
+ :rtype:
650
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
651
+ :raises ~azure.core.exceptions.HttpResponseError:
652
+ """
653
+
654
+ @distributed_trace_async
655
+ async def begin_update(
656
+ self,
657
+ resource_group_name: str,
658
+ agri_service_resource_name: str,
659
+ properties: Union[_models.AgriServiceResourceUpdate, JSON, IO[bytes]],
660
+ **kwargs: Any
661
+ ) -> AsyncLROPoller[_models.AgriServiceResource]:
662
+ """Update a AgriServiceResource.
663
+
664
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
665
+ Required.
666
+ :type resource_group_name: str
667
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
668
+ :type agri_service_resource_name: str
669
+ :param properties: The resource properties to be updated. Is one of the following types:
670
+ AgriServiceResourceUpdate, JSON, IO[bytes] Required.
671
+ :type properties: ~azure.mgmt.agricultureplatform.models.AgriServiceResourceUpdate or JSON or
672
+ IO[bytes]
673
+ :return: An instance of AsyncLROPoller that returns AgriServiceResource. The
674
+ AgriServiceResource is compatible with MutableMapping
675
+ :rtype:
676
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
677
+ :raises ~azure.core.exceptions.HttpResponseError:
678
+ """
679
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
680
+ _params = kwargs.pop("params", {}) or {}
681
+
682
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
683
+ cls: ClsType[_models.AgriServiceResource] = kwargs.pop("cls", None)
684
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
685
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
686
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
687
+ if cont_token is None:
688
+ raw_result = await self._update_initial(
689
+ resource_group_name=resource_group_name,
690
+ agri_service_resource_name=agri_service_resource_name,
691
+ properties=properties,
692
+ content_type=content_type,
693
+ cls=lambda x, y, z: x,
694
+ headers=_headers,
695
+ params=_params,
696
+ **kwargs
697
+ )
698
+ await raw_result.http_response.read() # type: ignore
699
+ kwargs.pop("error_map", None)
700
+
701
+ def get_long_running_output(pipeline_response):
702
+ response = pipeline_response.http_response
703
+ deserialized = _deserialize(_models.AgriServiceResource, response.json())
704
+ if cls:
705
+ return cls(pipeline_response, deserialized, {}) # type: ignore
706
+ return deserialized
707
+
708
+ path_format_arguments = {
709
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
710
+ }
711
+
712
+ if polling is True:
713
+ polling_method: AsyncPollingMethod = cast(
714
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
715
+ )
716
+ elif polling is False:
717
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
718
+ else:
719
+ polling_method = polling
720
+ if cont_token:
721
+ return AsyncLROPoller[_models.AgriServiceResource].from_continuation_token(
722
+ polling_method=polling_method,
723
+ continuation_token=cont_token,
724
+ client=self._client,
725
+ deserialization_callback=get_long_running_output,
726
+ )
727
+ return AsyncLROPoller[_models.AgriServiceResource](
728
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
729
+ )
730
+
731
+ async def _delete_initial(
732
+ self, resource_group_name: str, agri_service_resource_name: str, **kwargs: Any
733
+ ) -> AsyncIterator[bytes]:
734
+ error_map: MutableMapping = {
735
+ 401: ClientAuthenticationError,
736
+ 404: ResourceNotFoundError,
737
+ 409: ResourceExistsError,
738
+ 304: ResourceNotModifiedError,
739
+ }
740
+ error_map.update(kwargs.pop("error_map", {}) or {})
741
+
742
+ _headers = kwargs.pop("headers", {}) or {}
743
+ _params = kwargs.pop("params", {}) or {}
744
+
745
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
746
+
747
+ _request = build_agri_service_delete_request(
748
+ resource_group_name=resource_group_name,
749
+ agri_service_resource_name=agri_service_resource_name,
750
+ subscription_id=self._config.subscription_id,
751
+ api_version=self._config.api_version,
752
+ headers=_headers,
753
+ params=_params,
754
+ )
755
+ path_format_arguments = {
756
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
757
+ }
758
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
759
+
760
+ _stream = True
761
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
762
+ _request, stream=_stream, **kwargs
763
+ )
764
+
765
+ response = pipeline_response.http_response
766
+
767
+ if response.status_code not in [202, 204]:
768
+ try:
769
+ await response.read() # Load the body in memory and close the socket
770
+ except (StreamConsumedError, StreamClosedError):
771
+ pass
772
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
773
+ error = _failsafe_deserialize(
774
+ _models.ErrorResponse,
775
+ response,
776
+ )
777
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
778
+
779
+ response_headers = {}
780
+ if response.status_code == 202:
781
+ response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
782
+ response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After"))
783
+
784
+ deserialized = response.iter_bytes()
785
+
786
+ if cls:
787
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
788
+
789
+ return deserialized # type: ignore
790
+
791
+ @distributed_trace_async
792
+ async def begin_delete(
793
+ self, resource_group_name: str, agri_service_resource_name: str, **kwargs: Any
794
+ ) -> AsyncLROPoller[None]:
795
+ """Delete a AgriServiceResource.
796
+
797
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
798
+ Required.
799
+ :type resource_group_name: str
800
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
801
+ :type agri_service_resource_name: str
802
+ :return: An instance of AsyncLROPoller that returns None
803
+ :rtype: ~azure.core.polling.AsyncLROPoller[None]
804
+ :raises ~azure.core.exceptions.HttpResponseError:
805
+ """
806
+ _headers = kwargs.pop("headers", {}) or {}
807
+ _params = kwargs.pop("params", {}) or {}
808
+
809
+ cls: ClsType[None] = kwargs.pop("cls", None)
810
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
811
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
812
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
813
+ if cont_token is None:
814
+ raw_result = await self._delete_initial(
815
+ resource_group_name=resource_group_name,
816
+ agri_service_resource_name=agri_service_resource_name,
817
+ cls=lambda x, y, z: x,
818
+ headers=_headers,
819
+ params=_params,
820
+ **kwargs
821
+ )
822
+ await raw_result.http_response.read() # type: ignore
823
+ kwargs.pop("error_map", None)
824
+
825
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
826
+ if cls:
827
+ return cls(pipeline_response, None, {}) # type: ignore
828
+
829
+ path_format_arguments = {
830
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
831
+ }
832
+
833
+ if polling is True:
834
+ polling_method: AsyncPollingMethod = cast(
835
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
836
+ )
837
+ elif polling is False:
838
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
839
+ else:
840
+ polling_method = polling
841
+ if cont_token:
842
+ return AsyncLROPoller[None].from_continuation_token(
843
+ polling_method=polling_method,
844
+ continuation_token=cont_token,
845
+ client=self._client,
846
+ deserialization_callback=get_long_running_output,
847
+ )
848
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
849
+
850
+ @distributed_trace
851
+ def list_by_resource_group(
852
+ self, resource_group_name: str, **kwargs: Any
853
+ ) -> AsyncItemPaged["_models.AgriServiceResource"]:
854
+ """List AgriServiceResource resources by resource group.
855
+
856
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
857
+ Required.
858
+ :type resource_group_name: str
859
+ :return: An iterator like instance of AgriServiceResource
860
+ :rtype:
861
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
862
+ :raises ~azure.core.exceptions.HttpResponseError:
863
+ """
864
+ _headers = kwargs.pop("headers", {}) or {}
865
+ _params = kwargs.pop("params", {}) or {}
866
+
867
+ cls: ClsType[List[_models.AgriServiceResource]] = kwargs.pop("cls", None)
868
+
869
+ error_map: MutableMapping = {
870
+ 401: ClientAuthenticationError,
871
+ 404: ResourceNotFoundError,
872
+ 409: ResourceExistsError,
873
+ 304: ResourceNotModifiedError,
874
+ }
875
+ error_map.update(kwargs.pop("error_map", {}) or {})
876
+
877
+ def prepare_request(next_link=None):
878
+ if not next_link:
879
+
880
+ _request = build_agri_service_list_by_resource_group_request(
881
+ resource_group_name=resource_group_name,
882
+ subscription_id=self._config.subscription_id,
883
+ api_version=self._config.api_version,
884
+ headers=_headers,
885
+ params=_params,
886
+ )
887
+ path_format_arguments = {
888
+ "endpoint": self._serialize.url(
889
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
890
+ ),
891
+ }
892
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
893
+
894
+ else:
895
+ # make call to next link with the client's api-version
896
+ _parsed_next_link = urllib.parse.urlparse(next_link)
897
+ _next_request_params = case_insensitive_dict(
898
+ {
899
+ key: [urllib.parse.quote(v) for v in value]
900
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
901
+ }
902
+ )
903
+ _next_request_params["api-version"] = self._config.api_version
904
+ _request = HttpRequest(
905
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
906
+ )
907
+ path_format_arguments = {
908
+ "endpoint": self._serialize.url(
909
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
910
+ ),
911
+ }
912
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
913
+
914
+ return _request
915
+
916
+ async def extract_data(pipeline_response):
917
+ deserialized = pipeline_response.http_response.json()
918
+ list_of_elem = _deserialize(List[_models.AgriServiceResource], deserialized.get("value", []))
919
+ if cls:
920
+ list_of_elem = cls(list_of_elem) # type: ignore
921
+ return deserialized.get("nextLink") or None, AsyncList(list_of_elem)
922
+
923
+ async def get_next(next_link=None):
924
+ _request = prepare_request(next_link)
925
+
926
+ _stream = False
927
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
928
+ _request, stream=_stream, **kwargs
929
+ )
930
+ response = pipeline_response.http_response
931
+
932
+ if response.status_code not in [200]:
933
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
934
+ error = _failsafe_deserialize(
935
+ _models.ErrorResponse,
936
+ response,
937
+ )
938
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
939
+
940
+ return pipeline_response
941
+
942
+ return AsyncItemPaged(get_next, extract_data)
943
+
944
+ @distributed_trace
945
+ def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.AgriServiceResource"]:
946
+ """List AgriServiceResource resources by subscription ID.
947
+
948
+ :return: An iterator like instance of AgriServiceResource
949
+ :rtype:
950
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agricultureplatform.models.AgriServiceResource]
951
+ :raises ~azure.core.exceptions.HttpResponseError:
952
+ """
953
+ _headers = kwargs.pop("headers", {}) or {}
954
+ _params = kwargs.pop("params", {}) or {}
955
+
956
+ cls: ClsType[List[_models.AgriServiceResource]] = kwargs.pop("cls", None)
957
+
958
+ error_map: MutableMapping = {
959
+ 401: ClientAuthenticationError,
960
+ 404: ResourceNotFoundError,
961
+ 409: ResourceExistsError,
962
+ 304: ResourceNotModifiedError,
963
+ }
964
+ error_map.update(kwargs.pop("error_map", {}) or {})
965
+
966
+ def prepare_request(next_link=None):
967
+ if not next_link:
968
+
969
+ _request = build_agri_service_list_by_subscription_request(
970
+ subscription_id=self._config.subscription_id,
971
+ api_version=self._config.api_version,
972
+ headers=_headers,
973
+ params=_params,
974
+ )
975
+ path_format_arguments = {
976
+ "endpoint": self._serialize.url(
977
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
978
+ ),
979
+ }
980
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
981
+
982
+ else:
983
+ # make call to next link with the client's api-version
984
+ _parsed_next_link = urllib.parse.urlparse(next_link)
985
+ _next_request_params = case_insensitive_dict(
986
+ {
987
+ key: [urllib.parse.quote(v) for v in value]
988
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
989
+ }
990
+ )
991
+ _next_request_params["api-version"] = self._config.api_version
992
+ _request = HttpRequest(
993
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
994
+ )
995
+ path_format_arguments = {
996
+ "endpoint": self._serialize.url(
997
+ "self._config.base_url", self._config.base_url, "str", skip_quote=True
998
+ ),
999
+ }
1000
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
1001
+
1002
+ return _request
1003
+
1004
+ async def extract_data(pipeline_response):
1005
+ deserialized = pipeline_response.http_response.json()
1006
+ list_of_elem = _deserialize(List[_models.AgriServiceResource], deserialized.get("value", []))
1007
+ if cls:
1008
+ list_of_elem = cls(list_of_elem) # type: ignore
1009
+ return deserialized.get("nextLink") or None, AsyncList(list_of_elem)
1010
+
1011
+ async def get_next(next_link=None):
1012
+ _request = prepare_request(next_link)
1013
+
1014
+ _stream = False
1015
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1016
+ _request, stream=_stream, **kwargs
1017
+ )
1018
+ response = pipeline_response.http_response
1019
+
1020
+ if response.status_code not in [200]:
1021
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
1022
+ error = _failsafe_deserialize(
1023
+ _models.ErrorResponse,
1024
+ response,
1025
+ )
1026
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
1027
+
1028
+ return pipeline_response
1029
+
1030
+ return AsyncItemPaged(get_next, extract_data)
1031
+
1032
+ @distributed_trace_async
1033
+ async def list_available_solutions(
1034
+ self, resource_group_name: str, agri_service_resource_name: str, **kwargs: Any
1035
+ ) -> _models.AvailableAgriSolutionListResult:
1036
+ """Returns the list of available agri solutions.
1037
+
1038
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
1039
+ Required.
1040
+ :type resource_group_name: str
1041
+ :param agri_service_resource_name: The name of the AgriService resource. Required.
1042
+ :type agri_service_resource_name: str
1043
+ :return: AvailableAgriSolutionListResult. The AvailableAgriSolutionListResult is compatible
1044
+ with MutableMapping
1045
+ :rtype: ~azure.mgmt.agricultureplatform.models.AvailableAgriSolutionListResult
1046
+ :raises ~azure.core.exceptions.HttpResponseError:
1047
+ """
1048
+ error_map: MutableMapping = {
1049
+ 401: ClientAuthenticationError,
1050
+ 404: ResourceNotFoundError,
1051
+ 409: ResourceExistsError,
1052
+ 304: ResourceNotModifiedError,
1053
+ }
1054
+ error_map.update(kwargs.pop("error_map", {}) or {})
1055
+
1056
+ _headers = kwargs.pop("headers", {}) or {}
1057
+ _params = kwargs.pop("params", {}) or {}
1058
+
1059
+ cls: ClsType[_models.AvailableAgriSolutionListResult] = kwargs.pop("cls", None)
1060
+
1061
+ _request = build_agri_service_list_available_solutions_request(
1062
+ resource_group_name=resource_group_name,
1063
+ agri_service_resource_name=agri_service_resource_name,
1064
+ subscription_id=self._config.subscription_id,
1065
+ api_version=self._config.api_version,
1066
+ headers=_headers,
1067
+ params=_params,
1068
+ )
1069
+ path_format_arguments = {
1070
+ "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
1071
+ }
1072
+ _request.url = self._client.format_url(_request.url, **path_format_arguments)
1073
+
1074
+ _stream = kwargs.pop("stream", False)
1075
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
1076
+ _request, stream=_stream, **kwargs
1077
+ )
1078
+
1079
+ response = pipeline_response.http_response
1080
+
1081
+ if response.status_code not in [200]:
1082
+ if _stream:
1083
+ try:
1084
+ await response.read() # Load the body in memory and close the socket
1085
+ except (StreamConsumedError, StreamClosedError):
1086
+ pass
1087
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
1088
+ error = _failsafe_deserialize(
1089
+ _models.ErrorResponse,
1090
+ response,
1091
+ )
1092
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
1093
+
1094
+ if _stream:
1095
+ deserialized = response.iter_bytes()
1096
+ else:
1097
+ deserialized = _deserialize(_models.AvailableAgriSolutionListResult, response.json())
1098
+
1099
+ if cls:
1100
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1101
+
1102
+ return deserialized # type: ignore