openmeter 1.0.0b121__py3-none-any.whl → 1.0.0b123__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 +1516 -138
- openmeter/aio/_operations/_operations.py +1220 -135
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b123.dist-info}/METADATA +1 -1
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b123.dist-info}/RECORD +5 -5
- {openmeter-1.0.0b121.dist-info → openmeter-1.0.0b123.dist-info}/WHEEL +0 -0
|
@@ -385,7 +385,13 @@ def build_query_portal_meter_request(
|
|
|
385
385
|
|
|
386
386
|
|
|
387
387
|
def build_list_entitlements_request(
|
|
388
|
-
*,
|
|
388
|
+
*,
|
|
389
|
+
page: int = 1,
|
|
390
|
+
page_size: int = 100,
|
|
391
|
+
limit: int = 1000,
|
|
392
|
+
offset: int = 0,
|
|
393
|
+
order_by: str = "createdAt",
|
|
394
|
+
**kwargs: Any
|
|
389
395
|
) -> HttpRequest:
|
|
390
396
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
391
397
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -396,6 +402,10 @@ def build_list_entitlements_request(
|
|
|
396
402
|
_url = "/api/v1/entitlements"
|
|
397
403
|
|
|
398
404
|
# Construct parameters
|
|
405
|
+
if page is not None:
|
|
406
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
407
|
+
if page_size is not None:
|
|
408
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
399
409
|
if limit is not None:
|
|
400
410
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
401
411
|
if offset is not None:
|
|
@@ -410,7 +420,14 @@ def build_list_entitlements_request(
|
|
|
410
420
|
|
|
411
421
|
|
|
412
422
|
def build_list_features_request(
|
|
413
|
-
*,
|
|
423
|
+
*,
|
|
424
|
+
page: int = 1,
|
|
425
|
+
page_size: int = 100,
|
|
426
|
+
limit: int = 1000,
|
|
427
|
+
offset: int = 0,
|
|
428
|
+
order_by: str = "updatedAt",
|
|
429
|
+
include_archived: bool = False,
|
|
430
|
+
**kwargs: Any
|
|
414
431
|
) -> HttpRequest:
|
|
415
432
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
416
433
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -421,6 +438,10 @@ def build_list_features_request(
|
|
|
421
438
|
_url = "/api/v1/features"
|
|
422
439
|
|
|
423
440
|
# Construct parameters
|
|
441
|
+
if page is not None:
|
|
442
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
443
|
+
if page_size is not None:
|
|
444
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
424
445
|
if limit is not None:
|
|
425
446
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
426
447
|
if offset is not None:
|
|
@@ -492,7 +513,15 @@ def build_delete_feature_request(feature_id: str, **kwargs: Any) -> HttpRequest:
|
|
|
492
513
|
|
|
493
514
|
|
|
494
515
|
def build_list_grants_request(
|
|
495
|
-
*,
|
|
516
|
+
*,
|
|
517
|
+
page: int = 1,
|
|
518
|
+
page_size: int = 100,
|
|
519
|
+
limit: int = 1000,
|
|
520
|
+
offset: int = 0,
|
|
521
|
+
order: str = "ASC",
|
|
522
|
+
order_by: str = "updatedAt",
|
|
523
|
+
include_deleted: bool = False,
|
|
524
|
+
**kwargs: Any
|
|
496
525
|
) -> HttpRequest:
|
|
497
526
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
498
527
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -503,10 +532,16 @@ def build_list_grants_request(
|
|
|
503
532
|
_url = "/api/v1/grants"
|
|
504
533
|
|
|
505
534
|
# Construct parameters
|
|
535
|
+
if page is not None:
|
|
536
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
537
|
+
if page_size is not None:
|
|
538
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
506
539
|
if limit is not None:
|
|
507
540
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
508
541
|
if offset is not None:
|
|
509
542
|
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
543
|
+
if order is not None:
|
|
544
|
+
_params["order"] = _SERIALIZER.query("order", order, "str")
|
|
510
545
|
if order_by is not None:
|
|
511
546
|
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
512
547
|
if include_deleted is not None:
|
|
@@ -797,6 +832,280 @@ def build_get_debug_metrics_request(**kwargs: Any) -> HttpRequest:
|
|
|
797
832
|
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
798
833
|
|
|
799
834
|
|
|
835
|
+
def build_list_notification_channels_request(
|
|
836
|
+
*, limit: int = 1000, offset: int = 0, order_by: str = "id", include_disabled: bool = False, **kwargs: Any
|
|
837
|
+
) -> HttpRequest:
|
|
838
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
839
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
840
|
+
|
|
841
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
842
|
+
|
|
843
|
+
# Construct URL
|
|
844
|
+
_url = "/api/v1/notification/channels"
|
|
845
|
+
|
|
846
|
+
# Construct parameters
|
|
847
|
+
if limit is not None:
|
|
848
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
849
|
+
if offset is not None:
|
|
850
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
851
|
+
if order_by is not None:
|
|
852
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
853
|
+
if include_disabled is not None:
|
|
854
|
+
_params["includeDisabled"] = _SERIALIZER.query("include_disabled", include_disabled, "bool")
|
|
855
|
+
|
|
856
|
+
# Construct headers
|
|
857
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
858
|
+
|
|
859
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
def build_create_notification_channel_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
|
|
863
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
864
|
+
|
|
865
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
866
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
867
|
+
|
|
868
|
+
# Construct URL
|
|
869
|
+
_url = "/api/v1/notification/channels"
|
|
870
|
+
|
|
871
|
+
# Construct headers
|
|
872
|
+
if content_type is not None:
|
|
873
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
874
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
875
|
+
|
|
876
|
+
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
def build_get_notification_channel_request(channel_id: str, **kwargs: Any) -> HttpRequest:
|
|
880
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
881
|
+
|
|
882
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
883
|
+
|
|
884
|
+
# Construct URL
|
|
885
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
886
|
+
path_format_arguments = {
|
|
887
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
891
|
+
|
|
892
|
+
# Construct headers
|
|
893
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
894
|
+
|
|
895
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
def build_delete_notification_channel_request( # pylint: disable=name-too-long
|
|
899
|
+
channel_id: str, **kwargs: Any
|
|
900
|
+
) -> HttpRequest:
|
|
901
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
902
|
+
|
|
903
|
+
accept = _headers.pop("Accept", "application/problem+json")
|
|
904
|
+
|
|
905
|
+
# Construct URL
|
|
906
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
907
|
+
path_format_arguments = {
|
|
908
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
912
|
+
|
|
913
|
+
# Construct headers
|
|
914
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
915
|
+
|
|
916
|
+
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
def build_update_notification_channel_request( # pylint: disable=name-too-long
|
|
920
|
+
channel_id: str, **kwargs: Any
|
|
921
|
+
) -> HttpRequest:
|
|
922
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
923
|
+
|
|
924
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
925
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
926
|
+
|
|
927
|
+
# Construct URL
|
|
928
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
929
|
+
path_format_arguments = {
|
|
930
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
934
|
+
|
|
935
|
+
# Construct headers
|
|
936
|
+
if content_type is not None:
|
|
937
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
938
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
939
|
+
|
|
940
|
+
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
def build_list_notification_rules_request(
|
|
944
|
+
*,
|
|
945
|
+
limit: int = 1000,
|
|
946
|
+
offset: int = 0,
|
|
947
|
+
order_by: str = "id",
|
|
948
|
+
include_disabled: bool = False,
|
|
949
|
+
feature: Optional[List[str]] = None,
|
|
950
|
+
**kwargs: Any
|
|
951
|
+
) -> HttpRequest:
|
|
952
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
953
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
954
|
+
|
|
955
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
956
|
+
|
|
957
|
+
# Construct URL
|
|
958
|
+
_url = "/api/v1/notification/rules"
|
|
959
|
+
|
|
960
|
+
# Construct parameters
|
|
961
|
+
if limit is not None:
|
|
962
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
963
|
+
if offset is not None:
|
|
964
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
965
|
+
if order_by is not None:
|
|
966
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
967
|
+
if include_disabled is not None:
|
|
968
|
+
_params["includeDisabled"] = _SERIALIZER.query("include_disabled", include_disabled, "bool")
|
|
969
|
+
if feature is not None:
|
|
970
|
+
_params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
|
|
971
|
+
|
|
972
|
+
# Construct headers
|
|
973
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
974
|
+
|
|
975
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def build_create_notification_rule_request(**kwargs: Any) -> HttpRequest:
|
|
979
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
980
|
+
|
|
981
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
982
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
983
|
+
|
|
984
|
+
# Construct URL
|
|
985
|
+
_url = "/api/v1/notification/rules"
|
|
986
|
+
|
|
987
|
+
# Construct headers
|
|
988
|
+
if content_type is not None:
|
|
989
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
990
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
991
|
+
|
|
992
|
+
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
def build_get_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
996
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
997
|
+
|
|
998
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
999
|
+
|
|
1000
|
+
# Construct URL
|
|
1001
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
1002
|
+
path_format_arguments = {
|
|
1003
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1007
|
+
|
|
1008
|
+
# Construct headers
|
|
1009
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1010
|
+
|
|
1011
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
def build_delete_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
1015
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1016
|
+
|
|
1017
|
+
accept = _headers.pop("Accept", "application/problem+json")
|
|
1018
|
+
|
|
1019
|
+
# Construct URL
|
|
1020
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
1021
|
+
path_format_arguments = {
|
|
1022
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1026
|
+
|
|
1027
|
+
# Construct headers
|
|
1028
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1029
|
+
|
|
1030
|
+
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
def build_update_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
1034
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1035
|
+
|
|
1036
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1037
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1038
|
+
|
|
1039
|
+
# Construct URL
|
|
1040
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
1041
|
+
path_format_arguments = {
|
|
1042
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1046
|
+
|
|
1047
|
+
# Construct headers
|
|
1048
|
+
if content_type is not None:
|
|
1049
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
1050
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1051
|
+
|
|
1052
|
+
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
def build_list_notification_events_request(
|
|
1056
|
+
*,
|
|
1057
|
+
limit: int = 1000,
|
|
1058
|
+
offset: int = 0,
|
|
1059
|
+
order_by: str = "id",
|
|
1060
|
+
feature: Optional[List[str]] = None,
|
|
1061
|
+
subject: Optional[List[str]] = None,
|
|
1062
|
+
**kwargs: Any
|
|
1063
|
+
) -> HttpRequest:
|
|
1064
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1065
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
1066
|
+
|
|
1067
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1068
|
+
|
|
1069
|
+
# Construct URL
|
|
1070
|
+
_url = "/api/v1/notification/events"
|
|
1071
|
+
|
|
1072
|
+
# Construct parameters
|
|
1073
|
+
if limit is not None:
|
|
1074
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
1075
|
+
if offset is not None:
|
|
1076
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
1077
|
+
if order_by is not None:
|
|
1078
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
1079
|
+
if feature is not None:
|
|
1080
|
+
_params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
|
|
1081
|
+
if subject is not None:
|
|
1082
|
+
_params["subject"] = _SERIALIZER.query("subject", subject, "[str]")
|
|
1083
|
+
|
|
1084
|
+
# Construct headers
|
|
1085
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1086
|
+
|
|
1087
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
def build_get_notification_event_request(event_id: str, **kwargs: Any) -> HttpRequest:
|
|
1091
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1092
|
+
|
|
1093
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1094
|
+
|
|
1095
|
+
# Construct URL
|
|
1096
|
+
_url = "/api/v1/notification/events/{eventId}"
|
|
1097
|
+
path_format_arguments = {
|
|
1098
|
+
"eventId": _SERIALIZER.url("event_id", event_id, "str"),
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1102
|
+
|
|
1103
|
+
# Construct headers
|
|
1104
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1105
|
+
|
|
1106
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
1107
|
+
|
|
1108
|
+
|
|
800
1109
|
class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-methods
|
|
801
1110
|
@distributed_trace
|
|
802
1111
|
def list_events(
|
|
@@ -1573,7 +1882,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1573
1882
|
:paramtype window_time_zone: str
|
|
1574
1883
|
:keyword subject: Filtering by multiple subjects.
|
|
1575
1884
|
|
|
1576
|
-
Usage:
|
|
1885
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
1577
1886
|
:paramtype subject: list[str]
|
|
1578
1887
|
:keyword filter_group_by: Default value is None.
|
|
1579
1888
|
:paramtype filter_group_by: dict[str, str]
|
|
@@ -2615,13 +2924,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2615
2924
|
|
|
2616
2925
|
@distributed_trace
|
|
2617
2926
|
def list_entitlements(
|
|
2618
|
-
self,
|
|
2619
|
-
|
|
2927
|
+
self,
|
|
2928
|
+
*,
|
|
2929
|
+
page: int = 1,
|
|
2930
|
+
page_size: int = 100,
|
|
2931
|
+
limit: int = 1000,
|
|
2932
|
+
offset: int = 0,
|
|
2933
|
+
order_by: str = "createdAt",
|
|
2934
|
+
**kwargs: Any
|
|
2935
|
+
) -> Any:
|
|
2620
2936
|
"""List entitlements.
|
|
2621
2937
|
|
|
2622
2938
|
List all entitlements regardless of subject. This endpoint is intended for administrative
|
|
2623
2939
|
purposes.
|
|
2940
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
2624
2941
|
|
|
2942
|
+
:keyword page: Page number to return. Default value is 1.
|
|
2943
|
+
:paramtype page: int
|
|
2944
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
2945
|
+
:paramtype page_size: int
|
|
2625
2946
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
2626
2947
|
:paramtype limit: int
|
|
2627
2948
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -2629,17 +2950,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2629
2950
|
:keyword order_by: Order by field. Known values are: "createdAt" and "updatedAt". Default value
|
|
2630
2951
|
is "createdAt".
|
|
2631
2952
|
:paramtype order_by: str
|
|
2632
|
-
:return:
|
|
2633
|
-
:rtype:
|
|
2953
|
+
:return: any
|
|
2954
|
+
:rtype: any
|
|
2634
2955
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2635
|
-
|
|
2636
|
-
Example:
|
|
2637
|
-
.. code-block:: python
|
|
2638
|
-
|
|
2639
|
-
# response body for status code(s): 200
|
|
2640
|
-
response == [
|
|
2641
|
-
{}
|
|
2642
|
-
]
|
|
2643
2956
|
"""
|
|
2644
2957
|
error_map = {
|
|
2645
2958
|
404: ResourceNotFoundError,
|
|
@@ -2653,9 +2966,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2653
2966
|
_headers = kwargs.pop("headers", {}) or {}
|
|
2654
2967
|
_params = kwargs.pop("params", {}) or {}
|
|
2655
2968
|
|
|
2656
|
-
cls: ClsType[
|
|
2969
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
2657
2970
|
|
|
2658
2971
|
_request = build_list_entitlements_request(
|
|
2972
|
+
page=page,
|
|
2973
|
+
page_size=page_size,
|
|
2659
2974
|
limit=limit,
|
|
2660
2975
|
offset=offset,
|
|
2661
2976
|
order_by=order_by,
|
|
@@ -2683,25 +2998,31 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2683
2998
|
deserialized = None
|
|
2684
2999
|
|
|
2685
3000
|
if cls:
|
|
2686
|
-
return cls(pipeline_response, cast(
|
|
3001
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
2687
3002
|
|
|
2688
|
-
return cast(
|
|
3003
|
+
return cast(Any, deserialized) # type: ignore
|
|
2689
3004
|
|
|
2690
3005
|
@distributed_trace
|
|
2691
3006
|
def list_features(
|
|
2692
3007
|
self,
|
|
2693
3008
|
*,
|
|
3009
|
+
page: int = 1,
|
|
3010
|
+
page_size: int = 100,
|
|
2694
3011
|
limit: int = 1000,
|
|
2695
3012
|
offset: int = 0,
|
|
2696
3013
|
order_by: str = "updatedAt",
|
|
2697
3014
|
include_archived: bool = False,
|
|
2698
3015
|
**kwargs: Any
|
|
2699
|
-
) ->
|
|
2700
|
-
# pylint: disable=line-too-long
|
|
3016
|
+
) -> Any:
|
|
2701
3017
|
"""List features.
|
|
2702
3018
|
|
|
2703
|
-
List all features.
|
|
3019
|
+
List all features. If page is provided that takes precedence and the paginated response is
|
|
3020
|
+
returned.
|
|
2704
3021
|
|
|
3022
|
+
:keyword page: Page number to return. Default value is 1.
|
|
3023
|
+
:paramtype page: int
|
|
3024
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
3025
|
+
:paramtype page_size: int
|
|
2705
3026
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
2706
3027
|
:paramtype limit: int
|
|
2707
3028
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -2711,47 +3032,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2711
3032
|
:paramtype order_by: str
|
|
2712
3033
|
:keyword include_archived: Include archived features. Default value is False.
|
|
2713
3034
|
:paramtype include_archived: bool
|
|
2714
|
-
:return:
|
|
2715
|
-
:rtype:
|
|
3035
|
+
:return: any
|
|
3036
|
+
:rtype: any
|
|
2716
3037
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2717
|
-
|
|
2718
|
-
Example:
|
|
2719
|
-
.. code-block:: python
|
|
2720
|
-
|
|
2721
|
-
# response body for status code(s): 200
|
|
2722
|
-
response == [
|
|
2723
|
-
{
|
|
2724
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2725
|
-
was created. Required.
|
|
2726
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
2727
|
-
"key": "str", # The key is an immutable unique identifier of the
|
|
2728
|
-
feature used throughout the API, for example when interacting with a
|
|
2729
|
-
subject's entitlements. The key has to be unique across all active features,
|
|
2730
|
-
but archived features can share the same key. The key should consist of
|
|
2731
|
-
lowercase alphanumeric characters and dashes. Required.
|
|
2732
|
-
"name": "str", # The name of the feature. Required.
|
|
2733
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2734
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
2735
|
-
"archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is
|
|
2736
|
-
archived, no new entitlements can be created for it.
|
|
2737
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
2738
|
-
the resource was deleted.
|
|
2739
|
-
"metadata": {
|
|
2740
|
-
"str": "str" # Optional. Additional metadata for the
|
|
2741
|
-
feature, useful for syncing with external systems and annotating custom
|
|
2742
|
-
fields.
|
|
2743
|
-
},
|
|
2744
|
-
"meterGroupByFilters": {
|
|
2745
|
-
"str": "str" # Optional. Optional meter group by filters.
|
|
2746
|
-
Useful if the meter scope is broader than what feature tracks. Example
|
|
2747
|
-
scenario would be a meter tracking all token use with groupBy fields for
|
|
2748
|
-
the model, then the feature could filter for model=gpt-4.
|
|
2749
|
-
},
|
|
2750
|
-
"meterSlug": "str" # Optional. The meter that the feature is
|
|
2751
|
-
associated with and and based on which usage is calculated. The meter
|
|
2752
|
-
selected must have SUM or COUNT aggregation.
|
|
2753
|
-
}
|
|
2754
|
-
]
|
|
2755
3038
|
"""
|
|
2756
3039
|
error_map = {
|
|
2757
3040
|
404: ResourceNotFoundError,
|
|
@@ -2765,9 +3048,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2765
3048
|
_headers = kwargs.pop("headers", {}) or {}
|
|
2766
3049
|
_params = kwargs.pop("params", {}) or {}
|
|
2767
3050
|
|
|
2768
|
-
cls: ClsType[
|
|
3051
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
2769
3052
|
|
|
2770
3053
|
_request = build_list_features_request(
|
|
3054
|
+
page=page,
|
|
3055
|
+
page_size=page_size,
|
|
2771
3056
|
limit=limit,
|
|
2772
3057
|
offset=offset,
|
|
2773
3058
|
order_by=order_by,
|
|
@@ -2796,9 +3081,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2796
3081
|
deserialized = None
|
|
2797
3082
|
|
|
2798
3083
|
if cls:
|
|
2799
|
-
return cls(pipeline_response, cast(
|
|
3084
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
2800
3085
|
|
|
2801
|
-
return cast(
|
|
3086
|
+
return cast(Any, deserialized) # type: ignore
|
|
2802
3087
|
|
|
2803
3088
|
@overload
|
|
2804
3089
|
def create_feature(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
@@ -3218,97 +3503,43 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3218
3503
|
def list_grants(
|
|
3219
3504
|
self,
|
|
3220
3505
|
*,
|
|
3506
|
+
page: int = 1,
|
|
3507
|
+
page_size: int = 100,
|
|
3221
3508
|
limit: int = 1000,
|
|
3222
3509
|
offset: int = 0,
|
|
3510
|
+
order: str = "ASC",
|
|
3223
3511
|
order_by: str = "updatedAt",
|
|
3224
3512
|
include_deleted: bool = False,
|
|
3225
3513
|
**kwargs: Any
|
|
3226
|
-
) ->
|
|
3227
|
-
# pylint: disable=line-too-long
|
|
3514
|
+
) -> Any:
|
|
3228
3515
|
"""List grants.
|
|
3229
3516
|
|
|
3230
3517
|
List all grants for all the subjects and entitlements. This endpoint is intended for
|
|
3231
3518
|
administrative purposes only. To fetch the grants of a specific entitlement please use the
|
|
3232
3519
|
/api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
|
|
3233
3520
|
|
|
3521
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
3522
|
+
|
|
3523
|
+
:keyword page: Page number to return. Default value is 1.
|
|
3524
|
+
:paramtype page: int
|
|
3525
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
3526
|
+
:paramtype page_size: int
|
|
3234
3527
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
3235
3528
|
:paramtype limit: int
|
|
3236
3529
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
3237
3530
|
:paramtype offset: int
|
|
3531
|
+
:keyword order: Order by field.
|
|
3532
|
+
|
|
3533
|
+
Usage: ``?order=ASC``. Known values are: "ASC" and "DESC". Default value is "ASC".
|
|
3534
|
+
:paramtype order: str
|
|
3238
3535
|
:keyword order_by: Order by field. Known values are: "id", "createdAt", and "updatedAt".
|
|
3239
3536
|
Default value is "updatedAt".
|
|
3240
3537
|
:paramtype order_by: str
|
|
3241
3538
|
:keyword include_deleted: Include deleted entries. Default value is False.
|
|
3242
3539
|
:paramtype include_deleted: bool
|
|
3243
|
-
:return:
|
|
3244
|
-
:rtype:
|
|
3540
|
+
:return: any
|
|
3541
|
+
:rtype: any
|
|
3245
3542
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
3246
|
-
|
|
3247
|
-
Example:
|
|
3248
|
-
.. code-block:: python
|
|
3249
|
-
|
|
3250
|
-
# response body for status code(s): 200
|
|
3251
|
-
response == [
|
|
3252
|
-
{
|
|
3253
|
-
"amount": 0.0, # The amount to grant. Should be a positive number.
|
|
3254
|
-
Required.
|
|
3255
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
3256
|
-
was created. Required.
|
|
3257
|
-
"effectiveAt": "2020-02-20 00:00:00", # Effective date for grants
|
|
3258
|
-
and anchor for recurring grants. Provided value will be ceiled to metering
|
|
3259
|
-
windowSize (minute). Required.
|
|
3260
|
-
"entitlementId": "str", # The unique entitlement ULID that the grant
|
|
3261
|
-
is associated with. Required.
|
|
3262
|
-
"expiration": {
|
|
3263
|
-
"count": 0, # The expiration period count like 12 months.
|
|
3264
|
-
Required.
|
|
3265
|
-
"duration": "str" # The expiration period duration like
|
|
3266
|
-
month. Required. Known values are: "HOUR", "DAY", "WEEK", "MONTH", and
|
|
3267
|
-
"YEAR".
|
|
3268
|
-
},
|
|
3269
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
3270
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
3271
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
3272
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
3273
|
-
the resource was deleted.
|
|
3274
|
-
"expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date
|
|
3275
|
-
of the grant.
|
|
3276
|
-
"maxRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
3277
|
-
rolled over at reset, after which they can have a different balance compared
|
|
3278
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
3279
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
3280
|
-
MinRolloverAmount)).
|
|
3281
|
-
"metadata": {
|
|
3282
|
-
"str": "str" # Optional. Dictionary of :code:`<string>`.
|
|
3283
|
-
},
|
|
3284
|
-
"minRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
3285
|
-
rolled over at reset, after which they can have a different balance compared
|
|
3286
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
3287
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
3288
|
-
MinRolloverAmount)).
|
|
3289
|
-
"nextRecurrence": "2020-02-20 00:00:00", # Optional. The next time
|
|
3290
|
-
the grant will recurr.
|
|
3291
|
-
"priority": 1, # Optional. Default value is 1. The priority of the
|
|
3292
|
-
grant. Grants with higher priority are applied first. Priority is a positive
|
|
3293
|
-
decimal numbers. With lower numbers indicating higher importance. For
|
|
3294
|
-
example, a priority of 1 is more urgent than a priority of 2. When there are
|
|
3295
|
-
several grants available for the same subject, the system selects the grant
|
|
3296
|
-
with the highest priority. In cases where grants share the same priority
|
|
3297
|
-
level, the grant closest to its expiration will be used first. In the case of
|
|
3298
|
-
two grants have identical priorities and expiration dates, the system will
|
|
3299
|
-
use the grant that was created first.
|
|
3300
|
-
"recurrence": {
|
|
3301
|
-
"anchor": "2020-02-20 00:00:00", # An arbitrary anchor to
|
|
3302
|
-
base the recurring period on. Required.
|
|
3303
|
-
"interval": "str" # List of pre-defined periods that can be
|
|
3304
|
-
used for recurring & scheduling. DAY: Every day WEEK: Every
|
|
3305
|
-
week MONTH: Every month YEAR: Every year. Required. Known values
|
|
3306
|
-
are: "DAY", "WEEK", "MONTH", and "YEAR".
|
|
3307
|
-
},
|
|
3308
|
-
"voidedAt": "2020-02-20 00:00:00" # Optional. The date and time the
|
|
3309
|
-
grant was voided (cannot be used after that).
|
|
3310
|
-
}
|
|
3311
|
-
]
|
|
3312
3543
|
"""
|
|
3313
3544
|
error_map = {
|
|
3314
3545
|
404: ResourceNotFoundError,
|
|
@@ -3321,11 +3552,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3321
3552
|
_headers = kwargs.pop("headers", {}) or {}
|
|
3322
3553
|
_params = kwargs.pop("params", {}) or {}
|
|
3323
3554
|
|
|
3324
|
-
cls: ClsType[
|
|
3555
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
3325
3556
|
|
|
3326
3557
|
_request = build_list_grants_request(
|
|
3558
|
+
page=page,
|
|
3559
|
+
page_size=page_size,
|
|
3327
3560
|
limit=limit,
|
|
3328
3561
|
offset=offset,
|
|
3562
|
+
order=order,
|
|
3329
3563
|
order_by=order_by,
|
|
3330
3564
|
include_deleted=include_deleted,
|
|
3331
3565
|
headers=_headers,
|
|
@@ -3352,9 +3586,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3352
3586
|
deserialized = None
|
|
3353
3587
|
|
|
3354
3588
|
if cls:
|
|
3355
|
-
return cls(pipeline_response, cast(
|
|
3589
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
3356
3590
|
|
|
3357
|
-
return cast(
|
|
3591
|
+
return cast(Any, deserialized) # type: ignore
|
|
3358
3592
|
|
|
3359
3593
|
@distributed_trace
|
|
3360
3594
|
def void_grant(self, grant_id: str, **kwargs: Any) -> Optional[JSON]:
|
|
@@ -4966,3 +5200,1147 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4966
5200
|
return cls(pipeline_response, cast(str, deserialized), {}) # type: ignore
|
|
4967
5201
|
|
|
4968
5202
|
return cast(str, deserialized) # type: ignore
|
|
5203
|
+
|
|
5204
|
+
@distributed_trace
|
|
5205
|
+
def list_notification_channels(
|
|
5206
|
+
self, *, limit: int = 1000, offset: int = 0, order_by: str = "id", include_disabled: bool = False, **kwargs: Any
|
|
5207
|
+
) -> List[JSON]:
|
|
5208
|
+
"""List notification channels.
|
|
5209
|
+
|
|
5210
|
+
List all notification channels.
|
|
5211
|
+
|
|
5212
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
5213
|
+
:paramtype limit: int
|
|
5214
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
5215
|
+
:paramtype offset: int
|
|
5216
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
5217
|
+
"updatedAt". Default value is "id".
|
|
5218
|
+
:paramtype order_by: str
|
|
5219
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
5220
|
+
:paramtype include_disabled: bool
|
|
5221
|
+
:return: list of JSON object
|
|
5222
|
+
:rtype: list[JSON]
|
|
5223
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5224
|
+
|
|
5225
|
+
Example:
|
|
5226
|
+
.. code-block:: python
|
|
5227
|
+
|
|
5228
|
+
# response body for status code(s): 200
|
|
5229
|
+
response == [
|
|
5230
|
+
{}
|
|
5231
|
+
]
|
|
5232
|
+
"""
|
|
5233
|
+
error_map = {
|
|
5234
|
+
404: ResourceNotFoundError,
|
|
5235
|
+
409: ResourceExistsError,
|
|
5236
|
+
304: ResourceNotModifiedError,
|
|
5237
|
+
400: HttpResponseError,
|
|
5238
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5239
|
+
}
|
|
5240
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5241
|
+
|
|
5242
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5243
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5244
|
+
|
|
5245
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
5246
|
+
|
|
5247
|
+
_request = build_list_notification_channels_request(
|
|
5248
|
+
limit=limit,
|
|
5249
|
+
offset=offset,
|
|
5250
|
+
order_by=order_by,
|
|
5251
|
+
include_disabled=include_disabled,
|
|
5252
|
+
headers=_headers,
|
|
5253
|
+
params=_params,
|
|
5254
|
+
)
|
|
5255
|
+
_request.url = self._client.format_url(_request.url)
|
|
5256
|
+
|
|
5257
|
+
_stream = False
|
|
5258
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5259
|
+
_request, stream=_stream, **kwargs
|
|
5260
|
+
)
|
|
5261
|
+
|
|
5262
|
+
response = pipeline_response.http_response
|
|
5263
|
+
|
|
5264
|
+
if response.status_code not in [200]:
|
|
5265
|
+
if _stream:
|
|
5266
|
+
response.read() # Load the body in memory and close the socket
|
|
5267
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5268
|
+
raise HttpResponseError(response=response)
|
|
5269
|
+
|
|
5270
|
+
if response.content:
|
|
5271
|
+
deserialized = response.json()
|
|
5272
|
+
else:
|
|
5273
|
+
deserialized = None
|
|
5274
|
+
|
|
5275
|
+
if cls:
|
|
5276
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
5277
|
+
|
|
5278
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
5279
|
+
|
|
5280
|
+
@overload
|
|
5281
|
+
def create_notification_channel(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
5282
|
+
"""Create a notification channel.
|
|
5283
|
+
|
|
5284
|
+
Create a new notification channel.
|
|
5285
|
+
|
|
5286
|
+
:param body: The notification channel to create. Required.
|
|
5287
|
+
:type body: JSON
|
|
5288
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5289
|
+
Default value is "application/json".
|
|
5290
|
+
:paramtype content_type: str
|
|
5291
|
+
:return: JSON object
|
|
5292
|
+
:rtype: JSON
|
|
5293
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5294
|
+
|
|
5295
|
+
Example:
|
|
5296
|
+
.. code-block:: python
|
|
5297
|
+
|
|
5298
|
+
# JSON input template you can fill out and use as your body input.
|
|
5299
|
+
body = {}
|
|
5300
|
+
|
|
5301
|
+
# response body for status code(s): 409
|
|
5302
|
+
response == {
|
|
5303
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5304
|
+
of the problem. Required.
|
|
5305
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5306
|
+
occurrence of the problem. Required.
|
|
5307
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5308
|
+
Required.
|
|
5309
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5310
|
+
Required.
|
|
5311
|
+
"extensions": {
|
|
5312
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5313
|
+
Required.
|
|
5314
|
+
},
|
|
5315
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5316
|
+
occurrence of the problem.
|
|
5317
|
+
}
|
|
5318
|
+
"""
|
|
5319
|
+
|
|
5320
|
+
@overload
|
|
5321
|
+
def create_notification_channel(
|
|
5322
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5323
|
+
) -> JSON:
|
|
5324
|
+
"""Create a notification channel.
|
|
5325
|
+
|
|
5326
|
+
Create a new notification channel.
|
|
5327
|
+
|
|
5328
|
+
:param body: The notification channel to create. Required.
|
|
5329
|
+
:type body: IO[bytes]
|
|
5330
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5331
|
+
Default value is "application/json".
|
|
5332
|
+
:paramtype content_type: str
|
|
5333
|
+
:return: JSON object
|
|
5334
|
+
:rtype: JSON
|
|
5335
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5336
|
+
|
|
5337
|
+
Example:
|
|
5338
|
+
.. code-block:: python
|
|
5339
|
+
|
|
5340
|
+
# response body for status code(s): 409
|
|
5341
|
+
response == {
|
|
5342
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5343
|
+
of the problem. Required.
|
|
5344
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5345
|
+
occurrence of the problem. Required.
|
|
5346
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5347
|
+
Required.
|
|
5348
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5349
|
+
Required.
|
|
5350
|
+
"extensions": {
|
|
5351
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5352
|
+
Required.
|
|
5353
|
+
},
|
|
5354
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5355
|
+
occurrence of the problem.
|
|
5356
|
+
}
|
|
5357
|
+
"""
|
|
5358
|
+
|
|
5359
|
+
@distributed_trace
|
|
5360
|
+
def create_notification_channel(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5361
|
+
"""Create a notification channel.
|
|
5362
|
+
|
|
5363
|
+
Create a new notification channel.
|
|
5364
|
+
|
|
5365
|
+
:param body: The notification channel to create. Is either a JSON type or a IO[bytes] type.
|
|
5366
|
+
Required.
|
|
5367
|
+
:type body: JSON or IO[bytes]
|
|
5368
|
+
:return: JSON object
|
|
5369
|
+
:rtype: JSON
|
|
5370
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5371
|
+
|
|
5372
|
+
Example:
|
|
5373
|
+
.. code-block:: python
|
|
5374
|
+
|
|
5375
|
+
# JSON input template you can fill out and use as your body input.
|
|
5376
|
+
body = {}
|
|
5377
|
+
|
|
5378
|
+
# response body for status code(s): 409
|
|
5379
|
+
response == {
|
|
5380
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5381
|
+
of the problem. Required.
|
|
5382
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5383
|
+
occurrence of the problem. Required.
|
|
5384
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5385
|
+
Required.
|
|
5386
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5387
|
+
Required.
|
|
5388
|
+
"extensions": {
|
|
5389
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5390
|
+
Required.
|
|
5391
|
+
},
|
|
5392
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5393
|
+
occurrence of the problem.
|
|
5394
|
+
}
|
|
5395
|
+
"""
|
|
5396
|
+
error_map = {
|
|
5397
|
+
404: ResourceNotFoundError,
|
|
5398
|
+
409: ResourceExistsError,
|
|
5399
|
+
304: ResourceNotModifiedError,
|
|
5400
|
+
400: HttpResponseError,
|
|
5401
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5402
|
+
}
|
|
5403
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5404
|
+
|
|
5405
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5406
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5407
|
+
|
|
5408
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5409
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5410
|
+
|
|
5411
|
+
content_type = content_type or "application/json"
|
|
5412
|
+
_json = None
|
|
5413
|
+
_content = None
|
|
5414
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5415
|
+
_content = body
|
|
5416
|
+
else:
|
|
5417
|
+
_json = body
|
|
5418
|
+
|
|
5419
|
+
_request = build_create_notification_channel_request(
|
|
5420
|
+
content_type=content_type,
|
|
5421
|
+
json=_json,
|
|
5422
|
+
content=_content,
|
|
5423
|
+
headers=_headers,
|
|
5424
|
+
params=_params,
|
|
5425
|
+
)
|
|
5426
|
+
_request.url = self._client.format_url(_request.url)
|
|
5427
|
+
|
|
5428
|
+
_stream = False
|
|
5429
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5430
|
+
_request, stream=_stream, **kwargs
|
|
5431
|
+
)
|
|
5432
|
+
|
|
5433
|
+
response = pipeline_response.http_response
|
|
5434
|
+
|
|
5435
|
+
if response.status_code not in [201, 409]:
|
|
5436
|
+
if _stream:
|
|
5437
|
+
response.read() # Load the body in memory and close the socket
|
|
5438
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5439
|
+
raise HttpResponseError(response=response)
|
|
5440
|
+
|
|
5441
|
+
if response.status_code == 201:
|
|
5442
|
+
if response.content:
|
|
5443
|
+
deserialized = response.json()
|
|
5444
|
+
else:
|
|
5445
|
+
deserialized = None
|
|
5446
|
+
|
|
5447
|
+
if response.status_code == 409:
|
|
5448
|
+
if response.content:
|
|
5449
|
+
deserialized = response.json()
|
|
5450
|
+
else:
|
|
5451
|
+
deserialized = None
|
|
5452
|
+
|
|
5453
|
+
if cls:
|
|
5454
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5455
|
+
|
|
5456
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5457
|
+
|
|
5458
|
+
@distributed_trace
|
|
5459
|
+
def get_notification_channel(self, channel_id: str, **kwargs: Any) -> JSON:
|
|
5460
|
+
"""Get notification channel.
|
|
5461
|
+
|
|
5462
|
+
Get a notification channel by id.
|
|
5463
|
+
|
|
5464
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5465
|
+
:type channel_id: str
|
|
5466
|
+
:return: JSON object
|
|
5467
|
+
:rtype: JSON
|
|
5468
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5469
|
+
"""
|
|
5470
|
+
error_map = {
|
|
5471
|
+
409: ResourceExistsError,
|
|
5472
|
+
304: ResourceNotModifiedError,
|
|
5473
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5474
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5475
|
+
}
|
|
5476
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5477
|
+
|
|
5478
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5479
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5480
|
+
|
|
5481
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5482
|
+
|
|
5483
|
+
_request = build_get_notification_channel_request(
|
|
5484
|
+
channel_id=channel_id,
|
|
5485
|
+
headers=_headers,
|
|
5486
|
+
params=_params,
|
|
5487
|
+
)
|
|
5488
|
+
_request.url = self._client.format_url(_request.url)
|
|
5489
|
+
|
|
5490
|
+
_stream = False
|
|
5491
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5492
|
+
_request, stream=_stream, **kwargs
|
|
5493
|
+
)
|
|
5494
|
+
|
|
5495
|
+
response = pipeline_response.http_response
|
|
5496
|
+
|
|
5497
|
+
if response.status_code not in [200]:
|
|
5498
|
+
if _stream:
|
|
5499
|
+
response.read() # Load the body in memory and close the socket
|
|
5500
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5501
|
+
raise HttpResponseError(response=response)
|
|
5502
|
+
|
|
5503
|
+
if response.content:
|
|
5504
|
+
deserialized = response.json()
|
|
5505
|
+
else:
|
|
5506
|
+
deserialized = None
|
|
5507
|
+
|
|
5508
|
+
if cls:
|
|
5509
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5510
|
+
|
|
5511
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5512
|
+
|
|
5513
|
+
@distributed_trace
|
|
5514
|
+
def delete_notification_channel( # pylint: disable=inconsistent-return-statements
|
|
5515
|
+
self, channel_id: str, **kwargs: Any
|
|
5516
|
+
) -> None:
|
|
5517
|
+
"""Delete a notification channel.
|
|
5518
|
+
|
|
5519
|
+
Delete notification channel by id.
|
|
5520
|
+
|
|
5521
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5522
|
+
:type channel_id: str
|
|
5523
|
+
:return: None
|
|
5524
|
+
:rtype: None
|
|
5525
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5526
|
+
"""
|
|
5527
|
+
error_map = {
|
|
5528
|
+
409: ResourceExistsError,
|
|
5529
|
+
304: ResourceNotModifiedError,
|
|
5530
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5531
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5532
|
+
}
|
|
5533
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5534
|
+
|
|
5535
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5536
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5537
|
+
|
|
5538
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
5539
|
+
|
|
5540
|
+
_request = build_delete_notification_channel_request(
|
|
5541
|
+
channel_id=channel_id,
|
|
5542
|
+
headers=_headers,
|
|
5543
|
+
params=_params,
|
|
5544
|
+
)
|
|
5545
|
+
_request.url = self._client.format_url(_request.url)
|
|
5546
|
+
|
|
5547
|
+
_stream = False
|
|
5548
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5549
|
+
_request, stream=_stream, **kwargs
|
|
5550
|
+
)
|
|
5551
|
+
|
|
5552
|
+
response = pipeline_response.http_response
|
|
5553
|
+
|
|
5554
|
+
if response.status_code not in [204]:
|
|
5555
|
+
if _stream:
|
|
5556
|
+
response.read() # Load the body in memory and close the socket
|
|
5557
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5558
|
+
raise HttpResponseError(response=response)
|
|
5559
|
+
|
|
5560
|
+
if cls:
|
|
5561
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
5562
|
+
|
|
5563
|
+
@overload
|
|
5564
|
+
def update_notification_channel(
|
|
5565
|
+
self, channel_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
5566
|
+
) -> JSON:
|
|
5567
|
+
"""Update notification channel.
|
|
5568
|
+
|
|
5569
|
+
Update a notification channel by id.
|
|
5570
|
+
|
|
5571
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5572
|
+
:type channel_id: str
|
|
5573
|
+
:param body: The notification channel to update. Required.
|
|
5574
|
+
:type body: JSON
|
|
5575
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5576
|
+
Default value is "application/json".
|
|
5577
|
+
:paramtype content_type: str
|
|
5578
|
+
:return: JSON object
|
|
5579
|
+
:rtype: JSON
|
|
5580
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5581
|
+
|
|
5582
|
+
Example:
|
|
5583
|
+
.. code-block:: python
|
|
5584
|
+
|
|
5585
|
+
# JSON input template you can fill out and use as your body input.
|
|
5586
|
+
body = {}
|
|
5587
|
+
"""
|
|
5588
|
+
|
|
5589
|
+
@overload
|
|
5590
|
+
def update_notification_channel(
|
|
5591
|
+
self, channel_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5592
|
+
) -> JSON:
|
|
5593
|
+
"""Update notification channel.
|
|
5594
|
+
|
|
5595
|
+
Update a notification channel by id.
|
|
5596
|
+
|
|
5597
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5598
|
+
:type channel_id: str
|
|
5599
|
+
:param body: The notification channel to update. Required.
|
|
5600
|
+
:type body: IO[bytes]
|
|
5601
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5602
|
+
Default value is "application/json".
|
|
5603
|
+
:paramtype content_type: str
|
|
5604
|
+
:return: JSON object
|
|
5605
|
+
:rtype: JSON
|
|
5606
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5607
|
+
"""
|
|
5608
|
+
|
|
5609
|
+
@distributed_trace
|
|
5610
|
+
def update_notification_channel(self, channel_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5611
|
+
"""Update notification channel.
|
|
5612
|
+
|
|
5613
|
+
Update a notification channel by id.
|
|
5614
|
+
|
|
5615
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5616
|
+
:type channel_id: str
|
|
5617
|
+
:param body: The notification channel to update. Is either a JSON type or a IO[bytes] type.
|
|
5618
|
+
Required.
|
|
5619
|
+
:type body: JSON or IO[bytes]
|
|
5620
|
+
:return: JSON object
|
|
5621
|
+
:rtype: JSON
|
|
5622
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5623
|
+
|
|
5624
|
+
Example:
|
|
5625
|
+
.. code-block:: python
|
|
5626
|
+
|
|
5627
|
+
# JSON input template you can fill out and use as your body input.
|
|
5628
|
+
body = {}
|
|
5629
|
+
"""
|
|
5630
|
+
error_map = {
|
|
5631
|
+
409: ResourceExistsError,
|
|
5632
|
+
304: ResourceNotModifiedError,
|
|
5633
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5634
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5635
|
+
}
|
|
5636
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5637
|
+
|
|
5638
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5639
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5640
|
+
|
|
5641
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5642
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5643
|
+
|
|
5644
|
+
content_type = content_type or "application/json"
|
|
5645
|
+
_json = None
|
|
5646
|
+
_content = None
|
|
5647
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5648
|
+
_content = body
|
|
5649
|
+
else:
|
|
5650
|
+
_json = body
|
|
5651
|
+
|
|
5652
|
+
_request = build_update_notification_channel_request(
|
|
5653
|
+
channel_id=channel_id,
|
|
5654
|
+
content_type=content_type,
|
|
5655
|
+
json=_json,
|
|
5656
|
+
content=_content,
|
|
5657
|
+
headers=_headers,
|
|
5658
|
+
params=_params,
|
|
5659
|
+
)
|
|
5660
|
+
_request.url = self._client.format_url(_request.url)
|
|
5661
|
+
|
|
5662
|
+
_stream = False
|
|
5663
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5664
|
+
_request, stream=_stream, **kwargs
|
|
5665
|
+
)
|
|
5666
|
+
|
|
5667
|
+
response = pipeline_response.http_response
|
|
5668
|
+
|
|
5669
|
+
if response.status_code not in [200]:
|
|
5670
|
+
if _stream:
|
|
5671
|
+
response.read() # Load the body in memory and close the socket
|
|
5672
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5673
|
+
raise HttpResponseError(response=response)
|
|
5674
|
+
|
|
5675
|
+
if response.content:
|
|
5676
|
+
deserialized = response.json()
|
|
5677
|
+
else:
|
|
5678
|
+
deserialized = None
|
|
5679
|
+
|
|
5680
|
+
if cls:
|
|
5681
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5682
|
+
|
|
5683
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5684
|
+
|
|
5685
|
+
@distributed_trace
|
|
5686
|
+
def list_notification_rules(
|
|
5687
|
+
self,
|
|
5688
|
+
*,
|
|
5689
|
+
limit: int = 1000,
|
|
5690
|
+
offset: int = 0,
|
|
5691
|
+
order_by: str = "id",
|
|
5692
|
+
include_disabled: bool = False,
|
|
5693
|
+
feature: Optional[List[str]] = None,
|
|
5694
|
+
**kwargs: Any
|
|
5695
|
+
) -> List[JSON]:
|
|
5696
|
+
"""List notification rules.
|
|
5697
|
+
|
|
5698
|
+
List all notification rules.
|
|
5699
|
+
|
|
5700
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
5701
|
+
:paramtype limit: int
|
|
5702
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
5703
|
+
:paramtype offset: int
|
|
5704
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
5705
|
+
"updatedAt". Default value is "id".
|
|
5706
|
+
:paramtype order_by: str
|
|
5707
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
5708
|
+
:paramtype include_disabled: bool
|
|
5709
|
+
:keyword feature: Filtering by multiple features.
|
|
5710
|
+
|
|
5711
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
5712
|
+
:paramtype feature: list[str]
|
|
5713
|
+
:return: list of JSON object
|
|
5714
|
+
:rtype: list[JSON]
|
|
5715
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5716
|
+
|
|
5717
|
+
Example:
|
|
5718
|
+
.. code-block:: python
|
|
5719
|
+
|
|
5720
|
+
# response body for status code(s): 200
|
|
5721
|
+
response == [
|
|
5722
|
+
{}
|
|
5723
|
+
]
|
|
5724
|
+
"""
|
|
5725
|
+
error_map = {
|
|
5726
|
+
404: ResourceNotFoundError,
|
|
5727
|
+
409: ResourceExistsError,
|
|
5728
|
+
304: ResourceNotModifiedError,
|
|
5729
|
+
400: HttpResponseError,
|
|
5730
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5731
|
+
}
|
|
5732
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5733
|
+
|
|
5734
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5735
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5736
|
+
|
|
5737
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
5738
|
+
|
|
5739
|
+
_request = build_list_notification_rules_request(
|
|
5740
|
+
limit=limit,
|
|
5741
|
+
offset=offset,
|
|
5742
|
+
order_by=order_by,
|
|
5743
|
+
include_disabled=include_disabled,
|
|
5744
|
+
feature=feature,
|
|
5745
|
+
headers=_headers,
|
|
5746
|
+
params=_params,
|
|
5747
|
+
)
|
|
5748
|
+
_request.url = self._client.format_url(_request.url)
|
|
5749
|
+
|
|
5750
|
+
_stream = False
|
|
5751
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5752
|
+
_request, stream=_stream, **kwargs
|
|
5753
|
+
)
|
|
5754
|
+
|
|
5755
|
+
response = pipeline_response.http_response
|
|
5756
|
+
|
|
5757
|
+
if response.status_code not in [200]:
|
|
5758
|
+
if _stream:
|
|
5759
|
+
response.read() # Load the body in memory and close the socket
|
|
5760
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5761
|
+
raise HttpResponseError(response=response)
|
|
5762
|
+
|
|
5763
|
+
if response.content:
|
|
5764
|
+
deserialized = response.json()
|
|
5765
|
+
else:
|
|
5766
|
+
deserialized = None
|
|
5767
|
+
|
|
5768
|
+
if cls:
|
|
5769
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
5770
|
+
|
|
5771
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
5772
|
+
|
|
5773
|
+
@overload
|
|
5774
|
+
def create_notification_rule(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
5775
|
+
"""Create a notification rule.
|
|
5776
|
+
|
|
5777
|
+
Create a new notification rule.
|
|
5778
|
+
|
|
5779
|
+
:param body: The notification rule to create. Required.
|
|
5780
|
+
:type body: JSON
|
|
5781
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5782
|
+
Default value is "application/json".
|
|
5783
|
+
:paramtype content_type: str
|
|
5784
|
+
:return: JSON object
|
|
5785
|
+
:rtype: JSON
|
|
5786
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5787
|
+
|
|
5788
|
+
Example:
|
|
5789
|
+
.. code-block:: python
|
|
5790
|
+
|
|
5791
|
+
# JSON input template you can fill out and use as your body input.
|
|
5792
|
+
body = {}
|
|
5793
|
+
|
|
5794
|
+
# response body for status code(s): 409
|
|
5795
|
+
response == {
|
|
5796
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5797
|
+
of the problem. Required.
|
|
5798
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5799
|
+
occurrence of the problem. Required.
|
|
5800
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5801
|
+
Required.
|
|
5802
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5803
|
+
Required.
|
|
5804
|
+
"extensions": {
|
|
5805
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5806
|
+
Required.
|
|
5807
|
+
},
|
|
5808
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5809
|
+
occurrence of the problem.
|
|
5810
|
+
}
|
|
5811
|
+
"""
|
|
5812
|
+
|
|
5813
|
+
@overload
|
|
5814
|
+
def create_notification_rule(
|
|
5815
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5816
|
+
) -> JSON:
|
|
5817
|
+
"""Create a notification rule.
|
|
5818
|
+
|
|
5819
|
+
Create a new notification rule.
|
|
5820
|
+
|
|
5821
|
+
:param body: The notification rule to create. Required.
|
|
5822
|
+
:type body: IO[bytes]
|
|
5823
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5824
|
+
Default value is "application/json".
|
|
5825
|
+
:paramtype content_type: str
|
|
5826
|
+
:return: JSON object
|
|
5827
|
+
:rtype: JSON
|
|
5828
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5829
|
+
|
|
5830
|
+
Example:
|
|
5831
|
+
.. code-block:: python
|
|
5832
|
+
|
|
5833
|
+
# response body for status code(s): 409
|
|
5834
|
+
response == {
|
|
5835
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5836
|
+
of the problem. Required.
|
|
5837
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5838
|
+
occurrence of the problem. Required.
|
|
5839
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5840
|
+
Required.
|
|
5841
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5842
|
+
Required.
|
|
5843
|
+
"extensions": {
|
|
5844
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5845
|
+
Required.
|
|
5846
|
+
},
|
|
5847
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5848
|
+
occurrence of the problem.
|
|
5849
|
+
}
|
|
5850
|
+
"""
|
|
5851
|
+
|
|
5852
|
+
@distributed_trace
|
|
5853
|
+
def create_notification_rule(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5854
|
+
"""Create a notification rule.
|
|
5855
|
+
|
|
5856
|
+
Create a new notification rule.
|
|
5857
|
+
|
|
5858
|
+
:param body: The notification rule to create. Is either a JSON type or a IO[bytes] type.
|
|
5859
|
+
Required.
|
|
5860
|
+
:type body: JSON or IO[bytes]
|
|
5861
|
+
:return: JSON object
|
|
5862
|
+
:rtype: JSON
|
|
5863
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5864
|
+
|
|
5865
|
+
Example:
|
|
5866
|
+
.. code-block:: python
|
|
5867
|
+
|
|
5868
|
+
# JSON input template you can fill out and use as your body input.
|
|
5869
|
+
body = {}
|
|
5870
|
+
|
|
5871
|
+
# response body for status code(s): 409
|
|
5872
|
+
response == {
|
|
5873
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5874
|
+
of the problem. Required.
|
|
5875
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5876
|
+
occurrence of the problem. Required.
|
|
5877
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5878
|
+
Required.
|
|
5879
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5880
|
+
Required.
|
|
5881
|
+
"extensions": {
|
|
5882
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5883
|
+
Required.
|
|
5884
|
+
},
|
|
5885
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5886
|
+
occurrence of the problem.
|
|
5887
|
+
}
|
|
5888
|
+
"""
|
|
5889
|
+
error_map = {
|
|
5890
|
+
404: ResourceNotFoundError,
|
|
5891
|
+
409: ResourceExistsError,
|
|
5892
|
+
304: ResourceNotModifiedError,
|
|
5893
|
+
400: HttpResponseError,
|
|
5894
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5895
|
+
}
|
|
5896
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5897
|
+
|
|
5898
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5899
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5900
|
+
|
|
5901
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5902
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5903
|
+
|
|
5904
|
+
content_type = content_type or "application/json"
|
|
5905
|
+
_json = None
|
|
5906
|
+
_content = None
|
|
5907
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5908
|
+
_content = body
|
|
5909
|
+
else:
|
|
5910
|
+
_json = body
|
|
5911
|
+
|
|
5912
|
+
_request = build_create_notification_rule_request(
|
|
5913
|
+
content_type=content_type,
|
|
5914
|
+
json=_json,
|
|
5915
|
+
content=_content,
|
|
5916
|
+
headers=_headers,
|
|
5917
|
+
params=_params,
|
|
5918
|
+
)
|
|
5919
|
+
_request.url = self._client.format_url(_request.url)
|
|
5920
|
+
|
|
5921
|
+
_stream = False
|
|
5922
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5923
|
+
_request, stream=_stream, **kwargs
|
|
5924
|
+
)
|
|
5925
|
+
|
|
5926
|
+
response = pipeline_response.http_response
|
|
5927
|
+
|
|
5928
|
+
if response.status_code not in [201, 409]:
|
|
5929
|
+
if _stream:
|
|
5930
|
+
response.read() # Load the body in memory and close the socket
|
|
5931
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5932
|
+
raise HttpResponseError(response=response)
|
|
5933
|
+
|
|
5934
|
+
if response.status_code == 201:
|
|
5935
|
+
if response.content:
|
|
5936
|
+
deserialized = response.json()
|
|
5937
|
+
else:
|
|
5938
|
+
deserialized = None
|
|
5939
|
+
|
|
5940
|
+
if response.status_code == 409:
|
|
5941
|
+
if response.content:
|
|
5942
|
+
deserialized = response.json()
|
|
5943
|
+
else:
|
|
5944
|
+
deserialized = None
|
|
5945
|
+
|
|
5946
|
+
if cls:
|
|
5947
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5948
|
+
|
|
5949
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5950
|
+
|
|
5951
|
+
@distributed_trace
|
|
5952
|
+
def get_notification_rule(self, rule_id: str, **kwargs: Any) -> JSON:
|
|
5953
|
+
"""Get notification rule.
|
|
5954
|
+
|
|
5955
|
+
Get a notification rule by id.
|
|
5956
|
+
|
|
5957
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5958
|
+
:type rule_id: str
|
|
5959
|
+
:return: JSON object
|
|
5960
|
+
:rtype: JSON
|
|
5961
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5962
|
+
"""
|
|
5963
|
+
error_map = {
|
|
5964
|
+
409: ResourceExistsError,
|
|
5965
|
+
304: ResourceNotModifiedError,
|
|
5966
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5967
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5968
|
+
}
|
|
5969
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5970
|
+
|
|
5971
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5972
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5973
|
+
|
|
5974
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5975
|
+
|
|
5976
|
+
_request = build_get_notification_rule_request(
|
|
5977
|
+
rule_id=rule_id,
|
|
5978
|
+
headers=_headers,
|
|
5979
|
+
params=_params,
|
|
5980
|
+
)
|
|
5981
|
+
_request.url = self._client.format_url(_request.url)
|
|
5982
|
+
|
|
5983
|
+
_stream = False
|
|
5984
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5985
|
+
_request, stream=_stream, **kwargs
|
|
5986
|
+
)
|
|
5987
|
+
|
|
5988
|
+
response = pipeline_response.http_response
|
|
5989
|
+
|
|
5990
|
+
if response.status_code not in [200]:
|
|
5991
|
+
if _stream:
|
|
5992
|
+
response.read() # Load the body in memory and close the socket
|
|
5993
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5994
|
+
raise HttpResponseError(response=response)
|
|
5995
|
+
|
|
5996
|
+
if response.content:
|
|
5997
|
+
deserialized = response.json()
|
|
5998
|
+
else:
|
|
5999
|
+
deserialized = None
|
|
6000
|
+
|
|
6001
|
+
if cls:
|
|
6002
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6003
|
+
|
|
6004
|
+
return cast(JSON, deserialized) # type: ignore
|
|
6005
|
+
|
|
6006
|
+
@distributed_trace
|
|
6007
|
+
def delete_notification_rule( # pylint: disable=inconsistent-return-statements
|
|
6008
|
+
self, rule_id: str, **kwargs: Any
|
|
6009
|
+
) -> None:
|
|
6010
|
+
"""Delete a notification rule.
|
|
6011
|
+
|
|
6012
|
+
Delete notification rule by id.
|
|
6013
|
+
|
|
6014
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6015
|
+
:type rule_id: str
|
|
6016
|
+
:return: None
|
|
6017
|
+
:rtype: None
|
|
6018
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6019
|
+
"""
|
|
6020
|
+
error_map = {
|
|
6021
|
+
409: ResourceExistsError,
|
|
6022
|
+
304: ResourceNotModifiedError,
|
|
6023
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6024
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6025
|
+
}
|
|
6026
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6027
|
+
|
|
6028
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6029
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6030
|
+
|
|
6031
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
6032
|
+
|
|
6033
|
+
_request = build_delete_notification_rule_request(
|
|
6034
|
+
rule_id=rule_id,
|
|
6035
|
+
headers=_headers,
|
|
6036
|
+
params=_params,
|
|
6037
|
+
)
|
|
6038
|
+
_request.url = self._client.format_url(_request.url)
|
|
6039
|
+
|
|
6040
|
+
_stream = False
|
|
6041
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6042
|
+
_request, stream=_stream, **kwargs
|
|
6043
|
+
)
|
|
6044
|
+
|
|
6045
|
+
response = pipeline_response.http_response
|
|
6046
|
+
|
|
6047
|
+
if response.status_code not in [204]:
|
|
6048
|
+
if _stream:
|
|
6049
|
+
response.read() # Load the body in memory and close the socket
|
|
6050
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6051
|
+
raise HttpResponseError(response=response)
|
|
6052
|
+
|
|
6053
|
+
if cls:
|
|
6054
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
6055
|
+
|
|
6056
|
+
@overload
|
|
6057
|
+
def update_notification_rule(
|
|
6058
|
+
self, rule_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
6059
|
+
) -> JSON:
|
|
6060
|
+
"""Update a notification rule.
|
|
6061
|
+
|
|
6062
|
+
Update a notification rule by id.
|
|
6063
|
+
|
|
6064
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6065
|
+
:type rule_id: str
|
|
6066
|
+
:param body: The notification rule to update. Required.
|
|
6067
|
+
:type body: JSON
|
|
6068
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
6069
|
+
Default value is "application/json".
|
|
6070
|
+
:paramtype content_type: str
|
|
6071
|
+
:return: JSON object
|
|
6072
|
+
:rtype: JSON
|
|
6073
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6074
|
+
|
|
6075
|
+
Example:
|
|
6076
|
+
.. code-block:: python
|
|
6077
|
+
|
|
6078
|
+
# JSON input template you can fill out and use as your body input.
|
|
6079
|
+
body = {}
|
|
6080
|
+
"""
|
|
6081
|
+
|
|
6082
|
+
@overload
|
|
6083
|
+
def update_notification_rule(
|
|
6084
|
+
self, rule_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
6085
|
+
) -> JSON:
|
|
6086
|
+
"""Update a notification rule.
|
|
6087
|
+
|
|
6088
|
+
Update a notification rule by id.
|
|
6089
|
+
|
|
6090
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6091
|
+
:type rule_id: str
|
|
6092
|
+
:param body: The notification rule to update. Required.
|
|
6093
|
+
:type body: IO[bytes]
|
|
6094
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
6095
|
+
Default value is "application/json".
|
|
6096
|
+
:paramtype content_type: str
|
|
6097
|
+
:return: JSON object
|
|
6098
|
+
:rtype: JSON
|
|
6099
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6100
|
+
"""
|
|
6101
|
+
|
|
6102
|
+
@distributed_trace
|
|
6103
|
+
def update_notification_rule(self, rule_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
6104
|
+
"""Update a notification rule.
|
|
6105
|
+
|
|
6106
|
+
Update a notification rule by id.
|
|
6107
|
+
|
|
6108
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6109
|
+
:type rule_id: str
|
|
6110
|
+
:param body: The notification rule to update. Is either a JSON type or a IO[bytes] type.
|
|
6111
|
+
Required.
|
|
6112
|
+
:type body: JSON or IO[bytes]
|
|
6113
|
+
:return: JSON object
|
|
6114
|
+
:rtype: JSON
|
|
6115
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6116
|
+
|
|
6117
|
+
Example:
|
|
6118
|
+
.. code-block:: python
|
|
6119
|
+
|
|
6120
|
+
# JSON input template you can fill out and use as your body input.
|
|
6121
|
+
body = {}
|
|
6122
|
+
"""
|
|
6123
|
+
error_map = {
|
|
6124
|
+
409: ResourceExistsError,
|
|
6125
|
+
304: ResourceNotModifiedError,
|
|
6126
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6127
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6128
|
+
}
|
|
6129
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6130
|
+
|
|
6131
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
6132
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6133
|
+
|
|
6134
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
6135
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6136
|
+
|
|
6137
|
+
content_type = content_type or "application/json"
|
|
6138
|
+
_json = None
|
|
6139
|
+
_content = None
|
|
6140
|
+
if isinstance(body, (IOBase, bytes)):
|
|
6141
|
+
_content = body
|
|
6142
|
+
else:
|
|
6143
|
+
_json = body
|
|
6144
|
+
|
|
6145
|
+
_request = build_update_notification_rule_request(
|
|
6146
|
+
rule_id=rule_id,
|
|
6147
|
+
content_type=content_type,
|
|
6148
|
+
json=_json,
|
|
6149
|
+
content=_content,
|
|
6150
|
+
headers=_headers,
|
|
6151
|
+
params=_params,
|
|
6152
|
+
)
|
|
6153
|
+
_request.url = self._client.format_url(_request.url)
|
|
6154
|
+
|
|
6155
|
+
_stream = False
|
|
6156
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6157
|
+
_request, stream=_stream, **kwargs
|
|
6158
|
+
)
|
|
6159
|
+
|
|
6160
|
+
response = pipeline_response.http_response
|
|
6161
|
+
|
|
6162
|
+
if response.status_code not in [200]:
|
|
6163
|
+
if _stream:
|
|
6164
|
+
response.read() # Load the body in memory and close the socket
|
|
6165
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6166
|
+
raise HttpResponseError(response=response)
|
|
6167
|
+
|
|
6168
|
+
if response.content:
|
|
6169
|
+
deserialized = response.json()
|
|
6170
|
+
else:
|
|
6171
|
+
deserialized = None
|
|
6172
|
+
|
|
6173
|
+
if cls:
|
|
6174
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6175
|
+
|
|
6176
|
+
return cast(JSON, deserialized) # type: ignore
|
|
6177
|
+
|
|
6178
|
+
@distributed_trace
|
|
6179
|
+
def list_notification_events(
|
|
6180
|
+
self,
|
|
6181
|
+
*,
|
|
6182
|
+
limit: int = 1000,
|
|
6183
|
+
offset: int = 0,
|
|
6184
|
+
order_by: str = "id",
|
|
6185
|
+
feature: Optional[List[str]] = None,
|
|
6186
|
+
subject: Optional[List[str]] = None,
|
|
6187
|
+
**kwargs: Any
|
|
6188
|
+
) -> List[JSON]:
|
|
6189
|
+
"""List notification evens.
|
|
6190
|
+
|
|
6191
|
+
List all notification events.
|
|
6192
|
+
|
|
6193
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
6194
|
+
:paramtype limit: int
|
|
6195
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
6196
|
+
:paramtype offset: int
|
|
6197
|
+
:keyword order_by: Order by field. Known values are: "id" and "createdAt". Default value is
|
|
6198
|
+
"id".
|
|
6199
|
+
:paramtype order_by: str
|
|
6200
|
+
:keyword feature: Filtering by multiple features.
|
|
6201
|
+
|
|
6202
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
6203
|
+
:paramtype feature: list[str]
|
|
6204
|
+
:keyword subject: Filtering by multiple subjects.
|
|
6205
|
+
|
|
6206
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
6207
|
+
:paramtype subject: list[str]
|
|
6208
|
+
:return: list of JSON object
|
|
6209
|
+
:rtype: list[JSON]
|
|
6210
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6211
|
+
|
|
6212
|
+
Example:
|
|
6213
|
+
.. code-block:: python
|
|
6214
|
+
|
|
6215
|
+
# response body for status code(s): 200
|
|
6216
|
+
response == [
|
|
6217
|
+
{
|
|
6218
|
+
"createdAt": "2020-02-20 00:00:00", # Timestamp when the
|
|
6219
|
+
notification event was created. Required.
|
|
6220
|
+
"deliveryStatus": [
|
|
6221
|
+
{
|
|
6222
|
+
"channel": {
|
|
6223
|
+
"id": "str", # A unique identifier for the
|
|
6224
|
+
notification channel. Required.
|
|
6225
|
+
"type": "str" # The type of the notification
|
|
6226
|
+
channel. Required. "WEBHOOK"
|
|
6227
|
+
},
|
|
6228
|
+
"state": "str", # Required. Known values are:
|
|
6229
|
+
"SUCCESS", "FAILED", and "SENDING".
|
|
6230
|
+
"updatedAt": "2020-02-20 00:00:00" # Required.
|
|
6231
|
+
}
|
|
6232
|
+
],
|
|
6233
|
+
"id": "str", # A unique identifier for the notification event.
|
|
6234
|
+
Required.
|
|
6235
|
+
"payload": {},
|
|
6236
|
+
"rule": {
|
|
6237
|
+
"id": "str", # A unique identifier for the notification
|
|
6238
|
+
rule. Required.
|
|
6239
|
+
"type": "str" # The type of the notification event.
|
|
6240
|
+
Required. "entitlements.balance.threshold"
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
]
|
|
6244
|
+
"""
|
|
6245
|
+
error_map = {
|
|
6246
|
+
404: ResourceNotFoundError,
|
|
6247
|
+
409: ResourceExistsError,
|
|
6248
|
+
304: ResourceNotModifiedError,
|
|
6249
|
+
400: HttpResponseError,
|
|
6250
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6251
|
+
}
|
|
6252
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6253
|
+
|
|
6254
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6255
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6256
|
+
|
|
6257
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
6258
|
+
|
|
6259
|
+
_request = build_list_notification_events_request(
|
|
6260
|
+
limit=limit,
|
|
6261
|
+
offset=offset,
|
|
6262
|
+
order_by=order_by,
|
|
6263
|
+
feature=feature,
|
|
6264
|
+
subject=subject,
|
|
6265
|
+
headers=_headers,
|
|
6266
|
+
params=_params,
|
|
6267
|
+
)
|
|
6268
|
+
_request.url = self._client.format_url(_request.url)
|
|
6269
|
+
|
|
6270
|
+
_stream = False
|
|
6271
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6272
|
+
_request, stream=_stream, **kwargs
|
|
6273
|
+
)
|
|
6274
|
+
|
|
6275
|
+
response = pipeline_response.http_response
|
|
6276
|
+
|
|
6277
|
+
if response.status_code not in [200]:
|
|
6278
|
+
if _stream:
|
|
6279
|
+
response.read() # Load the body in memory and close the socket
|
|
6280
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6281
|
+
raise HttpResponseError(response=response)
|
|
6282
|
+
|
|
6283
|
+
if response.content:
|
|
6284
|
+
deserialized = response.json()
|
|
6285
|
+
else:
|
|
6286
|
+
deserialized = None
|
|
6287
|
+
|
|
6288
|
+
if cls:
|
|
6289
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
6290
|
+
|
|
6291
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
6292
|
+
|
|
6293
|
+
@distributed_trace
|
|
6294
|
+
def get_notification_event(self, event_id: str, **kwargs: Any) -> JSON:
|
|
6295
|
+
"""Get notification event.
|
|
6296
|
+
|
|
6297
|
+
Get a notification event by id.
|
|
6298
|
+
|
|
6299
|
+
:param event_id: A unique ULID identifier for a notification event. Required.
|
|
6300
|
+
:type event_id: str
|
|
6301
|
+
:return: JSON object
|
|
6302
|
+
:rtype: JSON
|
|
6303
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6304
|
+
"""
|
|
6305
|
+
error_map = {
|
|
6306
|
+
409: ResourceExistsError,
|
|
6307
|
+
304: ResourceNotModifiedError,
|
|
6308
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6309
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6310
|
+
}
|
|
6311
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6312
|
+
|
|
6313
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6314
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6315
|
+
|
|
6316
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6317
|
+
|
|
6318
|
+
_request = build_get_notification_event_request(
|
|
6319
|
+
event_id=event_id,
|
|
6320
|
+
headers=_headers,
|
|
6321
|
+
params=_params,
|
|
6322
|
+
)
|
|
6323
|
+
_request.url = self._client.format_url(_request.url)
|
|
6324
|
+
|
|
6325
|
+
_stream = False
|
|
6326
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6327
|
+
_request, stream=_stream, **kwargs
|
|
6328
|
+
)
|
|
6329
|
+
|
|
6330
|
+
response = pipeline_response.http_response
|
|
6331
|
+
|
|
6332
|
+
if response.status_code not in [200]:
|
|
6333
|
+
if _stream:
|
|
6334
|
+
response.read() # Load the body in memory and close the socket
|
|
6335
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6336
|
+
raise HttpResponseError(response=response)
|
|
6337
|
+
|
|
6338
|
+
if response.content:
|
|
6339
|
+
deserialized = response.json()
|
|
6340
|
+
else:
|
|
6341
|
+
deserialized = None
|
|
6342
|
+
|
|
6343
|
+
if cls:
|
|
6344
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6345
|
+
|
|
6346
|
+
return cast(JSON, deserialized) # type: ignore
|