openmeter 1.0.0b113__py3-none-any.whl → 1.0.0b115__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.

@@ -1896,7 +1896,8 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
1896
1896
  ) -> List[JSON]:
1897
1897
  """List entitlements.
1898
1898
 
1899
- List entitlements.
1899
+ List all entitlements regardless of subject. This endpoint is intended for administrative
1900
+ purposes.
1900
1901
 
1901
1902
  :keyword limit: Number of entries to return. Default value is 1000.
1902
1903
  :paramtype limit: int
@@ -1921,6 +1922,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
1921
1922
  404: ResourceNotFoundError,
1922
1923
  409: ResourceExistsError,
1923
1924
  304: ResourceNotModifiedError,
1925
+ 400: HttpResponseError,
1924
1926
  401: lambda response: ClientAuthenticationError(response=response),
1925
1927
  }
1926
1928
  error_map.update(kwargs.pop("error_map", {}) or {})
@@ -1964,19 +1966,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
1964
1966
 
1965
1967
  @distributed_trace_async
1966
1968
  async def list_features(
1967
- self, *, limit: int = 1000, offset: int = 0, order_by: str = "id", include_archived: bool = False, **kwargs: Any
1969
+ self,
1970
+ *,
1971
+ limit: int = 1000,
1972
+ offset: int = 0,
1973
+ order_by: str = "updatedAt",
1974
+ include_archived: bool = False,
1975
+ **kwargs: Any
1968
1976
  ) -> List[JSON]:
1969
1977
  # pylint: disable=line-too-long
1970
1978
  """List features.
1971
1979
 
1972
- List features.
1980
+ List all features.
1973
1981
 
1974
1982
  :keyword limit: Number of entries to return. Default value is 1000.
1975
1983
  :paramtype limit: int
1976
1984
  :keyword offset: Number of entries to skip. Default value is 0.
1977
1985
  :paramtype offset: int
1978
1986
  :keyword order_by: Order by field. Known values are: "id", "createdAt", and "updatedAt".
1979
- Default value is "id".
1987
+ Default value is "updatedAt".
1980
1988
  :paramtype order_by: str
1981
1989
  :keyword include_archived: Include archived features. Default value is False.
1982
1990
  :paramtype include_archived: bool
@@ -1993,26 +2001,32 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
1993
2001
  "createdAt": "2020-02-20 00:00:00", # The date and time the resource
1994
2002
  was created. Required.
1995
2003
  "id": "str", # Readonly unique ULID identifier. Required.
1996
- "key": "str", # The unique key of the feature to reference it from
1997
- your application. Required.
2004
+ "key": "str", # The key is an immutable unique identifier of the
2005
+ feature used throughout the API, for example when interacting with a
2006
+ subject's entitlements. The key has to be unique across all active features,
2007
+ but archived features can share the same key. The key should consist of
2008
+ lowercase alphanumeric characters and dashes. Required.
1998
2009
  "name": "str", # The name of the feature. Required.
1999
2010
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource
2000
- was last updated. Defaults to createdAt if not updated. Required.
2011
+ was last updated. The initial value is the same as createdAt. Required.
2001
2012
  "archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is
2002
- archived, it will not be used for grants or usage.
2013
+ archived, no new entitlements can be created for it.
2003
2014
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
2004
- the resource was deleted. Null if not deleted.
2015
+ the resource was deleted.
2005
2016
  "metadata": {
2006
2017
  "str": "str" # Optional. Additional metadata for the
2007
- feature.
2018
+ feature, useful for syncing with external systems and annotating custom
2019
+ fields.
2008
2020
  },
2009
2021
  "meterGroupByFilters": {
2010
2022
  "str": "str" # Optional. Optional meter group by filters.
2011
- Useful if the meter scope is broader than what feature tracks.
2023
+ Useful if the meter scope is broader than what feature tracks. Example
2024
+ scenario would be a meter tracking all token use with groupBy fields for
2025
+ the model, then the feature could filter for model=gpt-4.
2012
2026
  },
2013
2027
  "meterSlug": "str" # Optional. The meter that the feature is
2014
- associated with and decreases grants by usage. If present, the usage of the
2015
- feature can be metered.
2028
+ associated with and and based on which usage is calculated. The meter
2029
+ selected must have SUM or COUNT aggregation.
2016
2030
  }
2017
2031
  ]
2018
2032
  """
@@ -2020,6 +2034,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2020
2034
  404: ResourceNotFoundError,
2021
2035
  409: ResourceExistsError,
2022
2036
  304: ResourceNotModifiedError,
2037
+ 400: HttpResponseError,
2023
2038
  401: lambda response: ClientAuthenticationError(response=response),
2024
2039
  }
2025
2040
  error_map.update(kwargs.pop("error_map", {}) or {})
@@ -2065,9 +2080,15 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2065
2080
  @overload
2066
2081
  async def create_feature(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
2067
2082
  # pylint: disable=line-too-long
2068
- """Create feature.
2083
+ """Create a feature.
2069
2084
 
2070
- Creates a feature.
2085
+ Features are either metered or static. A feature is metered if meterSlug is provided at
2086
+ creation.
2087
+ For metered features you can pass additional filters that will be applied when calculating
2088
+ feature usage, based on the meter's groupBy fields. Only meters with SUM and COUNT aggregation
2089
+ are supported for features.
2090
+
2091
+ Features cannot be updated later, only archived.
2071
2092
 
2072
2093
  :param body: The feature to create. Required.
2073
2094
  :type body: JSON
@@ -2083,19 +2104,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2083
2104
 
2084
2105
  # JSON input template you can fill out and use as your body input.
2085
2106
  body = {
2086
- "key": "str", # The unique key of the feature to reference it from your
2087
- application. Required.
2107
+ "key": "str", # The key is an immutable unique identifier of the feature
2108
+ used throughout the API, for example when interacting with a subject's
2109
+ entitlements. The key has to be unique across all active features, but archived
2110
+ features can share the same key. The key should consist of lowercase alphanumeric
2111
+ characters and dashes. Required.
2088
2112
  "name": "str", # The name of the feature. Required.
2089
2113
  "metadata": {
2090
- "str": "str" # Optional. Additional metadata for the feature.
2114
+ "str": "str" # Optional. Additional metadata for the feature, useful
2115
+ for syncing with external systems and annotating custom fields.
2091
2116
  },
2092
2117
  "meterGroupByFilters": {
2093
2118
  "str": "str" # Optional. Optional meter group by filters. Useful if
2094
- the meter scope is broader than what feature tracks.
2119
+ the meter scope is broader than what feature tracks. Example scenario would
2120
+ be a meter tracking all token use with groupBy fields for the model, then the
2121
+ feature could filter for model=gpt-4.
2095
2122
  },
2096
2123
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2097
- and decreases grants by usage. If present, the usage of the feature can be
2098
- metered.
2124
+ and and based on which usage is calculated. The meter selected must have SUM or
2125
+ COUNT aggregation.
2099
2126
  }
2100
2127
 
2101
2128
  # response body for status code(s): 201
@@ -2103,34 +2130,46 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2103
2130
  "createdAt": "2020-02-20 00:00:00", # The date and time the resource was
2104
2131
  created. Required.
2105
2132
  "id": "str", # Readonly unique ULID identifier. Required.
2106
- "key": "str", # The unique key of the feature to reference it from your
2107
- application. Required.
2133
+ "key": "str", # The key is an immutable unique identifier of the feature
2134
+ used throughout the API, for example when interacting with a subject's
2135
+ entitlements. The key has to be unique across all active features, but archived
2136
+ features can share the same key. The key should consist of lowercase alphanumeric
2137
+ characters and dashes. Required.
2108
2138
  "name": "str", # The name of the feature. Required.
2109
2139
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
2110
- last updated. Defaults to createdAt if not updated. Required.
2140
+ last updated. The initial value is the same as createdAt. Required.
2111
2141
  "archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is archived,
2112
- it will not be used for grants or usage.
2142
+ no new entitlements can be created for it.
2113
2143
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
2114
- resource was deleted. Null if not deleted.
2144
+ resource was deleted.
2115
2145
  "metadata": {
2116
- "str": "str" # Optional. Additional metadata for the feature.
2146
+ "str": "str" # Optional. Additional metadata for the feature, useful
2147
+ for syncing with external systems and annotating custom fields.
2117
2148
  },
2118
2149
  "meterGroupByFilters": {
2119
2150
  "str": "str" # Optional. Optional meter group by filters. Useful if
2120
- the meter scope is broader than what feature tracks.
2151
+ the meter scope is broader than what feature tracks. Example scenario would
2152
+ be a meter tracking all token use with groupBy fields for the model, then the
2153
+ feature could filter for model=gpt-4.
2121
2154
  },
2122
2155
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2123
- and decreases grants by usage. If present, the usage of the feature can be
2124
- metered.
2156
+ and and based on which usage is calculated. The meter selected must have SUM or
2157
+ COUNT aggregation.
2125
2158
  }
2126
2159
  """
2127
2160
 
2128
2161
  @overload
2129
2162
  async def create_feature(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> JSON:
2130
2163
  # pylint: disable=line-too-long
2131
- """Create feature.
2164
+ """Create a feature.
2165
+
2166
+ Features are either metered or static. A feature is metered if meterSlug is provided at
2167
+ creation.
2168
+ For metered features you can pass additional filters that will be applied when calculating
2169
+ feature usage, based on the meter's groupBy fields. Only meters with SUM and COUNT aggregation
2170
+ are supported for features.
2132
2171
 
2133
- Creates a feature.
2172
+ Features cannot be updated later, only archived.
2134
2173
 
2135
2174
  :param body: The feature to create. Required.
2136
2175
  :type body: IO[bytes]
@@ -2149,34 +2188,46 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2149
2188
  "createdAt": "2020-02-20 00:00:00", # The date and time the resource was
2150
2189
  created. Required.
2151
2190
  "id": "str", # Readonly unique ULID identifier. Required.
2152
- "key": "str", # The unique key of the feature to reference it from your
2153
- application. Required.
2191
+ "key": "str", # The key is an immutable unique identifier of the feature
2192
+ used throughout the API, for example when interacting with a subject's
2193
+ entitlements. The key has to be unique across all active features, but archived
2194
+ features can share the same key. The key should consist of lowercase alphanumeric
2195
+ characters and dashes. Required.
2154
2196
  "name": "str", # The name of the feature. Required.
2155
2197
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
2156
- last updated. Defaults to createdAt if not updated. Required.
2198
+ last updated. The initial value is the same as createdAt. Required.
2157
2199
  "archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is archived,
2158
- it will not be used for grants or usage.
2200
+ no new entitlements can be created for it.
2159
2201
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
2160
- resource was deleted. Null if not deleted.
2202
+ resource was deleted.
2161
2203
  "metadata": {
2162
- "str": "str" # Optional. Additional metadata for the feature.
2204
+ "str": "str" # Optional. Additional metadata for the feature, useful
2205
+ for syncing with external systems and annotating custom fields.
2163
2206
  },
2164
2207
  "meterGroupByFilters": {
2165
2208
  "str": "str" # Optional. Optional meter group by filters. Useful if
2166
- the meter scope is broader than what feature tracks.
2209
+ the meter scope is broader than what feature tracks. Example scenario would
2210
+ be a meter tracking all token use with groupBy fields for the model, then the
2211
+ feature could filter for model=gpt-4.
2167
2212
  },
2168
2213
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2169
- and decreases grants by usage. If present, the usage of the feature can be
2170
- metered.
2214
+ and and based on which usage is calculated. The meter selected must have SUM or
2215
+ COUNT aggregation.
2171
2216
  }
2172
2217
  """
2173
2218
 
2174
2219
  @distributed_trace_async
2175
2220
  async def create_feature(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
2176
2221
  # pylint: disable=line-too-long
2177
- """Create feature.
2222
+ """Create a feature.
2223
+
2224
+ Features are either metered or static. A feature is metered if meterSlug is provided at
2225
+ creation.
2226
+ For metered features you can pass additional filters that will be applied when calculating
2227
+ feature usage, based on the meter's groupBy fields. Only meters with SUM and COUNT aggregation
2228
+ are supported for features.
2178
2229
 
2179
- Creates a feature.
2230
+ Features cannot be updated later, only archived.
2180
2231
 
2181
2232
  :param body: The feature to create. Is either a JSON type or a IO[bytes] type. Required.
2182
2233
  :type body: JSON or IO[bytes]
@@ -2189,19 +2240,25 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2189
2240
 
2190
2241
  # JSON input template you can fill out and use as your body input.
2191
2242
  body = {
2192
- "key": "str", # The unique key of the feature to reference it from your
2193
- application. Required.
2243
+ "key": "str", # The key is an immutable unique identifier of the feature
2244
+ used throughout the API, for example when interacting with a subject's
2245
+ entitlements. The key has to be unique across all active features, but archived
2246
+ features can share the same key. The key should consist of lowercase alphanumeric
2247
+ characters and dashes. Required.
2194
2248
  "name": "str", # The name of the feature. Required.
2195
2249
  "metadata": {
2196
- "str": "str" # Optional. Additional metadata for the feature.
2250
+ "str": "str" # Optional. Additional metadata for the feature, useful
2251
+ for syncing with external systems and annotating custom fields.
2197
2252
  },
2198
2253
  "meterGroupByFilters": {
2199
2254
  "str": "str" # Optional. Optional meter group by filters. Useful if
2200
- the meter scope is broader than what feature tracks.
2255
+ the meter scope is broader than what feature tracks. Example scenario would
2256
+ be a meter tracking all token use with groupBy fields for the model, then the
2257
+ feature could filter for model=gpt-4.
2201
2258
  },
2202
2259
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2203
- and decreases grants by usage. If present, the usage of the feature can be
2204
- metered.
2260
+ and and based on which usage is calculated. The meter selected must have SUM or
2261
+ COUNT aggregation.
2205
2262
  }
2206
2263
 
2207
2264
  # response body for status code(s): 201
@@ -2209,25 +2266,31 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2209
2266
  "createdAt": "2020-02-20 00:00:00", # The date and time the resource was
2210
2267
  created. Required.
2211
2268
  "id": "str", # Readonly unique ULID identifier. Required.
2212
- "key": "str", # The unique key of the feature to reference it from your
2213
- application. Required.
2269
+ "key": "str", # The key is an immutable unique identifier of the feature
2270
+ used throughout the API, for example when interacting with a subject's
2271
+ entitlements. The key has to be unique across all active features, but archived
2272
+ features can share the same key. The key should consist of lowercase alphanumeric
2273
+ characters and dashes. Required.
2214
2274
  "name": "str", # The name of the feature. Required.
2215
2275
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
2216
- last updated. Defaults to createdAt if not updated. Required.
2276
+ last updated. The initial value is the same as createdAt. Required.
2217
2277
  "archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is archived,
2218
- it will not be used for grants or usage.
2278
+ no new entitlements can be created for it.
2219
2279
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
2220
- resource was deleted. Null if not deleted.
2280
+ resource was deleted.
2221
2281
  "metadata": {
2222
- "str": "str" # Optional. Additional metadata for the feature.
2282
+ "str": "str" # Optional. Additional metadata for the feature, useful
2283
+ for syncing with external systems and annotating custom fields.
2223
2284
  },
2224
2285
  "meterGroupByFilters": {
2225
2286
  "str": "str" # Optional. Optional meter group by filters. Useful if
2226
- the meter scope is broader than what feature tracks.
2287
+ the meter scope is broader than what feature tracks. Example scenario would
2288
+ be a meter tracking all token use with groupBy fields for the model, then the
2289
+ feature could filter for model=gpt-4.
2227
2290
  },
2228
2291
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2229
- and decreases grants by usage. If present, the usage of the feature can be
2230
- metered.
2292
+ and and based on which usage is calculated. The meter selected must have SUM or
2293
+ COUNT aggregation.
2231
2294
  }
2232
2295
  """
2233
2296
  error_map = {
@@ -2291,7 +2354,7 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2291
2354
  # pylint: disable=line-too-long
2292
2355
  """Get feature.
2293
2356
 
2294
- Get feature by id.
2357
+ Get a feature by id.
2295
2358
 
2296
2359
  :param feature_id: A unique ULID identifier for a feature. Required.
2297
2360
  :type feature_id: str
@@ -2307,25 +2370,31 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2307
2370
  "createdAt": "2020-02-20 00:00:00", # The date and time the resource was
2308
2371
  created. Required.
2309
2372
  "id": "str", # Readonly unique ULID identifier. Required.
2310
- "key": "str", # The unique key of the feature to reference it from your
2311
- application. Required.
2373
+ "key": "str", # The key is an immutable unique identifier of the feature
2374
+ used throughout the API, for example when interacting with a subject's
2375
+ entitlements. The key has to be unique across all active features, but archived
2376
+ features can share the same key. The key should consist of lowercase alphanumeric
2377
+ characters and dashes. Required.
2312
2378
  "name": "str", # The name of the feature. Required.
2313
2379
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
2314
- last updated. Defaults to createdAt if not updated. Required.
2380
+ last updated. The initial value is the same as createdAt. Required.
2315
2381
  "archivedAt": "2020-02-20 00:00:00", # Optional. If the feature is archived,
2316
- it will not be used for grants or usage.
2382
+ no new entitlements can be created for it.
2317
2383
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
2318
- resource was deleted. Null if not deleted.
2384
+ resource was deleted.
2319
2385
  "metadata": {
2320
- "str": "str" # Optional. Additional metadata for the feature.
2386
+ "str": "str" # Optional. Additional metadata for the feature, useful
2387
+ for syncing with external systems and annotating custom fields.
2321
2388
  },
2322
2389
  "meterGroupByFilters": {
2323
2390
  "str": "str" # Optional. Optional meter group by filters. Useful if
2324
- the meter scope is broader than what feature tracks.
2391
+ the meter scope is broader than what feature tracks. Example scenario would
2392
+ be a meter tracking all token use with groupBy fields for the model, then the
2393
+ feature could filter for model=gpt-4.
2325
2394
  },
2326
2395
  "meterSlug": "str" # Optional. The meter that the feature is associated with
2327
- and decreases grants by usage. If present, the usage of the feature can be
2328
- metered.
2396
+ and and based on which usage is calculated. The meter selected must have SUM or
2397
+ COUNT aggregation.
2329
2398
  }
2330
2399
  """
2331
2400
  error_map = {
@@ -2375,9 +2444,12 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2375
2444
  async def delete_feature( # pylint: disable=inconsistent-return-statements
2376
2445
  self, feature_id: str, **kwargs: Any
2377
2446
  ) -> None:
2378
- """Delete feature.
2447
+ """Archive a feature.
2379
2448
 
2380
- Delete a feature by key.
2449
+ Once a feature is archived it cannot be unarchived. If a feature is archived, new entitlements
2450
+ cannot be created for it, but archiving the feature does not affect existing entitlements. This
2451
+ means, if you want to create a new feature with the same key, and then create entitlements for
2452
+ it, the previous entitlements have to be deleted first on a per subject basis.
2381
2453
 
2382
2454
  :param feature_id: A unique ULID identifier for a feature. Required.
2383
2455
  :type feature_id: str
@@ -2434,7 +2506,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2434
2506
  # pylint: disable=line-too-long
2435
2507
  """List grants.
2436
2508
 
2437
- List all grants.
2509
+ List all grants for all the subjects and entitlements. This endpoint is intended for
2510
+ administrative purposes only. To fetch the grants of a specific entitlement please use the
2511
+ /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
2438
2512
 
2439
2513
  :keyword limit: Number of entries to return. Default value is 1000.
2440
2514
  :paramtype limit: int
@@ -2473,9 +2547,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2473
2547
  },
2474
2548
  "id": "str", # Readonly unique ULID identifier. Required.
2475
2549
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource
2476
- was last updated. Defaults to createdAt if not updated. Required.
2550
+ was last updated. The initial value is the same as createdAt. Required.
2477
2551
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
2478
- the resource was deleted. Null if not deleted.
2552
+ the resource was deleted.
2479
2553
  "expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date
2480
2554
  of the grant.
2481
2555
  "maxRolloverAmount": 0, # Optional. Default value is 0. Grants are
@@ -2563,9 +2637,17 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2563
2637
 
2564
2638
  @distributed_trace_async
2565
2639
  async def void_grant(self, grant_id: str, **kwargs: Any) -> Optional[JSON]:
2566
- """Delete a grant.
2640
+ """Void a grant.
2567
2641
 
2568
- Void (delete) a grant. A grant can only be deleted if it hasn't been used.
2642
+ Voiding a grant means it is no longer valid, it doesn't take part in further balance
2643
+ calculations. Voiding a grant does not retroactively take effect, meaning any usage that has
2644
+ already been attributed to the grant will remain, but future usage cannot be burnt down from
2645
+ the grant.
2646
+
2647
+ For example, if you have a single grant for your metered entitlement with an initial amount of
2648
+ 100, and so far 60 usage has been metered, the grant (and the entitlement itself) would have a
2649
+ balance of 40. If you then void that grant, balance becomes 0, but the 60 previous usage will
2650
+ not be affected.
2569
2651
 
2570
2652
  :param grant_id: A unique identifier for a grant. Required.
2571
2653
  :type grant_id: str
@@ -2644,9 +2726,26 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2644
2726
  async def create_entitlement(
2645
2727
  self, subject_id_or_key: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
2646
2728
  ) -> JSON:
2647
- """Create entitlement.
2729
+ """Create an entitlement.
2730
+
2731
+ OpenMeter has three types of entitlements: metered, boolean, and static. The type property
2732
+ determines the type of entitlement. The underlying feature has to be compatible with the
2733
+ entitlement type specified in the request (e.g., a metered entitlement needs a feature
2734
+ associated with a meter).
2735
+
2648
2736
 
2649
- Create an entitlement for a subject.
2737
+ * Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
2738
+ * Static entitlements let you pass along a configuration while granting access, e.g. "Using
2739
+ this feature with X Y settings" (passed in the config).
2740
+ * Metered entitlements have many use cases, from setting up usage-based access to implementing
2741
+ complex credit systems. Example: The customer can use 10000 AI tokens during the usage period
2742
+ of the entitlement.
2743
+
2744
+ A given subject can only have one active (non-deleted) entitlement per featureKey. If you try
2745
+ to create a new entitlement for a featureKey that already has an active entitlement, the
2746
+ request will fail with a 409 error.
2747
+
2748
+ Once an entitlement is created you cannot modify it, only delete it.
2650
2749
 
2651
2750
  :param subject_id_or_key: A unique identifier for a subject. Required.
2652
2751
  :type subject_id_or_key: str
@@ -2688,9 +2787,26 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2688
2787
  async def create_entitlement(
2689
2788
  self, subject_id_or_key: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
2690
2789
  ) -> JSON:
2691
- """Create entitlement.
2790
+ """Create an entitlement.
2791
+
2792
+ OpenMeter has three types of entitlements: metered, boolean, and static. The type property
2793
+ determines the type of entitlement. The underlying feature has to be compatible with the
2794
+ entitlement type specified in the request (e.g., a metered entitlement needs a feature
2795
+ associated with a meter).
2692
2796
 
2693
- Create an entitlement for a subject.
2797
+
2798
+ * Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
2799
+ * Static entitlements let you pass along a configuration while granting access, e.g. "Using
2800
+ this feature with X Y settings" (passed in the config).
2801
+ * Metered entitlements have many use cases, from setting up usage-based access to implementing
2802
+ complex credit systems. Example: The customer can use 10000 AI tokens during the usage period
2803
+ of the entitlement.
2804
+
2805
+ A given subject can only have one active (non-deleted) entitlement per featureKey. If you try
2806
+ to create a new entitlement for a featureKey that already has an active entitlement, the
2807
+ request will fail with a 409 error.
2808
+
2809
+ Once an entitlement is created you cannot modify it, only delete it.
2694
2810
 
2695
2811
  :param subject_id_or_key: A unique identifier for a subject. Required.
2696
2812
  :type subject_id_or_key: str
@@ -2727,9 +2843,26 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2727
2843
 
2728
2844
  @distributed_trace_async
2729
2845
  async def create_entitlement(self, subject_id_or_key: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
2730
- """Create entitlement.
2846
+ """Create an entitlement.
2847
+
2848
+ OpenMeter has three types of entitlements: metered, boolean, and static. The type property
2849
+ determines the type of entitlement. The underlying feature has to be compatible with the
2850
+ entitlement type specified in the request (e.g., a metered entitlement needs a feature
2851
+ associated with a meter).
2852
+
2853
+
2854
+ * Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
2855
+ * Static entitlements let you pass along a configuration while granting access, e.g. "Using
2856
+ this feature with X Y settings" (passed in the config).
2857
+ * Metered entitlements have many use cases, from setting up usage-based access to implementing
2858
+ complex credit systems. Example: The customer can use 10000 AI tokens during the usage period
2859
+ of the entitlement.
2731
2860
 
2732
- Create an entitlement for a subject.
2861
+ A given subject can only have one active (non-deleted) entitlement per featureKey. If you try
2862
+ to create a new entitlement for a featureKey that already has an active entitlement, the
2863
+ request will fail with a 409 error.
2864
+
2865
+ Once an entitlement is created you cannot modify it, only delete it.
2733
2866
 
2734
2867
  :param subject_id_or_key: A unique identifier for a subject. Required.
2735
2868
  :type subject_id_or_key: str
@@ -2831,9 +2964,10 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2831
2964
  async def list_subject_entitlements(
2832
2965
  self, subject_id_or_key: str, *, include_deleted: bool = False, **kwargs: Any
2833
2966
  ) -> List[JSON]:
2834
- """List entitlements.
2967
+ """List entitlements of a subject.
2835
2968
 
2836
- List all entitlements for a subject.
2969
+ List all entitlements for a subject. For checking entitlement access, use the /value endpoint
2970
+ instead.
2837
2971
 
2838
2972
  :param subject_id_or_key: A unique identifier for a subject. Required.
2839
2973
  :type subject_id_or_key: str
@@ -2897,9 +3031,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2897
3031
 
2898
3032
  @distributed_trace_async
2899
3033
  async def get_entitlement(self, subject_id_or_key: str, entitlement_id: str, **kwargs: Any) -> JSON:
2900
- """Get entitlement.
3034
+ """Get an entitlement.
2901
3035
 
2902
- Get entitlement by id.
3036
+ Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
2903
3037
 
2904
3038
  :param subject_id_or_key: A unique identifier for a subject. Required.
2905
3039
  :type subject_id_or_key: str
@@ -2966,9 +3100,15 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2966
3100
  async def delete_entitlement( # pylint: disable=inconsistent-return-statements
2967
3101
  self, subject_id_or_key: str, entitlement_id: str, **kwargs: Any
2968
3102
  ) -> None:
2969
- """Delete entitlement.
3103
+ """Delete an entitlement.
2970
3104
 
2971
- Delete an entitlement by id.
3105
+ Deleting an entitlement revokes access to the associated feature. As a single subject can only
3106
+ have one entitlement per featureKey, when "migrating" features you have to delete the old
3107
+ entitlements as well.
3108
+ As access and status checks can be historical queries, deleting an entitlement populates the
3109
+ deletedAt timestamp. When queried for a time before that, the entitlement is still considered
3110
+ active, you cannot have retroactive changes to access, which is important for, among other
3111
+ things, auditing.
2972
3112
 
2973
3113
  :param subject_id_or_key: A unique identifier for a subject. Required.
2974
3114
  :type subject_id_or_key: str
@@ -3028,7 +3168,8 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3028
3168
  # pylint: disable=line-too-long
3029
3169
  """List grants for an entitlement.
3030
3170
 
3031
- List all grants for an entitlement.
3171
+ List all grants issued for an entitlement. This endpoint is intended for administrative
3172
+ purposes.
3032
3173
 
3033
3174
  :param subject_id_or_key: A unique identifier for a subject. Required.
3034
3175
  :type subject_id_or_key: str
@@ -3067,9 +3208,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3067
3208
  },
3068
3209
  "id": "str", # Readonly unique ULID identifier. Required.
3069
3210
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource
3070
- was last updated. Defaults to createdAt if not updated. Required.
3211
+ was last updated. The initial value is the same as createdAt. Required.
3071
3212
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time
3072
- the resource was deleted. Null if not deleted.
3213
+ the resource was deleted.
3073
3214
  "expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date
3074
3215
  of the grant.
3075
3216
  "maxRolloverAmount": 0, # Optional. Default value is 0. Grants are
@@ -3166,9 +3307,29 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3166
3307
  **kwargs: Any
3167
3308
  ) -> JSON:
3168
3309
  # pylint: disable=line-too-long
3169
- """Create grant.
3310
+ """Create a grant.
3311
+
3312
+ Grants define a behavior of granting usage for a metered entitlement. They can have complicated
3313
+ recurrence and rollover rules, thanks to which you can define a wide range of access patterns
3314
+ with a single grant, in most cases you don't have to periodically create new grants. You can
3315
+ only issue grants for active metered entitlements.
3316
+
3317
+ A grant defines a given amount of usage that can be consumed for the entitlement. The grant is
3318
+ in effect between its effective date and its expiration date. Specifying both is mandatory for
3319
+ new grants.
3320
+
3321
+ Grants have a priority setting that determines their order of use. Lower numbers have higher
3322
+ priority, with 0 being the highest priority.
3323
+
3324
+ Grants can have a recurrence setting intended to automate the manual reissuing of grants. For
3325
+ example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover
3326
+ settings).
3170
3327
 
3171
- Create a grant for an entitlement.
3328
+ Rollover settings define what happens to the remaining balance of a grant at a reset.
3329
+ Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
3330
+
3331
+ Grants cannot be changed once created, only deleted. This is to ensure that balance is
3332
+ deterministic regardless of when it is queried.
3172
3333
 
3173
3334
  :param subject_id_or_key: A unique identifier for a subject. Required.
3174
3335
  :type subject_id_or_key: str
@@ -3247,9 +3408,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3247
3408
  },
3248
3409
  "id": "str", # Readonly unique ULID identifier. Required.
3249
3410
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
3250
- last updated. Defaults to createdAt if not updated. Required.
3411
+ last updated. The initial value is the same as createdAt. Required.
3251
3412
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
3252
- resource was deleted. Null if not deleted.
3413
+ resource was deleted.
3253
3414
  "expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date of the
3254
3415
  grant.
3255
3416
  "maxRolloverAmount": 0, # Optional. Default value is 0. Grants are rolled
@@ -3300,9 +3461,29 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3300
3461
  **kwargs: Any
3301
3462
  ) -> JSON:
3302
3463
  # pylint: disable=line-too-long
3303
- """Create grant.
3464
+ """Create a grant.
3465
+
3466
+ Grants define a behavior of granting usage for a metered entitlement. They can have complicated
3467
+ recurrence and rollover rules, thanks to which you can define a wide range of access patterns
3468
+ with a single grant, in most cases you don't have to periodically create new grants. You can
3469
+ only issue grants for active metered entitlements.
3470
+
3471
+ A grant defines a given amount of usage that can be consumed for the entitlement. The grant is
3472
+ in effect between its effective date and its expiration date. Specifying both is mandatory for
3473
+ new grants.
3474
+
3475
+ Grants have a priority setting that determines their order of use. Lower numbers have higher
3476
+ priority, with 0 being the highest priority.
3477
+
3478
+ Grants can have a recurrence setting intended to automate the manual reissuing of grants. For
3479
+ example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover
3480
+ settings).
3481
+
3482
+ Rollover settings define what happens to the remaining balance of a grant at a reset.
3483
+ Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
3304
3484
 
3305
- Create a grant for an entitlement.
3485
+ Grants cannot be changed once created, only deleted. This is to ensure that balance is
3486
+ deterministic regardless of when it is queried.
3306
3487
 
3307
3488
  :param subject_id_or_key: A unique identifier for a subject. Required.
3308
3489
  :type subject_id_or_key: str
@@ -3337,9 +3518,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3337
3518
  },
3338
3519
  "id": "str", # Readonly unique ULID identifier. Required.
3339
3520
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
3340
- last updated. Defaults to createdAt if not updated. Required.
3521
+ last updated. The initial value is the same as createdAt. Required.
3341
3522
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
3342
- resource was deleted. Null if not deleted.
3523
+ resource was deleted.
3343
3524
  "expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date of the
3344
3525
  grant.
3345
3526
  "maxRolloverAmount": 0, # Optional. Default value is 0. Grants are rolled
@@ -3384,9 +3565,29 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3384
3565
  self, subject_id_or_key: str, entitlement_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
3385
3566
  ) -> JSON:
3386
3567
  # pylint: disable=line-too-long
3387
- """Create grant.
3568
+ """Create a grant.
3388
3569
 
3389
- Create a grant for an entitlement.
3570
+ Grants define a behavior of granting usage for a metered entitlement. They can have complicated
3571
+ recurrence and rollover rules, thanks to which you can define a wide range of access patterns
3572
+ with a single grant, in most cases you don't have to periodically create new grants. You can
3573
+ only issue grants for active metered entitlements.
3574
+
3575
+ A grant defines a given amount of usage that can be consumed for the entitlement. The grant is
3576
+ in effect between its effective date and its expiration date. Specifying both is mandatory for
3577
+ new grants.
3578
+
3579
+ Grants have a priority setting that determines their order of use. Lower numbers have higher
3580
+ priority, with 0 being the highest priority.
3581
+
3582
+ Grants can have a recurrence setting intended to automate the manual reissuing of grants. For
3583
+ example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover
3584
+ settings).
3585
+
3586
+ Rollover settings define what happens to the remaining balance of a grant at a reset.
3587
+ Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
3588
+
3589
+ Grants cannot be changed once created, only deleted. This is to ensure that balance is
3590
+ deterministic regardless of when it is queried.
3390
3591
 
3391
3592
  :param subject_id_or_key: A unique identifier for a subject. Required.
3392
3593
  :type subject_id_or_key: str
@@ -3462,9 +3663,9 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3462
3663
  },
3463
3664
  "id": "str", # Readonly unique ULID identifier. Required.
3464
3665
  "updatedAt": "2020-02-20 00:00:00", # The date and time the resource was
3465
- last updated. Defaults to createdAt if not updated. Required.
3666
+ last updated. The initial value is the same as createdAt. Required.
3466
3667
  "deletedAt": "2020-02-20 00:00:00", # Optional. The date and time the
3467
- resource was deleted. Null if not deleted.
3668
+ resource was deleted.
3468
3669
  "expiresAt": "2020-02-20 00:00:00", # Optional. The expiration date of the
3469
3670
  grant.
3470
3671
  "maxRolloverAmount": 0, # Optional. Default value is 0. Grants are rolled
@@ -3570,9 +3771,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3570
3771
  time: Optional[datetime.datetime] = None,
3571
3772
  **kwargs: Any
3572
3773
  ) -> JSON:
3573
- """Get the balance of a specific entitlement.
3774
+ # pylint: disable=line-too-long
3775
+ """Get the current value and access of an entitlement.
3574
3776
 
3575
- Get the balance of a specific entitlement.
3777
+ This endpoint should be used for access checks and enforcement. All entitlement types share the
3778
+ hasAccess property in their value response, but multiple other properties are returned based on
3779
+ the entitlement type.
3780
+
3781
+ For convenience reasons, /value works with both entitlementId and featureKey.
3576
3782
 
3577
3783
  :param subject_id_or_key: A unique identifier for a subject. Required.
3578
3784
  :type subject_id_or_key: str
@@ -3591,14 +3797,20 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3591
3797
 
3592
3798
  # response body for status code(s): 200
3593
3799
  response == {
3594
- "hasAccess": bool, # Whether the subject has access to the feature.
3595
- Required.
3596
- "balance": 0.0, # Optional. The balance of a metered entitlement.
3597
- "config": "str", # Optional. The JSON parseable configuration value of a
3598
- static entitlement.
3599
- "overage": 0.0, # Optional. The overage of a metered entitlement.
3600
- "usage": 0.0 # Optional. Total usage of the feature in the period. Includes
3601
- overages.
3800
+ "hasAccess": bool, # Whether the subject has access to the feature. Shared
3801
+ accross all entitlement types. Required.
3802
+ "balance": 0.0, # Optional. Only available for metered entitlements. Metered
3803
+ entitlements are built around a balance calculation where feature usage is
3804
+ deducted from the issued grants. Balance represents the remaining balance of the
3805
+ entitlement, it's value never turns negative.
3806
+ "config": "str", # Optional. Only available for static entitlements. The
3807
+ JSON parsable config of the entitlement.
3808
+ "overage": 0.0, # Optional. Only available for metered entitlements. Overage
3809
+ represents the usage that wasn't covered by grants, e.g. if the subject had a
3810
+ total feature usage of 100 in the period but they were only granted 80, there
3811
+ would be 20 overage.
3812
+ "usage": 0.0 # Optional. Only available for metered entitlements. Returns
3813
+ the total feature usage in the current period.
3602
3814
  }
3603
3815
  """
3604
3816
  error_map = {
@@ -3662,10 +3874,14 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3662
3874
  # pylint: disable=line-too-long
3663
3875
  """Get the balance history of a specific entitlement.
3664
3876
 
3665
- Get the balance history of a specific entitlement.
3877
+ Returns historical balance and usage data for the entitlement. The queried history can span
3878
+ accross multiple reset events.
3879
+
3880
+ BurndownHistory returns a continous history of segments, where the segments are seperated by
3881
+ events that changed either the grant burndown priority or the usage period.
3666
3882
 
3667
- The windows are inclusive at their start and exclusive at their end.
3668
- The last window may be smaller than the window size and is inclusive at both ends.
3883
+ WindowedHistory returns windowed usage data for the period enriched with balance information
3884
+ and the list of grants that were being burnt down in that window.
3669
3885
 
3670
3886
  :param subject_id_or_key: A unique identifier for a subject. Required.
3671
3887
  :type subject_id_or_key: str
@@ -3807,9 +4023,16 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3807
4023
  **kwargs: Any
3808
4024
  ) -> None:
3809
4025
  # pylint: disable=line-too-long
3810
- """Reset entitlement.
4026
+ """Reset an entitlement.
3811
4027
 
3812
- Reset the entitlement usage and start a new period. Grants that can be are rolled over.
4028
+ Reset marks the start of a new usage period for the entitlement and initiates grant rollover.
4029
+ At the start of a period usage is zerod out and grants are rolled over based on their rollover
4030
+ settings. It would typically be synced with the subjects billing period to enforce usage based
4031
+ on their subscription.
4032
+
4033
+ Usage is automatically reset for metered entitlements based on their usage period, but this
4034
+ endpoint allows to manually reset it at any time. When doing so the period anchor of the
4035
+ entitlement can be changed if needed.
3813
4036
 
3814
4037
  :param subject_id_or_key: A unique identifier for a subject. Required.
3815
4038
  :type subject_id_or_key: str
@@ -3831,10 +4054,12 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3831
4054
  body = {
3832
4055
  "effectiveAt": "2020-02-20 00:00:00", # Optional. The time at which the
3833
4056
  reset takes effect, defaults to now. The reset cannot be in the future. The
3834
- provided value is truncated to the granularity of the underlying meter.
3835
- "retainAnchor": bool # Optional. Should the reset retain the usage period
3836
- anchor. If true, the usage period anchor is retained. If false, the usage period
3837
- anchor is reset to the effectiveAt time.
4057
+ provided value is truncated to the minute due to how historical meter data is
4058
+ stored.
4059
+ "retainAnchor": bool # Optional. Determines whether the usage period anchor
4060
+ is retained or reset to the effectiveAt time. * If true, the usage period
4061
+ anchor is retained. * If false, the usage period anchor is reset to the
4062
+ effectiveAt time.
3838
4063
  }
3839
4064
  """
3840
4065
 
@@ -3848,9 +4073,16 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3848
4073
  content_type: str = "application/json",
3849
4074
  **kwargs: Any
3850
4075
  ) -> None:
3851
- """Reset entitlement.
4076
+ """Reset an entitlement.
4077
+
4078
+ Reset marks the start of a new usage period for the entitlement and initiates grant rollover.
4079
+ At the start of a period usage is zerod out and grants are rolled over based on their rollover
4080
+ settings. It would typically be synced with the subjects billing period to enforce usage based
4081
+ on their subscription.
3852
4082
 
3853
- Reset the entitlement usage and start a new period. Grants that can be are rolled over.
4083
+ Usage is automatically reset for metered entitlements based on their usage period, but this
4084
+ endpoint allows to manually reset it at any time. When doing so the period anchor of the
4085
+ entitlement can be changed if needed.
3854
4086
 
3855
4087
  :param subject_id_or_key: A unique identifier for a subject. Required.
3856
4088
  :type subject_id_or_key: str
@@ -3871,9 +4103,16 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3871
4103
  self, subject_id_or_key: str, entitlement_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
3872
4104
  ) -> None:
3873
4105
  # pylint: disable=line-too-long
3874
- """Reset entitlement.
4106
+ """Reset an entitlement.
4107
+
4108
+ Reset marks the start of a new usage period for the entitlement and initiates grant rollover.
4109
+ At the start of a period usage is zerod out and grants are rolled over based on their rollover
4110
+ settings. It would typically be synced with the subjects billing period to enforce usage based
4111
+ on their subscription.
3875
4112
 
3876
- Reset the entitlement usage and start a new period. Grants that can be are rolled over.
4113
+ Usage is automatically reset for metered entitlements based on their usage period, but this
4114
+ endpoint allows to manually reset it at any time. When doing so the period anchor of the
4115
+ entitlement can be changed if needed.
3877
4116
 
3878
4117
  :param subject_id_or_key: A unique identifier for a subject. Required.
3879
4118
  :type subject_id_or_key: str
@@ -3892,10 +4131,12 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3892
4131
  body = {
3893
4132
  "effectiveAt": "2020-02-20 00:00:00", # Optional. The time at which the
3894
4133
  reset takes effect, defaults to now. The reset cannot be in the future. The
3895
- provided value is truncated to the granularity of the underlying meter.
3896
- "retainAnchor": bool # Optional. Should the reset retain the usage period
3897
- anchor. If true, the usage period anchor is retained. If false, the usage period
3898
- anchor is reset to the effectiveAt time.
4134
+ provided value is truncated to the minute due to how historical meter data is
4135
+ stored.
4136
+ "retainAnchor": bool # Optional. Determines whether the usage period anchor
4137
+ is retained or reset to the effectiveAt time. * If true, the usage period
4138
+ anchor is retained. * If false, the usage period anchor is reset to the
4139
+ effectiveAt time.
3899
4140
  }
3900
4141
  """
3901
4142
  error_map = {