openmeter 1.0.0b120__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 +1451 -23
- openmeter/aio/_operations/_operations.py +1181 -17
- {openmeter-1.0.0b120.dist-info → openmeter-1.0.0b122.dist-info}/METADATA +1 -1
- {openmeter-1.0.0b120.dist-info → openmeter-1.0.0b122.dist-info}/RECORD +5 -5
- {openmeter-1.0.0b120.dist-info → openmeter-1.0.0b122.dist-info}/WHEEL +0 -0
|
@@ -627,7 +627,7 @@ def build_delete_entitlement_request(subject_id_or_key: str, entitlement_id: str
|
|
|
627
627
|
|
|
628
628
|
def build_list_entitlement_grants_request(
|
|
629
629
|
subject_id_or_key: str,
|
|
630
|
-
|
|
630
|
+
entitlement_id_or_feature_key: str,
|
|
631
631
|
*,
|
|
632
632
|
include_deleted: bool = False,
|
|
633
633
|
order_by: str = "updatedAt",
|
|
@@ -639,10 +639,12 @@ def build_list_entitlement_grants_request(
|
|
|
639
639
|
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
640
640
|
|
|
641
641
|
# Construct URL
|
|
642
|
-
_url = "/api/v1/subjects/{subjectIdOrKey}/entitlements/{
|
|
642
|
+
_url = "/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants"
|
|
643
643
|
path_format_arguments = {
|
|
644
644
|
"subjectIdOrKey": _SERIALIZER.url("subject_id_or_key", subject_id_or_key, "str"),
|
|
645
|
-
"
|
|
645
|
+
"entitlementIdOrFeatureKey": _SERIALIZER.url(
|
|
646
|
+
"entitlement_id_or_feature_key", entitlement_id_or_feature_key, "str"
|
|
647
|
+
),
|
|
646
648
|
}
|
|
647
649
|
|
|
648
650
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -659,17 +661,21 @@ def build_list_entitlement_grants_request(
|
|
|
659
661
|
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
660
662
|
|
|
661
663
|
|
|
662
|
-
def build_create_grant_request(
|
|
664
|
+
def build_create_grant_request(
|
|
665
|
+
subject_id_or_key: str, entitlement_id_or_feature_key: str, **kwargs: Any
|
|
666
|
+
) -> HttpRequest:
|
|
663
667
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
664
668
|
|
|
665
669
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
666
670
|
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
667
671
|
|
|
668
672
|
# Construct URL
|
|
669
|
-
_url = "/api/v1/subjects/{subjectIdOrKey}/entitlements/{
|
|
673
|
+
_url = "/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants"
|
|
670
674
|
path_format_arguments = {
|
|
671
675
|
"subjectIdOrKey": _SERIALIZER.url("subject_id_or_key", subject_id_or_key, "str"),
|
|
672
|
-
"
|
|
676
|
+
"entitlementIdOrFeatureKey": _SERIALIZER.url(
|
|
677
|
+
"entitlement_id_or_feature_key", entitlement_id_or_feature_key, "str"
|
|
678
|
+
),
|
|
673
679
|
}
|
|
674
680
|
|
|
675
681
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -791,6 +797,280 @@ def build_get_debug_metrics_request(**kwargs: Any) -> HttpRequest:
|
|
|
791
797
|
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
792
798
|
|
|
793
799
|
|
|
800
|
+
def build_list_notification_channels_request(
|
|
801
|
+
*, limit: int = 1000, offset: int = 0, order_by: str = "id", include_disabled: bool = False, **kwargs: Any
|
|
802
|
+
) -> HttpRequest:
|
|
803
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
804
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
805
|
+
|
|
806
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
807
|
+
|
|
808
|
+
# Construct URL
|
|
809
|
+
_url = "/api/v1/notification/channels"
|
|
810
|
+
|
|
811
|
+
# Construct parameters
|
|
812
|
+
if limit is not None:
|
|
813
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
814
|
+
if offset is not None:
|
|
815
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
816
|
+
if order_by is not None:
|
|
817
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
818
|
+
if include_disabled is not None:
|
|
819
|
+
_params["includeDisabled"] = _SERIALIZER.query("include_disabled", include_disabled, "bool")
|
|
820
|
+
|
|
821
|
+
# Construct headers
|
|
822
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
823
|
+
|
|
824
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
def build_create_notification_channel_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
|
|
828
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
829
|
+
|
|
830
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
831
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
832
|
+
|
|
833
|
+
# Construct URL
|
|
834
|
+
_url = "/api/v1/notification/channels"
|
|
835
|
+
|
|
836
|
+
# Construct headers
|
|
837
|
+
if content_type is not None:
|
|
838
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
839
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
840
|
+
|
|
841
|
+
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
def build_get_notification_channel_request(channel_id: str, **kwargs: Any) -> HttpRequest:
|
|
845
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
846
|
+
|
|
847
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
848
|
+
|
|
849
|
+
# Construct URL
|
|
850
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
851
|
+
path_format_arguments = {
|
|
852
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
856
|
+
|
|
857
|
+
# Construct headers
|
|
858
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
859
|
+
|
|
860
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
def build_delete_notification_channel_request( # pylint: disable=name-too-long
|
|
864
|
+
channel_id: str, **kwargs: Any
|
|
865
|
+
) -> HttpRequest:
|
|
866
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
867
|
+
|
|
868
|
+
accept = _headers.pop("Accept", "application/problem+json")
|
|
869
|
+
|
|
870
|
+
# Construct URL
|
|
871
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
872
|
+
path_format_arguments = {
|
|
873
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
877
|
+
|
|
878
|
+
# Construct headers
|
|
879
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
880
|
+
|
|
881
|
+
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
def build_update_notification_channel_request( # pylint: disable=name-too-long
|
|
885
|
+
channel_id: str, **kwargs: Any
|
|
886
|
+
) -> HttpRequest:
|
|
887
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
888
|
+
|
|
889
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
890
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
891
|
+
|
|
892
|
+
# Construct URL
|
|
893
|
+
_url = "/api/v1/notification/channels/{channelId}"
|
|
894
|
+
path_format_arguments = {
|
|
895
|
+
"channelId": _SERIALIZER.url("channel_id", channel_id, "str"),
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
899
|
+
|
|
900
|
+
# Construct headers
|
|
901
|
+
if content_type is not None:
|
|
902
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
903
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
904
|
+
|
|
905
|
+
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def build_list_notification_rules_request(
|
|
909
|
+
*,
|
|
910
|
+
limit: int = 1000,
|
|
911
|
+
offset: int = 0,
|
|
912
|
+
order_by: str = "id",
|
|
913
|
+
include_disabled: bool = False,
|
|
914
|
+
feature: Optional[List[str]] = None,
|
|
915
|
+
**kwargs: Any
|
|
916
|
+
) -> HttpRequest:
|
|
917
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
918
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
919
|
+
|
|
920
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
921
|
+
|
|
922
|
+
# Construct URL
|
|
923
|
+
_url = "/api/v1/notification/rules"
|
|
924
|
+
|
|
925
|
+
# Construct parameters
|
|
926
|
+
if limit is not None:
|
|
927
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
928
|
+
if offset is not None:
|
|
929
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
930
|
+
if order_by is not None:
|
|
931
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
932
|
+
if include_disabled is not None:
|
|
933
|
+
_params["includeDisabled"] = _SERIALIZER.query("include_disabled", include_disabled, "bool")
|
|
934
|
+
if feature is not None:
|
|
935
|
+
_params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
|
|
936
|
+
|
|
937
|
+
# Construct headers
|
|
938
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
939
|
+
|
|
940
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
def build_create_notification_rule_request(**kwargs: Any) -> HttpRequest:
|
|
944
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
945
|
+
|
|
946
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
947
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
948
|
+
|
|
949
|
+
# Construct URL
|
|
950
|
+
_url = "/api/v1/notification/rules"
|
|
951
|
+
|
|
952
|
+
# Construct headers
|
|
953
|
+
if content_type is not None:
|
|
954
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
955
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
956
|
+
|
|
957
|
+
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
def build_get_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
961
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
962
|
+
|
|
963
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
964
|
+
|
|
965
|
+
# Construct URL
|
|
966
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
967
|
+
path_format_arguments = {
|
|
968
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
972
|
+
|
|
973
|
+
# Construct headers
|
|
974
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
975
|
+
|
|
976
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
def build_delete_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
980
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
981
|
+
|
|
982
|
+
accept = _headers.pop("Accept", "application/problem+json")
|
|
983
|
+
|
|
984
|
+
# Construct URL
|
|
985
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
986
|
+
path_format_arguments = {
|
|
987
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
991
|
+
|
|
992
|
+
# Construct headers
|
|
993
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
994
|
+
|
|
995
|
+
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
def build_update_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
999
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1000
|
+
|
|
1001
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1002
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1003
|
+
|
|
1004
|
+
# Construct URL
|
|
1005
|
+
_url = "/api/v1/notification/rules/{ruleId}"
|
|
1006
|
+
path_format_arguments = {
|
|
1007
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1011
|
+
|
|
1012
|
+
# Construct headers
|
|
1013
|
+
if content_type is not None:
|
|
1014
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
1015
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1016
|
+
|
|
1017
|
+
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
def build_list_notification_events_request(
|
|
1021
|
+
*,
|
|
1022
|
+
limit: int = 1000,
|
|
1023
|
+
offset: int = 0,
|
|
1024
|
+
order_by: str = "id",
|
|
1025
|
+
feature: Optional[List[str]] = None,
|
|
1026
|
+
subject: Optional[List[str]] = None,
|
|
1027
|
+
**kwargs: Any
|
|
1028
|
+
) -> HttpRequest:
|
|
1029
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1030
|
+
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
1031
|
+
|
|
1032
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1033
|
+
|
|
1034
|
+
# Construct URL
|
|
1035
|
+
_url = "/api/v1/notification/events"
|
|
1036
|
+
|
|
1037
|
+
# Construct parameters
|
|
1038
|
+
if limit is not None:
|
|
1039
|
+
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
1040
|
+
if offset is not None:
|
|
1041
|
+
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
1042
|
+
if order_by is not None:
|
|
1043
|
+
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
1044
|
+
if feature is not None:
|
|
1045
|
+
_params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
|
|
1046
|
+
if subject is not None:
|
|
1047
|
+
_params["subject"] = _SERIALIZER.query("subject", subject, "[str]")
|
|
1048
|
+
|
|
1049
|
+
# Construct headers
|
|
1050
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1051
|
+
|
|
1052
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
def build_get_notification_event_request(event_id: str, **kwargs: Any) -> HttpRequest:
|
|
1056
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1057
|
+
|
|
1058
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1059
|
+
|
|
1060
|
+
# Construct URL
|
|
1061
|
+
_url = "/api/v1/notification/events/{eventId}"
|
|
1062
|
+
path_format_arguments = {
|
|
1063
|
+
"eventId": _SERIALIZER.url("event_id", event_id, "str"),
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1067
|
+
|
|
1068
|
+
# Construct headers
|
|
1069
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1070
|
+
|
|
1071
|
+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
1072
|
+
|
|
1073
|
+
|
|
794
1074
|
class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-methods
|
|
795
1075
|
@distributed_trace
|
|
796
1076
|
def list_events(
|
|
@@ -1567,7 +1847,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1567
1847
|
:paramtype window_time_zone: str
|
|
1568
1848
|
:keyword subject: Filtering by multiple subjects.
|
|
1569
1849
|
|
|
1570
|
-
Usage:
|
|
1850
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
1571
1851
|
:paramtype subject: list[str]
|
|
1572
1852
|
:keyword filter_group_by: Default value is None.
|
|
1573
1853
|
:paramtype filter_group_by: dict[str, str]
|
|
@@ -3874,7 +4154,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3874
4154
|
def list_entitlement_grants(
|
|
3875
4155
|
self,
|
|
3876
4156
|
subject_id_or_key: str,
|
|
3877
|
-
|
|
4157
|
+
entitlement_id_or_feature_key: str,
|
|
3878
4158
|
*,
|
|
3879
4159
|
include_deleted: bool = False,
|
|
3880
4160
|
order_by: str = "updatedAt",
|
|
@@ -3883,13 +4163,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3883
4163
|
# pylint: disable=line-too-long
|
|
3884
4164
|
"""List grants for an entitlement.
|
|
3885
4165
|
|
|
3886
|
-
List all grants issued for an entitlement.
|
|
3887
|
-
|
|
4166
|
+
List all grants issued for an entitlement. The entitlement can be defined either by its id or
|
|
4167
|
+
featureKey.
|
|
3888
4168
|
|
|
3889
4169
|
:param subject_id_or_key: A unique identifier for a subject. Required.
|
|
3890
4170
|
:type subject_id_or_key: str
|
|
3891
|
-
:param
|
|
3892
|
-
|
|
4171
|
+
:param entitlement_id_or_feature_key: The id of the entitlement or the key of the feature.
|
|
4172
|
+
Required.
|
|
4173
|
+
:type entitlement_id_or_feature_key: str
|
|
3893
4174
|
:keyword include_deleted: Include deleted entries. Default value is False.
|
|
3894
4175
|
:paramtype include_deleted: bool
|
|
3895
4176
|
:keyword order_by: Order by field. Known values are: "id", "createdAt", and "updatedAt".
|
|
@@ -3980,7 +4261,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3980
4261
|
|
|
3981
4262
|
_request = build_list_entitlement_grants_request(
|
|
3982
4263
|
subject_id_or_key=subject_id_or_key,
|
|
3983
|
-
|
|
4264
|
+
entitlement_id_or_feature_key=entitlement_id_or_feature_key,
|
|
3984
4265
|
include_deleted=include_deleted,
|
|
3985
4266
|
order_by=order_by,
|
|
3986
4267
|
headers=_headers,
|
|
@@ -4015,7 +4296,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4015
4296
|
def create_grant(
|
|
4016
4297
|
self,
|
|
4017
4298
|
subject_id_or_key: str,
|
|
4018
|
-
|
|
4299
|
+
entitlement_id_or_feature_key: str,
|
|
4019
4300
|
body: JSON,
|
|
4020
4301
|
*,
|
|
4021
4302
|
content_type: str = "application/json",
|
|
@@ -4048,8 +4329,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4048
4329
|
|
|
4049
4330
|
:param subject_id_or_key: A unique identifier for a subject. Required.
|
|
4050
4331
|
:type subject_id_or_key: str
|
|
4051
|
-
:param
|
|
4052
|
-
|
|
4332
|
+
:param entitlement_id_or_feature_key: The id of the entitlement or the key of the feature.
|
|
4333
|
+
Required.
|
|
4334
|
+
:type entitlement_id_or_feature_key: str
|
|
4053
4335
|
:param body: The grant to create. Required.
|
|
4054
4336
|
:type body: JSON
|
|
4055
4337
|
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
@@ -4169,7 +4451,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4169
4451
|
def create_grant(
|
|
4170
4452
|
self,
|
|
4171
4453
|
subject_id_or_key: str,
|
|
4172
|
-
|
|
4454
|
+
entitlement_id_or_feature_key: str,
|
|
4173
4455
|
body: IO[bytes],
|
|
4174
4456
|
*,
|
|
4175
4457
|
content_type: str = "application/json",
|
|
@@ -4202,8 +4484,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4202
4484
|
|
|
4203
4485
|
:param subject_id_or_key: A unique identifier for a subject. Required.
|
|
4204
4486
|
:type subject_id_or_key: str
|
|
4205
|
-
:param
|
|
4206
|
-
|
|
4487
|
+
:param entitlement_id_or_feature_key: The id of the entitlement or the key of the feature.
|
|
4488
|
+
Required.
|
|
4489
|
+
:type entitlement_id_or_feature_key: str
|
|
4207
4490
|
:param body: The grant to create. Required.
|
|
4208
4491
|
:type body: IO[bytes]
|
|
4209
4492
|
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
@@ -4277,7 +4560,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4277
4560
|
|
|
4278
4561
|
@distributed_trace
|
|
4279
4562
|
def create_grant(
|
|
4280
|
-
self, subject_id_or_key: str,
|
|
4563
|
+
self, subject_id_or_key: str, entitlement_id_or_feature_key: str, body: Union[JSON, IO[bytes]], **kwargs: Any
|
|
4281
4564
|
) -> JSON:
|
|
4282
4565
|
# pylint: disable=line-too-long
|
|
4283
4566
|
"""Create a grant.
|
|
@@ -4306,8 +4589,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4306
4589
|
|
|
4307
4590
|
:param subject_id_or_key: A unique identifier for a subject. Required.
|
|
4308
4591
|
:type subject_id_or_key: str
|
|
4309
|
-
:param
|
|
4310
|
-
|
|
4592
|
+
:param entitlement_id_or_feature_key: The id of the entitlement or the key of the feature.
|
|
4593
|
+
Required.
|
|
4594
|
+
:type entitlement_id_or_feature_key: str
|
|
4311
4595
|
:param body: The grant to create. Is either a JSON type or a IO[bytes] type. Required.
|
|
4312
4596
|
:type body: JSON or IO[bytes]
|
|
4313
4597
|
:return: JSON object
|
|
@@ -4445,7 +4729,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4445
4729
|
|
|
4446
4730
|
_request = build_create_grant_request(
|
|
4447
4731
|
subject_id_or_key=subject_id_or_key,
|
|
4448
|
-
|
|
4732
|
+
entitlement_id_or_feature_key=entitlement_id_or_feature_key,
|
|
4449
4733
|
content_type=content_type,
|
|
4450
4734
|
json=_json,
|
|
4451
4735
|
content=_content,
|
|
@@ -4956,3 +5240,1147 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
4956
5240
|
return cls(pipeline_response, cast(str, deserialized), {}) # type: ignore
|
|
4957
5241
|
|
|
4958
5242
|
return cast(str, deserialized) # type: ignore
|
|
5243
|
+
|
|
5244
|
+
@distributed_trace
|
|
5245
|
+
def list_notification_channels(
|
|
5246
|
+
self, *, limit: int = 1000, offset: int = 0, order_by: str = "id", include_disabled: bool = False, **kwargs: Any
|
|
5247
|
+
) -> List[JSON]:
|
|
5248
|
+
"""List notification channels.
|
|
5249
|
+
|
|
5250
|
+
List all notification channels.
|
|
5251
|
+
|
|
5252
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
5253
|
+
:paramtype limit: int
|
|
5254
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
5255
|
+
:paramtype offset: int
|
|
5256
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
5257
|
+
"updatedAt". Default value is "id".
|
|
5258
|
+
:paramtype order_by: str
|
|
5259
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
5260
|
+
:paramtype include_disabled: bool
|
|
5261
|
+
:return: list of JSON object
|
|
5262
|
+
:rtype: list[JSON]
|
|
5263
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5264
|
+
|
|
5265
|
+
Example:
|
|
5266
|
+
.. code-block:: python
|
|
5267
|
+
|
|
5268
|
+
# response body for status code(s): 200
|
|
5269
|
+
response == [
|
|
5270
|
+
{}
|
|
5271
|
+
]
|
|
5272
|
+
"""
|
|
5273
|
+
error_map = {
|
|
5274
|
+
404: ResourceNotFoundError,
|
|
5275
|
+
409: ResourceExistsError,
|
|
5276
|
+
304: ResourceNotModifiedError,
|
|
5277
|
+
400: HttpResponseError,
|
|
5278
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5279
|
+
}
|
|
5280
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5281
|
+
|
|
5282
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5283
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5284
|
+
|
|
5285
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
5286
|
+
|
|
5287
|
+
_request = build_list_notification_channels_request(
|
|
5288
|
+
limit=limit,
|
|
5289
|
+
offset=offset,
|
|
5290
|
+
order_by=order_by,
|
|
5291
|
+
include_disabled=include_disabled,
|
|
5292
|
+
headers=_headers,
|
|
5293
|
+
params=_params,
|
|
5294
|
+
)
|
|
5295
|
+
_request.url = self._client.format_url(_request.url)
|
|
5296
|
+
|
|
5297
|
+
_stream = False
|
|
5298
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5299
|
+
_request, stream=_stream, **kwargs
|
|
5300
|
+
)
|
|
5301
|
+
|
|
5302
|
+
response = pipeline_response.http_response
|
|
5303
|
+
|
|
5304
|
+
if response.status_code not in [200]:
|
|
5305
|
+
if _stream:
|
|
5306
|
+
response.read() # Load the body in memory and close the socket
|
|
5307
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5308
|
+
raise HttpResponseError(response=response)
|
|
5309
|
+
|
|
5310
|
+
if response.content:
|
|
5311
|
+
deserialized = response.json()
|
|
5312
|
+
else:
|
|
5313
|
+
deserialized = None
|
|
5314
|
+
|
|
5315
|
+
if cls:
|
|
5316
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
5317
|
+
|
|
5318
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
5319
|
+
|
|
5320
|
+
@overload
|
|
5321
|
+
def create_notification_channel(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
5322
|
+
"""Create a notification channel.
|
|
5323
|
+
|
|
5324
|
+
Create a new notification channel.
|
|
5325
|
+
|
|
5326
|
+
:param body: The notification channel to create. Required.
|
|
5327
|
+
:type body: JSON
|
|
5328
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5329
|
+
Default value is "application/json".
|
|
5330
|
+
:paramtype content_type: str
|
|
5331
|
+
:return: JSON object
|
|
5332
|
+
:rtype: JSON
|
|
5333
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5334
|
+
|
|
5335
|
+
Example:
|
|
5336
|
+
.. code-block:: python
|
|
5337
|
+
|
|
5338
|
+
# JSON input template you can fill out and use as your body input.
|
|
5339
|
+
body = {}
|
|
5340
|
+
|
|
5341
|
+
# response body for status code(s): 409
|
|
5342
|
+
response == {
|
|
5343
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5344
|
+
of the problem. Required.
|
|
5345
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5346
|
+
occurrence of the problem. Required.
|
|
5347
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5348
|
+
Required.
|
|
5349
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5350
|
+
Required.
|
|
5351
|
+
"extensions": {
|
|
5352
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5353
|
+
Required.
|
|
5354
|
+
},
|
|
5355
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5356
|
+
occurrence of the problem.
|
|
5357
|
+
}
|
|
5358
|
+
"""
|
|
5359
|
+
|
|
5360
|
+
@overload
|
|
5361
|
+
def create_notification_channel(
|
|
5362
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5363
|
+
) -> JSON:
|
|
5364
|
+
"""Create a notification channel.
|
|
5365
|
+
|
|
5366
|
+
Create a new notification channel.
|
|
5367
|
+
|
|
5368
|
+
:param body: The notification channel to create. Required.
|
|
5369
|
+
:type body: IO[bytes]
|
|
5370
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5371
|
+
Default value is "application/json".
|
|
5372
|
+
:paramtype content_type: str
|
|
5373
|
+
:return: JSON object
|
|
5374
|
+
:rtype: JSON
|
|
5375
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5376
|
+
|
|
5377
|
+
Example:
|
|
5378
|
+
.. code-block:: python
|
|
5379
|
+
|
|
5380
|
+
# response body for status code(s): 409
|
|
5381
|
+
response == {
|
|
5382
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5383
|
+
of the problem. Required.
|
|
5384
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5385
|
+
occurrence of the problem. Required.
|
|
5386
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5387
|
+
Required.
|
|
5388
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5389
|
+
Required.
|
|
5390
|
+
"extensions": {
|
|
5391
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5392
|
+
Required.
|
|
5393
|
+
},
|
|
5394
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5395
|
+
occurrence of the problem.
|
|
5396
|
+
}
|
|
5397
|
+
"""
|
|
5398
|
+
|
|
5399
|
+
@distributed_trace
|
|
5400
|
+
def create_notification_channel(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5401
|
+
"""Create a notification channel.
|
|
5402
|
+
|
|
5403
|
+
Create a new notification channel.
|
|
5404
|
+
|
|
5405
|
+
:param body: The notification channel to create. Is either a JSON type or a IO[bytes] type.
|
|
5406
|
+
Required.
|
|
5407
|
+
:type body: JSON or IO[bytes]
|
|
5408
|
+
:return: JSON object
|
|
5409
|
+
:rtype: JSON
|
|
5410
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5411
|
+
|
|
5412
|
+
Example:
|
|
5413
|
+
.. code-block:: python
|
|
5414
|
+
|
|
5415
|
+
# JSON input template you can fill out and use as your body input.
|
|
5416
|
+
body = {}
|
|
5417
|
+
|
|
5418
|
+
# response body for status code(s): 409
|
|
5419
|
+
response == {
|
|
5420
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5421
|
+
of the problem. Required.
|
|
5422
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5423
|
+
occurrence of the problem. Required.
|
|
5424
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5425
|
+
Required.
|
|
5426
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5427
|
+
Required.
|
|
5428
|
+
"extensions": {
|
|
5429
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5430
|
+
Required.
|
|
5431
|
+
},
|
|
5432
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5433
|
+
occurrence of the problem.
|
|
5434
|
+
}
|
|
5435
|
+
"""
|
|
5436
|
+
error_map = {
|
|
5437
|
+
404: ResourceNotFoundError,
|
|
5438
|
+
409: ResourceExistsError,
|
|
5439
|
+
304: ResourceNotModifiedError,
|
|
5440
|
+
400: HttpResponseError,
|
|
5441
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5442
|
+
}
|
|
5443
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5444
|
+
|
|
5445
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5446
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5447
|
+
|
|
5448
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5449
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5450
|
+
|
|
5451
|
+
content_type = content_type or "application/json"
|
|
5452
|
+
_json = None
|
|
5453
|
+
_content = None
|
|
5454
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5455
|
+
_content = body
|
|
5456
|
+
else:
|
|
5457
|
+
_json = body
|
|
5458
|
+
|
|
5459
|
+
_request = build_create_notification_channel_request(
|
|
5460
|
+
content_type=content_type,
|
|
5461
|
+
json=_json,
|
|
5462
|
+
content=_content,
|
|
5463
|
+
headers=_headers,
|
|
5464
|
+
params=_params,
|
|
5465
|
+
)
|
|
5466
|
+
_request.url = self._client.format_url(_request.url)
|
|
5467
|
+
|
|
5468
|
+
_stream = False
|
|
5469
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5470
|
+
_request, stream=_stream, **kwargs
|
|
5471
|
+
)
|
|
5472
|
+
|
|
5473
|
+
response = pipeline_response.http_response
|
|
5474
|
+
|
|
5475
|
+
if response.status_code not in [201, 409]:
|
|
5476
|
+
if _stream:
|
|
5477
|
+
response.read() # Load the body in memory and close the socket
|
|
5478
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5479
|
+
raise HttpResponseError(response=response)
|
|
5480
|
+
|
|
5481
|
+
if response.status_code == 201:
|
|
5482
|
+
if response.content:
|
|
5483
|
+
deserialized = response.json()
|
|
5484
|
+
else:
|
|
5485
|
+
deserialized = None
|
|
5486
|
+
|
|
5487
|
+
if response.status_code == 409:
|
|
5488
|
+
if response.content:
|
|
5489
|
+
deserialized = response.json()
|
|
5490
|
+
else:
|
|
5491
|
+
deserialized = None
|
|
5492
|
+
|
|
5493
|
+
if cls:
|
|
5494
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5495
|
+
|
|
5496
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5497
|
+
|
|
5498
|
+
@distributed_trace
|
|
5499
|
+
def get_notification_channel(self, channel_id: str, **kwargs: Any) -> JSON:
|
|
5500
|
+
"""Get notification channel.
|
|
5501
|
+
|
|
5502
|
+
Get a notification channel by id.
|
|
5503
|
+
|
|
5504
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5505
|
+
:type channel_id: str
|
|
5506
|
+
:return: JSON object
|
|
5507
|
+
:rtype: JSON
|
|
5508
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5509
|
+
"""
|
|
5510
|
+
error_map = {
|
|
5511
|
+
409: ResourceExistsError,
|
|
5512
|
+
304: ResourceNotModifiedError,
|
|
5513
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5514
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5515
|
+
}
|
|
5516
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5517
|
+
|
|
5518
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5519
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5520
|
+
|
|
5521
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5522
|
+
|
|
5523
|
+
_request = build_get_notification_channel_request(
|
|
5524
|
+
channel_id=channel_id,
|
|
5525
|
+
headers=_headers,
|
|
5526
|
+
params=_params,
|
|
5527
|
+
)
|
|
5528
|
+
_request.url = self._client.format_url(_request.url)
|
|
5529
|
+
|
|
5530
|
+
_stream = False
|
|
5531
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5532
|
+
_request, stream=_stream, **kwargs
|
|
5533
|
+
)
|
|
5534
|
+
|
|
5535
|
+
response = pipeline_response.http_response
|
|
5536
|
+
|
|
5537
|
+
if response.status_code not in [200]:
|
|
5538
|
+
if _stream:
|
|
5539
|
+
response.read() # Load the body in memory and close the socket
|
|
5540
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5541
|
+
raise HttpResponseError(response=response)
|
|
5542
|
+
|
|
5543
|
+
if response.content:
|
|
5544
|
+
deserialized = response.json()
|
|
5545
|
+
else:
|
|
5546
|
+
deserialized = None
|
|
5547
|
+
|
|
5548
|
+
if cls:
|
|
5549
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5550
|
+
|
|
5551
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5552
|
+
|
|
5553
|
+
@distributed_trace
|
|
5554
|
+
def delete_notification_channel( # pylint: disable=inconsistent-return-statements
|
|
5555
|
+
self, channel_id: str, **kwargs: Any
|
|
5556
|
+
) -> None:
|
|
5557
|
+
"""Delete a notification channel.
|
|
5558
|
+
|
|
5559
|
+
Delete notification channel by id.
|
|
5560
|
+
|
|
5561
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5562
|
+
:type channel_id: str
|
|
5563
|
+
:return: None
|
|
5564
|
+
:rtype: None
|
|
5565
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5566
|
+
"""
|
|
5567
|
+
error_map = {
|
|
5568
|
+
409: ResourceExistsError,
|
|
5569
|
+
304: ResourceNotModifiedError,
|
|
5570
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5571
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5572
|
+
}
|
|
5573
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5574
|
+
|
|
5575
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5576
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5577
|
+
|
|
5578
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
5579
|
+
|
|
5580
|
+
_request = build_delete_notification_channel_request(
|
|
5581
|
+
channel_id=channel_id,
|
|
5582
|
+
headers=_headers,
|
|
5583
|
+
params=_params,
|
|
5584
|
+
)
|
|
5585
|
+
_request.url = self._client.format_url(_request.url)
|
|
5586
|
+
|
|
5587
|
+
_stream = False
|
|
5588
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5589
|
+
_request, stream=_stream, **kwargs
|
|
5590
|
+
)
|
|
5591
|
+
|
|
5592
|
+
response = pipeline_response.http_response
|
|
5593
|
+
|
|
5594
|
+
if response.status_code not in [204]:
|
|
5595
|
+
if _stream:
|
|
5596
|
+
response.read() # Load the body in memory and close the socket
|
|
5597
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5598
|
+
raise HttpResponseError(response=response)
|
|
5599
|
+
|
|
5600
|
+
if cls:
|
|
5601
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
5602
|
+
|
|
5603
|
+
@overload
|
|
5604
|
+
def update_notification_channel(
|
|
5605
|
+
self, channel_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
5606
|
+
) -> JSON:
|
|
5607
|
+
"""Update notification channel.
|
|
5608
|
+
|
|
5609
|
+
Update a notification channel by id.
|
|
5610
|
+
|
|
5611
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5612
|
+
:type channel_id: str
|
|
5613
|
+
:param body: The notification channel to update. Required.
|
|
5614
|
+
:type body: JSON
|
|
5615
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5616
|
+
Default value is "application/json".
|
|
5617
|
+
:paramtype content_type: str
|
|
5618
|
+
:return: JSON object
|
|
5619
|
+
:rtype: JSON
|
|
5620
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5621
|
+
|
|
5622
|
+
Example:
|
|
5623
|
+
.. code-block:: python
|
|
5624
|
+
|
|
5625
|
+
# JSON input template you can fill out and use as your body input.
|
|
5626
|
+
body = {}
|
|
5627
|
+
"""
|
|
5628
|
+
|
|
5629
|
+
@overload
|
|
5630
|
+
def update_notification_channel(
|
|
5631
|
+
self, channel_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5632
|
+
) -> JSON:
|
|
5633
|
+
"""Update notification channel.
|
|
5634
|
+
|
|
5635
|
+
Update a notification channel by id.
|
|
5636
|
+
|
|
5637
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5638
|
+
:type channel_id: str
|
|
5639
|
+
:param body: The notification channel to update. Required.
|
|
5640
|
+
:type body: IO[bytes]
|
|
5641
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5642
|
+
Default value is "application/json".
|
|
5643
|
+
:paramtype content_type: str
|
|
5644
|
+
:return: JSON object
|
|
5645
|
+
:rtype: JSON
|
|
5646
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5647
|
+
"""
|
|
5648
|
+
|
|
5649
|
+
@distributed_trace
|
|
5650
|
+
def update_notification_channel(self, channel_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5651
|
+
"""Update notification channel.
|
|
5652
|
+
|
|
5653
|
+
Update a notification channel by id.
|
|
5654
|
+
|
|
5655
|
+
:param channel_id: A unique ULID identifier for a notification channel. Required.
|
|
5656
|
+
:type channel_id: str
|
|
5657
|
+
:param body: The notification channel to update. Is either a JSON type or a IO[bytes] type.
|
|
5658
|
+
Required.
|
|
5659
|
+
:type body: JSON or IO[bytes]
|
|
5660
|
+
:return: JSON object
|
|
5661
|
+
:rtype: JSON
|
|
5662
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5663
|
+
|
|
5664
|
+
Example:
|
|
5665
|
+
.. code-block:: python
|
|
5666
|
+
|
|
5667
|
+
# JSON input template you can fill out and use as your body input.
|
|
5668
|
+
body = {}
|
|
5669
|
+
"""
|
|
5670
|
+
error_map = {
|
|
5671
|
+
409: ResourceExistsError,
|
|
5672
|
+
304: ResourceNotModifiedError,
|
|
5673
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5674
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
5675
|
+
}
|
|
5676
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5677
|
+
|
|
5678
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5679
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5680
|
+
|
|
5681
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5682
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5683
|
+
|
|
5684
|
+
content_type = content_type or "application/json"
|
|
5685
|
+
_json = None
|
|
5686
|
+
_content = None
|
|
5687
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5688
|
+
_content = body
|
|
5689
|
+
else:
|
|
5690
|
+
_json = body
|
|
5691
|
+
|
|
5692
|
+
_request = build_update_notification_channel_request(
|
|
5693
|
+
channel_id=channel_id,
|
|
5694
|
+
content_type=content_type,
|
|
5695
|
+
json=_json,
|
|
5696
|
+
content=_content,
|
|
5697
|
+
headers=_headers,
|
|
5698
|
+
params=_params,
|
|
5699
|
+
)
|
|
5700
|
+
_request.url = self._client.format_url(_request.url)
|
|
5701
|
+
|
|
5702
|
+
_stream = False
|
|
5703
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5704
|
+
_request, stream=_stream, **kwargs
|
|
5705
|
+
)
|
|
5706
|
+
|
|
5707
|
+
response = pipeline_response.http_response
|
|
5708
|
+
|
|
5709
|
+
if response.status_code not in [200]:
|
|
5710
|
+
if _stream:
|
|
5711
|
+
response.read() # Load the body in memory and close the socket
|
|
5712
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5713
|
+
raise HttpResponseError(response=response)
|
|
5714
|
+
|
|
5715
|
+
if response.content:
|
|
5716
|
+
deserialized = response.json()
|
|
5717
|
+
else:
|
|
5718
|
+
deserialized = None
|
|
5719
|
+
|
|
5720
|
+
if cls:
|
|
5721
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5722
|
+
|
|
5723
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5724
|
+
|
|
5725
|
+
@distributed_trace
|
|
5726
|
+
def list_notification_rules(
|
|
5727
|
+
self,
|
|
5728
|
+
*,
|
|
5729
|
+
limit: int = 1000,
|
|
5730
|
+
offset: int = 0,
|
|
5731
|
+
order_by: str = "id",
|
|
5732
|
+
include_disabled: bool = False,
|
|
5733
|
+
feature: Optional[List[str]] = None,
|
|
5734
|
+
**kwargs: Any
|
|
5735
|
+
) -> List[JSON]:
|
|
5736
|
+
"""List notification rules.
|
|
5737
|
+
|
|
5738
|
+
List all notification rules.
|
|
5739
|
+
|
|
5740
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
5741
|
+
:paramtype limit: int
|
|
5742
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
5743
|
+
:paramtype offset: int
|
|
5744
|
+
:keyword order_by: Order by field. Known values are: "id", "type", "createdAt", and
|
|
5745
|
+
"updatedAt". Default value is "id".
|
|
5746
|
+
:paramtype order_by: str
|
|
5747
|
+
:keyword include_disabled: Include disabled entries. Default value is False.
|
|
5748
|
+
:paramtype include_disabled: bool
|
|
5749
|
+
:keyword feature: Filtering by multiple features.
|
|
5750
|
+
|
|
5751
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
5752
|
+
:paramtype feature: list[str]
|
|
5753
|
+
:return: list of JSON object
|
|
5754
|
+
:rtype: list[JSON]
|
|
5755
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5756
|
+
|
|
5757
|
+
Example:
|
|
5758
|
+
.. code-block:: python
|
|
5759
|
+
|
|
5760
|
+
# response body for status code(s): 200
|
|
5761
|
+
response == [
|
|
5762
|
+
{}
|
|
5763
|
+
]
|
|
5764
|
+
"""
|
|
5765
|
+
error_map = {
|
|
5766
|
+
404: ResourceNotFoundError,
|
|
5767
|
+
409: ResourceExistsError,
|
|
5768
|
+
304: ResourceNotModifiedError,
|
|
5769
|
+
400: HttpResponseError,
|
|
5770
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5771
|
+
}
|
|
5772
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5773
|
+
|
|
5774
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5775
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5776
|
+
|
|
5777
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
5778
|
+
|
|
5779
|
+
_request = build_list_notification_rules_request(
|
|
5780
|
+
limit=limit,
|
|
5781
|
+
offset=offset,
|
|
5782
|
+
order_by=order_by,
|
|
5783
|
+
include_disabled=include_disabled,
|
|
5784
|
+
feature=feature,
|
|
5785
|
+
headers=_headers,
|
|
5786
|
+
params=_params,
|
|
5787
|
+
)
|
|
5788
|
+
_request.url = self._client.format_url(_request.url)
|
|
5789
|
+
|
|
5790
|
+
_stream = False
|
|
5791
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5792
|
+
_request, stream=_stream, **kwargs
|
|
5793
|
+
)
|
|
5794
|
+
|
|
5795
|
+
response = pipeline_response.http_response
|
|
5796
|
+
|
|
5797
|
+
if response.status_code not in [200]:
|
|
5798
|
+
if _stream:
|
|
5799
|
+
response.read() # Load the body in memory and close the socket
|
|
5800
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5801
|
+
raise HttpResponseError(response=response)
|
|
5802
|
+
|
|
5803
|
+
if response.content:
|
|
5804
|
+
deserialized = response.json()
|
|
5805
|
+
else:
|
|
5806
|
+
deserialized = None
|
|
5807
|
+
|
|
5808
|
+
if cls:
|
|
5809
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
5810
|
+
|
|
5811
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
5812
|
+
|
|
5813
|
+
@overload
|
|
5814
|
+
def create_notification_rule(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
5815
|
+
"""Create a notification rule.
|
|
5816
|
+
|
|
5817
|
+
Create a new notification rule.
|
|
5818
|
+
|
|
5819
|
+
:param body: The notification rule to create. Required.
|
|
5820
|
+
:type body: JSON
|
|
5821
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5822
|
+
Default value is "application/json".
|
|
5823
|
+
:paramtype content_type: str
|
|
5824
|
+
:return: JSON object
|
|
5825
|
+
:rtype: JSON
|
|
5826
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5827
|
+
|
|
5828
|
+
Example:
|
|
5829
|
+
.. code-block:: python
|
|
5830
|
+
|
|
5831
|
+
# JSON input template you can fill out and use as your body input.
|
|
5832
|
+
body = {}
|
|
5833
|
+
|
|
5834
|
+
# response body for status code(s): 409
|
|
5835
|
+
response == {
|
|
5836
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5837
|
+
of the problem. Required.
|
|
5838
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5839
|
+
occurrence of the problem. Required.
|
|
5840
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5841
|
+
Required.
|
|
5842
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5843
|
+
Required.
|
|
5844
|
+
"extensions": {
|
|
5845
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5846
|
+
Required.
|
|
5847
|
+
},
|
|
5848
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5849
|
+
occurrence of the problem.
|
|
5850
|
+
}
|
|
5851
|
+
"""
|
|
5852
|
+
|
|
5853
|
+
@overload
|
|
5854
|
+
def create_notification_rule(
|
|
5855
|
+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5856
|
+
) -> JSON:
|
|
5857
|
+
"""Create a notification rule.
|
|
5858
|
+
|
|
5859
|
+
Create a new notification rule.
|
|
5860
|
+
|
|
5861
|
+
:param body: The notification rule to create. Required.
|
|
5862
|
+
:type body: IO[bytes]
|
|
5863
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5864
|
+
Default value is "application/json".
|
|
5865
|
+
:paramtype content_type: str
|
|
5866
|
+
:return: JSON object
|
|
5867
|
+
:rtype: JSON
|
|
5868
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5869
|
+
|
|
5870
|
+
Example:
|
|
5871
|
+
.. code-block:: python
|
|
5872
|
+
|
|
5873
|
+
# response body for status code(s): 409
|
|
5874
|
+
response == {
|
|
5875
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5876
|
+
of the problem. Required.
|
|
5877
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5878
|
+
occurrence of the problem. Required.
|
|
5879
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5880
|
+
Required.
|
|
5881
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5882
|
+
Required.
|
|
5883
|
+
"extensions": {
|
|
5884
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5885
|
+
Required.
|
|
5886
|
+
},
|
|
5887
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5888
|
+
occurrence of the problem.
|
|
5889
|
+
}
|
|
5890
|
+
"""
|
|
5891
|
+
|
|
5892
|
+
@distributed_trace
|
|
5893
|
+
def create_notification_rule(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5894
|
+
"""Create a notification rule.
|
|
5895
|
+
|
|
5896
|
+
Create a new notification rule.
|
|
5897
|
+
|
|
5898
|
+
:param body: The notification rule to create. Is either a JSON type or a IO[bytes] type.
|
|
5899
|
+
Required.
|
|
5900
|
+
:type body: JSON or IO[bytes]
|
|
5901
|
+
:return: JSON object
|
|
5902
|
+
:rtype: JSON
|
|
5903
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5904
|
+
|
|
5905
|
+
Example:
|
|
5906
|
+
.. code-block:: python
|
|
5907
|
+
|
|
5908
|
+
# JSON input template you can fill out and use as your body input.
|
|
5909
|
+
body = {}
|
|
5910
|
+
|
|
5911
|
+
# response body for status code(s): 409
|
|
5912
|
+
response == {
|
|
5913
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5914
|
+
of the problem. Required.
|
|
5915
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5916
|
+
occurrence of the problem. Required.
|
|
5917
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5918
|
+
Required.
|
|
5919
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5920
|
+
Required.
|
|
5921
|
+
"extensions": {
|
|
5922
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5923
|
+
Required.
|
|
5924
|
+
},
|
|
5925
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5926
|
+
occurrence of the problem.
|
|
5927
|
+
}
|
|
5928
|
+
"""
|
|
5929
|
+
error_map = {
|
|
5930
|
+
404: ResourceNotFoundError,
|
|
5931
|
+
409: ResourceExistsError,
|
|
5932
|
+
304: ResourceNotModifiedError,
|
|
5933
|
+
400: HttpResponseError,
|
|
5934
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5935
|
+
}
|
|
5936
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5937
|
+
|
|
5938
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5939
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5940
|
+
|
|
5941
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5942
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5943
|
+
|
|
5944
|
+
content_type = content_type or "application/json"
|
|
5945
|
+
_json = None
|
|
5946
|
+
_content = None
|
|
5947
|
+
if isinstance(body, (IOBase, bytes)):
|
|
5948
|
+
_content = body
|
|
5949
|
+
else:
|
|
5950
|
+
_json = body
|
|
5951
|
+
|
|
5952
|
+
_request = build_create_notification_rule_request(
|
|
5953
|
+
content_type=content_type,
|
|
5954
|
+
json=_json,
|
|
5955
|
+
content=_content,
|
|
5956
|
+
headers=_headers,
|
|
5957
|
+
params=_params,
|
|
5958
|
+
)
|
|
5959
|
+
_request.url = self._client.format_url(_request.url)
|
|
5960
|
+
|
|
5961
|
+
_stream = False
|
|
5962
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
5963
|
+
_request, stream=_stream, **kwargs
|
|
5964
|
+
)
|
|
5965
|
+
|
|
5966
|
+
response = pipeline_response.http_response
|
|
5967
|
+
|
|
5968
|
+
if response.status_code not in [201, 409]:
|
|
5969
|
+
if _stream:
|
|
5970
|
+
response.read() # Load the body in memory and close the socket
|
|
5971
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5972
|
+
raise HttpResponseError(response=response)
|
|
5973
|
+
|
|
5974
|
+
if response.status_code == 201:
|
|
5975
|
+
if response.content:
|
|
5976
|
+
deserialized = response.json()
|
|
5977
|
+
else:
|
|
5978
|
+
deserialized = None
|
|
5979
|
+
|
|
5980
|
+
if response.status_code == 409:
|
|
5981
|
+
if response.content:
|
|
5982
|
+
deserialized = response.json()
|
|
5983
|
+
else:
|
|
5984
|
+
deserialized = None
|
|
5985
|
+
|
|
5986
|
+
if cls:
|
|
5987
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5988
|
+
|
|
5989
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5990
|
+
|
|
5991
|
+
@distributed_trace
|
|
5992
|
+
def get_notification_rule(self, rule_id: str, **kwargs: Any) -> JSON:
|
|
5993
|
+
"""Get notification rule.
|
|
5994
|
+
|
|
5995
|
+
Get a notification rule by id.
|
|
5996
|
+
|
|
5997
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5998
|
+
:type rule_id: str
|
|
5999
|
+
:return: JSON object
|
|
6000
|
+
:rtype: JSON
|
|
6001
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6002
|
+
"""
|
|
6003
|
+
error_map = {
|
|
6004
|
+
409: ResourceExistsError,
|
|
6005
|
+
304: ResourceNotModifiedError,
|
|
6006
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6007
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6008
|
+
}
|
|
6009
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6010
|
+
|
|
6011
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6012
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6013
|
+
|
|
6014
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6015
|
+
|
|
6016
|
+
_request = build_get_notification_rule_request(
|
|
6017
|
+
rule_id=rule_id,
|
|
6018
|
+
headers=_headers,
|
|
6019
|
+
params=_params,
|
|
6020
|
+
)
|
|
6021
|
+
_request.url = self._client.format_url(_request.url)
|
|
6022
|
+
|
|
6023
|
+
_stream = False
|
|
6024
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6025
|
+
_request, stream=_stream, **kwargs
|
|
6026
|
+
)
|
|
6027
|
+
|
|
6028
|
+
response = pipeline_response.http_response
|
|
6029
|
+
|
|
6030
|
+
if response.status_code not in [200]:
|
|
6031
|
+
if _stream:
|
|
6032
|
+
response.read() # Load the body in memory and close the socket
|
|
6033
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6034
|
+
raise HttpResponseError(response=response)
|
|
6035
|
+
|
|
6036
|
+
if response.content:
|
|
6037
|
+
deserialized = response.json()
|
|
6038
|
+
else:
|
|
6039
|
+
deserialized = None
|
|
6040
|
+
|
|
6041
|
+
if cls:
|
|
6042
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6043
|
+
|
|
6044
|
+
return cast(JSON, deserialized) # type: ignore
|
|
6045
|
+
|
|
6046
|
+
@distributed_trace
|
|
6047
|
+
def delete_notification_rule( # pylint: disable=inconsistent-return-statements
|
|
6048
|
+
self, rule_id: str, **kwargs: Any
|
|
6049
|
+
) -> None:
|
|
6050
|
+
"""Delete a notification rule.
|
|
6051
|
+
|
|
6052
|
+
Delete notification rule by id.
|
|
6053
|
+
|
|
6054
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6055
|
+
:type rule_id: str
|
|
6056
|
+
:return: None
|
|
6057
|
+
:rtype: None
|
|
6058
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6059
|
+
"""
|
|
6060
|
+
error_map = {
|
|
6061
|
+
409: ResourceExistsError,
|
|
6062
|
+
304: ResourceNotModifiedError,
|
|
6063
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6064
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6065
|
+
}
|
|
6066
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6067
|
+
|
|
6068
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6069
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6070
|
+
|
|
6071
|
+
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
6072
|
+
|
|
6073
|
+
_request = build_delete_notification_rule_request(
|
|
6074
|
+
rule_id=rule_id,
|
|
6075
|
+
headers=_headers,
|
|
6076
|
+
params=_params,
|
|
6077
|
+
)
|
|
6078
|
+
_request.url = self._client.format_url(_request.url)
|
|
6079
|
+
|
|
6080
|
+
_stream = False
|
|
6081
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6082
|
+
_request, stream=_stream, **kwargs
|
|
6083
|
+
)
|
|
6084
|
+
|
|
6085
|
+
response = pipeline_response.http_response
|
|
6086
|
+
|
|
6087
|
+
if response.status_code not in [204]:
|
|
6088
|
+
if _stream:
|
|
6089
|
+
response.read() # Load the body in memory and close the socket
|
|
6090
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6091
|
+
raise HttpResponseError(response=response)
|
|
6092
|
+
|
|
6093
|
+
if cls:
|
|
6094
|
+
return cls(pipeline_response, None, {}) # type: ignore
|
|
6095
|
+
|
|
6096
|
+
@overload
|
|
6097
|
+
def update_notification_rule(
|
|
6098
|
+
self, rule_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
6099
|
+
) -> JSON:
|
|
6100
|
+
"""Update a notification rule.
|
|
6101
|
+
|
|
6102
|
+
Update a notification rule by id.
|
|
6103
|
+
|
|
6104
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6105
|
+
:type rule_id: str
|
|
6106
|
+
:param body: The notification rule to update. Required.
|
|
6107
|
+
:type body: JSON
|
|
6108
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
6109
|
+
Default value is "application/json".
|
|
6110
|
+
:paramtype content_type: str
|
|
6111
|
+
:return: JSON object
|
|
6112
|
+
:rtype: JSON
|
|
6113
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6114
|
+
|
|
6115
|
+
Example:
|
|
6116
|
+
.. code-block:: python
|
|
6117
|
+
|
|
6118
|
+
# JSON input template you can fill out and use as your body input.
|
|
6119
|
+
body = {}
|
|
6120
|
+
"""
|
|
6121
|
+
|
|
6122
|
+
@overload
|
|
6123
|
+
def update_notification_rule(
|
|
6124
|
+
self, rule_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
6125
|
+
) -> JSON:
|
|
6126
|
+
"""Update a notification rule.
|
|
6127
|
+
|
|
6128
|
+
Update a notification rule by id.
|
|
6129
|
+
|
|
6130
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6131
|
+
:type rule_id: str
|
|
6132
|
+
:param body: The notification rule to update. Required.
|
|
6133
|
+
:type body: IO[bytes]
|
|
6134
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
6135
|
+
Default value is "application/json".
|
|
6136
|
+
:paramtype content_type: str
|
|
6137
|
+
:return: JSON object
|
|
6138
|
+
:rtype: JSON
|
|
6139
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6140
|
+
"""
|
|
6141
|
+
|
|
6142
|
+
@distributed_trace
|
|
6143
|
+
def update_notification_rule(self, rule_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
6144
|
+
"""Update a notification rule.
|
|
6145
|
+
|
|
6146
|
+
Update a notification rule by id.
|
|
6147
|
+
|
|
6148
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6149
|
+
:type rule_id: str
|
|
6150
|
+
:param body: The notification rule to update. Is either a JSON type or a IO[bytes] type.
|
|
6151
|
+
Required.
|
|
6152
|
+
:type body: JSON or IO[bytes]
|
|
6153
|
+
:return: JSON object
|
|
6154
|
+
:rtype: JSON
|
|
6155
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6156
|
+
|
|
6157
|
+
Example:
|
|
6158
|
+
.. code-block:: python
|
|
6159
|
+
|
|
6160
|
+
# JSON input template you can fill out and use as your body input.
|
|
6161
|
+
body = {}
|
|
6162
|
+
"""
|
|
6163
|
+
error_map = {
|
|
6164
|
+
409: ResourceExistsError,
|
|
6165
|
+
304: ResourceNotModifiedError,
|
|
6166
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6167
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6168
|
+
}
|
|
6169
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6170
|
+
|
|
6171
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
6172
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6173
|
+
|
|
6174
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
6175
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6176
|
+
|
|
6177
|
+
content_type = content_type or "application/json"
|
|
6178
|
+
_json = None
|
|
6179
|
+
_content = None
|
|
6180
|
+
if isinstance(body, (IOBase, bytes)):
|
|
6181
|
+
_content = body
|
|
6182
|
+
else:
|
|
6183
|
+
_json = body
|
|
6184
|
+
|
|
6185
|
+
_request = build_update_notification_rule_request(
|
|
6186
|
+
rule_id=rule_id,
|
|
6187
|
+
content_type=content_type,
|
|
6188
|
+
json=_json,
|
|
6189
|
+
content=_content,
|
|
6190
|
+
headers=_headers,
|
|
6191
|
+
params=_params,
|
|
6192
|
+
)
|
|
6193
|
+
_request.url = self._client.format_url(_request.url)
|
|
6194
|
+
|
|
6195
|
+
_stream = False
|
|
6196
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6197
|
+
_request, stream=_stream, **kwargs
|
|
6198
|
+
)
|
|
6199
|
+
|
|
6200
|
+
response = pipeline_response.http_response
|
|
6201
|
+
|
|
6202
|
+
if response.status_code not in [200]:
|
|
6203
|
+
if _stream:
|
|
6204
|
+
response.read() # Load the body in memory and close the socket
|
|
6205
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6206
|
+
raise HttpResponseError(response=response)
|
|
6207
|
+
|
|
6208
|
+
if response.content:
|
|
6209
|
+
deserialized = response.json()
|
|
6210
|
+
else:
|
|
6211
|
+
deserialized = None
|
|
6212
|
+
|
|
6213
|
+
if cls:
|
|
6214
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6215
|
+
|
|
6216
|
+
return cast(JSON, deserialized) # type: ignore
|
|
6217
|
+
|
|
6218
|
+
@distributed_trace
|
|
6219
|
+
def list_notification_events(
|
|
6220
|
+
self,
|
|
6221
|
+
*,
|
|
6222
|
+
limit: int = 1000,
|
|
6223
|
+
offset: int = 0,
|
|
6224
|
+
order_by: str = "id",
|
|
6225
|
+
feature: Optional[List[str]] = None,
|
|
6226
|
+
subject: Optional[List[str]] = None,
|
|
6227
|
+
**kwargs: Any
|
|
6228
|
+
) -> List[JSON]:
|
|
6229
|
+
"""List notification evens.
|
|
6230
|
+
|
|
6231
|
+
List all notification events.
|
|
6232
|
+
|
|
6233
|
+
:keyword limit: Number of entries to return. Default value is 1000.
|
|
6234
|
+
:paramtype limit: int
|
|
6235
|
+
:keyword offset: Number of entries to skip. Default value is 0.
|
|
6236
|
+
:paramtype offset: int
|
|
6237
|
+
:keyword order_by: Order by field. Known values are: "id" and "createdAt". Default value is
|
|
6238
|
+
"id".
|
|
6239
|
+
:paramtype order_by: str
|
|
6240
|
+
:keyword feature: Filtering by multiple features.
|
|
6241
|
+
|
|
6242
|
+
Usage: ``?feature=feature-1&feature=feature-2``. Default value is None.
|
|
6243
|
+
:paramtype feature: list[str]
|
|
6244
|
+
:keyword subject: Filtering by multiple subjects.
|
|
6245
|
+
|
|
6246
|
+
Usage: ``?subject=customer-1&subject=customer-2``. Default value is None.
|
|
6247
|
+
:paramtype subject: list[str]
|
|
6248
|
+
:return: list of JSON object
|
|
6249
|
+
:rtype: list[JSON]
|
|
6250
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6251
|
+
|
|
6252
|
+
Example:
|
|
6253
|
+
.. code-block:: python
|
|
6254
|
+
|
|
6255
|
+
# response body for status code(s): 200
|
|
6256
|
+
response == [
|
|
6257
|
+
{
|
|
6258
|
+
"createdAt": "2020-02-20 00:00:00", # Timestamp when the
|
|
6259
|
+
notification event was created. Required.
|
|
6260
|
+
"deliveryStatus": [
|
|
6261
|
+
{
|
|
6262
|
+
"channel": {
|
|
6263
|
+
"id": "str", # A unique identifier for the
|
|
6264
|
+
notification channel. Required.
|
|
6265
|
+
"type": "str" # The type of the notification
|
|
6266
|
+
channel. Required. "WEBHOOK"
|
|
6267
|
+
},
|
|
6268
|
+
"state": "str", # Required. Known values are:
|
|
6269
|
+
"SUCCESS", "FAILED", and "SENDING".
|
|
6270
|
+
"updatedAt": "2020-02-20 00:00:00" # Required.
|
|
6271
|
+
}
|
|
6272
|
+
],
|
|
6273
|
+
"id": "str", # A unique identifier for the notification event.
|
|
6274
|
+
Required.
|
|
6275
|
+
"payload": {},
|
|
6276
|
+
"rule": {
|
|
6277
|
+
"id": "str", # A unique identifier for the notification
|
|
6278
|
+
rule. Required.
|
|
6279
|
+
"type": "str" # The type of the notification event.
|
|
6280
|
+
Required. "entitlements.balance.threshold"
|
|
6281
|
+
}
|
|
6282
|
+
}
|
|
6283
|
+
]
|
|
6284
|
+
"""
|
|
6285
|
+
error_map = {
|
|
6286
|
+
404: ResourceNotFoundError,
|
|
6287
|
+
409: ResourceExistsError,
|
|
6288
|
+
304: ResourceNotModifiedError,
|
|
6289
|
+
400: HttpResponseError,
|
|
6290
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6291
|
+
}
|
|
6292
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6293
|
+
|
|
6294
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6295
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6296
|
+
|
|
6297
|
+
cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
|
|
6298
|
+
|
|
6299
|
+
_request = build_list_notification_events_request(
|
|
6300
|
+
limit=limit,
|
|
6301
|
+
offset=offset,
|
|
6302
|
+
order_by=order_by,
|
|
6303
|
+
feature=feature,
|
|
6304
|
+
subject=subject,
|
|
6305
|
+
headers=_headers,
|
|
6306
|
+
params=_params,
|
|
6307
|
+
)
|
|
6308
|
+
_request.url = self._client.format_url(_request.url)
|
|
6309
|
+
|
|
6310
|
+
_stream = False
|
|
6311
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6312
|
+
_request, stream=_stream, **kwargs
|
|
6313
|
+
)
|
|
6314
|
+
|
|
6315
|
+
response = pipeline_response.http_response
|
|
6316
|
+
|
|
6317
|
+
if response.status_code not in [200]:
|
|
6318
|
+
if _stream:
|
|
6319
|
+
response.read() # Load the body in memory and close the socket
|
|
6320
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6321
|
+
raise HttpResponseError(response=response)
|
|
6322
|
+
|
|
6323
|
+
if response.content:
|
|
6324
|
+
deserialized = response.json()
|
|
6325
|
+
else:
|
|
6326
|
+
deserialized = None
|
|
6327
|
+
|
|
6328
|
+
if cls:
|
|
6329
|
+
return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
|
|
6330
|
+
|
|
6331
|
+
return cast(List[JSON], deserialized) # type: ignore
|
|
6332
|
+
|
|
6333
|
+
@distributed_trace
|
|
6334
|
+
def get_notification_event(self, event_id: str, **kwargs: Any) -> JSON:
|
|
6335
|
+
"""Get notification event.
|
|
6336
|
+
|
|
6337
|
+
Get a notification event by id.
|
|
6338
|
+
|
|
6339
|
+
:param event_id: A unique ULID identifier for a notification event. Required.
|
|
6340
|
+
:type event_id: str
|
|
6341
|
+
:return: JSON object
|
|
6342
|
+
:rtype: JSON
|
|
6343
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6344
|
+
"""
|
|
6345
|
+
error_map = {
|
|
6346
|
+
409: ResourceExistsError,
|
|
6347
|
+
304: ResourceNotModifiedError,
|
|
6348
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6349
|
+
404: lambda response: ResourceNotFoundError(response=response),
|
|
6350
|
+
}
|
|
6351
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6352
|
+
|
|
6353
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6354
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6355
|
+
|
|
6356
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6357
|
+
|
|
6358
|
+
_request = build_get_notification_event_request(
|
|
6359
|
+
event_id=event_id,
|
|
6360
|
+
headers=_headers,
|
|
6361
|
+
params=_params,
|
|
6362
|
+
)
|
|
6363
|
+
_request.url = self._client.format_url(_request.url)
|
|
6364
|
+
|
|
6365
|
+
_stream = False
|
|
6366
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6367
|
+
_request, stream=_stream, **kwargs
|
|
6368
|
+
)
|
|
6369
|
+
|
|
6370
|
+
response = pipeline_response.http_response
|
|
6371
|
+
|
|
6372
|
+
if response.status_code not in [200]:
|
|
6373
|
+
if _stream:
|
|
6374
|
+
response.read() # Load the body in memory and close the socket
|
|
6375
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6376
|
+
raise HttpResponseError(response=response)
|
|
6377
|
+
|
|
6378
|
+
if response.content:
|
|
6379
|
+
deserialized = response.json()
|
|
6380
|
+
else:
|
|
6381
|
+
deserialized = None
|
|
6382
|
+
|
|
6383
|
+
if cls:
|
|
6384
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6385
|
+
|
|
6386
|
+
return cast(JSON, deserialized) # type: ignore
|