From 8b3f02e21a2440ca65aa9bc58e6e996a627c864b Mon Sep 17 00:00:00 2001 From: Evan Sims Date: Fri, 12 Jul 2024 10:26:43 -0500 Subject: [PATCH] refactor: sync repo file structure changes --- .openapi-generator/FILES | 34 +- README.md | 5 +- VERSION.txt | 2 +- example/example1/setup.py | 2 +- example/opentelemetry/setup.py | 2 +- openfga_sdk/api/open_fga_api.py | 467 ++++++++++++++++-- openfga_sdk/api_client.py | 8 +- openfga_sdk/sync/api_client.py | 6 +- openfga_sdk/sync/open_fga_api.py | 467 ++++++++++++++++-- requirements.txt | 1 + setup.py | 6 +- test/api/__init__.py | 0 .../open_fga_api_test.py} | 0 test/client/__init__.py | 0 .../{test_client.py => client/client_test.py} | 0 ...configuration.py => configuration_test.py} | 0 ...est_credentials.py => credentials_test.py} | 0 test/{test_oauth2.py => oauth2_test.py} | 0 test/sync/__init__.py | 0 test/sync/client/__init__.py | 0 .../client/client_test.py} | 0 .../oauth2_test.py} | 0 .../open_fga_api_test.py} | 0 ...{test_validation.py => validation_test.py} | 0 24 files changed, 914 insertions(+), 86 deletions(-) create mode 100644 test/api/__init__.py rename test/{test_open_fga_api.py => api/open_fga_api_test.py} (100%) create mode 100644 test/client/__init__.py rename test/{test_client.py => client/client_test.py} (100%) rename test/{test_configuration.py => configuration_test.py} (100%) rename test/{test_credentials.py => credentials_test.py} (100%) rename test/{test_oauth2.py => oauth2_test.py} (100%) create mode 100644 test/sync/__init__.py create mode 100644 test/sync/client/__init__.py rename test/{test_client_sync.py => sync/client/client_test.py} (100%) rename test/{test_oauth2_sync.py => sync/oauth2_test.py} (100%) rename test/{test_open_fga_api_sync.py => sync/open_fga_api_test.py} (100%) rename test/{test_validation.py => validation_test.py} (100%) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1a629e6..73f5024 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -94,12 +94,20 @@ docs/WriteAuthorizationModelResponse.md docs/WriteRequest.md docs/WriteRequestDeletes.md docs/WriteRequestWrites.md +docs/opentelemetry.md example/Makefile example/README.md example/example1/example1.py example/example1/requirements.txt example/example1/setup.cfg example/example1/setup.py +example/opentelemetry/.env.example +example/opentelemetry/.gitignore +example/opentelemetry/README.md +example/opentelemetry/main.py +example/opentelemetry/requirements.txt +example/opentelemetry/setup.cfg +example/opentelemetry/setup.py openfga_sdk/__init__.py openfga_sdk/api/__init__.py openfga_sdk/api/open_fga_api.py @@ -213,18 +221,28 @@ openfga_sdk/sync/client/__init__.py openfga_sdk/sync/client/client.py openfga_sdk/sync/oauth2.py openfga_sdk/sync/rest.py +openfga_sdk/telemetry/__init__.py +openfga_sdk/telemetry/attributes.py +openfga_sdk/telemetry/counters.py +openfga_sdk/telemetry/histograms.py +openfga_sdk/telemetry/metrics.py +openfga_sdk/telemetry/telemetry.py openfga_sdk/validation.py requirements.txt setup.cfg setup.py test-requirements.txt +test/_/configuration_test.py +test/_/credentials_test.py +test/_/oauth2_test.py +test/_/validation_test.py test/__init__.py -test/test_client.py -test/test_client_sync.py -test/test_configuration.py -test/test_credentials.py -test/test_oauth2.py -test/test_oauth2_sync.py +test/api/__init__.py +test/client/__init__.py +test/client/client_test.py +test/sync/__init__.py +test/sync/client/__init__.py +test/sync/client/client_test.py +test/sync/oauth2_test.py +test/sync/open_fga_api_test.py test/test_open_fga_api.py -test/test_open_fga_api_sync.py -test/test_validation.py diff --git a/README.md b/README.md index db4ceaf..d695edc 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,8 @@ from `openfga_sdk.sync` that supports all the credential types and calls, without requiring async/await. ```python -from openfga_sdk.sync import ClientConfiguration, OpenFgaClient +from openfga_sdk.client import ClientConfiguration +from openfga_sdk.sync import OpenFgaClient def main(): @@ -1144,8 +1145,6 @@ Class | Method | HTTP request | Description This SDK supports producing metrics that can be consumed as part of an [OpenTelemetry](https://opentelemetry.io/) setup. For more information, please see [the documentation](https://github.com/openfga/python-sdk/blob/main/docs/opentelemetry.md) - - ## Contributing ### Issues diff --git a/VERSION.txt b/VERSION.txt index 8f0916f..a918a2a 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.5.0 +0.6.0 diff --git a/example/example1/setup.py b/example/example1/setup.py index 793e003..cd44d00 100644 --- a/example/example1/setup.py +++ b/example/example1/setup.py @@ -14,7 +14,7 @@ NAME = "example1" VERSION = "0.0.1" -REQUIRES = ["openfga-sdk >= 0.5"] +REQUIRES = ["openfga-sdk >= 0.6.0"] setup( name=NAME, diff --git a/example/opentelemetry/setup.py b/example/opentelemetry/setup.py index 8e9ecd1..d3dac6b 100644 --- a/example/opentelemetry/setup.py +++ b/example/opentelemetry/setup.py @@ -12,7 +12,7 @@ from setuptools import find_packages, setup -NAME = "openfga-sdk" +NAME = "openfga-opentelemetry-example" VERSION = "0.0.1" REQUIRES = [""] diff --git a/openfga_sdk/api/open_fga_api.py b/openfga_sdk/api/open_fga_api.py index 2cf44a9..7db6c40 100644 --- a/openfga_sdk/api/open_fga_api.py +++ b/openfga_sdk/api/open_fga_api.py @@ -143,6 +143,8 @@ async def check_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `check`" @@ -188,10 +190,15 @@ async def check_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "check", + TelemetryAttributes.request_method: "check" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + try: if body_params.tuple_key: telemetry_attributes[TelemetryAttributes.client_user] = ( @@ -201,7 +208,11 @@ async def check_with_http_info(self, body, **kwargs): pass try: - if body_params.authorization_model_id: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: telemetry_attributes[TelemetryAttributes.request_model_id] = ( body_params.authorization_model_id ) @@ -320,6 +331,8 @@ async def create_store_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + query_params = [] header_params = dict(local_var_params.get("_headers", {})) @@ -359,9 +372,35 @@ async def create_store_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "createStore", + TelemetryAttributes.request_method: "create_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores", "POST", @@ -470,6 +509,8 @@ async def delete_store_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `delete_store`" @@ -495,9 +536,35 @@ async def delete_store_with_http_info(self, **kwargs): response_types_map = {} telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "deleteStore", + TelemetryAttributes.request_method: "delete_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}".replace("{store_id}", store_id), "DELETE", @@ -617,6 +684,8 @@ async def expand_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `expand`" @@ -662,10 +731,35 @@ async def expand_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "expand", + TelemetryAttributes.request_method: "expand" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/expand".replace("{store_id}", store_id), "POST", @@ -774,6 +868,8 @@ async def get_store_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `get_store`" @@ -807,10 +903,35 @@ async def get_store_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "getStore", + TelemetryAttributes.request_method: "get_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}".replace("{store_id}", store_id), "GET", @@ -931,6 +1052,8 @@ async def list_objects_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `list_objects`" @@ -976,10 +1099,35 @@ async def list_objects_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "listObjects", + TelemetryAttributes.request_method: "list_objects" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/list-objects".replace("{store_id}", store_id), "POST", @@ -1096,6 +1244,8 @@ async def list_stores_with_http_info(self, **kwargs): path_params = {} + store_id = None + query_params = [] if local_var_params.get("page_size") is not None: query_params.append(("page_size", local_var_params["page_size"])) @@ -1129,9 +1279,35 @@ async def list_stores_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "listStores", + TelemetryAttributes.request_method: "list_stores" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores", "GET", @@ -1252,6 +1428,8 @@ async def list_users_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `list_users`" @@ -1297,10 +1475,15 @@ async def list_users_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "listUsers", + TelemetryAttributes.request_method: "list_users" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + try: if body_params.tuple_key: telemetry_attributes[TelemetryAttributes.client_user] = ( @@ -1310,7 +1493,11 @@ async def list_users_with_http_info(self, body, **kwargs): pass try: - if body_params.authorization_model_id: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: telemetry_attributes[TelemetryAttributes.request_model_id] = ( body_params.authorization_model_id ) @@ -1436,6 +1623,8 @@ async def read_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read`" @@ -1481,10 +1670,35 @@ async def read_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "read", + TelemetryAttributes.request_method: "read" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/read".replace("{store_id}", store_id), "POST", @@ -1607,6 +1821,8 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs) path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_assertions`" @@ -1645,11 +1861,35 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs) } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_model_id: authorization_model_id, - TelemetryAttributes.request_method: "readAssertions", + TelemetryAttributes.request_method: "read_assertions" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/assertions/{authorization_model_id}".replace( "{store_id}", store_id @@ -1772,6 +2012,8 @@ async def read_authorization_model_with_http_info(self, id, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_authorization_model`" @@ -1808,10 +2050,35 @@ async def read_authorization_model_with_http_info(self, id, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readAuthorizationModel", + TelemetryAttributes.request_method: "read_authorization_model" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/authorization-models/{id}".replace( "{store_id}", store_id @@ -1930,6 +2197,8 @@ async def read_authorization_models_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_authorization_models`" @@ -1969,10 +2238,35 @@ async def read_authorization_models_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readAuthorizationModels", + TelemetryAttributes.request_method: "read_authorization_models" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/authorization-models".replace("{store_id}", store_id), "GET", @@ -2093,6 +2387,8 @@ async def read_changes_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_changes`" @@ -2134,10 +2430,35 @@ async def read_changes_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readChanges", + TelemetryAttributes.request_method: "read_changes" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/changes".replace("{store_id}", store_id), "GET", @@ -2257,6 +2578,8 @@ async def write_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write`" @@ -2302,10 +2625,35 @@ async def write_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "write", + TelemetryAttributes.request_method: "write" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/write".replace("{store_id}", store_id), "POST", @@ -2442,6 +2790,8 @@ async def write_assertions_with_http_info( path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write_assertions`" @@ -2484,11 +2834,35 @@ async def write_assertions_with_http_info( response_types_map = {} telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_model_id: authorization_model_id, - TelemetryAttributes.request_method: "writeAssertions", + TelemetryAttributes.request_method: "write_assertions" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/assertions/{authorization_model_id}".replace( "{store_id}", store_id @@ -2611,6 +2985,8 @@ async def write_authorization_model_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write_authorization_model`" @@ -2656,10 +3032,35 @@ async def write_authorization_model_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "writeAuthorizationModel", + TelemetryAttributes.request_method: "write_authorization_model" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return await self.api_client.call_api( "/stores/{store_id}/authorization-models".replace("{store_id}", store_id), "POST", diff --git a/openfga_sdk/api_client.py b/openfga_sdk/api_client.py index 5806d03..46de203 100644 --- a/openfga_sdk/api_client.py +++ b/openfga_sdk/api_client.py @@ -93,16 +93,20 @@ def __init__( ): if configuration is None: configuration = Configuration.get_default_copy() + self.configuration = configuration self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value + self.cookie = cookie - # Set default User-Agent. + self.user_agent = DEFAULT_USER_AGENT + self.client_side_validation = configuration.client_side_validation self._telemetry = Telemetry() @@ -258,7 +262,6 @@ async def __call_api( max_retry = _retry_params.max_retry if _retry_params.min_wait_in_ms is not None: max_retry = _retry_params.min_wait_in_ms - for retry in range(max_retry + 1): try: # perform request and return response @@ -553,6 +556,7 @@ async def call_api( _request_auth, _retry_params, _oauth2_client, + _telemetry_attributes, ), ) diff --git a/openfga_sdk/sync/api_client.py b/openfga_sdk/sync/api_client.py index 03e4b89..60006b2 100644 --- a/openfga_sdk/sync/api_client.py +++ b/openfga_sdk/sync/api_client.py @@ -92,16 +92,20 @@ def __init__( ): if configuration is None: configuration = Configuration.get_default_copy() + self.configuration = configuration self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value + self.cookie = cookie - # Set default User-Agent. + self.user_agent = DEFAULT_USER_AGENT + self.client_side_validation = configuration.client_side_validation self._telemetry = Telemetry() diff --git a/openfga_sdk/sync/open_fga_api.py b/openfga_sdk/sync/open_fga_api.py index d7fdcfb..2512f0b 100644 --- a/openfga_sdk/sync/open_fga_api.py +++ b/openfga_sdk/sync/open_fga_api.py @@ -143,6 +143,8 @@ def check_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `check`" @@ -188,10 +190,15 @@ def check_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "check", + TelemetryAttributes.request_method: "check" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + try: if body_params.tuple_key: telemetry_attributes[TelemetryAttributes.client_user] = ( @@ -201,7 +208,11 @@ def check_with_http_info(self, body, **kwargs): pass try: - if body_params.authorization_model_id: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: telemetry_attributes[TelemetryAttributes.request_model_id] = ( body_params.authorization_model_id ) @@ -320,6 +331,8 @@ def create_store_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + query_params = [] header_params = dict(local_var_params.get("_headers", {})) @@ -359,9 +372,35 @@ def create_store_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "createStore", + TelemetryAttributes.request_method: "create_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores", "POST", @@ -470,6 +509,8 @@ def delete_store_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `delete_store`" @@ -495,9 +536,35 @@ def delete_store_with_http_info(self, **kwargs): response_types_map = {} telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "deleteStore", + TelemetryAttributes.request_method: "delete_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}".replace("{store_id}", store_id), "DELETE", @@ -617,6 +684,8 @@ def expand_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `expand`" @@ -662,10 +731,35 @@ def expand_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "expand", + TelemetryAttributes.request_method: "expand" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/expand".replace("{store_id}", store_id), "POST", @@ -774,6 +868,8 @@ def get_store_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `get_store`" @@ -807,10 +903,35 @@ def get_store_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "getStore", + TelemetryAttributes.request_method: "get_store" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}".replace("{store_id}", store_id), "GET", @@ -931,6 +1052,8 @@ def list_objects_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `list_objects`" @@ -976,10 +1099,35 @@ def list_objects_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "listObjects", + TelemetryAttributes.request_method: "list_objects" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/list-objects".replace("{store_id}", store_id), "POST", @@ -1096,6 +1244,8 @@ def list_stores_with_http_info(self, **kwargs): path_params = {} + store_id = None + query_params = [] if local_var_params.get("page_size") is not None: query_params.append(("page_size", local_var_params["page_size"])) @@ -1129,9 +1279,35 @@ def list_stores_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_method: "listStores", + TelemetryAttributes.request_method: "list_stores" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores", "GET", @@ -1252,6 +1428,8 @@ def list_users_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `list_users`" @@ -1297,10 +1475,15 @@ def list_users_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "listUsers", + TelemetryAttributes.request_method: "list_users" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + try: if body_params.tuple_key: telemetry_attributes[TelemetryAttributes.client_user] = ( @@ -1310,7 +1493,11 @@ def list_users_with_http_info(self, body, **kwargs): pass try: - if body_params.authorization_model_id: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: telemetry_attributes[TelemetryAttributes.request_model_id] = ( body_params.authorization_model_id ) @@ -1436,6 +1623,8 @@ def read_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read`" @@ -1481,10 +1670,35 @@ def read_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "read", + TelemetryAttributes.request_method: "read" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/read".replace("{store_id}", store_id), "POST", @@ -1605,6 +1819,8 @@ def read_assertions_with_http_info(self, authorization_model_id, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_assertions`" @@ -1643,11 +1859,35 @@ def read_assertions_with_http_info(self, authorization_model_id, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_model_id: authorization_model_id, - TelemetryAttributes.request_method: "readAssertions", + TelemetryAttributes.request_method: "read_assertions" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/assertions/{authorization_model_id}".replace( "{store_id}", store_id @@ -1770,6 +2010,8 @@ def read_authorization_model_with_http_info(self, id, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_authorization_model`" @@ -1806,10 +2048,35 @@ def read_authorization_model_with_http_info(self, id, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readAuthorizationModel", + TelemetryAttributes.request_method: "read_authorization_model" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/authorization-models/{id}".replace( "{store_id}", store_id @@ -1928,6 +2195,8 @@ def read_authorization_models_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_authorization_models`" @@ -1967,10 +2236,35 @@ def read_authorization_models_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readAuthorizationModels", + TelemetryAttributes.request_method: "read_authorization_models" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/authorization-models".replace("{store_id}", store_id), "GET", @@ -2091,6 +2385,8 @@ def read_changes_with_http_info(self, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `read_changes`" @@ -2132,10 +2428,35 @@ def read_changes_with_http_info(self, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "readChanges", + TelemetryAttributes.request_method: "read_changes" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/changes".replace("{store_id}", store_id), "GET", @@ -2255,6 +2576,8 @@ def write_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write`" @@ -2300,10 +2623,35 @@ def write_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "write", + TelemetryAttributes.request_method: "write" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/write".replace("{store_id}", store_id), "POST", @@ -2438,6 +2786,8 @@ def write_assertions_with_http_info(self, authorization_model_id, body, **kwargs path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write_assertions`" @@ -2480,11 +2830,35 @@ def write_assertions_with_http_info(self, authorization_model_id, body, **kwargs response_types_map = {} telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_model_id: authorization_model_id, - TelemetryAttributes.request_method: "writeAssertions", + TelemetryAttributes.request_method: "write_assertions" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/assertions/{authorization_model_id}".replace( "{store_id}", store_id @@ -2607,6 +2981,8 @@ def write_authorization_model_with_http_info(self, body, **kwargs): path_params = {} + store_id = None + if self.api_client._get_store_id() is None: raise ApiValueError( "Store ID expected in api_client's configuration when calling `write_authorization_model`" @@ -2652,10 +3028,35 @@ def write_authorization_model_with_http_info(self, body, **kwargs): } telemetry_attributes: dict[TelemetryAttribute, str] = { - TelemetryAttributes.request_store_id: store_id, - TelemetryAttributes.request_method: "writeAuthorizationModel", + TelemetryAttributes.request_method: "write_authorization_model" } + try: + if store_id: + telemetry_attributes[TelemetryAttributes.request_store_id] = store_id + except: + pass + + try: + if body_params.tuple_key: + telemetry_attributes[TelemetryAttributes.client_user] = ( + body_params.tuple_key.user + ) + except: + pass + + try: + if "authorization_model_id" in local_var_params: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + local_var_params["authorization_model_id"] + ) + elif body_params.authorization_model_id: + telemetry_attributes[TelemetryAttributes.request_model_id] = ( + body_params.authorization_model_id + ) + except: + pass + return self.api_client.call_api( "/stores/{store_id}/authorization-models".replace("{store_id}", store_id), "POST", diff --git a/requirements.txt b/requirements.txt index ba729c9..4eef03d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ aiohttp >= 3.9.3, < 4 python-dateutil >= 2.9.0, < 3 setuptools >= 69.1.1 +build >= 1.2.1, < 2 urllib3 >= 1.25.11, < 3 opentelemetry-api >= 1.25.0, < 2 diff --git a/setup.py b/setup.py index 324aa53..ad48153 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ import pathlib import pkg_resources -import setuptools +from setuptools import find_packages, setup NAME = "openfga-sdk" VERSION = "0.6.0" @@ -29,7 +29,7 @@ this_directory = pathlib.Path(__file__).parent long_description = (this_directory / "README.md").read_text() -setuptools.setup( +setup( name=NAME, version=VERSION, description="A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.", @@ -54,7 +54,7 @@ ], install_requires=REQUIRES, python_requires=">=3.10", - packages=setuptools.find_packages(exclude=["test", "tests"]), + packages=find_packages(exclude=["test"]), include_package_data=True, license="Apache-2.0", long_description_content_type="text/markdown", diff --git a/test/api/__init__.py b/test/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_open_fga_api.py b/test/api/open_fga_api_test.py similarity index 100% rename from test/test_open_fga_api.py rename to test/api/open_fga_api_test.py diff --git a/test/client/__init__.py b/test/client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_client.py b/test/client/client_test.py similarity index 100% rename from test/test_client.py rename to test/client/client_test.py diff --git a/test/test_configuration.py b/test/configuration_test.py similarity index 100% rename from test/test_configuration.py rename to test/configuration_test.py diff --git a/test/test_credentials.py b/test/credentials_test.py similarity index 100% rename from test/test_credentials.py rename to test/credentials_test.py diff --git a/test/test_oauth2.py b/test/oauth2_test.py similarity index 100% rename from test/test_oauth2.py rename to test/oauth2_test.py diff --git a/test/sync/__init__.py b/test/sync/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/sync/client/__init__.py b/test/sync/client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_client_sync.py b/test/sync/client/client_test.py similarity index 100% rename from test/test_client_sync.py rename to test/sync/client/client_test.py diff --git a/test/test_oauth2_sync.py b/test/sync/oauth2_test.py similarity index 100% rename from test/test_oauth2_sync.py rename to test/sync/oauth2_test.py diff --git a/test/test_open_fga_api_sync.py b/test/sync/open_fga_api_test.py similarity index 100% rename from test/test_open_fga_api_sync.py rename to test/sync/open_fga_api_test.py diff --git a/test/test_validation.py b/test/validation_test.py similarity index 100% rename from test/test_validation.py rename to test/validation_test.py