openmeter 1.0.0b121__py3-none-any.whl → 1.0.0b122__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.
Potentially problematic release.
This version of openmeter might be problematic. Click here for more details.
- openmeter/_operations/_operations.py +1419 -1
- openmeter/aio/_operations/_operations.py +1161 -1
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b122.dist-info}/METADATA +1 -1
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b122.dist-info}/RECORD +5 -5
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b122.dist-info}/WHEEL +0 -0
|
@@ -27,10 +27,14 @@ from ..._operations._operations import (
|
|
|
27
27
|
build_create_feature_request,
|
|
28
28
|
build_create_grant_request,
|
|
29
29
|
build_create_meter_request,
|
|
30
|
+
build_create_notification_channel_request,
|
|
31
|
+
build_create_notification_rule_request,
|
|
30
32
|
build_create_portal_token_request,
|
|
31
33
|
build_delete_entitlement_request,
|
|
32
34
|
build_delete_feature_request,
|
|
33
35
|
build_delete_meter_request,
|
|
36
|
+
build_delete_notification_channel_request,
|
|
37
|
+
build_delete_notification_rule_request,
|
|
34
38
|
build_delete_subject_request,
|
|
35
39
|
build_get_debug_metrics_request,
|
|
36
40
|
build_get_entitlement_history_request,
|
|
@@ -38,6 +42,9 @@ from ..._operations._operations import (
|
|
|
38
42
|
build_get_entitlement_value_request,
|
|
39
43
|
build_get_feature_request,
|
|
40
44
|
build_get_meter_request,
|
|
45
|
+
build_get_notification_channel_request,
|
|
46
|
+
build_get_notification_event_request,
|
|
47
|
+
build_get_notification_rule_request,
|
|
41
48
|
build_get_subject_request,
|
|
42
49
|
build_ingest_events_request,
|
|
43
50
|
build_invalidate_portal_tokens_request,
|
|
@@ -48,12 +55,17 @@ from ..._operations._operations import (
|
|
|
48
55
|
build_list_grants_request,
|
|
49
56
|
build_list_meter_subjects_request,
|
|
50
57
|
build_list_meters_request,
|
|
58
|
+
build_list_notification_channels_request,
|
|
59
|
+
build_list_notification_events_request,
|
|
60
|
+
build_list_notification_rules_request,
|
|
51
61
|
build_list_portal_tokens_request,
|
|
52
62
|
build_list_subject_entitlements_request,
|
|
53
63
|
build_list_subjects_request,
|
|
54
64
|
build_query_meter_request,
|
|
55
65
|
build_query_portal_meter_request,
|
|
56
66
|
build_reset_entitlement_usage_request,
|
|
67
|
+
build_update_notification_channel_request,
|
|
68
|
+
build_update_notification_rule_request,
|
|
57
69
|
build_upsert_subject_request,
|
|
58
70
|
build_void_grant_request,
|
|
59
71
|
)
|
|
@@ -844,7 +856,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
844
856
|
:paramtype window_time_zone: str
|
|
845
857
|
:keyword subject: Filtering by multiple subjects.
|
|
846
858
|
|
|
847
|
-
Usage:
|
|
859
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
848
860
|
:paramtype subject: list[str]
|
|
849
861
|
:keyword filter_group_by: Default value is None.
|
|
850
862
|
:paramtype filter_group_by: dict[str, str]
|
|
@@ -4245,3 +4257,1151 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4245
4257
|
return cls(pipeline_response, cast(str, deserialized), {}) # type: ignore
|
|
4246
4258
|
|
|
4247
4259
|
return cast(str, deserialized) # type: ignore
|
|
4260
|
+
|
|
4261
|
+
@distributed_trace_async
|
|
4262
|
+
async def list_notification_channels(
|
|
4263
|
+
self, *, limit: int = 1000, offset: int = 0, order_by: str = "id", include_disabled: bool = False, **kwargs: Any
|
|
4264
|
+
) -> List[JSON]:
|
|
4265
|
+
"""List notification channels.
|
|
4266
|
+
|
|
4267
|
+
List all notification channels.
|
|
4268
|
+
|
|
4269
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
4270
|
+
:paramtype limit: int
|
|
4271
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
4272
|
+
:paramtype offset: int
|
|
4273
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
4274
|
+
"updatedAt". Default value is "id".
|
|
4275
|
+
:paramtype order_by: str
|
|
4276
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
4277
|
+
:paramtype include_disabled: bool
|
|
4278
|
+
:return: list of JSON object
|
|
4279
|
+
:rtype: list[JSON]
|
|
4280
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4281
|
+
|
|
4282
|
+
Example:
|
|
4283
|
+
.. code-block:: python
|
|
4284
|
+
|
|
4285
|
+
# response body for status code(s): 200
|
|
4286
|
+
response == [
|
|
4287
|
+
{}
|
|
4288
|
+
]
|
|
4289
|
+
"""
|
|
4290
|
+
error_map = {
|
|
4291
|
+
404: ResourceNotFoundError,
|
|
4292
|
+
409: ResourceExistsError,
|
|
4293
|
+
304: ResourceNotModifiedError,
|
|
4294
|
+
400: HttpResponseError,
|
|
4295
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4296
|
+
}
|
|
4297
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4298
|
+
|
|
4299
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
4300
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4301
|
+
|
|
4302
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
4303
|
+
|
|
4304
|
+
_request = build_list_notification_channels_request(
|
|
4305
|
+
limit=limit,
|
|
4306
|
+
offset=offset,
|
|
4307
|
+
order_by=order_by,
|
|
4308
|
+
include_disabled=include_disabled,
|
|
4309
|
+
headers=_headers,
|
|
4310
|
+
params=_params,
|
|
4311
|
+
)
|
|
4312
|
+
_request.url = self._client.format_url(_request.url)
|
|
4313
|
+
|
|
4314
|
+
_stream = False
|
|
4315
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4316
|
+
_request, stream=_stream, **kwargs
|
|
4317
|
+
)
|
|
4318
|
+
|
|
4319
|
+
response = pipeline_response.http_response
|
|
4320
|
+
|
|
4321
|
+
if response.status_code not in [200]:
|
|
4322
|
+
if _stream:
|
|
4323
|
+
await response.read() # Load the body in memory and close the socket
|
|
4324
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4325
|
+
raise HttpResponseError(response=response)
|
|
4326
|
+
|
|
4327
|
+
if response.content:
|
|
4328
|
+
deserialized = response.json()
|
|
4329
|
+
else:
|
|
4330
|
+
deserialized = None
|
|
4331
|
+
|
|
4332
|
+
if cls:
|
|
4333
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
4334
|
+
|
|
4335
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
4336
|
+
|
|
4337
|
+
@overload
|
|
4338
|
+
async def create_notification_channel(
|
|
4339
|
+
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
4340
|
+
) -> JSON:
|
|
4341
|
+
"""Create a notification channel.
|
|
4342
|
+
|
|
4343
|
+
Create a new notification channel.
|
|
4344
|
+
|
|
4345
|
+
:param body: The notification channel to create. Required.
|
|
4346
|
+
:type body: JSON
|
|
4347
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
4348
|
+
Default value is "application/json".
|
|
4349
|
+
:paramtype content_type: str
|
|
4350
|
+
:return: JSON object
|
|
4351
|
+
:rtype: JSON
|
|
4352
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4353
|
+
|
|
4354
|
+
Example:
|
|
4355
|
+
.. code-block:: python
|
|
4356
|
+
|
|
4357
|
+
# JSON input template you can fill out and use as your body input.
|
|
4358
|
+
body = {}
|
|
4359
|
+
|
|
4360
|
+
# response body for status code(s): 409
|
|
4361
|
+
response == {
|
|
4362
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4363
|
+
of the problem. Required.
|
|
4364
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4365
|
+
occurrence of the problem. Required.
|
|
4366
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4367
|
+
Required.
|
|
4368
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4369
|
+
Required.
|
|
4370
|
+
"extensions": {
|
|
4371
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4372
|
+
Required.
|
|
4373
|
+
},
|
|
4374
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4375
|
+
occurrence of the problem.
|
|
4376
|
+
}
|
|
4377
|
+
"""
|
|
4378
|
+
|
|
4379
|
+
@overload
|
|
4380
|
+
async def create_notification_channel(
|
|
4381
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
4382
|
+
) -> JSON:
|
|
4383
|
+
"""Create a notification channel.
|
|
4384
|
+
|
|
4385
|
+
Create a new notification channel.
|
|
4386
|
+
|
|
4387
|
+
:param body: The notification channel to create. Required.
|
|
4388
|
+
:type body: IO[bytes]
|
|
4389
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
4390
|
+
Default value is "application/json".
|
|
4391
|
+
:paramtype content_type: str
|
|
4392
|
+
:return: JSON object
|
|
4393
|
+
:rtype: JSON
|
|
4394
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4395
|
+
|
|
4396
|
+
Example:
|
|
4397
|
+
.. code-block:: python
|
|
4398
|
+
|
|
4399
|
+
# response body for status code(s): 409
|
|
4400
|
+
response == {
|
|
4401
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4402
|
+
of the problem. Required.
|
|
4403
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4404
|
+
occurrence of the problem. Required.
|
|
4405
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4406
|
+
Required.
|
|
4407
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4408
|
+
Required.
|
|
4409
|
+
"extensions": {
|
|
4410
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4411
|
+
Required.
|
|
4412
|
+
},
|
|
4413
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4414
|
+
occurrence of the problem.
|
|
4415
|
+
}
|
|
4416
|
+
"""
|
|
4417
|
+
|
|
4418
|
+
@distributed_trace_async
|
|
4419
|
+
async def create_notification_channel(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
4420
|
+
"""Create a notification channel.
|
|
4421
|
+
|
|
4422
|
+
Create a new notification channel.
|
|
4423
|
+
|
|
4424
|
+
:param body: The notification channel to create. Is either a JSON type or a IO[bytes] type.
|
|
4425
|
+
Required.
|
|
4426
|
+
:type body: JSON or IO[bytes]
|
|
4427
|
+
:return: JSON object
|
|
4428
|
+
:rtype: JSON
|
|
4429
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4430
|
+
|
|
4431
|
+
Example:
|
|
4432
|
+
.. code-block:: python
|
|
4433
|
+
|
|
4434
|
+
# JSON input template you can fill out and use as your body input.
|
|
4435
|
+
body = {}
|
|
4436
|
+
|
|
4437
|
+
# response body for status code(s): 409
|
|
4438
|
+
response == {
|
|
4439
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4440
|
+
of the problem. Required.
|
|
4441
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4442
|
+
occurrence of the problem. Required.
|
|
4443
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4444
|
+
Required.
|
|
4445
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4446
|
+
Required.
|
|
4447
|
+
"extensions": {
|
|
4448
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4449
|
+
Required.
|
|
4450
|
+
},
|
|
4451
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4452
|
+
occurrence of the problem.
|
|
4453
|
+
}
|
|
4454
|
+
"""
|
|
4455
|
+
error_map = {
|
|
4456
|
+
404: ResourceNotFoundError,
|
|
4457
|
+
409: ResourceExistsError,
|
|
4458
|
+
304: ResourceNotModifiedError,
|
|
4459
|
+
400: HttpResponseError,
|
|
4460
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4461
|
+
}
|
|
4462
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4463
|
+
|
|
4464
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
4465
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4466
|
+
|
|
4467
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
4468
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
4469
|
+
|
|
4470
|
+
content_type = content_type or "application/json"
|
|
4471
|
+
_json = None
|
|
4472
|
+
_content = None
|
|
4473
|
+
if isinstance(body, (IOBase, bytes)):
|
|
4474
|
+
_content = body
|
|
4475
|
+
else:
|
|
4476
|
+
_json = body
|
|
4477
|
+
|
|
4478
|
+
_request = build_create_notification_channel_request(
|
|
4479
|
+
content_type=content_type,
|
|
4480
|
+
json=_json,
|
|
4481
|
+
content=_content,
|
|
4482
|
+
headers=_headers,
|
|
4483
|
+
params=_params,
|
|
4484
|
+
)
|
|
4485
|
+
_request.url = self._client.format_url(_request.url)
|
|
4486
|
+
|
|
4487
|
+
_stream = False
|
|
4488
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4489
|
+
_request, stream=_stream, **kwargs
|
|
4490
|
+
)
|
|
4491
|
+
|
|
4492
|
+
response = pipeline_response.http_response
|
|
4493
|
+
|
|
4494
|
+
if response.status_code not in [201, 409]:
|
|
4495
|
+
if _stream:
|
|
4496
|
+
await response.read() # Load the body in memory and close the socket
|
|
4497
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4498
|
+
raise HttpResponseError(response=response)
|
|
4499
|
+
|
|
4500
|
+
if response.status_code == 201:
|
|
4501
|
+
if response.content:
|
|
4502
|
+
deserialized = response.json()
|
|
4503
|
+
else:
|
|
4504
|
+
deserialized = None
|
|
4505
|
+
|
|
4506
|
+
if response.status_code == 409:
|
|
4507
|
+
if response.content:
|
|
4508
|
+
deserialized = response.json()
|
|
4509
|
+
else:
|
|
4510
|
+
deserialized = None
|
|
4511
|
+
|
|
4512
|
+
if cls:
|
|
4513
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
4514
|
+
|
|
4515
|
+
return cast(JSON, deserialized) # type: ignore
|
|
4516
|
+
|
|
4517
|
+
@distributed_trace_async
|
|
4518
|
+
async def get_notification_channel(self, channel_id: str, **kwargs: Any) -> JSON:
|
|
4519
|
+
"""Get notification channel.
|
|
4520
|
+
|
|
4521
|
+
Get a notification channel by id.
|
|
4522
|
+
|
|
4523
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
4524
|
+
:type channel_id: str
|
|
4525
|
+
:return: JSON object
|
|
4526
|
+
:rtype: JSON
|
|
4527
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4528
|
+
"""
|
|
4529
|
+
error_map = {
|
|
4530
|
+
409: ResourceExistsError,
|
|
4531
|
+
304: ResourceNotModifiedError,
|
|
4532
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4533
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
4534
|
+
}
|
|
4535
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4536
|
+
|
|
4537
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
4538
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4539
|
+
|
|
4540
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
4541
|
+
|
|
4542
|
+
_request = build_get_notification_channel_request(
|
|
4543
|
+
channel_id=channel_id,
|
|
4544
|
+
headers=_headers,
|
|
4545
|
+
params=_params,
|
|
4546
|
+
)
|
|
4547
|
+
_request.url = self._client.format_url(_request.url)
|
|
4548
|
+
|
|
4549
|
+
_stream = False
|
|
4550
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4551
|
+
_request, stream=_stream, **kwargs
|
|
4552
|
+
)
|
|
4553
|
+
|
|
4554
|
+
response = pipeline_response.http_response
|
|
4555
|
+
|
|
4556
|
+
if response.status_code not in [200]:
|
|
4557
|
+
if _stream:
|
|
4558
|
+
await response.read() # Load the body in memory and close the socket
|
|
4559
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4560
|
+
raise HttpResponseError(response=response)
|
|
4561
|
+
|
|
4562
|
+
if response.content:
|
|
4563
|
+
deserialized = response.json()
|
|
4564
|
+
else:
|
|
4565
|
+
deserialized = None
|
|
4566
|
+
|
|
4567
|
+
if cls:
|
|
4568
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
4569
|
+
|
|
4570
|
+
return cast(JSON, deserialized) # type: ignore
|
|
4571
|
+
|
|
4572
|
+
@distributed_trace_async
|
|
4573
|
+
async def delete_notification_channel( # pylint: disable=inconsistent-return-statements
|
|
4574
|
+
self, channel_id: str, **kwargs: Any
|
|
4575
|
+
) -> None:
|
|
4576
|
+
"""Delete a notification channel.
|
|
4577
|
+
|
|
4578
|
+
Delete notification channel by id.
|
|
4579
|
+
|
|
4580
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
4581
|
+
:type channel_id: str
|
|
4582
|
+
:return: None
|
|
4583
|
+
:rtype: None
|
|
4584
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4585
|
+
"""
|
|
4586
|
+
error_map = {
|
|
4587
|
+
409: ResourceExistsError,
|
|
4588
|
+
304: ResourceNotModifiedError,
|
|
4589
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4590
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
4591
|
+
}
|
|
4592
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4593
|
+
|
|
4594
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
4595
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4596
|
+
|
|
4597
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
4598
|
+
|
|
4599
|
+
_request = build_delete_notification_channel_request(
|
|
4600
|
+
channel_id=channel_id,
|
|
4601
|
+
headers=_headers,
|
|
4602
|
+
params=_params,
|
|
4603
|
+
)
|
|
4604
|
+
_request.url = self._client.format_url(_request.url)
|
|
4605
|
+
|
|
4606
|
+
_stream = False
|
|
4607
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4608
|
+
_request, stream=_stream, **kwargs
|
|
4609
|
+
)
|
|
4610
|
+
|
|
4611
|
+
response = pipeline_response.http_response
|
|
4612
|
+
|
|
4613
|
+
if response.status_code not in [204]:
|
|
4614
|
+
if _stream:
|
|
4615
|
+
await response.read() # Load the body in memory and close the socket
|
|
4616
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4617
|
+
raise HttpResponseError(response=response)
|
|
4618
|
+
|
|
4619
|
+
if cls:
|
|
4620
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
4621
|
+
|
|
4622
|
+
@overload
|
|
4623
|
+
async def update_notification_channel(
|
|
4624
|
+
self, channel_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
4625
|
+
) -> JSON:
|
|
4626
|
+
"""Update notification channel.
|
|
4627
|
+
|
|
4628
|
+
Update a notification channel by id.
|
|
4629
|
+
|
|
4630
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
4631
|
+
:type channel_id: str
|
|
4632
|
+
:param body: The notification channel to update. Required.
|
|
4633
|
+
:type body: JSON
|
|
4634
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
4635
|
+
Default value is "application/json".
|
|
4636
|
+
:paramtype content_type: str
|
|
4637
|
+
:return: JSON object
|
|
4638
|
+
:rtype: JSON
|
|
4639
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4640
|
+
|
|
4641
|
+
Example:
|
|
4642
|
+
.. code-block:: python
|
|
4643
|
+
|
|
4644
|
+
# JSON input template you can fill out and use as your body input.
|
|
4645
|
+
body = {}
|
|
4646
|
+
"""
|
|
4647
|
+
|
|
4648
|
+
@overload
|
|
4649
|
+
async def update_notification_channel(
|
|
4650
|
+
self, channel_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
4651
|
+
) -> JSON:
|
|
4652
|
+
"""Update notification channel.
|
|
4653
|
+
|
|
4654
|
+
Update a notification channel by id.
|
|
4655
|
+
|
|
4656
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
4657
|
+
:type channel_id: str
|
|
4658
|
+
:param body: The notification channel to update. Required.
|
|
4659
|
+
:type body: IO[bytes]
|
|
4660
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
4661
|
+
Default value is "application/json".
|
|
4662
|
+
:paramtype content_type: str
|
|
4663
|
+
:return: JSON object
|
|
4664
|
+
:rtype: JSON
|
|
4665
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4666
|
+
"""
|
|
4667
|
+
|
|
4668
|
+
@distributed_trace_async
|
|
4669
|
+
async def update_notification_channel(self, channel_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
4670
|
+
"""Update notification channel.
|
|
4671
|
+
|
|
4672
|
+
Update a notification channel by id.
|
|
4673
|
+
|
|
4674
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
4675
|
+
:type channel_id: str
|
|
4676
|
+
:param body: The notification channel to update. Is either a JSON type or a IO[bytes] type.
|
|
4677
|
+
Required.
|
|
4678
|
+
:type body: JSON or IO[bytes]
|
|
4679
|
+
:return: JSON object
|
|
4680
|
+
:rtype: JSON
|
|
4681
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4682
|
+
|
|
4683
|
+
Example:
|
|
4684
|
+
.. code-block:: python
|
|
4685
|
+
|
|
4686
|
+
# JSON input template you can fill out and use as your body input.
|
|
4687
|
+
body = {}
|
|
4688
|
+
"""
|
|
4689
|
+
error_map = {
|
|
4690
|
+
409: ResourceExistsError,
|
|
4691
|
+
304: ResourceNotModifiedError,
|
|
4692
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4693
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
4694
|
+
}
|
|
4695
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4696
|
+
|
|
4697
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
4698
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4699
|
+
|
|
4700
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
4701
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
4702
|
+
|
|
4703
|
+
content_type = content_type or "application/json"
|
|
4704
|
+
_json = None
|
|
4705
|
+
_content = None
|
|
4706
|
+
if isinstance(body, (IOBase, bytes)):
|
|
4707
|
+
_content = body
|
|
4708
|
+
else:
|
|
4709
|
+
_json = body
|
|
4710
|
+
|
|
4711
|
+
_request = build_update_notification_channel_request(
|
|
4712
|
+
channel_id=channel_id,
|
|
4713
|
+
content_type=content_type,
|
|
4714
|
+
json=_json,
|
|
4715
|
+
content=_content,
|
|
4716
|
+
headers=_headers,
|
|
4717
|
+
params=_params,
|
|
4718
|
+
)
|
|
4719
|
+
_request.url = self._client.format_url(_request.url)
|
|
4720
|
+
|
|
4721
|
+
_stream = False
|
|
4722
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4723
|
+
_request, stream=_stream, **kwargs
|
|
4724
|
+
)
|
|
4725
|
+
|
|
4726
|
+
response = pipeline_response.http_response
|
|
4727
|
+
|
|
4728
|
+
if response.status_code not in [200]:
|
|
4729
|
+
if _stream:
|
|
4730
|
+
await response.read() # Load the body in memory and close the socket
|
|
4731
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4732
|
+
raise HttpResponseError(response=response)
|
|
4733
|
+
|
|
4734
|
+
if response.content:
|
|
4735
|
+
deserialized = response.json()
|
|
4736
|
+
else:
|
|
4737
|
+
deserialized = None
|
|
4738
|
+
|
|
4739
|
+
if cls:
|
|
4740
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
4741
|
+
|
|
4742
|
+
return cast(JSON, deserialized) # type: ignore
|
|
4743
|
+
|
|
4744
|
+
@distributed_trace_async
|
|
4745
|
+
async def list_notification_rules(
|
|
4746
|
+
self,
|
|
4747
|
+
*,
|
|
4748
|
+
limit: int = 1000,
|
|
4749
|
+
offset: int = 0,
|
|
4750
|
+
order_by: str = "id",
|
|
4751
|
+
include_disabled: bool = False,
|
|
4752
|
+
feature: Optional[List[str]] = None,
|
|
4753
|
+
**kwargs: Any
|
|
4754
|
+
) -> List[JSON]:
|
|
4755
|
+
"""List notification rules.
|
|
4756
|
+
|
|
4757
|
+
List all notification rules.
|
|
4758
|
+
|
|
4759
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
4760
|
+
:paramtype limit: int
|
|
4761
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
4762
|
+
:paramtype offset: int
|
|
4763
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
4764
|
+
"updatedAt". Default value is "id".
|
|
4765
|
+
:paramtype order_by: str
|
|
4766
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
4767
|
+
:paramtype include_disabled: bool
|
|
4768
|
+
:keyword feature: Filtering by multiple features.
|
|
4769
|
+
|
|
4770
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
4771
|
+
:paramtype feature: list[str]
|
|
4772
|
+
:return: list of JSON object
|
|
4773
|
+
:rtype: list[JSON]
|
|
4774
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4775
|
+
|
|
4776
|
+
Example:
|
|
4777
|
+
.. code-block:: python
|
|
4778
|
+
|
|
4779
|
+
# response body for status code(s): 200
|
|
4780
|
+
response == [
|
|
4781
|
+
{}
|
|
4782
|
+
]
|
|
4783
|
+
"""
|
|
4784
|
+
error_map = {
|
|
4785
|
+
404: ResourceNotFoundError,
|
|
4786
|
+
409: ResourceExistsError,
|
|
4787
|
+
304: ResourceNotModifiedError,
|
|
4788
|
+
400: HttpResponseError,
|
|
4789
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4790
|
+
}
|
|
4791
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4792
|
+
|
|
4793
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
4794
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4795
|
+
|
|
4796
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
4797
|
+
|
|
4798
|
+
_request = build_list_notification_rules_request(
|
|
4799
|
+
limit=limit,
|
|
4800
|
+
offset=offset,
|
|
4801
|
+
order_by=order_by,
|
|
4802
|
+
include_disabled=include_disabled,
|
|
4803
|
+
feature=feature,
|
|
4804
|
+
headers=_headers,
|
|
4805
|
+
params=_params,
|
|
4806
|
+
)
|
|
4807
|
+
_request.url = self._client.format_url(_request.url)
|
|
4808
|
+
|
|
4809
|
+
_stream = False
|
|
4810
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4811
|
+
_request, stream=_stream, **kwargs
|
|
4812
|
+
)
|
|
4813
|
+
|
|
4814
|
+
response = pipeline_response.http_response
|
|
4815
|
+
|
|
4816
|
+
if response.status_code not in [200]:
|
|
4817
|
+
if _stream:
|
|
4818
|
+
await response.read() # Load the body in memory and close the socket
|
|
4819
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4820
|
+
raise HttpResponseError(response=response)
|
|
4821
|
+
|
|
4822
|
+
if response.content:
|
|
4823
|
+
deserialized = response.json()
|
|
4824
|
+
else:
|
|
4825
|
+
deserialized = None
|
|
4826
|
+
|
|
4827
|
+
if cls:
|
|
4828
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
4829
|
+
|
|
4830
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
4831
|
+
|
|
4832
|
+
@overload
|
|
4833
|
+
async def create_notification_rule(
|
|
4834
|
+
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
4835
|
+
) -> JSON:
|
|
4836
|
+
"""Create a notification rule.
|
|
4837
|
+
|
|
4838
|
+
Create a new notification rule.
|
|
4839
|
+
|
|
4840
|
+
:param body: The notification rule to create. Required.
|
|
4841
|
+
:type body: JSON
|
|
4842
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
4843
|
+
Default value is "application/json".
|
|
4844
|
+
:paramtype content_type: str
|
|
4845
|
+
:return: JSON object
|
|
4846
|
+
:rtype: JSON
|
|
4847
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4848
|
+
|
|
4849
|
+
Example:
|
|
4850
|
+
.. code-block:: python
|
|
4851
|
+
|
|
4852
|
+
# JSON input template you can fill out and use as your body input.
|
|
4853
|
+
body = {}
|
|
4854
|
+
|
|
4855
|
+
# response body for status code(s): 409
|
|
4856
|
+
response == {
|
|
4857
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4858
|
+
of the problem. Required.
|
|
4859
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4860
|
+
occurrence of the problem. Required.
|
|
4861
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4862
|
+
Required.
|
|
4863
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4864
|
+
Required.
|
|
4865
|
+
"extensions": {
|
|
4866
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4867
|
+
Required.
|
|
4868
|
+
},
|
|
4869
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4870
|
+
occurrence of the problem.
|
|
4871
|
+
}
|
|
4872
|
+
"""
|
|
4873
|
+
|
|
4874
|
+
@overload
|
|
4875
|
+
async def create_notification_rule(
|
|
4876
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
4877
|
+
) -> JSON:
|
|
4878
|
+
"""Create a notification rule.
|
|
4879
|
+
|
|
4880
|
+
Create a new notification rule.
|
|
4881
|
+
|
|
4882
|
+
:param body: The notification rule to create. Required.
|
|
4883
|
+
:type body: IO[bytes]
|
|
4884
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
4885
|
+
Default value is "application/json".
|
|
4886
|
+
:paramtype content_type: str
|
|
4887
|
+
:return: JSON object
|
|
4888
|
+
:rtype: JSON
|
|
4889
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4890
|
+
|
|
4891
|
+
Example:
|
|
4892
|
+
.. code-block:: python
|
|
4893
|
+
|
|
4894
|
+
# response body for status code(s): 409
|
|
4895
|
+
response == {
|
|
4896
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4897
|
+
of the problem. Required.
|
|
4898
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4899
|
+
occurrence of the problem. Required.
|
|
4900
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4901
|
+
Required.
|
|
4902
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4903
|
+
Required.
|
|
4904
|
+
"extensions": {
|
|
4905
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4906
|
+
Required.
|
|
4907
|
+
},
|
|
4908
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4909
|
+
occurrence of the problem.
|
|
4910
|
+
}
|
|
4911
|
+
"""
|
|
4912
|
+
|
|
4913
|
+
@distributed_trace_async
|
|
4914
|
+
async def create_notification_rule(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
4915
|
+
"""Create a notification rule.
|
|
4916
|
+
|
|
4917
|
+
Create a new notification rule.
|
|
4918
|
+
|
|
4919
|
+
:param body: The notification rule to create. Is either a JSON type or a IO[bytes] type.
|
|
4920
|
+
Required.
|
|
4921
|
+
:type body: JSON or IO[bytes]
|
|
4922
|
+
:return: JSON object
|
|
4923
|
+
:rtype: JSON
|
|
4924
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
4925
|
+
|
|
4926
|
+
Example:
|
|
4927
|
+
.. code-block:: python
|
|
4928
|
+
|
|
4929
|
+
# JSON input template you can fill out and use as your body input.
|
|
4930
|
+
body = {}
|
|
4931
|
+
|
|
4932
|
+
# response body for status code(s): 409
|
|
4933
|
+
response == {
|
|
4934
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
4935
|
+
of the problem. Required.
|
|
4936
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
4937
|
+
occurrence of the problem. Required.
|
|
4938
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
4939
|
+
Required.
|
|
4940
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
4941
|
+
Required.
|
|
4942
|
+
"extensions": {
|
|
4943
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
4944
|
+
Required.
|
|
4945
|
+
},
|
|
4946
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
4947
|
+
occurrence of the problem.
|
|
4948
|
+
}
|
|
4949
|
+
"""
|
|
4950
|
+
error_map = {
|
|
4951
|
+
404: ResourceNotFoundError,
|
|
4952
|
+
409: ResourceExistsError,
|
|
4953
|
+
304: ResourceNotModifiedError,
|
|
4954
|
+
400: HttpResponseError,
|
|
4955
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
4956
|
+
}
|
|
4957
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
4958
|
+
|
|
4959
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
4960
|
+
_params = kwargs.pop("params", {}) or {}
|
|
4961
|
+
|
|
4962
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
4963
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
4964
|
+
|
|
4965
|
+
content_type = content_type or "application/json"
|
|
4966
|
+
_json = None
|
|
4967
|
+
_content = None
|
|
4968
|
+
if isinstance(body, (IOBase, bytes)):
|
|
4969
|
+
_content = body
|
|
4970
|
+
else:
|
|
4971
|
+
_json = body
|
|
4972
|
+
|
|
4973
|
+
_request = build_create_notification_rule_request(
|
|
4974
|
+
content_type=content_type,
|
|
4975
|
+
json=_json,
|
|
4976
|
+
content=_content,
|
|
4977
|
+
headers=_headers,
|
|
4978
|
+
params=_params,
|
|
4979
|
+
)
|
|
4980
|
+
_request.url = self._client.format_url(_request.url)
|
|
4981
|
+
|
|
4982
|
+
_stream = False
|
|
4983
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
4984
|
+
_request, stream=_stream, **kwargs
|
|
4985
|
+
)
|
|
4986
|
+
|
|
4987
|
+
response = pipeline_response.http_response
|
|
4988
|
+
|
|
4989
|
+
if response.status_code not in [201, 409]:
|
|
4990
|
+
if _stream:
|
|
4991
|
+
await response.read() # Load the body in memory and close the socket
|
|
4992
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
4993
|
+
raise HttpResponseError(response=response)
|
|
4994
|
+
|
|
4995
|
+
if response.status_code == 201:
|
|
4996
|
+
if response.content:
|
|
4997
|
+
deserialized = response.json()
|
|
4998
|
+
else:
|
|
4999
|
+
deserialized = None
|
|
5000
|
+
|
|
5001
|
+
if response.status_code == 409:
|
|
5002
|
+
if response.content:
|
|
5003
|
+
deserialized = response.json()
|
|
5004
|
+
else:
|
|
5005
|
+
deserialized = None
|
|
5006
|
+
|
|
5007
|
+
if cls:
|
|
5008
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5009
|
+
|
|
5010
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5011
|
+
|
|
5012
|
+
@distributed_trace_async
|
|
5013
|
+
async def get_notification_rule(self, rule_id: str, **kwargs: Any) -> JSON:
|
|
5014
|
+
"""Get notification rule.
|
|
5015
|
+
|
|
5016
|
+
Get a notification rule by id.
|
|
5017
|
+
|
|
5018
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5019
|
+
:type rule_id: str
|
|
5020
|
+
:return: JSON object
|
|
5021
|
+
:rtype: JSON
|
|
5022
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5023
|
+
"""
|
|
5024
|
+
error_map = {
|
|
5025
|
+
409: ResourceExistsError,
|
|
5026
|
+
304: ResourceNotModifiedError,
|
|
5027
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5028
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5029
|
+
}
|
|
5030
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5031
|
+
|
|
5032
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5033
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5034
|
+
|
|
5035
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5036
|
+
|
|
5037
|
+
_request = build_get_notification_rule_request(
|
|
5038
|
+
rule_id=rule_id,
|
|
5039
|
+
headers=_headers,
|
|
5040
|
+
params=_params,
|
|
5041
|
+
)
|
|
5042
|
+
_request.url = self._client.format_url(_request.url)
|
|
5043
|
+
|
|
5044
|
+
_stream = False
|
|
5045
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5046
|
+
_request, stream=_stream, **kwargs
|
|
5047
|
+
)
|
|
5048
|
+
|
|
5049
|
+
response = pipeline_response.http_response
|
|
5050
|
+
|
|
5051
|
+
if response.status_code not in [200]:
|
|
5052
|
+
if _stream:
|
|
5053
|
+
await response.read() # Load the body in memory and close the socket
|
|
5054
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5055
|
+
raise HttpResponseError(response=response)
|
|
5056
|
+
|
|
5057
|
+
if response.content:
|
|
5058
|
+
deserialized = response.json()
|
|
5059
|
+
else:
|
|
5060
|
+
deserialized = None
|
|
5061
|
+
|
|
5062
|
+
if cls:
|
|
5063
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5064
|
+
|
|
5065
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5066
|
+
|
|
5067
|
+
@distributed_trace_async
|
|
5068
|
+
async def delete_notification_rule( # pylint: disable=inconsistent-return-statements
|
|
5069
|
+
self, rule_id: str, **kwargs: Any
|
|
5070
|
+
) -> None:
|
|
5071
|
+
"""Delete a notification rule.
|
|
5072
|
+
|
|
5073
|
+
Delete notification rule by id.
|
|
5074
|
+
|
|
5075
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5076
|
+
:type rule_id: str
|
|
5077
|
+
:return: None
|
|
5078
|
+
:rtype: None
|
|
5079
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5080
|
+
"""
|
|
5081
|
+
error_map = {
|
|
5082
|
+
409: ResourceExistsError,
|
|
5083
|
+
304: ResourceNotModifiedError,
|
|
5084
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5085
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5086
|
+
}
|
|
5087
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5088
|
+
|
|
5089
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5090
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5091
|
+
|
|
5092
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
5093
|
+
|
|
5094
|
+
_request = build_delete_notification_rule_request(
|
|
5095
|
+
rule_id=rule_id,
|
|
5096
|
+
headers=_headers,
|
|
5097
|
+
params=_params,
|
|
5098
|
+
)
|
|
5099
|
+
_request.url = self._client.format_url(_request.url)
|
|
5100
|
+
|
|
5101
|
+
_stream = False
|
|
5102
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5103
|
+
_request, stream=_stream, **kwargs
|
|
5104
|
+
)
|
|
5105
|
+
|
|
5106
|
+
response = pipeline_response.http_response
|
|
5107
|
+
|
|
5108
|
+
if response.status_code not in [204]:
|
|
5109
|
+
if _stream:
|
|
5110
|
+
await response.read() # Load the body in memory and close the socket
|
|
5111
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5112
|
+
raise HttpResponseError(response=response)
|
|
5113
|
+
|
|
5114
|
+
if cls:
|
|
5115
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
5116
|
+
|
|
5117
|
+
@overload
|
|
5118
|
+
async def update_notification_rule(
|
|
5119
|
+
self, rule_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
5120
|
+
) -> JSON:
|
|
5121
|
+
"""Update a notification rule.
|
|
5122
|
+
|
|
5123
|
+
Update a notification rule by id.
|
|
5124
|
+
|
|
5125
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5126
|
+
:type rule_id: str
|
|
5127
|
+
:param body: The notification rule to update. Required.
|
|
5128
|
+
:type body: JSON
|
|
5129
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5130
|
+
Default value is "application/json".
|
|
5131
|
+
:paramtype content_type: str
|
|
5132
|
+
:return: JSON object
|
|
5133
|
+
:rtype: JSON
|
|
5134
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5135
|
+
|
|
5136
|
+
Example:
|
|
5137
|
+
.. code-block:: python
|
|
5138
|
+
|
|
5139
|
+
# JSON input template you can fill out and use as your body input.
|
|
5140
|
+
body = {}
|
|
5141
|
+
"""
|
|
5142
|
+
|
|
5143
|
+
@overload
|
|
5144
|
+
async def update_notification_rule(
|
|
5145
|
+
self, rule_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5146
|
+
) -> JSON:
|
|
5147
|
+
"""Update a notification rule.
|
|
5148
|
+
|
|
5149
|
+
Update a notification rule by id.
|
|
5150
|
+
|
|
5151
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5152
|
+
:type rule_id: str
|
|
5153
|
+
:param body: The notification rule to update. Required.
|
|
5154
|
+
:type body: IO[bytes]
|
|
5155
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5156
|
+
Default value is "application/json".
|
|
5157
|
+
:paramtype content_type: str
|
|
5158
|
+
:return: JSON object
|
|
5159
|
+
:rtype: JSON
|
|
5160
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5161
|
+
"""
|
|
5162
|
+
|
|
5163
|
+
@distributed_trace_async
|
|
5164
|
+
async def update_notification_rule(self, rule_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5165
|
+
"""Update a notification rule.
|
|
5166
|
+
|
|
5167
|
+
Update a notification rule by id.
|
|
5168
|
+
|
|
5169
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5170
|
+
:type rule_id: str
|
|
5171
|
+
:param body: The notification rule to update. Is either a JSON type or a IO[bytes] type.
|
|
5172
|
+
Required.
|
|
5173
|
+
:type body: JSON or IO[bytes]
|
|
5174
|
+
:return: JSON object
|
|
5175
|
+
:rtype: JSON
|
|
5176
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5177
|
+
|
|
5178
|
+
Example:
|
|
5179
|
+
.. code-block:: python
|
|
5180
|
+
|
|
5181
|
+
# JSON input template you can fill out and use as your body input.
|
|
5182
|
+
body = {}
|
|
5183
|
+
"""
|
|
5184
|
+
error_map = {
|
|
5185
|
+
409: ResourceExistsError,
|
|
5186
|
+
304: ResourceNotModifiedError,
|
|
5187
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5188
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5189
|
+
}
|
|
5190
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5191
|
+
|
|
5192
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5193
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5194
|
+
|
|
5195
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5196
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5197
|
+
|
|
5198
|
+
content_type = content_type or "application/json"
|
|
5199
|
+
_json = None
|
|
5200
|
+
_content = None
|
|
5201
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5202
|
+
_content = body
|
|
5203
|
+
else:
|
|
5204
|
+
_json = body
|
|
5205
|
+
|
|
5206
|
+
_request = build_update_notification_rule_request(
|
|
5207
|
+
rule_id=rule_id,
|
|
5208
|
+
content_type=content_type,
|
|
5209
|
+
json=_json,
|
|
5210
|
+
content=_content,
|
|
5211
|
+
headers=_headers,
|
|
5212
|
+
params=_params,
|
|
5213
|
+
)
|
|
5214
|
+
_request.url = self._client.format_url(_request.url)
|
|
5215
|
+
|
|
5216
|
+
_stream = False
|
|
5217
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5218
|
+
_request, stream=_stream, **kwargs
|
|
5219
|
+
)
|
|
5220
|
+
|
|
5221
|
+
response = pipeline_response.http_response
|
|
5222
|
+
|
|
5223
|
+
if response.status_code not in [200]:
|
|
5224
|
+
if _stream:
|
|
5225
|
+
await response.read() # Load the body in memory and close the socket
|
|
5226
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5227
|
+
raise HttpResponseError(response=response)
|
|
5228
|
+
|
|
5229
|
+
if response.content:
|
|
5230
|
+
deserialized = response.json()
|
|
5231
|
+
else:
|
|
5232
|
+
deserialized = None
|
|
5233
|
+
|
|
5234
|
+
if cls:
|
|
5235
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5236
|
+
|
|
5237
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5238
|
+
|
|
5239
|
+
@distributed_trace_async
|
|
5240
|
+
async def list_notification_events(
|
|
5241
|
+
self,
|
|
5242
|
+
*,
|
|
5243
|
+
limit: int = 1000,
|
|
5244
|
+
offset: int = 0,
|
|
5245
|
+
order_by: str = "id",
|
|
5246
|
+
feature: Optional[List[str]] = None,
|
|
5247
|
+
subject: Optional[List[str]] = None,
|
|
5248
|
+
**kwargs: Any
|
|
5249
|
+
) -> List[JSON]:
|
|
5250
|
+
"""List notification evens.
|
|
5251
|
+
|
|
5252
|
+
List all notification events.
|
|
5253
|
+
|
|
5254
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
5255
|
+
:paramtype limit: int
|
|
5256
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
5257
|
+
:paramtype offset: int
|
|
5258
|
+
:keyword order_by: Order by field. Known values are: "id" and "createdAt". Default value is
|
|
5259
|
+
"id".
|
|
5260
|
+
:paramtype order_by: str
|
|
5261
|
+
:keyword feature: Filtering by multiple features.
|
|
5262
|
+
|
|
5263
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
5264
|
+
:paramtype feature: list[str]
|
|
5265
|
+
:keyword subject: Filtering by multiple subjects.
|
|
5266
|
+
|
|
5267
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
5268
|
+
:paramtype subject: list[str]
|
|
5269
|
+
:return: list of JSON object
|
|
5270
|
+
:rtype: list[JSON]
|
|
5271
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5272
|
+
|
|
5273
|
+
Example:
|
|
5274
|
+
.. code-block:: python
|
|
5275
|
+
|
|
5276
|
+
# response body for status code(s): 200
|
|
5277
|
+
response == [
|
|
5278
|
+
{
|
|
5279
|
+
"createdAt": "2020-02-20 00:00:00", # Timestamp when the
|
|
5280
|
+
notification event was created. Required.
|
|
5281
|
+
"deliveryStatus": [
|
|
5282
|
+
{
|
|
5283
|
+
"channel": {
|
|
5284
|
+
"id": "str", # A unique identifier for the
|
|
5285
|
+
notification channel. Required.
|
|
5286
|
+
"type": "str" # The type of the notification
|
|
5287
|
+
channel. Required. "WEBHOOK"
|
|
5288
|
+
},
|
|
5289
|
+
"state": "str", # Required. Known values are:
|
|
5290
|
+
"SUCCESS", "FAILED", and "SENDING".
|
|
5291
|
+
"updatedAt": "2020-02-20 00:00:00" # Required.
|
|
5292
|
+
}
|
|
5293
|
+
],
|
|
5294
|
+
"id": "str", # A unique identifier for the notification event.
|
|
5295
|
+
Required.
|
|
5296
|
+
"payload": {},
|
|
5297
|
+
"rule": {
|
|
5298
|
+
"id": "str", # A unique identifier for the notification
|
|
5299
|
+
rule. Required.
|
|
5300
|
+
"type": "str" # The type of the notification event.
|
|
5301
|
+
Required. "entitlements.balance.threshold"
|
|
5302
|
+
}
|
|
5303
|
+
}
|
|
5304
|
+
]
|
|
5305
|
+
"""
|
|
5306
|
+
error_map = {
|
|
5307
|
+
404: ResourceNotFoundError,
|
|
5308
|
+
409: ResourceExistsError,
|
|
5309
|
+
304: ResourceNotModifiedError,
|
|
5310
|
+
400: HttpResponseError,
|
|
5311
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5312
|
+
}
|
|
5313
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5314
|
+
|
|
5315
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5316
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5317
|
+
|
|
5318
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
5319
|
+
|
|
5320
|
+
_request = build_list_notification_events_request(
|
|
5321
|
+
limit=limit,
|
|
5322
|
+
offset=offset,
|
|
5323
|
+
order_by=order_by,
|
|
5324
|
+
feature=feature,
|
|
5325
|
+
subject=subject,
|
|
5326
|
+
headers=_headers,
|
|
5327
|
+
params=_params,
|
|
5328
|
+
)
|
|
5329
|
+
_request.url = self._client.format_url(_request.url)
|
|
5330
|
+
|
|
5331
|
+
_stream = False
|
|
5332
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5333
|
+
_request, stream=_stream, **kwargs
|
|
5334
|
+
)
|
|
5335
|
+
|
|
5336
|
+
response = pipeline_response.http_response
|
|
5337
|
+
|
|
5338
|
+
if response.status_code not in [200]:
|
|
5339
|
+
if _stream:
|
|
5340
|
+
await response.read() # Load the body in memory and close the socket
|
|
5341
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5342
|
+
raise HttpResponseError(response=response)
|
|
5343
|
+
|
|
5344
|
+
if response.content:
|
|
5345
|
+
deserialized = response.json()
|
|
5346
|
+
else:
|
|
5347
|
+
deserialized = None
|
|
5348
|
+
|
|
5349
|
+
if cls:
|
|
5350
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
5351
|
+
|
|
5352
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
5353
|
+
|
|
5354
|
+
@distributed_trace_async
|
|
5355
|
+
async def get_notification_event(self, event_id: str, **kwargs: Any) -> JSON:
|
|
5356
|
+
"""Get notification event.
|
|
5357
|
+
|
|
5358
|
+
Get a notification event by id.
|
|
5359
|
+
|
|
5360
|
+
:param event_id: A unique ULID identifier for a notification event. Required.
|
|
5361
|
+
:type event_id: str
|
|
5362
|
+
:return: JSON object
|
|
5363
|
+
:rtype: JSON
|
|
5364
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5365
|
+
"""
|
|
5366
|
+
error_map = {
|
|
5367
|
+
409: ResourceExistsError,
|
|
5368
|
+
304: ResourceNotModifiedError,
|
|
5369
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5370
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5371
|
+
}
|
|
5372
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5373
|
+
|
|
5374
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5375
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5376
|
+
|
|
5377
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5378
|
+
|
|
5379
|
+
_request = build_get_notification_event_request(
|
|
5380
|
+
event_id=event_id,
|
|
5381
|
+
headers=_headers,
|
|
5382
|
+
params=_params,
|
|
5383
|
+
)
|
|
5384
|
+
_request.url = self._client.format_url(_request.url)
|
|
5385
|
+
|
|
5386
|
+
_stream = False
|
|
5387
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5388
|
+
_request, stream=_stream, **kwargs
|
|
5389
|
+
)
|
|
5390
|
+
|
|
5391
|
+
response = pipeline_response.http_response
|
|
5392
|
+
|
|
5393
|
+
if response.status_code not in [200]:
|
|
5394
|
+
if _stream:
|
|
5395
|
+
await response.read() # Load the body in memory and close the socket
|
|
5396
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5397
|
+
raise HttpResponseError(response=response)
|
|
5398
|
+
|
|
5399
|
+
if response.content:
|
|
5400
|
+
deserialized = response.json()
|
|
5401
|
+
else:
|
|
5402
|
+
deserialized = None
|
|
5403
|
+
|
|
5404
|
+
if cls:
|
|
5405
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5406
|
+
|
|
5407
|
+
return cast(JSON, deserialized) # type: ignore
|