diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 629fba1..f14d216 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -9,7 +9,7 @@ on: - "*.yml" - "*.md" - "skyflow/utils/_version.py" - - "samples/*" + - "samples/**" branches: - release/* diff --git a/samples/service_account/scoped_token_generation_example.py b/samples/service_account/scoped_token_generation_example.py index 1b7e9ed..1f740a5 100644 --- a/samples/service_account/scoped_token_generation_example.py +++ b/samples/service_account/scoped_token_generation_example.py @@ -8,9 +8,8 @@ # Generate bearer token from credentials file path options = { - "ctx": "" + "role_ids": ["ROLE_ID1", "ROLE_ID2"] } - if is_expired(bearer_token): bearer_token, token_type = generate_bearer_token( "", options @@ -25,3 +24,5 @@ print(bearer_token, token_type) + + diff --git a/samples/service_account/token_generation_with_context_example.py b/samples/service_account/token_generation_with_context_example.py index ea087c5..5e455a5 100644 --- a/samples/service_account/token_generation_with_context_example.py +++ b/samples/service_account/token_generation_with_context_example.py @@ -8,8 +8,9 @@ # Generate bearer token from credentials file path options = { - "role_ids": ["ROLE_ID1", "ROLE_ID2"] + "ctx": "" } + if is_expired(bearer_token): bearer_token, token_type = generate_bearer_token( "", options @@ -22,5 +23,4 @@ if is_expired(bearer_token): bearer_token, token_type = generate_bearer_token_from_creds(skyflow_credentials_string, options) - print(bearer_token, token_type) - + print(bearer_token, token_type) \ No newline at end of file diff --git a/samples/vault_api/delete_records.py b/samples/vault_api/delete_records.py index 449ff91..b03122a 100644 --- a/samples/vault_api/delete_records.py +++ b/samples/vault_api/delete_records.py @@ -35,12 +35,11 @@ ] delete_request = DeleteRequest( - table='TABLE_NAME', + table='', ids = primary_delete_ids ) -# will return first Vault ID -response = client.vault().delete(delete_request) +response = client.vault('').delete(delete_request) print(response) diff --git a/samples/vault_api/detokenize_records.py b/samples/vault_api/detokenize_records.py index f20d43c..92e43fd 100644 --- a/samples/vault_api/detokenize_records.py +++ b/samples/vault_api/detokenize_records.py @@ -8,9 +8,9 @@ # please pass one of api_key, token, credentials_string & path as credentials credentials = { "token": "BEARER_TOKEN", # bearer token - # api_key: "API_KEY", //API_KEY - # path: "PATH", //path to credentials file - # credentials_string: skyflow_credentials_string, // credentials as string + # api_key: "API_KEY", #API_KEY + # path: "PATH", #path to credentials file + # credentials_string: skyflow_credentials_string, #credentials as string } client = ( diff --git a/samples/vault_api/insert_byot.py b/samples/vault_api/insert_byot.py index 36135d7..f0b20eb 100644 --- a/samples/vault_api/insert_byot.py +++ b/samples/vault_api/insert_byot.py @@ -1,5 +1,6 @@ from skyflow import Env from skyflow import Skyflow, LogLevel +from skyflow.error import SkyflowError from skyflow.utils.enums import TokenStrict from skyflow.vault.data import GetRequest, InsertRequest from skyflow.vault.tokens import DetokenizeRequest @@ -28,23 +29,27 @@ .build() ) -# sample data -insert_data = [ - { "card_number": 'CARD_NUMBER1', "card_cvv": 'CVV1' }, - { "card_number": 'CARD_NUMBER2', "card_cvv": 'CVV2' }, -] - -insert_request = InsertRequest( - table_name='TABLE_NAME', - values = insert_data, - continue_on_error=False, # if continue on error is set true we will return request_index for errors - token_strict=TokenStrict.ENABLE, # token strict / byot is enabled, - tokens = [ - { "card_number": 'CARD_NUMBER1', "card_cvv": 'CVV1' }, - { "card_number": 'CARD_NUMBER2', "card_cvv": 'CVV2' }, - ], -) +#Initialize Client + +try: + insert_data = [ + {"": ''}, + {"": ''} + ] + + token_data = [ + {"": ''}, + {"": ''} + ] -response = skyflow_client.vault('VAULT_ID').insert(insert_request) + insert_request = InsertRequest( + table_name='', + values=insert_data, + token_strict=TokenStrict.ENABLE, # token strict is enabled, + tokens=token_data, + ) -print(response) + response = skyflow_client.vault('VAULT_ID').insert(insert_request) + print("Response:", response) +except SkyflowError as e: + print("Error Occurred:", e) diff --git a/samples/vault_api/insert_records.py b/samples/vault_api/insert_records.py index ee89c24..da8f2a3 100644 --- a/samples/vault_api/insert_records.py +++ b/samples/vault_api/insert_records.py @@ -29,8 +29,7 @@ # sample data insert_data = [ - { "card_number": 'CARD_NUMBER1', "card_cvv": 'CVV1' }, - { "card_number": 'CARD_NUMBER2', "card_cvv": 'CVV2' }, + { "": '', "": '' }, ] insert_request = InsertRequest( diff --git a/samples/vault_api/invoke_connection.py b/samples/vault_api/invoke_connection.py index 1daca5a..84cc76d 100644 --- a/samples/vault_api/invoke_connection.py +++ b/samples/vault_api/invoke_connection.py @@ -34,19 +34,27 @@ .build() ) + body = { "KEY1": "VALUE1", "KEY2": "VALUE2" } - headers = { -'Content-Type': 'application/json' + "KEY1": "VALUE1" +} +path_params = { + "KEY1": "VALUE1" +} +query_params = { + "KEY1": "VALUE1" } invoke_connection_request = InvokeConnectionRequest( method=Method.POST, body=body, - request_headers = headers + request_headers = headers, # optional + path_params = path_params, # optional + query_params=query_params # optional ) # will return the first connection response = skyflow_client.connection().invoke(invoke_connection_request) diff --git a/skyflow/generated/rest/api/tokens_api.py b/skyflow/generated/rest/api/tokens_api.py index d6bd55e..e21e793 100644 --- a/skyflow/generated/rest/api/tokens_api.py +++ b/skyflow/generated/rest/api/tokens_api.py @@ -101,6 +101,7 @@ def record_service_detokenize( _response_types_map: Dict[str, Optional[str]] = { '200': "V1DetokenizeResponse", + '207': "V1DetokenizeResponse", '404': "object", } response_data = self.api_client.call_api( diff --git a/skyflow/vault/data/_get_request.py b/skyflow/vault/data/_get_request.py index e40f904..a6c57e9 100644 --- a/skyflow/vault/data/_get_request.py +++ b/skyflow/vault/data/_get_request.py @@ -5,7 +5,7 @@ class GetRequest: def __init__(self, table, ids = None, - redaction_type = "plain-text", + redaction_type = None, return_tokens = False, fields = None, offset = None,