openmeter 1.0.0b122__py3-none-any.whl → 1.0.0b123__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openmeter might be problematic. Click here for more details.
- openmeter/_operations/_operations.py +97 -137
- openmeter/aio/_operations/_operations.py +59 -134
- {openmeter-1.0.0b122.dist-info → openmeter-1.0.0b123.dist-info}/METADATA +1 -1
- {openmeter-1.0.0b122.dist-info → openmeter-1.0.0b123.dist-info}/RECORD +5 -5
- {openmeter-1.0.0b122.dist-info → openmeter-1.0.0b123.dist-info}/WHEEL +0 -0
|
@@ -385,7 +385,13 @@ def build_query_portal_meter_request(
|
|
|
385
385
|
|
|
386
386
|
|
|
387
387
|
def build_list_entitlements_request(
|
|
388
|
-
*,
|
|
388
|
+
*,
|
|
389
|
+
page: int = 1,
|
|
390
|
+
page_size: int = 100,
|
|
391
|
+
limit: int = 1000,
|
|
392
|
+
offset: int = 0,
|
|
393
|
+
order_by: str = "createdAt",
|
|
394
|
+
**kwargs: Any
|
|
389
395
|
) -> HttpRequest:
|
|
390
396
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
391
397
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -396,6 +402,10 @@ def build_list_entitlements_request(
|
|
|
396
402
|
_url = "/api/v1/entitlements"
|
|
397
403
|
|
|
398
404
|
# Construct parameters
|
|
405
|
+
if page is not None:
|
|
406
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
407
|
+
if page_size is not None:
|
|
408
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
399
409
|
if limit is not None:
|
|
400
410
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
401
411
|
if offset is not None:
|
|
@@ -410,7 +420,14 @@ def build_list_entitlements_request(
|
|
|
410
420
|
|
|
411
421
|
|
|
412
422
|
def build_list_features_request(
|
|
413
|
-
*,
|
|
423
|
+
*,
|
|
424
|
+
page: int = 1,
|
|
425
|
+
page_size: int = 100,
|
|
426
|
+
limit: int = 1000,
|
|
427
|
+
offset: int = 0,
|
|
428
|
+
order_by: str = "updatedAt",
|
|
429
|
+
include_archived: bool = False,
|
|
430
|
+
**kwargs: Any
|
|
414
431
|
) -> HttpRequest:
|
|
415
432
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
416
433
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -421,6 +438,10 @@ def build_list_features_request(
|
|
|
421
438
|
_url = "/api/v1/features"
|
|
422
439
|
|
|
423
440
|
# Construct parameters
|
|
441
|
+
if page is not None:
|
|
442
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
443
|
+
if page_size is not None:
|
|
444
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
424
445
|
if limit is not None:
|
|
425
446
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
426
447
|
if offset is not None:
|
|
@@ -492,7 +513,15 @@ def build_delete_feature_request(feature_id: str, **kwargs: Any) -> HttpRequest:
|
|
|
492
513
|
|
|
493
514
|
|
|
494
515
|
def build_list_grants_request(
|
|
495
|
-
*,
|
|
516
|
+
*,
|
|
517
|
+
page: int = 1,
|
|
518
|
+
page_size: int = 100,
|
|
519
|
+
limit: int = 1000,
|
|
520
|
+
offset: int = 0,
|
|
521
|
+
order: str = "ASC",
|
|
522
|
+
order_by: str = "updatedAt",
|
|
523
|
+
include_deleted: bool = False,
|
|
524
|
+
**kwargs: Any
|
|
496
525
|
) -> HttpRequest:
|
|
497
526
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
498
527
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
@@ -503,10 +532,16 @@ def build_list_grants_request(
|
|
|
503
532
|
_url = "/api/v1/grants"
|
|
504
533
|
|
|
505
534
|
# Construct parameters
|
|
535
|
+
if page is not None:
|
|
536
|
+
_params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
|
|
537
|
+
if page_size is not None:
|
|
538
|
+
_params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
|
|
506
539
|
if limit is not None:
|
|
507
540
|
_params["limit"] = _SERIALIZER.query("limit", limit, "int", maximum=1000, minimum=1)
|
|
508
541
|
if offset is not None:
|
|
509
542
|
_params["offset"] = _SERIALIZER.query("offset", offset, "int", minimum=0)
|
|
543
|
+
if order is not None:
|
|
544
|
+
_params["order"] = _SERIALIZER.query("order", order, "str")
|
|
510
545
|
if order_by is not None:
|
|
511
546
|
_params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
|
|
512
547
|
if include_deleted is not None:
|
|
@@ -2889,13 +2924,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2889
2924
|
|
|
2890
2925
|
@distributed_trace
|
|
2891
2926
|
def list_entitlements(
|
|
2892
|
-
self,
|
|
2893
|
-
|
|
2927
|
+
self,
|
|
2928
|
+
*,
|
|
2929
|
+
page: int = 1,
|
|
2930
|
+
page_size: int = 100,
|
|
2931
|
+
limit: int = 1000,
|
|
2932
|
+
offset: int = 0,
|
|
2933
|
+
order_by: str = "createdAt",
|
|
2934
|
+
**kwargs: Any
|
|
2935
|
+
) -> Any:
|
|
2894
2936
|
"""List entitlements.
|
|
2895
2937
|
|
|
2896
2938
|
List all entitlements regardless of subject. This endpoint is intended for administrative
|
|
2897
2939
|
purposes.
|
|
2940
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
2898
2941
|
|
|
2942
|
+
:keyword page: Page number to return. Default value is 1.
|
|
2943
|
+
:paramtype page: int
|
|
2944
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
2945
|
+
:paramtype page_size: int
|
|
2899
2946
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
2900
2947
|
:paramtype limit: int
|
|
2901
2948
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -2903,17 +2950,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2903
2950
|
:keyword order_by: Order by field. Known values are: "createdAt" and "updatedAt". Default value
|
|
2904
2951
|
is "createdAt".
|
|
2905
2952
|
:paramtype order_by: str
|
|
2906
|
-
:return:
|
|
2907
|
-
:rtype:
|
|
2953
|
+
:return: any
|
|
2954
|
+
:rtype: any
|
|
2908
2955
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2909
|
-
|
|
2910
|
-
Example:
|
|
2911
|
-
.. code-block:: python
|
|
2912
|
-
|
|
2913
|
-
# response body for status code(s): 200
|
|
2914
|
-
response == [
|
|
2915
|
-
{}
|
|
2916
|
-
]
|
|
2917
2956
|
"""
|
|
2918
2957
|
error_map = {
|
|
2919
2958
|
404: ResourceNotFoundError,
|
|
@@ -2927,9 +2966,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2927
2966
|
_headers = kwargs.pop("headers", {}) or {}
|
|
2928
2967
|
_params = kwargs.pop("params", {}) or {}
|
|
2929
2968
|
|
|
2930
|
-
cls: ClsType[
|
|
2969
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
2931
2970
|
|
|
2932
2971
|
_request = build_list_entitlements_request(
|
|
2972
|
+
page=page,
|
|
2973
|
+
page_size=page_size,
|
|
2933
2974
|
limit=limit,
|
|
2934
2975
|
offset=offset,
|
|
2935
2976
|
order_by=order_by,
|
|
@@ -2957,25 +2998,31 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2957
2998
|
deserialized = None
|
|
2958
2999
|
|
|
2959
3000
|
if cls:
|
|
2960
|
-
return cls(pipeline_response, cast(
|
|
3001
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
2961
3002
|
|
|
2962
|
-
return cast(
|
|
3003
|
+
return cast(Any, deserialized) # type: ignore
|
|
2963
3004
|
|
|
2964
3005
|
@distributed_trace
|
|
2965
3006
|
def list_features(
|
|
2966
3007
|
self,
|
|
2967
3008
|
*,
|
|
3009
|
+
page: int = 1,
|
|
3010
|
+
page_size: int = 100,
|
|
2968
3011
|
limit: int = 1000,
|
|
2969
3012
|
offset: int = 0,
|
|
2970
3013
|
order_by: str = "updatedAt",
|
|
2971
3014
|
include_archived: bool = False,
|
|
2972
3015
|
**kwargs: Any
|
|
2973
|
-
) ->
|
|
2974
|
-
# pylint: disable=line-too-long
|
|
3016
|
+
) -> Any:
|
|
2975
3017
|
"""List features.
|
|
2976
3018
|
|
|
2977
|
-
List all features.
|
|
3019
|
+
List all features. If page is provided that takes precedence and the paginated response is
|
|
3020
|
+
returned.
|
|
2978
3021
|
|
|
3022
|
+
:keyword page: Page number to return. Default value is 1.
|
|
3023
|
+
:paramtype page: int
|
|
3024
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
3025
|
+
:paramtype page_size: int
|
|
2979
3026
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
2980
3027
|
:paramtype limit: int
|
|
2981
3028
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -2985,47 +3032,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2985
3032
|
:paramtype order_by: str
|
|
2986
3033
|
:keyword include_archived: Include archived features. Default value is False.
|
|
2987
3034
|
:paramtype include_archived: bool
|
|
2988
|
-
:return:
|
|
2989
|
-
:rtype:
|
|
3035
|
+
:return: any
|
|
3036
|
+
:rtype: any
|
|
2990
3037
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2991
|
-
|
|
2992
|
-
Example:
|
|
2993
|
-
.. code-block:: python
|
|
2994
|
-
|
|
2995
|
-
# response body for status code(s): 200
|
|
2996
|
-
response == [
|
|
2997
|
-
{
|
|
2998
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2999
|
-
was created. Required.
|
|
3000
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
3001
|
-
"key": "str", # The key is an immutable unique identifier of the
|
|
3002
|
-
feature used throughout the API, for example when interacting with a
|
|
3003
|
-
subject's entitlements. The key has to be unique across all active features,
|
|
3004
|
-
but archived features can share the same key. The key should consist of
|
|
3005
|
-
lowercase alphanumeric characters and dashes. Required.
|
|
3006
|
-
"name": "str", # The name of the feature. Required.
|
|
3007
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
3008
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
3009
|
-
"archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is
|
|
3010
|
-
archived, no new entitlements can be created for it.
|
|
3011
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
3012
|
-
the resource was deleted.
|
|
3013
|
-
"metadata": {
|
|
3014
|
-
"str": "str" # Optional. Additional metadata for the
|
|
3015
|
-
feature, useful for syncing with external systems and annotating custom
|
|
3016
|
-
fields.
|
|
3017
|
-
},
|
|
3018
|
-
"meterGroupByFilters": {
|
|
3019
|
-
"str": "str" # Optional. Optional meter group by filters.
|
|
3020
|
-
Useful if the meter scope is broader than what feature tracks. Example
|
|
3021
|
-
scenario would be a meter tracking all token use with groupBy fields for
|
|
3022
|
-
the model, then the feature could filter for model=gpt-4.
|
|
3023
|
-
},
|
|
3024
|
-
"meterSlug": "str" # Optional. The meter that the feature is
|
|
3025
|
-
associated with and and based on which usage is calculated. The meter
|
|
3026
|
-
selected must have SUM or COUNT aggregation.
|
|
3027
|
-
}
|
|
3028
|
-
]
|
|
3029
3038
|
"""
|
|
3030
3039
|
error_map = {
|
|
3031
3040
|
404: ResourceNotFoundError,
|
|
@@ -3039,9 +3048,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3039
3048
|
_headers = kwargs.pop("headers", {}) or {}
|
|
3040
3049
|
_params = kwargs.pop("params", {}) or {}
|
|
3041
3050
|
|
|
3042
|
-
cls: ClsType[
|
|
3051
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
3043
3052
|
|
|
3044
3053
|
_request = build_list_features_request(
|
|
3054
|
+
page=page,
|
|
3055
|
+
page_size=page_size,
|
|
3045
3056
|
limit=limit,
|
|
3046
3057
|
offset=offset,
|
|
3047
3058
|
order_by=order_by,
|
|
@@ -3070,9 +3081,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3070
3081
|
deserialized = None
|
|
3071
3082
|
|
|
3072
3083
|
if cls:
|
|
3073
|
-
return cls(pipeline_response, cast(
|
|
3084
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
3074
3085
|
|
|
3075
|
-
return cast(
|
|
3086
|
+
return cast(Any, deserialized) # type: ignore
|
|
3076
3087
|
|
|
3077
3088
|
@overload
|
|
3078
3089
|
def create_feature(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
@@ -3492,97 +3503,43 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3492
3503
|
def list_grants(
|
|
3493
3504
|
self,
|
|
3494
3505
|
*,
|
|
3506
|
+
page: int = 1,
|
|
3507
|
+
page_size: int = 100,
|
|
3495
3508
|
limit: int = 1000,
|
|
3496
3509
|
offset: int = 0,
|
|
3510
|
+
order: str = "ASC",
|
|
3497
3511
|
order_by: str = "updatedAt",
|
|
3498
3512
|
include_deleted: bool = False,
|
|
3499
3513
|
**kwargs: Any
|
|
3500
|
-
) ->
|
|
3501
|
-
# pylint: disable=line-too-long
|
|
3514
|
+
) -> Any:
|
|
3502
3515
|
"""List grants.
|
|
3503
3516
|
|
|
3504
3517
|
List all grants for all the subjects and entitlements. This endpoint is intended for
|
|
3505
3518
|
administrative purposes only. To fetch the grants of a specific entitlement please use the
|
|
3506
3519
|
/api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
|
|
3507
3520
|
|
|
3521
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
3522
|
+
|
|
3523
|
+
:keyword page: Page number to return. Default value is 1.
|
|
3524
|
+
:paramtype page: int
|
|
3525
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
3526
|
+
:paramtype page_size: int
|
|
3508
3527
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
3509
3528
|
:paramtype limit: int
|
|
3510
3529
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
3511
3530
|
:paramtype offset: int
|
|
3531
|
+
:keyword order: Order by field.
|
|
3532
|
+
|
|
3533
|
+
Usage: ``?order=ASC``. Known values are: "ASC" and "DESC". Default value is "ASC".
|
|
3534
|
+
:paramtype order: str
|
|
3512
3535
|
:keyword order_by: Order by field. Known values are: "id", "createdAt", and "updatedAt".
|
|
3513
3536
|
Default value is "updatedAt".
|
|
3514
3537
|
:paramtype order_by: str
|
|
3515
3538
|
:keyword include_deleted: Include deleted entries. Default value is False.
|
|
3516
3539
|
:paramtype include_deleted: bool
|
|
3517
|
-
:return:
|
|
3518
|
-
:rtype:
|
|
3540
|
+
:return: any
|
|
3541
|
+
:rtype: any
|
|
3519
3542
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
3520
|
-
|
|
3521
|
-
Example:
|
|
3522
|
-
.. code-block:: python
|
|
3523
|
-
|
|
3524
|
-
# response body for status code(s): 200
|
|
3525
|
-
response == [
|
|
3526
|
-
{
|
|
3527
|
-
"amount": 0.0, # The amount to grant. Should be a positive number.
|
|
3528
|
-
Required.
|
|
3529
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
3530
|
-
was created. Required.
|
|
3531
|
-
"effectiveAt": "2020-02-20 00:00:00", # Effective date for grants
|
|
3532
|
-
and anchor for recurring grants. Provided value will be ceiled to metering
|
|
3533
|
-
windowSize (minute). Required.
|
|
3534
|
-
"entitlementId": "str", # The unique entitlement ULID that the grant
|
|
3535
|
-
is associated with. Required.
|
|
3536
|
-
"expiration": {
|
|
3537
|
-
"count": 0, # The expiration period count like 12 months.
|
|
3538
|
-
Required.
|
|
3539
|
-
"duration": "str" # The expiration period duration like
|
|
3540
|
-
month. Required. Known values are: "HOUR", "DAY", "WEEK", "MONTH", and
|
|
3541
|
-
"YEAR".
|
|
3542
|
-
},
|
|
3543
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
3544
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
3545
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
3546
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
3547
|
-
the resource was deleted.
|
|
3548
|
-
"expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date
|
|
3549
|
-
of the grant.
|
|
3550
|
-
"maxRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
3551
|
-
rolled over at reset, after which they can have a different balance compared
|
|
3552
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
3553
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
3554
|
-
MinRolloverAmount)).
|
|
3555
|
-
"metadata": {
|
|
3556
|
-
"str": "str" # Optional. Dictionary of :code:`<string>`.
|
|
3557
|
-
},
|
|
3558
|
-
"minRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
3559
|
-
rolled over at reset, after which they can have a different balance compared
|
|
3560
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
3561
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
3562
|
-
MinRolloverAmount)).
|
|
3563
|
-
"nextRecurrence": "2020-02-20 00:00:00", # Optional. The next time
|
|
3564
|
-
the grant will recurr.
|
|
3565
|
-
"priority": 1, # Optional. Default value is 1. The priority of the
|
|
3566
|
-
grant. Grants with higher priority are applied first. Priority is a positive
|
|
3567
|
-
decimal numbers. With lower numbers indicating higher importance. For
|
|
3568
|
-
example, a priority of 1 is more urgent than a priority of 2. When there are
|
|
3569
|
-
several grants available for the same subject, the system selects the grant
|
|
3570
|
-
with the highest priority. In cases where grants share the same priority
|
|
3571
|
-
level, the grant closest to its expiration will be used first. In the case of
|
|
3572
|
-
two grants have identical priorities and expiration dates, the system will
|
|
3573
|
-
use the grant that was created first.
|
|
3574
|
-
"recurrence": {
|
|
3575
|
-
"anchor": "2020-02-20 00:00:00", # An arbitrary anchor to
|
|
3576
|
-
base the recurring period on. Required.
|
|
3577
|
-
"interval": "str" # List of pre-defined periods that can be
|
|
3578
|
-
used for recurring & scheduling. DAY: Every day WEEK: Every
|
|
3579
|
-
week MONTH: Every month YEAR: Every year. Required. Known values
|
|
3580
|
-
are: "DAY", "WEEK", "MONTH", and "YEAR".
|
|
3581
|
-
},
|
|
3582
|
-
"voidedAt": "2020-02-20 00:00:00" # Optional. The date and time the
|
|
3583
|
-
grant was voided (cannot be used after that).
|
|
3584
|
-
}
|
|
3585
|
-
]
|
|
3586
3543
|
"""
|
|
3587
3544
|
error_map = {
|
|
3588
3545
|
404: ResourceNotFoundError,
|
|
@@ -3595,11 +3552,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3595
3552
|
_headers = kwargs.pop("headers", {}) or {}
|
|
3596
3553
|
_params = kwargs.pop("params", {}) or {}
|
|
3597
3554
|
|
|
3598
|
-
cls: ClsType[
|
|
3555
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
3599
3556
|
|
|
3600
3557
|
_request = build_list_grants_request(
|
|
3558
|
+
page=page,
|
|
3559
|
+
page_size=page_size,
|
|
3601
3560
|
limit=limit,
|
|
3602
3561
|
offset=offset,
|
|
3562
|
+
order=order,
|
|
3603
3563
|
order_by=order_by,
|
|
3604
3564
|
include_deleted=include_deleted,
|
|
3605
3565
|
headers=_headers,
|
|
@@ -3626,9 +3586,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
3626
3586
|
deserialized = None
|
|
3627
3587
|
|
|
3628
3588
|
if cls:
|
|
3629
|
-
return cls(pipeline_response, cast(
|
|
3589
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
3630
3590
|
|
|
3631
|
-
return cast(
|
|
3591
|
+
return cast(Any, deserialized) # type: ignore
|
|
3632
3592
|
|
|
3633
3593
|
@distributed_trace
|
|
3634
3594
|
def void_grant(self, grant_id: str, **kwargs: Any) -> Optional[JSON]:
|
|
@@ -1904,13 +1904,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1904
1904
|
|
|
1905
1905
|
@distributed_trace_async
|
|
1906
1906
|
async def list_entitlements(
|
|
1907
|
-
self,
|
|
1908
|
-
|
|
1907
|
+
self,
|
|
1908
|
+
*,
|
|
1909
|
+
page: int = 1,
|
|
1910
|
+
page_size: int = 100,
|
|
1911
|
+
limit: int = 1000,
|
|
1912
|
+
offset: int = 0,
|
|
1913
|
+
order_by: str = "createdAt",
|
|
1914
|
+
**kwargs: Any
|
|
1915
|
+
) -> Any:
|
|
1909
1916
|
"""List entitlements.
|
|
1910
1917
|
|
|
1911
1918
|
List all entitlements regardless of subject. This endpoint is intended for administrative
|
|
1912
1919
|
purposes.
|
|
1920
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
1913
1921
|
|
|
1922
|
+
:keyword page: Page number to return. Default value is 1.
|
|
1923
|
+
:paramtype page: int
|
|
1924
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
1925
|
+
:paramtype page_size: int
|
|
1914
1926
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
1915
1927
|
:paramtype limit: int
|
|
1916
1928
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -1918,17 +1930,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1918
1930
|
:keyword order_by: Order by field. Known values are: "createdAt" and "updatedAt". Default value
|
|
1919
1931
|
is "createdAt".
|
|
1920
1932
|
:paramtype order_by: str
|
|
1921
|
-
:return:
|
|
1922
|
-
:rtype:
|
|
1933
|
+
:return: any
|
|
1934
|
+
:rtype: any
|
|
1923
1935
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1924
|
-
|
|
1925
|
-
Example:
|
|
1926
|
-
.. code-block:: python
|
|
1927
|
-
|
|
1928
|
-
# response body for status code(s): 200
|
|
1929
|
-
response == [
|
|
1930
|
-
{}
|
|
1931
|
-
]
|
|
1932
1936
|
"""
|
|
1933
1937
|
error_map = {
|
|
1934
1938
|
404: ResourceNotFoundError,
|
|
@@ -1942,9 +1946,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1942
1946
|
_headers = kwargs.pop("headers", {}) or {}
|
|
1943
1947
|
_params = kwargs.pop("params", {}) or {}
|
|
1944
1948
|
|
|
1945
|
-
cls: ClsType[
|
|
1949
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
1946
1950
|
|
|
1947
1951
|
_request = build_list_entitlements_request(
|
|
1952
|
+
page=page,
|
|
1953
|
+
page_size=page_size,
|
|
1948
1954
|
limit=limit,
|
|
1949
1955
|
offset=offset,
|
|
1950
1956
|
order_by=order_by,
|
|
@@ -1972,25 +1978,31 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
1972
1978
|
deserialized = None
|
|
1973
1979
|
|
|
1974
1980
|
if cls:
|
|
1975
|
-
return cls(pipeline_response, cast(
|
|
1981
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
1976
1982
|
|
|
1977
|
-
return cast(
|
|
1983
|
+
return cast(Any, deserialized) # type: ignore
|
|
1978
1984
|
|
|
1979
1985
|
@distributed_trace_async
|
|
1980
1986
|
async def list_features(
|
|
1981
1987
|
self,
|
|
1982
1988
|
*,
|
|
1989
|
+
page: int = 1,
|
|
1990
|
+
page_size: int = 100,
|
|
1983
1991
|
limit: int = 1000,
|
|
1984
1992
|
offset: int = 0,
|
|
1985
1993
|
order_by: str = "updatedAt",
|
|
1986
1994
|
include_archived: bool = False,
|
|
1987
1995
|
**kwargs: Any
|
|
1988
|
-
) ->
|
|
1989
|
-
# pylint: disable=line-too-long
|
|
1996
|
+
) -> Any:
|
|
1990
1997
|
"""List features.
|
|
1991
1998
|
|
|
1992
|
-
List all features.
|
|
1999
|
+
List all features. If page is provided that takes precedence and the paginated response is
|
|
2000
|
+
returned.
|
|
1993
2001
|
|
|
2002
|
+
:keyword page: Page number to return. Default value is 1.
|
|
2003
|
+
:paramtype page: int
|
|
2004
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
2005
|
+
:paramtype page_size: int
|
|
1994
2006
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
1995
2007
|
:paramtype limit: int
|
|
1996
2008
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
@@ -2000,47 +2012,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2000
2012
|
:paramtype order_by: str
|
|
2001
2013
|
:keyword include_archived: Include archived features. Default value is False.
|
|
2002
2014
|
:paramtype include_archived: bool
|
|
2003
|
-
:return:
|
|
2004
|
-
:rtype:
|
|
2015
|
+
:return: any
|
|
2016
|
+
:rtype: any
|
|
2005
2017
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2006
|
-
|
|
2007
|
-
Example:
|
|
2008
|
-
.. code-block:: python
|
|
2009
|
-
|
|
2010
|
-
# response body for status code(s): 200
|
|
2011
|
-
response == [
|
|
2012
|
-
{
|
|
2013
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2014
|
-
was created. Required.
|
|
2015
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
2016
|
-
"key": "str", # The key is an immutable unique identifier of the
|
|
2017
|
-
feature used throughout the API, for example when interacting with a
|
|
2018
|
-
subject's entitlements. The key has to be unique across all active features,
|
|
2019
|
-
but archived features can share the same key. The key should consist of
|
|
2020
|
-
lowercase alphanumeric characters and dashes. Required.
|
|
2021
|
-
"name": "str", # The name of the feature. Required.
|
|
2022
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2023
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
2024
|
-
"archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is
|
|
2025
|
-
archived, no new entitlements can be created for it.
|
|
2026
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
2027
|
-
the resource was deleted.
|
|
2028
|
-
"metadata": {
|
|
2029
|
-
"str": "str" # Optional. Additional metadata for the
|
|
2030
|
-
feature, useful for syncing with external systems and annotating custom
|
|
2031
|
-
fields.
|
|
2032
|
-
},
|
|
2033
|
-
"meterGroupByFilters": {
|
|
2034
|
-
"str": "str" # Optional. Optional meter group by filters.
|
|
2035
|
-
Useful if the meter scope is broader than what feature tracks. Example
|
|
2036
|
-
scenario would be a meter tracking all token use with groupBy fields for
|
|
2037
|
-
the model, then the feature could filter for model=gpt-4.
|
|
2038
|
-
},
|
|
2039
|
-
"meterSlug": "str" # Optional. The meter that the feature is
|
|
2040
|
-
associated with and and based on which usage is calculated. The meter
|
|
2041
|
-
selected must have SUM or COUNT aggregation.
|
|
2042
|
-
}
|
|
2043
|
-
]
|
|
2044
2018
|
"""
|
|
2045
2019
|
error_map = {
|
|
2046
2020
|
404: ResourceNotFoundError,
|
|
@@ -2054,9 +2028,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2054
2028
|
_headers = kwargs.pop("headers", {}) or {}
|
|
2055
2029
|
_params = kwargs.pop("params", {}) or {}
|
|
2056
2030
|
|
|
2057
|
-
cls: ClsType[
|
|
2031
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
2058
2032
|
|
|
2059
2033
|
_request = build_list_features_request(
|
|
2034
|
+
page=page,
|
|
2035
|
+
page_size=page_size,
|
|
2060
2036
|
limit=limit,
|
|
2061
2037
|
offset=offset,
|
|
2062
2038
|
order_by=order_by,
|
|
@@ -2085,9 +2061,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2085
2061
|
deserialized = None
|
|
2086
2062
|
|
|
2087
2063
|
if cls:
|
|
2088
|
-
return cls(pipeline_response, cast(
|
|
2064
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
2089
2065
|
|
|
2090
|
-
return cast(
|
|
2066
|
+
return cast(Any, deserialized) # type: ignore
|
|
2091
2067
|
|
|
2092
2068
|
@overload
|
|
2093
2069
|
async def create_feature(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
|
|
@@ -2509,97 +2485,43 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2509
2485
|
async def list_grants(
|
|
2510
2486
|
self,
|
|
2511
2487
|
*,
|
|
2488
|
+
page: int = 1,
|
|
2489
|
+
page_size: int = 100,
|
|
2512
2490
|
limit: int = 1000,
|
|
2513
2491
|
offset: int = 0,
|
|
2492
|
+
order: str = "ASC",
|
|
2514
2493
|
order_by: str = "updatedAt",
|
|
2515
2494
|
include_deleted: bool = False,
|
|
2516
2495
|
**kwargs: Any
|
|
2517
|
-
) ->
|
|
2518
|
-
# pylint: disable=line-too-long
|
|
2496
|
+
) -> Any:
|
|
2519
2497
|
"""List grants.
|
|
2520
2498
|
|
|
2521
2499
|
List all grants for all the subjects and entitlements. This endpoint is intended for
|
|
2522
2500
|
administrative purposes only. To fetch the grants of a specific entitlement please use the
|
|
2523
2501
|
/api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
|
|
2524
2502
|
|
|
2503
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
2504
|
+
|
|
2505
|
+
:keyword page: Page number to return. Default value is 1.
|
|
2506
|
+
:paramtype page: int
|
|
2507
|
+
:keyword page_size: Number of entries to return per page. Default value is 100.
|
|
2508
|
+
:paramtype page_size: int
|
|
2525
2509
|
:keyword limit: Number of entries to return. Default value is 1000.
|
|
2526
2510
|
:paramtype limit: int
|
|
2527
2511
|
:keyword offset: Number of entries to skip. Default value is 0.
|
|
2528
2512
|
:paramtype offset: int
|
|
2513
|
+
:keyword order: Order by field.
|
|
2514
|
+
|
|
2515
|
+
Usage: ``?order=ASC``. Known values are: "ASC" and "DESC". Default value is "ASC".
|
|
2516
|
+
:paramtype order: str
|
|
2529
2517
|
:keyword order_by: Order by field. Known values are: "id", "createdAt", and "updatedAt".
|
|
2530
2518
|
Default value is "updatedAt".
|
|
2531
2519
|
:paramtype order_by: str
|
|
2532
2520
|
:keyword include_deleted: Include deleted entries. Default value is False.
|
|
2533
2521
|
:paramtype include_deleted: bool
|
|
2534
|
-
:return:
|
|
2535
|
-
:rtype:
|
|
2522
|
+
:return: any
|
|
2523
|
+
:rtype: any
|
|
2536
2524
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
2537
|
-
|
|
2538
|
-
Example:
|
|
2539
|
-
.. code-block:: python
|
|
2540
|
-
|
|
2541
|
-
# response body for status code(s): 200
|
|
2542
|
-
response == [
|
|
2543
|
-
{
|
|
2544
|
-
"amount": 0.0, # The amount to grant. Should be a positive number.
|
|
2545
|
-
Required.
|
|
2546
|
-
"createdAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2547
|
-
was created. Required.
|
|
2548
|
-
"effectiveAt": "2020-02-20 00:00:00", # Effective date for grants
|
|
2549
|
-
and anchor for recurring grants. Provided value will be ceiled to metering
|
|
2550
|
-
windowSize (minute). Required.
|
|
2551
|
-
"entitlementId": "str", # The unique entitlement ULID that the grant
|
|
2552
|
-
is associated with. Required.
|
|
2553
|
-
"expiration": {
|
|
2554
|
-
"count": 0, # The expiration period count like 12 months.
|
|
2555
|
-
Required.
|
|
2556
|
-
"duration": "str" # The expiration period duration like
|
|
2557
|
-
month. Required. Known values are: "HOUR", "DAY", "WEEK", "MONTH", and
|
|
2558
|
-
"YEAR".
|
|
2559
|
-
},
|
|
2560
|
-
"id": "str", # Readonly unique ULID identifier. Required.
|
|
2561
|
-
"updatedAt": "2020-02-20 00:00:00", # The date and time the resource
|
|
2562
|
-
was last updated. The initial value is the same as createdAt. Required.
|
|
2563
|
-
"deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
|
|
2564
|
-
the resource was deleted.
|
|
2565
|
-
"expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date
|
|
2566
|
-
of the grant.
|
|
2567
|
-
"maxRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
2568
|
-
rolled over at reset, after which they can have a different balance compared
|
|
2569
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
2570
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
2571
|
-
MinRolloverAmount)).
|
|
2572
|
-
"metadata": {
|
|
2573
|
-
"str": "str" # Optional. Dictionary of :code:`<string>`.
|
|
2574
|
-
},
|
|
2575
|
-
"minRolloverAmount": 0, # Optional. Default value is 0. Grants are
|
|
2576
|
-
rolled over at reset, after which they can have a different balance compared
|
|
2577
|
-
to what they had before the reset. Balance after the reset is calculated as:
|
|
2578
|
-
Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset,
|
|
2579
|
-
MinRolloverAmount)).
|
|
2580
|
-
"nextRecurrence": "2020-02-20 00:00:00", # Optional. The next time
|
|
2581
|
-
the grant will recurr.
|
|
2582
|
-
"priority": 1, # Optional. Default value is 1. The priority of the
|
|
2583
|
-
grant. Grants with higher priority are applied first. Priority is a positive
|
|
2584
|
-
decimal numbers. With lower numbers indicating higher importance. For
|
|
2585
|
-
example, a priority of 1 is more urgent than a priority of 2. When there are
|
|
2586
|
-
several grants available for the same subject, the system selects the grant
|
|
2587
|
-
with the highest priority. In cases where grants share the same priority
|
|
2588
|
-
level, the grant closest to its expiration will be used first. In the case of
|
|
2589
|
-
two grants have identical priorities and expiration dates, the system will
|
|
2590
|
-
use the grant that was created first.
|
|
2591
|
-
"recurrence": {
|
|
2592
|
-
"anchor": "2020-02-20 00:00:00", # An arbitrary anchor to
|
|
2593
|
-
base the recurring period on. Required.
|
|
2594
|
-
"interval": "str" # List of pre-defined periods that can be
|
|
2595
|
-
used for recurring & scheduling. DAY: Every day WEEK: Every
|
|
2596
|
-
week MONTH: Every month YEAR: Every year. Required. Known values
|
|
2597
|
-
are: "DAY", "WEEK", "MONTH", and "YEAR".
|
|
2598
|
-
},
|
|
2599
|
-
"voidedAt": "2020-02-20 00:00:00" # Optional. The date and time the
|
|
2600
|
-
grant was voided (cannot be used after that).
|
|
2601
|
-
}
|
|
2602
|
-
]
|
|
2603
2525
|
"""
|
|
2604
2526
|
error_map = {
|
|
2605
2527
|
404: ResourceNotFoundError,
|
|
@@ -2612,11 +2534,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2612
2534
|
_headers = kwargs.pop("headers", {}) or {}
|
|
2613
2535
|
_params = kwargs.pop("params", {}) or {}
|
|
2614
2536
|
|
|
2615
|
-
cls: ClsType[
|
|
2537
|
+
cls: ClsType[Any] = kwargs.pop("cls", None)
|
|
2616
2538
|
|
|
2617
2539
|
_request = build_list_grants_request(
|
|
2540
|
+
page=page,
|
|
2541
|
+
page_size=page_size,
|
|
2618
2542
|
limit=limit,
|
|
2619
2543
|
offset=offset,
|
|
2544
|
+
order=order,
|
|
2620
2545
|
order_by=order_by,
|
|
2621
2546
|
include_deleted=include_deleted,
|
|
2622
2547
|
headers=_headers,
|
|
@@ -2643,9 +2568,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
|
|
|
2643
2568
|
deserialized = None
|
|
2644
2569
|
|
|
2645
2570
|
if cls:
|
|
2646
|
-
return cls(pipeline_response, cast(
|
|
2571
|
+
return cls(pipeline_response, cast(Any, deserialized), {}) # type: ignore
|
|
2647
2572
|
|
|
2648
|
-
return cast(
|
|
2573
|
+
return cast(Any, deserialized) # type: ignore
|
|
2649
2574
|
|
|
2650
2575
|
@distributed_trace_async
|
|
2651
2576
|
async def void_grant(self, grant_id: str, **kwargs: Any) -> Optional[JSON]:
|
|
@@ -2,7 +2,7 @@ openmeter/__init__.py,sha256=7klRT7LAGDqBcZsl7LGZrgrABVwyncgVUlidfaPiJm4,702
|
|
|
2
2
|
openmeter/_client.py,sha256=TIXIPi_UVO-d5BHra7_xIiKmLfZBrmc4L_Xq2gxi4lM,3982
|
|
3
3
|
openmeter/_configuration.py,sha256=CIdMxPaIXwDLaCsnvmdmHTfplV_cRp24101RJCEWtes,1807
|
|
4
4
|
openmeter/_operations/__init__.py,sha256=GVYObnS1nT-wbN8ONRxlAiH6NBeAXlOBi7olGJE9niA,682
|
|
5
|
-
openmeter/_operations/_operations.py,sha256=
|
|
5
|
+
openmeter/_operations/_operations.py,sha256=DsbYC_Htg0vGy_FzpEJAHp8Iedk8Hc_Wj6rYeVHdY-g,270306
|
|
6
6
|
openmeter/_operations/_patch.py,sha256=ptSL-JhY1fbGT9Cw2cUkPF1TPz5qVgXwTMMT5h41XUc,4874
|
|
7
7
|
openmeter/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
|
|
8
8
|
openmeter/_serialization.py,sha256=vQIv-wuCQabtiIq2DXOr7-InGADqxlXTGNEKv9OlDPs,78873
|
|
@@ -11,11 +11,11 @@ openmeter/aio/__init__.py,sha256=7klRT7LAGDqBcZsl7LGZrgrABVwyncgVUlidfaPiJm4,702
|
|
|
11
11
|
openmeter/aio/_client.py,sha256=O0VpMfw42UuTN_ZTIL3dw944PviLIrBBCSp7UaexyKQ,4100
|
|
12
12
|
openmeter/aio/_configuration.py,sha256=NtT-cxQWkt8q_FvMfwqqil18Tt9zJmWGVju4U9s7OsE,1817
|
|
13
13
|
openmeter/aio/_operations/__init__.py,sha256=GVYObnS1nT-wbN8ONRxlAiH6NBeAXlOBi7olGJE9niA,682
|
|
14
|
-
openmeter/aio/_operations/_operations.py,sha256=
|
|
14
|
+
openmeter/aio/_operations/_operations.py,sha256=g7Ee_FcWPMvfQ6oyglHXDXNV71XEVxwhs2aXYD6Nixo,233797
|
|
15
15
|
openmeter/aio/_operations/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
|
|
16
16
|
openmeter/aio/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
|
|
17
17
|
openmeter/aio/_vendor.py,sha256=CFsSbXOBydpg_f_uciu6Pe6cvF__6ofZ6KFEhkaMMEU,862
|
|
18
18
|
openmeter/py.typed,sha256=dcrsqJrcYfTX-ckLFJMTaj6mD8aDe2u0tkQG-ZYxnEg,26
|
|
19
|
-
openmeter-1.0.
|
|
20
|
-
openmeter-1.0.
|
|
21
|
-
openmeter-1.0.
|
|
19
|
+
openmeter-1.0.0b123.dist-info/METADATA,sha256=JM9HkJFxRjiCVD-IpOecYqfgk9S-4o-k8ZQgZtU2P_E,2258
|
|
20
|
+
openmeter-1.0.0b123.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
21
|
+
openmeter-1.0.0b123.dist-info/RECORD,,
|
|
File without changes
|