openmeter 1.0.0b147__tar.gz → 1.0.0b149__tar.gz
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-1.0.0b147 → openmeter-1.0.0b149}/PKG-INFO +1 -1
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/pyproject.toml +1 -1
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_operations/_operations.py +109 -207
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_operations/_operations.py +91 -193
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/README.md +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/__init__.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_client.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_configuration.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_operations/__init__.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_operations/_patch.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_patch.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_serialization.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/_vendor.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/__init__.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_client.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_configuration.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_operations/__init__.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_operations/_patch.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_patch.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/aio/_vendor.py +0 -0
- {openmeter-1.0.0b147 → openmeter-1.0.0b149}/src/openmeter/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "openmeter"
|
|
3
|
-
version = "v1.0.0-beta.
|
|
3
|
+
version = "v1.0.0-beta.149"
|
|
4
4
|
description = "Client for OpenMeter: Real-Time and Scalable Usage Metering"
|
|
5
5
|
authors = ["Andras Toth <4157749+tothandras@users.noreply.github.com>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -1142,6 +1142,25 @@ def build_update_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpR
|
|
|
1142
1142
|
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
|
|
1143
1143
|
|
|
1144
1144
|
|
|
1145
|
+
def build_test_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
|
|
1146
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1147
|
+
|
|
1148
|
+
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1149
|
+
|
|
1150
|
+
# Construct URL
|
|
1151
|
+
_url = "/api/v1/notification/rules/{ruleId}/test"
|
|
1152
|
+
path_format_arguments = {
|
|
1153
|
+
"ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
1157
|
+
|
|
1158
|
+
# Construct headers
|
|
1159
|
+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1160
|
+
|
|
1161
|
+
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
1162
|
+
|
|
1163
|
+
|
|
1145
1164
|
def build_list_notification_events_request(
|
|
1146
1165
|
*,
|
|
1147
1166
|
page: int = 1,
|
|
@@ -1186,23 +1205,6 @@ def build_list_notification_events_request(
|
|
|
1186
1205
|
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
1187
1206
|
|
|
1188
1207
|
|
|
1189
|
-
def build_create_notification_event_request(**kwargs: Any) -> HttpRequest:
|
|
1190
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1191
|
-
|
|
1192
|
-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1193
|
-
accept = _headers.pop("Accept", "application/json, application/problem+json")
|
|
1194
|
-
|
|
1195
|
-
# Construct URL
|
|
1196
|
-
_url = "/api/v1/notification/events"
|
|
1197
|
-
|
|
1198
|
-
# Construct headers
|
|
1199
|
-
if content_type is not None:
|
|
1200
|
-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
1201
|
-
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
1202
|
-
|
|
1203
|
-
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
1208
|
def build_get_notification_event_request(event_id: str, **kwargs: Any) -> HttpRequest:
|
|
1207
1209
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
1208
1210
|
|
|
@@ -6694,6 +6696,91 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
6694
6696
|
|
|
6695
6697
|
return cast(JSON, deserialized) # type: ignore
|
|
6696
6698
|
|
|
6699
|
+
@distributed_trace
|
|
6700
|
+
def test_notification_rule(self, rule_id: str, **kwargs: Any) -> JSON:
|
|
6701
|
+
"""Test notification rule.
|
|
6702
|
+
|
|
6703
|
+
Test a notification rule by sending a test event with random data.
|
|
6704
|
+
|
|
6705
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
6706
|
+
:type rule_id: str
|
|
6707
|
+
:return: JSON object
|
|
6708
|
+
:rtype: JSON
|
|
6709
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6710
|
+
|
|
6711
|
+
Example:
|
|
6712
|
+
.. code-block:: python
|
|
6713
|
+
|
|
6714
|
+
# response body for status code(s): 409
|
|
6715
|
+
response == {
|
|
6716
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
6717
|
+
of the problem. Required.
|
|
6718
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
6719
|
+
occurrence of the problem. Required.
|
|
6720
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
6721
|
+
Required.
|
|
6722
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
6723
|
+
Required.
|
|
6724
|
+
"extensions": {
|
|
6725
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
6726
|
+
Required.
|
|
6727
|
+
},
|
|
6728
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
6729
|
+
occurrence of the problem.
|
|
6730
|
+
}
|
|
6731
|
+
"""
|
|
6732
|
+
error_map = {
|
|
6733
|
+
404: ResourceNotFoundError,
|
|
6734
|
+
409: ResourceExistsError,
|
|
6735
|
+
304: ResourceNotModifiedError,
|
|
6736
|
+
400: HttpResponseError,
|
|
6737
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
6738
|
+
501: HttpResponseError,
|
|
6739
|
+
}
|
|
6740
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6741
|
+
|
|
6742
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
6743
|
+
_params = kwargs.pop("params", {}) or {}
|
|
6744
|
+
|
|
6745
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6746
|
+
|
|
6747
|
+
_request = build_test_notification_rule_request(
|
|
6748
|
+
rule_id=rule_id,
|
|
6749
|
+
headers=_headers,
|
|
6750
|
+
params=_params,
|
|
6751
|
+
)
|
|
6752
|
+
_request.url = self._client.format_url(_request.url)
|
|
6753
|
+
|
|
6754
|
+
_stream = False
|
|
6755
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6756
|
+
_request, stream=_stream, **kwargs
|
|
6757
|
+
)
|
|
6758
|
+
|
|
6759
|
+
response = pipeline_response.http_response
|
|
6760
|
+
|
|
6761
|
+
if response.status_code not in [201, 409]:
|
|
6762
|
+
if _stream:
|
|
6763
|
+
response.read() # Load the body in memory and close the socket
|
|
6764
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
6765
|
+
raise HttpResponseError(response=response)
|
|
6766
|
+
|
|
6767
|
+
if response.status_code == 201:
|
|
6768
|
+
if response.content:
|
|
6769
|
+
deserialized = response.json()
|
|
6770
|
+
else:
|
|
6771
|
+
deserialized = None
|
|
6772
|
+
|
|
6773
|
+
if response.status_code == 409:
|
|
6774
|
+
if response.content:
|
|
6775
|
+
deserialized = response.json()
|
|
6776
|
+
else:
|
|
6777
|
+
deserialized = None
|
|
6778
|
+
|
|
6779
|
+
if cls:
|
|
6780
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
6781
|
+
|
|
6782
|
+
return cast(JSON, deserialized) # type: ignore
|
|
6783
|
+
|
|
6697
6784
|
@distributed_trace
|
|
6698
6785
|
def list_notification_events(
|
|
6699
6786
|
self,
|
|
@@ -6770,8 +6857,12 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
6770
6857
|
event. Required.
|
|
6771
6858
|
"payload": {},
|
|
6772
6859
|
"rule": {},
|
|
6773
|
-
"type": "str" # The type of the notification event.
|
|
6860
|
+
"type": "str", # The type of the notification event.
|
|
6774
6861
|
Required. "entitlements.balance.threshold"
|
|
6862
|
+
"annotations": {
|
|
6863
|
+
"str": "str" # Optional. List of annotations managed
|
|
6864
|
+
by the system.
|
|
6865
|
+
}
|
|
6775
6866
|
}
|
|
6776
6867
|
],
|
|
6777
6868
|
"page": 0, # Current page number. Required.
|
|
@@ -6830,195 +6921,6 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
6830
6921
|
|
|
6831
6922
|
return cast(JSON, deserialized) # type: ignore
|
|
6832
6923
|
|
|
6833
|
-
@overload
|
|
6834
|
-
def create_notification_event(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
6835
|
-
"""Create a notification event.
|
|
6836
|
-
|
|
6837
|
-
Create a new notification event.
|
|
6838
|
-
|
|
6839
|
-
:param body: The notification event to create. Required.
|
|
6840
|
-
:type body: JSON
|
|
6841
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
6842
|
-
Default value is "application/json".
|
|
6843
|
-
:paramtype content_type: str
|
|
6844
|
-
:return: JSON object
|
|
6845
|
-
:rtype: JSON
|
|
6846
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6847
|
-
|
|
6848
|
-
Example:
|
|
6849
|
-
.. code-block:: python
|
|
6850
|
-
|
|
6851
|
-
# JSON input template you can fill out and use as your body input.
|
|
6852
|
-
body = {
|
|
6853
|
-
"payload": {},
|
|
6854
|
-
"ruleId": "str", # Required.
|
|
6855
|
-
"type": "str" # The type of the notification event. Required.
|
|
6856
|
-
"entitlements.balance.threshold"
|
|
6857
|
-
}
|
|
6858
|
-
|
|
6859
|
-
# response body for status code(s): 409
|
|
6860
|
-
response == {
|
|
6861
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
6862
|
-
of the problem. Required.
|
|
6863
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
6864
|
-
occurrence of the problem. Required.
|
|
6865
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
6866
|
-
Required.
|
|
6867
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
6868
|
-
Required.
|
|
6869
|
-
"extensions": {
|
|
6870
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
6871
|
-
Required.
|
|
6872
|
-
},
|
|
6873
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
6874
|
-
occurrence of the problem.
|
|
6875
|
-
}
|
|
6876
|
-
"""
|
|
6877
|
-
|
|
6878
|
-
@overload
|
|
6879
|
-
def create_notification_event(
|
|
6880
|
-
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
6881
|
-
) -> JSON:
|
|
6882
|
-
"""Create a notification event.
|
|
6883
|
-
|
|
6884
|
-
Create a new notification event.
|
|
6885
|
-
|
|
6886
|
-
:param body: The notification event to create. Required.
|
|
6887
|
-
:type body: IO[bytes]
|
|
6888
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
6889
|
-
Default value is "application/json".
|
|
6890
|
-
:paramtype content_type: str
|
|
6891
|
-
:return: JSON object
|
|
6892
|
-
:rtype: JSON
|
|
6893
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6894
|
-
|
|
6895
|
-
Example:
|
|
6896
|
-
.. code-block:: python
|
|
6897
|
-
|
|
6898
|
-
# response body for status code(s): 409
|
|
6899
|
-
response == {
|
|
6900
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
6901
|
-
of the problem. Required.
|
|
6902
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
6903
|
-
occurrence of the problem. Required.
|
|
6904
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
6905
|
-
Required.
|
|
6906
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
6907
|
-
Required.
|
|
6908
|
-
"extensions": {
|
|
6909
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
6910
|
-
Required.
|
|
6911
|
-
},
|
|
6912
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
6913
|
-
occurrence of the problem.
|
|
6914
|
-
}
|
|
6915
|
-
"""
|
|
6916
|
-
|
|
6917
|
-
@distributed_trace
|
|
6918
|
-
def create_notification_event(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
6919
|
-
"""Create a notification event.
|
|
6920
|
-
|
|
6921
|
-
Create a new notification event.
|
|
6922
|
-
|
|
6923
|
-
:param body: The notification event to create. Is either a JSON type or a IO[bytes] type.
|
|
6924
|
-
Required.
|
|
6925
|
-
:type body: JSON or IO[bytes]
|
|
6926
|
-
:return: JSON object
|
|
6927
|
-
:rtype: JSON
|
|
6928
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
6929
|
-
|
|
6930
|
-
Example:
|
|
6931
|
-
.. code-block:: python
|
|
6932
|
-
|
|
6933
|
-
# JSON input template you can fill out and use as your body input.
|
|
6934
|
-
body = {
|
|
6935
|
-
"payload": {},
|
|
6936
|
-
"ruleId": "str", # Required.
|
|
6937
|
-
"type": "str" # The type of the notification event. Required.
|
|
6938
|
-
"entitlements.balance.threshold"
|
|
6939
|
-
}
|
|
6940
|
-
|
|
6941
|
-
# response body for status code(s): 409
|
|
6942
|
-
response == {
|
|
6943
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
6944
|
-
of the problem. Required.
|
|
6945
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
6946
|
-
occurrence of the problem. Required.
|
|
6947
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
6948
|
-
Required.
|
|
6949
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
6950
|
-
Required.
|
|
6951
|
-
"extensions": {
|
|
6952
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
6953
|
-
Required.
|
|
6954
|
-
},
|
|
6955
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
6956
|
-
occurrence of the problem.
|
|
6957
|
-
}
|
|
6958
|
-
"""
|
|
6959
|
-
error_map = {
|
|
6960
|
-
404: ResourceNotFoundError,
|
|
6961
|
-
409: ResourceExistsError,
|
|
6962
|
-
304: ResourceNotModifiedError,
|
|
6963
|
-
400: HttpResponseError,
|
|
6964
|
-
401: lambda response: ClientAuthenticationError(response=response),
|
|
6965
|
-
501: HttpResponseError,
|
|
6966
|
-
}
|
|
6967
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
6968
|
-
|
|
6969
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
6970
|
-
_params = kwargs.pop("params", {}) or {}
|
|
6971
|
-
|
|
6972
|
-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
6973
|
-
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
6974
|
-
|
|
6975
|
-
content_type = content_type or "application/json"
|
|
6976
|
-
_json = None
|
|
6977
|
-
_content = None
|
|
6978
|
-
if isinstance(body, (IOBase, bytes)):
|
|
6979
|
-
_content = body
|
|
6980
|
-
else:
|
|
6981
|
-
_json = body
|
|
6982
|
-
|
|
6983
|
-
_request = build_create_notification_event_request(
|
|
6984
|
-
content_type=content_type,
|
|
6985
|
-
json=_json,
|
|
6986
|
-
content=_content,
|
|
6987
|
-
headers=_headers,
|
|
6988
|
-
params=_params,
|
|
6989
|
-
)
|
|
6990
|
-
_request.url = self._client.format_url(_request.url)
|
|
6991
|
-
|
|
6992
|
-
_stream = False
|
|
6993
|
-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
6994
|
-
_request, stream=_stream, **kwargs
|
|
6995
|
-
)
|
|
6996
|
-
|
|
6997
|
-
response = pipeline_response.http_response
|
|
6998
|
-
|
|
6999
|
-
if response.status_code not in [201, 409]:
|
|
7000
|
-
if _stream:
|
|
7001
|
-
response.read() # Load the body in memory and close the socket
|
|
7002
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
7003
|
-
raise HttpResponseError(response=response)
|
|
7004
|
-
|
|
7005
|
-
if response.status_code == 201:
|
|
7006
|
-
if response.content:
|
|
7007
|
-
deserialized = response.json()
|
|
7008
|
-
else:
|
|
7009
|
-
deserialized = None
|
|
7010
|
-
|
|
7011
|
-
if response.status_code == 409:
|
|
7012
|
-
if response.content:
|
|
7013
|
-
deserialized = response.json()
|
|
7014
|
-
else:
|
|
7015
|
-
deserialized = None
|
|
7016
|
-
|
|
7017
|
-
if cls:
|
|
7018
|
-
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
7019
|
-
|
|
7020
|
-
return cast(JSON, deserialized) # type: ignore
|
|
7021
|
-
|
|
7022
6924
|
@distributed_trace
|
|
7023
6925
|
def get_notification_event(self, event_id: str, **kwargs: Any) -> JSON:
|
|
7024
6926
|
"""Get notification event.
|
|
@@ -28,7 +28,6 @@ from ..._operations._operations import (
|
|
|
28
28
|
build_create_grant_request,
|
|
29
29
|
build_create_meter_request,
|
|
30
30
|
build_create_notification_channel_request,
|
|
31
|
-
build_create_notification_event_request,
|
|
32
31
|
build_create_notification_rule_request,
|
|
33
32
|
build_create_portal_token_request,
|
|
34
33
|
build_delete_entitlement_request,
|
|
@@ -68,6 +67,7 @@ from ..._operations._operations import (
|
|
|
68
67
|
build_query_portal_meter_request,
|
|
69
68
|
build_receive_svix_operational_event_request,
|
|
70
69
|
build_reset_entitlement_usage_request,
|
|
70
|
+
build_test_notification_rule_request,
|
|
71
71
|
build_update_notification_channel_request,
|
|
72
72
|
build_update_notification_rule_request,
|
|
73
73
|
build_upsert_subject_request,
|
|
@@ -5551,6 +5551,91 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
5551
5551
|
|
|
5552
5552
|
return cast(JSON, deserialized) # type: ignore
|
|
5553
5553
|
|
|
5554
|
+
@distributed_trace_async
|
|
5555
|
+
async def test_notification_rule(self, rule_id: str, **kwargs: Any) -> JSON:
|
|
5556
|
+
"""Test notification rule.
|
|
5557
|
+
|
|
5558
|
+
Test a notification rule by sending a test event with random data.
|
|
5559
|
+
|
|
5560
|
+
:param rule_id: A unique ULID identifier for a notification rule. Required.
|
|
5561
|
+
:type rule_id: str
|
|
5562
|
+
:return: JSON object
|
|
5563
|
+
:rtype: JSON
|
|
5564
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5565
|
+
|
|
5566
|
+
Example:
|
|
5567
|
+
.. code-block:: python
|
|
5568
|
+
|
|
5569
|
+
# response body for status code(s): 409
|
|
5570
|
+
response == {
|
|
5571
|
+
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5572
|
+
of the problem. Required.
|
|
5573
|
+
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5574
|
+
occurrence of the problem. Required.
|
|
5575
|
+
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5576
|
+
Required.
|
|
5577
|
+
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5578
|
+
Required.
|
|
5579
|
+
"extensions": {
|
|
5580
|
+
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5581
|
+
Required.
|
|
5582
|
+
},
|
|
5583
|
+
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5584
|
+
occurrence of the problem.
|
|
5585
|
+
}
|
|
5586
|
+
"""
|
|
5587
|
+
error_map = {
|
|
5588
|
+
404: ResourceNotFoundError,
|
|
5589
|
+
409: ResourceExistsError,
|
|
5590
|
+
304: ResourceNotModifiedError,
|
|
5591
|
+
400: HttpResponseError,
|
|
5592
|
+
401: lambda response: ClientAuthenticationError(response=response),
|
|
5593
|
+
501: HttpResponseError,
|
|
5594
|
+
}
|
|
5595
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5596
|
+
|
|
5597
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
5598
|
+
_params = kwargs.pop("params", {}) or {}
|
|
5599
|
+
|
|
5600
|
+
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5601
|
+
|
|
5602
|
+
_request = build_test_notification_rule_request(
|
|
5603
|
+
rule_id=rule_id,
|
|
5604
|
+
headers=_headers,
|
|
5605
|
+
params=_params,
|
|
5606
|
+
)
|
|
5607
|
+
_request.url = self._client.format_url(_request.url)
|
|
5608
|
+
|
|
5609
|
+
_stream = False
|
|
5610
|
+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5611
|
+
_request, stream=_stream, **kwargs
|
|
5612
|
+
)
|
|
5613
|
+
|
|
5614
|
+
response = pipeline_response.http_response
|
|
5615
|
+
|
|
5616
|
+
if response.status_code not in [201, 409]:
|
|
5617
|
+
if _stream:
|
|
5618
|
+
await response.read() # Load the body in memory and close the socket
|
|
5619
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5620
|
+
raise HttpResponseError(response=response)
|
|
5621
|
+
|
|
5622
|
+
if response.status_code == 201:
|
|
5623
|
+
if response.content:
|
|
5624
|
+
deserialized = response.json()
|
|
5625
|
+
else:
|
|
5626
|
+
deserialized = None
|
|
5627
|
+
|
|
5628
|
+
if response.status_code == 409:
|
|
5629
|
+
if response.content:
|
|
5630
|
+
deserialized = response.json()
|
|
5631
|
+
else:
|
|
5632
|
+
deserialized = None
|
|
5633
|
+
|
|
5634
|
+
if cls:
|
|
5635
|
+
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5636
|
+
|
|
5637
|
+
return cast(JSON, deserialized) # type: ignore
|
|
5638
|
+
|
|
5554
5639
|
@distributed_trace_async
|
|
5555
5640
|
async def list_notification_events(
|
|
5556
5641
|
self,
|
|
@@ -5627,8 +5712,12 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
5627
5712
|
event. Required.
|
|
5628
5713
|
"payload": {},
|
|
5629
5714
|
"rule": {},
|
|
5630
|
-
"type": "str" # The type of the notification event.
|
|
5715
|
+
"type": "str", # The type of the notification event.
|
|
5631
5716
|
Required. "entitlements.balance.threshold"
|
|
5717
|
+
"annotations": {
|
|
5718
|
+
"str": "str" # Optional. List of annotations managed
|
|
5719
|
+
by the system.
|
|
5720
|
+
}
|
|
5632
5721
|
}
|
|
5633
5722
|
],
|
|
5634
5723
|
"page": 0, # Current page number. Required.
|
|
@@ -5687,197 +5776,6 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
5687
5776
|
|
|
5688
5777
|
return cast(JSON, deserialized) # type: ignore
|
|
5689
5778
|
|
|
5690
|
-
@overload
|
|
5691
|
-
async def create_notification_event(
|
|
5692
|
-
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
|
|
5693
|
-
) -> JSON:
|
|
5694
|
-
"""Create a notification event.
|
|
5695
|
-
|
|
5696
|
-
Create a new notification event.
|
|
5697
|
-
|
|
5698
|
-
:param body: The notification event to create. Required.
|
|
5699
|
-
:type body: JSON
|
|
5700
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
5701
|
-
Default value is "application/json".
|
|
5702
|
-
:paramtype content_type: str
|
|
5703
|
-
:return: JSON object
|
|
5704
|
-
:rtype: JSON
|
|
5705
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5706
|
-
|
|
5707
|
-
Example:
|
|
5708
|
-
.. code-block:: python
|
|
5709
|
-
|
|
5710
|
-
# JSON input template you can fill out and use as your body input.
|
|
5711
|
-
body = {
|
|
5712
|
-
"payload": {},
|
|
5713
|
-
"ruleId": "str", # Required.
|
|
5714
|
-
"type": "str" # The type of the notification event. Required.
|
|
5715
|
-
"entitlements.balance.threshold"
|
|
5716
|
-
}
|
|
5717
|
-
|
|
5718
|
-
# response body for status code(s): 409
|
|
5719
|
-
response == {
|
|
5720
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5721
|
-
of the problem. Required.
|
|
5722
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5723
|
-
occurrence of the problem. Required.
|
|
5724
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5725
|
-
Required.
|
|
5726
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5727
|
-
Required.
|
|
5728
|
-
"extensions": {
|
|
5729
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5730
|
-
Required.
|
|
5731
|
-
},
|
|
5732
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5733
|
-
occurrence of the problem.
|
|
5734
|
-
}
|
|
5735
|
-
"""
|
|
5736
|
-
|
|
5737
|
-
@overload
|
|
5738
|
-
async def create_notification_event(
|
|
5739
|
-
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
5740
|
-
) -> JSON:
|
|
5741
|
-
"""Create a notification event.
|
|
5742
|
-
|
|
5743
|
-
Create a new notification event.
|
|
5744
|
-
|
|
5745
|
-
:param body: The notification event to create. Required.
|
|
5746
|
-
:type body: IO[bytes]
|
|
5747
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
5748
|
-
Default value is "application/json".
|
|
5749
|
-
:paramtype content_type: str
|
|
5750
|
-
:return: JSON object
|
|
5751
|
-
:rtype: JSON
|
|
5752
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5753
|
-
|
|
5754
|
-
Example:
|
|
5755
|
-
.. code-block:: python
|
|
5756
|
-
|
|
5757
|
-
# response body for status code(s): 409
|
|
5758
|
-
response == {
|
|
5759
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5760
|
-
of the problem. Required.
|
|
5761
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5762
|
-
occurrence of the problem. Required.
|
|
5763
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5764
|
-
Required.
|
|
5765
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5766
|
-
Required.
|
|
5767
|
-
"extensions": {
|
|
5768
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5769
|
-
Required.
|
|
5770
|
-
},
|
|
5771
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5772
|
-
occurrence of the problem.
|
|
5773
|
-
}
|
|
5774
|
-
"""
|
|
5775
|
-
|
|
5776
|
-
@distributed_trace_async
|
|
5777
|
-
async def create_notification_event(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
|
|
5778
|
-
"""Create a notification event.
|
|
5779
|
-
|
|
5780
|
-
Create a new notification event.
|
|
5781
|
-
|
|
5782
|
-
:param body: The notification event to create. Is either a JSON type or a IO[bytes] type.
|
|
5783
|
-
Required.
|
|
5784
|
-
:type body: JSON or IO[bytes]
|
|
5785
|
-
:return: JSON object
|
|
5786
|
-
:rtype: JSON
|
|
5787
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
5788
|
-
|
|
5789
|
-
Example:
|
|
5790
|
-
.. code-block:: python
|
|
5791
|
-
|
|
5792
|
-
# JSON input template you can fill out and use as your body input.
|
|
5793
|
-
body = {
|
|
5794
|
-
"payload": {},
|
|
5795
|
-
"ruleId": "str", # Required.
|
|
5796
|
-
"type": "str" # The type of the notification event. Required.
|
|
5797
|
-
"entitlements.balance.threshold"
|
|
5798
|
-
}
|
|
5799
|
-
|
|
5800
|
-
# response body for status code(s): 409
|
|
5801
|
-
response == {
|
|
5802
|
-
"detail": "str", # A human-readable explanation specific to this occurrence
|
|
5803
|
-
of the problem. Required.
|
|
5804
|
-
"status": 0, # The HTTP status code generated by the origin server for this
|
|
5805
|
-
occurrence of the problem. Required.
|
|
5806
|
-
"title": "str", # A a short, human-readable summary of the problem type.
|
|
5807
|
-
Required.
|
|
5808
|
-
"type": "str", # Type contains a URI that identifies the problem type.
|
|
5809
|
-
Required.
|
|
5810
|
-
"extensions": {
|
|
5811
|
-
"conflictingEntityId": "str" # The id of the conflicting entity.
|
|
5812
|
-
Required.
|
|
5813
|
-
},
|
|
5814
|
-
"instance": "str" # Optional. A URI reference that identifies the specific
|
|
5815
|
-
occurrence of the problem.
|
|
5816
|
-
}
|
|
5817
|
-
"""
|
|
5818
|
-
error_map = {
|
|
5819
|
-
404: ResourceNotFoundError,
|
|
5820
|
-
409: ResourceExistsError,
|
|
5821
|
-
304: ResourceNotModifiedError,
|
|
5822
|
-
400: HttpResponseError,
|
|
5823
|
-
401: lambda response: ClientAuthenticationError(response=response),
|
|
5824
|
-
501: HttpResponseError,
|
|
5825
|
-
}
|
|
5826
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
5827
|
-
|
|
5828
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
5829
|
-
_params = kwargs.pop("params", {}) or {}
|
|
5830
|
-
|
|
5831
|
-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
5832
|
-
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
|
5833
|
-
|
|
5834
|
-
content_type = content_type or "application/json"
|
|
5835
|
-
_json = None
|
|
5836
|
-
_content = None
|
|
5837
|
-
if isinstance(body, (IOBase, bytes)):
|
|
5838
|
-
_content = body
|
|
5839
|
-
else:
|
|
5840
|
-
_json = body
|
|
5841
|
-
|
|
5842
|
-
_request = build_create_notification_event_request(
|
|
5843
|
-
content_type=content_type,
|
|
5844
|
-
json=_json,
|
|
5845
|
-
content=_content,
|
|
5846
|
-
headers=_headers,
|
|
5847
|
-
params=_params,
|
|
5848
|
-
)
|
|
5849
|
-
_request.url = self._client.format_url(_request.url)
|
|
5850
|
-
|
|
5851
|
-
_stream = False
|
|
5852
|
-
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
5853
|
-
_request, stream=_stream, **kwargs
|
|
5854
|
-
)
|
|
5855
|
-
|
|
5856
|
-
response = pipeline_response.http_response
|
|
5857
|
-
|
|
5858
|
-
if response.status_code not in [201, 409]:
|
|
5859
|
-
if _stream:
|
|
5860
|
-
await response.read() # Load the body in memory and close the socket
|
|
5861
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
|
|
5862
|
-
raise HttpResponseError(response=response)
|
|
5863
|
-
|
|
5864
|
-
if response.status_code == 201:
|
|
5865
|
-
if response.content:
|
|
5866
|
-
deserialized = response.json()
|
|
5867
|
-
else:
|
|
5868
|
-
deserialized = None
|
|
5869
|
-
|
|
5870
|
-
if response.status_code == 409:
|
|
5871
|
-
if response.content:
|
|
5872
|
-
deserialized = response.json()
|
|
5873
|
-
else:
|
|
5874
|
-
deserialized = None
|
|
5875
|
-
|
|
5876
|
-
if cls:
|
|
5877
|
-
return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
|
|
5878
|
-
|
|
5879
|
-
return cast(JSON, deserialized) # type: ignore
|
|
5880
|
-
|
|
5881
5779
|
@distributed_trace_async
|
|
5882
5780
|
async def get_notification_event(self, event_id: str, **kwargs: Any) -> JSON:
|
|
5883
5781
|
"""Get notification event.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|