-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathconfiguration.py
More file actions
90 lines (80 loc) · 2.77 KB
/
configuration.py
File metadata and controls
90 lines (80 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
Python SDK for OpenFGA
API version: 1.x
Website: https://openfga.dev
Documentation: https://openfga.dev/docs
Support: https://openfga.dev/community
License: [Apache-2.0](https://github.com/openfga/python-sdk/blob/main/LICENSE)
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
"""
from openfga_sdk.configuration import Configuration
from openfga_sdk.exceptions import FgaValidationException
from openfga_sdk.telemetry.attributes import TelemetryAttribute
from openfga_sdk.telemetry.configuration import (
TelemetryConfigurationType,
TelemetryMetricConfiguration,
TelemetryMetricsConfiguration,
)
from openfga_sdk.telemetry.counters import TelemetryCounter
from openfga_sdk.telemetry.histograms import TelemetryHistogram
from openfga_sdk.validation import is_well_formed_ulid_string
class ClientConfiguration(Configuration):
"""
OpenFGA client configuration
"""
def __init__(
self,
api_scheme="https",
api_host=None,
store_id=None,
credentials=None,
retry_params=None,
authorization_model_id=None,
ssl_ca_cert=None,
api_url=None, # TODO: restructure when removing api_scheme/api_host
timeout_millisec: int | None = None,
telemetry: (
dict[
TelemetryConfigurationType | str,
TelemetryMetricsConfiguration
| dict[
TelemetryHistogram | TelemetryCounter | str,
TelemetryMetricConfiguration
| dict[TelemetryAttribute | str, bool]
| None,
]
| None,
]
| None
) = None,
headers: dict[str, str] | None = None,
):
super().__init__(
api_scheme,
api_host,
store_id,
credentials,
retry_params,
ssl_ca_cert=ssl_ca_cert,
api_url=api_url,
timeout_millisec=timeout_millisec,
telemetry=telemetry,
headers=headers,
)
self._authorization_model_id = authorization_model_id
def is_valid(self):
super().is_valid()
if (
self.authorization_model_id is not None
and self.authorization_model_id != ""
and is_well_formed_ulid_string(self.authorization_model_id) is False
):
raise FgaValidationException(
f"authorization_model_id ('{self.authorization_model_id}') is not in a valid ulid format"
)
@property
def authorization_model_id(self):
return self._authorization_model_id
@authorization_model_id.setter
def authorization_model_id(self, value):
self._authorization_model_id = value