├── tests ├── __init__.py ├── utils │ ├── __init__.py │ ├── logger │ │ └── __init__.py │ ├── validations │ │ └── __init__.py │ └── test__helpers.py ├── vault │ ├── __init__.py │ ├── client │ │ └── __init__.py │ └── controller │ │ └── __init__.py ├── client │ └── __init__.py └── service_account │ ├── __init__.py │ └── invalid_creds.json ├── skyflow ├── vault │ ├── __init__.py │ ├── client │ │ └── __init__.py │ ├── data │ │ ├── _upload_file_request.py │ │ ├── _query_request.py │ │ ├── _delete_request.py │ │ ├── _query_response.py │ │ ├── _get_response.py │ │ ├── _delete_response.py │ │ ├── _update_response.py │ │ ├── _update_request.py │ │ ├── _insert_response.py │ │ ├── _file_upload_response.py │ │ ├── __init__.py │ │ ├── _file_upload_request.py │ │ ├── _insert_request.py │ │ └── _get_request.py │ ├── controller │ │ ├── __init__.py │ │ ├── _audit.py │ │ ├── _bin_look_up.py │ │ └── _connections.py │ ├── tokens │ │ ├── _tokenize_request.py │ │ ├── _detokenize_request.py │ │ ├── __init__.py │ │ ├── _tokenize_response.py │ │ └── _detokenize_response.py │ ├── connection │ │ ├── __init__.py │ │ ├── _invoke_connection_response.py │ │ └── _invoke_connection_request.py │ └── detect │ │ ├── _get_detect_run_request.py │ │ ├── _transformations.py │ │ ├── _text_index.py │ │ ├── _date_transformation.py │ │ ├── _reidentify_text_response.py │ │ ├── _audio_bleep.py │ │ ├── _reidentify_text_request.py │ │ ├── _token_format.py │ │ ├── _file_input.py │ │ ├── __init__.py │ │ ├── _deidentify_text_response.py │ │ ├── _entity_info.py │ │ ├── _deidentify_text_request.py │ │ ├── _file.py │ │ └── _deidentify_file_response.py ├── generated │ ├── __init__.py │ └── rest │ │ ├── py.typed │ │ ├── version.py │ │ ├── types │ │ ├── uuid_.py │ │ ├── http_code.py │ │ ├── resource_id.py │ │ ├── v_1_byot.py │ │ ├── v_1_member_type.py │ │ ├── context_access_type.py │ │ ├── batch_record_method.py │ │ ├── detect_runs_response_output_type.py │ │ ├── file_data_deidentify_audio_data_format.py │ │ ├── shift_dates_entity_types_item.py │ │ ├── context_auth_mode.py │ │ ├── detect_guardrails_response_validation.py │ │ ├── reidentify_file_response_output_type.py │ │ ├── redaction_enum_redaction.py │ │ ├── detect_runs_response_status.py │ │ ├── file_data_deidentify_document_data_format.py │ │ ├── file_data_deidentify_presentation_data_format.py │ │ ├── token_type_mapping_default.py │ │ ├── file_data_deidentify_spreadsheet_data_format.py │ │ ├── file_data_deidentify_structured_text_data_format.py │ │ ├── reidentify_file_response_status.py │ │ ├── file_data_deidentify_image_data_format.py │ │ ├── file_data_reidentify_file_data_format.py │ │ ├── detokenize_record_response_value_type.py │ │ ├── v_1_file_av_scan_status.py │ │ ├── deidentified_file_output_processed_file_type.py │ │ ├── file_data_data_format.py │ │ ├── request_action_type.py │ │ ├── deidentified_file_output_processed_file_extension.py │ │ ├── reidentified_file_output_processed_file_extension.py │ │ ├── error_response.py │ │ ├── v_1_tokenize_record_response.py │ │ ├── v_1_get_file_scan_status_response.py │ │ ├── identify_response.py │ │ ├── protobuf_any.py │ │ ├── transformations.py │ │ ├── googlerpc_status.py │ │ ├── v_1_get_query_response.py │ │ ├── deidentify_file_response.py │ │ ├── v_1_bulk_get_record_response.py │ │ ├── audit_event_data.py │ │ ├── v_1_insert_record_response.py │ │ ├── v_1_tokenize_response.py │ │ ├── v_1_detokenize_response.py │ │ ├── v_1_delete_file_response.py │ │ ├── v_1_bin_list_response.py │ │ ├── v_1_delete_record_response.py │ │ ├── v_1_detokenize_record_request.py │ │ ├── v_1_update_record_response.py │ │ ├── v_1_record_meta_properties.py │ │ ├── error_response_error.py │ │ ├── audit_event_audit_resource_type.py │ │ ├── v_1_bulk_delete_record_response.py │ │ ├── audit_event_http_info.py │ │ ├── v_1_audit_response.py │ │ ├── v_1_tokenize_record_request.py │ │ ├── file_data_deidentify_pdf.py │ │ ├── file_data_deidentify_text.py │ │ ├── file_data.py │ │ ├── v_1_get_auth_token_response.py │ │ ├── v_1_vault_schema_config.py │ │ ├── v_1_field_records.py │ │ ├── file_data_reidentify_file.py │ │ ├── file_data_deidentify_audio.py │ │ ├── file_data_deidentify_image.py │ │ ├── file_data_deidentify_document.py │ │ ├── upload_file_v_2_response.py │ │ ├── v_1_vault_field_mapping.py │ │ ├── file_data_deidentify_spreadsheet.py │ │ ├── file_data_deidentify_presentation.py │ │ ├── shift_dates.py │ │ ├── file_data_deidentify_structured_text.py │ │ ├── word_character_count.py │ │ ├── detect_guardrails_response.py │ │ ├── v_1_audit_event_response.py │ │ ├── string_response_entities.py │ │ ├── reidentify_file_response.py │ │ ├── deidentify_string_response.py │ │ ├── v_1_detokenize_record_response.py │ │ ├── reidentified_file_output.py │ │ ├── locations.py │ │ ├── v_1_batch_operation_response.py │ │ ├── v_1_audit_after_options.py │ │ ├── format.py │ │ ├── deidentified_file_output.py │ │ ├── token_type_mapping.py │ │ ├── v_1_audit_response_event.py │ │ ├── v_1_card.py │ │ ├── format_masked_item.py │ │ ├── format_redacted_item.py │ │ ├── format_plaintext_item.py │ │ ├── token_type_mapping_entity_only_item.py │ │ ├── token_type_mapping_vault_token_item.py │ │ └── token_type_mapping_entity_unq_counter_item.py │ │ ├── query │ │ └── __init__.py │ │ ├── tokens │ │ └── __init__.py │ │ ├── bin_lookup │ │ └── __init__.py │ │ ├── guardrails │ │ └── __init__.py │ │ ├── authentication │ │ └── __init__.py │ │ ├── strings │ │ ├── __init__.py │ │ └── types │ │ │ ├── __init__.py │ │ │ └── deidentify_string_request_entity_types_item.py │ │ ├── records │ │ ├── types │ │ │ ├── record_service_bulk_get_record_request_order_by.py │ │ │ ├── record_service_get_record_request_redaction.py │ │ │ ├── record_service_bulk_get_record_request_redaction.py │ │ │ └── __init__.py │ │ └── __init__.py │ │ ├── environment.py │ │ ├── audit │ │ ├── types │ │ │ ├── audit_service_list_audit_events_request_sort_ops_order_by.py │ │ │ ├── audit_service_list_audit_events_request_filter_ops_context_actor_type.py │ │ │ ├── audit_service_list_audit_events_request_filter_ops_context_access_type.py │ │ │ ├── audit_service_list_audit_events_request_filter_ops_context_auth_mode.py │ │ │ ├── audit_service_list_audit_events_request_filter_ops_action_type.py │ │ │ ├── audit_service_list_audit_events_request_filter_ops_resource_type.py │ │ │ └── __init__.py │ │ └── __init__.py │ │ ├── files │ │ ├── types │ │ │ ├── deidentify_file_image_request_deidentify_image_masking_method.py │ │ │ ├── deidentify_file_audio_request_deidentify_audio_output_transcription.py │ │ │ ├── deidentify_file_request_entity_types_item.py │ │ │ ├── deidentify_file_request_deidentify_text_entity_types_item.py │ │ │ ├── deidentify_file_request_deidentify_document_entity_types_item.py │ │ │ ├── deidentify_file_audio_request_deidentify_audio_entity_types_item.py │ │ │ ├── deidentify_file_image_request_deidentify_image_entity_types_item.py │ │ │ ├── deidentify_file_request_deidentify_spreadsheet_entity_types_item.py │ │ │ ├── deidentify_file_request_deidentify_presentation_entity_types_item.py │ │ │ ├── deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py │ │ │ └── deidentify_file_request_deidentify_structured_text_entity_types_item.py │ │ └── __init__.py │ │ ├── errors │ │ ├── not_found_error.py │ │ ├── bad_request_error.py │ │ ├── unauthorized_error.py │ │ ├── __init__.py │ │ └── internal_server_error.py │ │ └── core │ │ ├── remove_none_from_dict.py │ │ ├── force_multipart.py │ │ ├── api_error.py │ │ ├── datetime_utils.py │ │ ├── http_response.py │ │ ├── __init__.py │ │ ├── request_options.py │ │ └── query_encoder.py ├── service_account │ ├── client │ │ ├── __init__.py │ │ └── auth_client.py │ └── __init__.py ├── utils │ ├── _version.py │ ├── constants.py │ ├── logger │ │ ├── __init__.py │ │ ├── _log_helpers.py │ │ └── _logger.py │ ├── enums │ │ ├── masking_method.py │ │ ├── log_level.py │ │ ├── token_mode.py │ │ ├── request_method.py │ │ ├── redaction_type.py │ │ ├── token_type.py │ │ ├── content_types.py │ │ ├── detect_output_transcriptions.py │ │ ├── env.py │ │ └── __init__.py │ ├── _helpers.py │ ├── __init__.py │ └── validations │ │ └── __init__.py ├── client │ └── __init__.py ├── error │ ├── __init__.py │ └── _skyflow_error.py └── __init__.py ├── codecov.yml ├── .github └── workflows │ ├── main.yml │ ├── release.yml │ ├── beta-release.yml │ ├── internal-release.yml │ ├── ci.yml │ ├── semgrep.yml │ ├── pull_request_template.md │ └── shared-tests.yml ├── requirements.txt ├── SECURITY.md ├── README.rst ├── .codespellrc ├── .semgreprules └── customRule.yml ├── LICENSE ├── setup.py ├── ci-scripts └── bump_version.sh ├── docs └── auth_credentials.md └── samples ├── service_account ├── token_generation_example.py ├── scoped_token_generation_example.py ├── token_generation_with_context_example.py └── signed_token_generation_example.py ├── detect_api ├── get_detect_run.py └── reidentify_text.py └── vault_api └── update_record.py /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/vault/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /skyflow/vault/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | -------------------------------------------------------------------------------- /skyflow/generated/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /skyflow/generated/rest/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /skyflow/vault/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/service_account/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/utils/logger/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/vault/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/utils/validations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/vault/controller/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /skyflow/service_account/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/service_account/invalid_creds.json: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------- /skyflow/utils/_version.py: -------------------------------------------------------------------------------- 1 | SDK_VERSION = '2.0.0' -------------------------------------------------------------------------------- /skyflow/client/__init__.py: -------------------------------------------------------------------------------- 1 | from .skyflow import Skyflow 2 | -------------------------------------------------------------------------------- /skyflow/error/__init__.py: -------------------------------------------------------------------------------- 1 | from ._skyflow_error import SkyflowError -------------------------------------------------------------------------------- /skyflow/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import LogLevel, Env 2 | from .client import Skyflow 3 | -------------------------------------------------------------------------------- /skyflow/vault/data/_upload_file_request.py: -------------------------------------------------------------------------------- 1 | class UploadFileRequest: 2 | def __init__(self): 3 | pass 4 | -------------------------------------------------------------------------------- /skyflow/generated/rest/version.py: -------------------------------------------------------------------------------- 1 | from importlib import metadata 2 | 3 | __version__ = metadata.version("skyflow") 4 | -------------------------------------------------------------------------------- /skyflow/utils/constants.py: -------------------------------------------------------------------------------- 1 | OPTIONAL_TOKEN='token' 2 | PROTOCOL='https' 3 | SKY_META_DATA_HEADER='sky-metadata' 4 | 5 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/uuid_.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | Uuid = str 4 | -------------------------------------------------------------------------------- /skyflow/utils/logger/__init__.py: -------------------------------------------------------------------------------- 1 | from ._logger import Logger 2 | from ._log_helpers import log_error, log_info, log_error_log -------------------------------------------------------------------------------- /skyflow/vault/data/_query_request.py: -------------------------------------------------------------------------------- 1 | class QueryRequest: 2 | def __init__(self, query): 3 | self.query = query 4 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/http_code.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | HttpCode = int 4 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/resource_id.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | ResourceId = str 4 | -------------------------------------------------------------------------------- /skyflow/vault/controller/__init__.py: -------------------------------------------------------------------------------- 1 | from ._vault import Vault 2 | from ._connections import Connection 3 | from ._detect import Detect -------------------------------------------------------------------------------- /skyflow/vault/tokens/_tokenize_request.py: -------------------------------------------------------------------------------- 1 | class TokenizeRequest: 2 | def __init__(self, values): 3 | self.values = values 4 | -------------------------------------------------------------------------------- /skyflow/generated/rest/query/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | -------------------------------------------------------------------------------- /skyflow/generated/rest/tokens/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | -------------------------------------------------------------------------------- /skyflow/generated/rest/bin_lookup/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | -------------------------------------------------------------------------------- /skyflow/generated/rest/guardrails/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | -------------------------------------------------------------------------------- /skyflow/utils/enums/masking_method.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class MaskingMethod(Enum): 4 | BLACKBOX= "blackbox" 5 | BLUR= "blur" -------------------------------------------------------------------------------- /skyflow/generated/rest/authentication/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | -------------------------------------------------------------------------------- /skyflow/vault/controller/_audit.py: -------------------------------------------------------------------------------- 1 | class Audit: 2 | #members 3 | def __init__(self): 4 | pass 5 | 6 | def list(self): 7 | pass 8 | -------------------------------------------------------------------------------- /skyflow/vault/controller/_bin_look_up.py: -------------------------------------------------------------------------------- 1 | class BinLookUp: 2 | #members 3 | def __init__(self): 4 | pass 5 | 6 | def get(self): 7 | pass -------------------------------------------------------------------------------- /skyflow/vault/data/_delete_request.py: -------------------------------------------------------------------------------- 1 | class DeleteRequest: 2 | def __init__(self, table, ids): 3 | self.table = table 4 | self.ids = ids 5 | -------------------------------------------------------------------------------- /skyflow/vault/connection/__init__.py: -------------------------------------------------------------------------------- 1 | from ._invoke_connection_request import InvokeConnectionRequest 2 | from ._invoke_connection_response import InvokeConnectionResponse -------------------------------------------------------------------------------- /skyflow/utils/enums/log_level.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class LogLevel(Enum): 4 | DEBUG = 1 5 | INFO = 2 6 | WARN = 3 7 | ERROR = 4 8 | OFF = 5 9 | -------------------------------------------------------------------------------- /skyflow/utils/enums/token_mode.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class TokenMode(Enum): 4 | DISABLE = "DISABLE" 5 | ENABLE = "ENABLE" 6 | ENABLE_STRICT = "ENABLE_STRICT" -------------------------------------------------------------------------------- /skyflow/vault/detect/_get_detect_run_request.py: -------------------------------------------------------------------------------- 1 | class GetDetectRunRequest: 2 | def __init__( 3 | self, 4 | run_id: str, 5 | ): 6 | self.run_id: str = run_id -------------------------------------------------------------------------------- /skyflow/service_account/__init__.py: -------------------------------------------------------------------------------- 1 | from ._utils import generate_bearer_token, generate_bearer_token_from_creds, is_expired, generate_signed_data_tokens, generate_signed_data_tokens_from_creds -------------------------------------------------------------------------------- /skyflow/utils/enums/request_method.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class RequestMethod(Enum): 4 | GET = "GET" 5 | POST = "POST" 6 | PUT = "PUT" 7 | DELETE = "DELETE" 8 | NONE = "NONE" -------------------------------------------------------------------------------- /skyflow/vault/tokens/_detokenize_request.py: -------------------------------------------------------------------------------- 1 | class DetokenizeRequest: 2 | def __init__(self, data, continue_on_error = False): 3 | self.data = data 4 | self.continue_on_error = continue_on_error -------------------------------------------------------------------------------- /skyflow/utils/enums/redaction_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class RedactionType(Enum): 4 | PLAIN_TEXT = 'PLAIN_TEXT' 5 | MASKED = 'MASKED' 6 | DEFAULT = 'DEFAULT' 7 | REDACTED = 'REDACTED' 8 | -------------------------------------------------------------------------------- /skyflow/utils/enums/token_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class TokenType(Enum): 4 | VAULT_TOKEN = "vault_token" 5 | ENTITY_UNIQUE_COUNTER = "entity_unq_counter" 6 | ENTITY_ONLY = "entity_only" 7 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_byot.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | V1Byot = typing.Union[typing.Literal["DISABLE", "ENABLE", "ENABLE_STRICT"], typing.Any] 6 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: main 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | test: 10 | uses: ./.github/workflows/shared-tests.yml 11 | with: 12 | python-version: '3.8' 13 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_member_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | V1MemberType = typing.Union[typing.Literal["NONE", "USER", "SERVICE_ACCOUNT"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/context_access_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ContextAccessType = typing.Union[typing.Literal["ACCESS_NONE", "API", "SQL"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/vault/tokens/__init__.py: -------------------------------------------------------------------------------- 1 | from ._detokenize_request import DetokenizeRequest 2 | from ._detokenize_response import DetokenizeResponse 3 | from ._tokenize_request import TokenizeRequest 4 | from ._tokenize_response import TokenizeResponse -------------------------------------------------------------------------------- /skyflow/generated/rest/types/batch_record_method.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | BatchRecordMethod = typing.Union[typing.Literal["NONE", "POST", "PUT", "GET", "DELETE"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_transformations.py: -------------------------------------------------------------------------------- 1 | from skyflow.vault.detect._date_transformation import DateTransformation 2 | 3 | class Transformations: 4 | def __init__(self, shift_dates: DateTransformation): 5 | self.shift_dates = shift_dates 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/detect_runs_response_output_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DetectRunsResponseOutputType = typing.Union[typing.Literal["UNKNOWN", "BASE64"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_audio_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifyAudioDataFormat = typing.Union[typing.Literal["mp3", "wav"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/shift_dates_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ShiftDatesEntityTypesItem = typing.Union[typing.Literal["date", "date_interval", "dob"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/strings/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .types import DeidentifyStringRequestEntityTypesItem 6 | 7 | __all__ = ["DeidentifyStringRequestEntityTypesItem"] 8 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/context_auth_mode.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ContextAuthMode = typing.Union[typing.Literal["AUTH_NONE", "OKTA_JWT", "SERVICE_ACCOUNT_JWT", "PAT_JWT"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/detect_guardrails_response_validation.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DetectGuardrailsResponseValidation = typing.Union[typing.Literal["failed", "passed"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/reidentify_file_response_output_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ReidentifyFileResponseOutputType = typing.Union[typing.Literal["UNKNOWN", "BASE64"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/redaction_enum_redaction.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RedactionEnumRedaction = typing.Union[typing.Literal["DEFAULT", "REDACTED", "MASKED", "PLAIN_TEXT"], typing.Any] 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | python_dateutil >= 2.5.3 2 | setuptools >= 21.0.0 3 | urllib3 >= 1.25.3, < 2.1.0 4 | pydantic >= 2 5 | typing-extensions >= 4.7.1 6 | DateTime~=5.5 7 | PyJWT~=2.9.0 8 | requests~=2.32.3 9 | coverage 10 | cryptography 11 | python-dotenv~=1.0.1 12 | httpx -------------------------------------------------------------------------------- /skyflow/generated/rest/types/detect_runs_response_status.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DetectRunsResponseStatus = typing.Union[typing.Literal["UNKNOWN", "FAILED", "SUCCESS", "IN_PROGRESS"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_document_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifyDocumentDataFormat = typing.Union[typing.Literal["pdf", "doc", "docx"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_presentation_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifyPresentationDataFormat = typing.Union[typing.Literal["ppt", "pptx"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/token_type_mapping_default.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | TokenTypeMappingDefault = typing.Union[typing.Literal["entity_unq_counter", "entity_only", "vault_token"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_spreadsheet_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifySpreadsheetDataFormat = typing.Union[typing.Literal["csv", "xls", "xlsx"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_structured_text_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifyStructuredTextDataFormat = typing.Union[typing.Literal["json", "xml"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/reidentify_file_response_status.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ReidentifyFileResponseStatus = typing.Union[typing.Literal["UNKNOWN", "FAILED", "SUCCESS", "IN_PROGRESS"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/utils/enums/content_types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class ContentType(Enum): 4 | JSON = 'application/json' 5 | PLAINTEXT = 'text/plain' 6 | XML = 'text/xml' 7 | URLENCODED = 'application/x-www-form-urlencoded' 8 | FORMDATA = 'multipart/form-data' -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | If you discover a potential security issue in this project, please reach out to us at security@skyflow.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them. -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_image_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDeidentifyImageDataFormat = typing.Union[typing.Literal["jpg", "jpeg", "tif", "tiff", "png", "bmp"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/records/types/record_service_bulk_get_record_request_order_by.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RecordServiceBulkGetRecordRequestOrderBy = typing.Union[typing.Literal["ASCENDING", "DESCENDING", "NONE"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/environment.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import enum 4 | 5 | 6 | class SkyflowEnvironment(enum.Enum): 7 | PRODUCTION = "https://identifier.vault.skyflowapis.com" 8 | SANDBOX = "https://identifier.vault.skyflowapis-preview.com" 9 | -------------------------------------------------------------------------------- /skyflow/generated/rest/strings/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .deidentify_string_request_entity_types_item import DeidentifyStringRequestEntityTypesItem 6 | 7 | __all__ = ["DeidentifyStringRequestEntityTypesItem"] 8 | -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_sort_ops_order_by.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestSortOpsOrderBy = typing.Union[typing.Literal["ASCENDING", "DESCENDING"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_masking_method.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileImageRequestDeidentifyImageMaskingMethod = typing.Union[typing.Literal["blur", "blackbox"], typing.Any] 6 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_reidentify_file_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataReidentifyFileDataFormat = typing.Union[ 6 | typing.Literal["txt", "csv", "json", "xls", "xlsx", "doc", "docx", "xml"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/generated/rest/records/types/record_service_get_record_request_redaction.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RecordServiceGetRecordRequestRedaction = typing.Union[ 6 | typing.Literal["DEFAULT", "REDACTED", "MASKED", "PLAIN_TEXT"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/generated/rest/records/types/record_service_bulk_get_record_request_redaction.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RecordServiceBulkGetRecordRequestRedaction = typing.Union[ 6 | typing.Literal["DEFAULT", "REDACTED", "MASKED", "PLAIN_TEXT"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/detokenize_record_response_value_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DetokenizeRecordResponseValueType = typing.Union[ 6 | typing.Literal["NONE", "STRING", "INTEGER", "FLOAT", "BOOL", "DATETIME", "JSON", "ARRAY", "DATE"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/vault/data/_query_response.py: -------------------------------------------------------------------------------- 1 | class QueryResponse: 2 | def __init__(self): 3 | self.fields = [] 4 | self.errors = None 5 | 6 | def __repr__(self): 7 | return f"QueryResponse(fields={self.fields}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | -------------------------------------------------------------------------------- /skyflow/utils/enums/detect_output_transcriptions.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class DetectOutputTranscriptions(Enum): 4 | DIARIZED_TRANSCRIPTION = "diarized_transcription" 5 | MEDICAL_DIARIZED_TRANSCRIPTION = "medical_diarized_transcription" 6 | MEDICAL_TRANSCRIPTION = "medical_transcription" 7 | TRANSCRIPTION = "transcription" -------------------------------------------------------------------------------- /skyflow/vault/detect/_text_index.py: -------------------------------------------------------------------------------- 1 | class TextIndex: 2 | def __init__(self, start: int, end: int): 3 | self.start = start 4 | self.end = end 5 | 6 | def __repr__(self): 7 | return f"TextIndex(start={self.start}, end={self.end})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_filter_ops_context_actor_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestFilterOpsContextActorType = typing.Union[ 6 | typing.Literal["NONE", "USER", "SERVICE_ACCOUNT"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_date_transformation.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from skyflow.utils.enums.detect_entities import DetectEntities 3 | 4 | class DateTransformation: 5 | def __init__(self, max_days: int, min_days: int, entities: List[DetectEntities]): 6 | self.max = max_days 7 | self.min = min_days 8 | self.entities = entities 9 | -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_filter_ops_context_access_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestFilterOpsContextAccessType = typing.Union[ 6 | typing.Literal["ACCESS_NONE", "API", "SQL", "OKTA_LOGIN"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/utils/_helpers.py: -------------------------------------------------------------------------------- 1 | from urllib.parse import urlparse 2 | 3 | def get_base_url(url): 4 | parsed_url = urlparse(url) 5 | base_url = f"{parsed_url.scheme}://{parsed_url.netloc}" 6 | return base_url 7 | 8 | def format_scope(scopes): 9 | if not scopes: 10 | return None 11 | return " ".join([f"role:{scope}" for scope in scopes]) -------------------------------------------------------------------------------- /skyflow/vault/data/_get_response.py: -------------------------------------------------------------------------------- 1 | class GetResponse: 2 | def __init__(self, data=None, errors = None): 3 | self.data = data if data else [] 4 | self.errors = errors 5 | 6 | def __repr__(self): 7 | return f"GetResponse(data={self.data}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() -------------------------------------------------------------------------------- /skyflow/utils/enums/env.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | class Env(Enum): 4 | DEV = 'DEV' 5 | SANDBOX = 'SANDBOX' 6 | PROD = 'PROD' 7 | STAGE = 'STAGE' 8 | 9 | class EnvUrls(Enum): 10 | PROD = "vault.skyflowapis.com" 11 | SANDBOX = "vault.skyflowapis-preview.com" 12 | DEV = "vault.skyflowapis.dev" 13 | STAGE = "vault.skyflowapis.tech" -------------------------------------------------------------------------------- /skyflow/vault/detect/_reidentify_text_response.py: -------------------------------------------------------------------------------- 1 | class ReidentifyTextResponse: 2 | def __init__(self, processed_text: str): 3 | self.processed_text = processed_text 4 | 5 | def __repr__(self) -> str: 6 | return f"ReidentifyTextResponse(processed_text='{self.processed_text}')" 7 | 8 | def __str__(self) -> str: 9 | return self.__repr__() -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_filter_ops_context_auth_mode.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestFilterOpsContextAuthMode = typing.Union[ 6 | typing.Literal["AUTH_NONE", "OKTA_JWT", "SERVICE_ACCOUNT_JWT", "PAT_JWT"], typing.Any 7 | ] 8 | -------------------------------------------------------------------------------- /skyflow/vault/data/_delete_response.py: -------------------------------------------------------------------------------- 1 | class DeleteResponse: 2 | def __init__(self, deleted_ids = None, errors = None): 3 | self.deleted_ids = deleted_ids 4 | self.errors = errors 5 | 6 | def __repr__(self): 7 | return f"DeleteResponse(deleted_ids={self.deleted_ids}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | 12 | -------------------------------------------------------------------------------- /skyflow/vault/data/_update_response.py: -------------------------------------------------------------------------------- 1 | class UpdateResponse: 2 | def __init__(self, updated_field = None, errors=None): 3 | self.updated_field = updated_field 4 | self.errors = errors 5 | 6 | def __repr__(self): 7 | return f"UpdateResponse(updated_field={self.updated_field}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | -------------------------------------------------------------------------------- /skyflow/vault/data/_update_request.py: -------------------------------------------------------------------------------- 1 | from skyflow.utils.enums import TokenMode 2 | 3 | class UpdateRequest: 4 | def __init__(self, table, data, tokens = None, return_tokens = False, token_mode = TokenMode.DISABLE): 5 | self.table = table 6 | self.data = data 7 | self.tokens = tokens 8 | self.return_tokens = return_tokens 9 | self.token_mode = token_mode 10 | -------------------------------------------------------------------------------- /skyflow/vault/data/_insert_response.py: -------------------------------------------------------------------------------- 1 | class InsertResponse: 2 | def __init__(self, inserted_fields = None, errors=None): 3 | self.inserted_fields = inserted_fields 4 | self.errors = errors 5 | 6 | def __repr__(self): 7 | return f"InsertResponse(inserted_fields={self.inserted_fields}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Public Release 2 | 3 | on: 4 | push: 5 | tags: "*.*.*" 6 | paths-ignore: 7 | - "setup.py" 8 | - "*.yml" 9 | - "*.md" 10 | - "skyflow/utils/_version.py" 11 | 12 | jobs: 13 | build-and-deploy: 14 | uses: ./.github/workflows/shared-build-and-deploy.yml 15 | with: 16 | ref: main 17 | tag: 'public' 18 | secrets: inherit 19 | -------------------------------------------------------------------------------- /skyflow/generated/rest/errors/not_found_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | from ..core.api_error import ApiError 6 | 7 | 8 | class NotFoundError(ApiError): 9 | def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None): 10 | super().__init__(status_code=404, headers=headers, body=body) 11 | -------------------------------------------------------------------------------- /skyflow/generated/rest/errors/bad_request_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | from ..core.api_error import ApiError 6 | 7 | 8 | class BadRequestError(ApiError): 9 | def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None): 10 | super().__init__(status_code=400, headers=headers, body=body) 11 | -------------------------------------------------------------------------------- /skyflow/generated/rest/errors/unauthorized_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | from ..core.api_error import ApiError 6 | 7 | 8 | class UnauthorizedError(ApiError): 9 | def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None): 10 | super().__init__(status_code=401, headers=headers, body=body) 11 | -------------------------------------------------------------------------------- /skyflow/vault/data/_file_upload_response.py: -------------------------------------------------------------------------------- 1 | class FileUploadResponse: 2 | def __init__(self, 3 | skyflow_id, 4 | errors): 5 | self.skyflow_id = skyflow_id 6 | self.errors = errors 7 | 8 | def __repr__(self): 9 | return f"FileUploadResponse(skyflow_id={self.skyflow_id}, errors={self.errors})" 10 | 11 | def __str__(self): 12 | return self.__repr__() -------------------------------------------------------------------------------- /skyflow/generated/rest/core/remove_none_from_dict.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from typing import Any, Dict, Mapping, Optional 4 | 5 | 6 | def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]: 7 | new: Dict[str, Any] = {} 8 | for key, value in original.items(): 9 | if value is not None: 10 | new[key] = value 11 | return new 12 | -------------------------------------------------------------------------------- /skyflow/vault/tokens/_tokenize_response.py: -------------------------------------------------------------------------------- 1 | class TokenizeResponse: 2 | def __init__(self, tokenized_fields = None, errors = None): 3 | self.tokenized_fields = tokenized_fields 4 | self.errors = errors 5 | 6 | 7 | def __repr__(self): 8 | return f"TokenizeResponse(tokenized_fields={self.tokenized_fields}, errors={self.errors})" 9 | 10 | def __str__(self): 11 | return self.__repr__() 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/beta-release.yml: -------------------------------------------------------------------------------- 1 | name: Public Beta Release 2 | 3 | on: 4 | push: 5 | tags: '*.*.*b*' 6 | paths-ignore: 7 | - "setup.py" 8 | - "*.yml" 9 | - "*.md" 10 | - "skyflow/utils/_version.py" 11 | 12 | jobs: 13 | build-and-deploy: 14 | uses: ./.github/workflows/shared-build-and-deploy.yml 15 | with: 16 | ref: ${{ github.ref_name }} 17 | tag: 'beta' 18 | secrets: inherit 19 | -------------------------------------------------------------------------------- /skyflow/generated/rest/errors/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .bad_request_error import BadRequestError 6 | from .internal_server_error import InternalServerError 7 | from .not_found_error import NotFoundError 8 | from .unauthorized_error import UnauthorizedError 9 | 10 | __all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "UnauthorizedError"] 11 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_output_transcription.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription = typing.Union[ 6 | typing.Literal[ 7 | "transcription", "medical_transcription", "diarized_transcription", "medical_diarized_transcription" 8 | ], 9 | typing.Any, 10 | ] 11 | -------------------------------------------------------------------------------- /skyflow/vault/tokens/_detokenize_response.py: -------------------------------------------------------------------------------- 1 | class DetokenizeResponse: 2 | def __init__(self, detokenized_fields = None, errors = None): 3 | self.detokenized_fields = detokenized_fields 4 | self.errors = errors 5 | 6 | def __repr__(self): 7 | return f"DetokenizeResponse(detokenized_fields={self.detokenized_fields}, errors={self.errors})" 8 | 9 | def __str__(self): 10 | return self.__repr__() 11 | 12 | 13 | -------------------------------------------------------------------------------- /skyflow/generated/rest/errors/internal_server_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | from ..core.api_error import ApiError 6 | from ..types.error_response import ErrorResponse 7 | 8 | 9 | class InternalServerError(ApiError): 10 | def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None): 11 | super().__init__(status_code=500, headers=headers, body=body) 12 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_audio_bleep.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | class Bleep: 4 | def __init__( 5 | self, 6 | gain: Optional[float] = None, 7 | frequency: Optional[float] = None, 8 | start_padding: Optional[float] = None, 9 | stop_padding: Optional[float] = None 10 | ): 11 | self.gain = gain 12 | self.frequency = frequency 13 | self.start_padding = start_padding 14 | self.stop_padding = stop_padding -------------------------------------------------------------------------------- /skyflow/service_account/client/auth_client.py: -------------------------------------------------------------------------------- 1 | from skyflow.generated.rest.client import Skyflow 2 | from skyflow.utils.constants import OPTIONAL_TOKEN 3 | 4 | class AuthClient: 5 | def __init__(self, url): 6 | self.__url = url 7 | self.__api_client = self.initialize_api_client() 8 | 9 | def initialize_api_client(self): 10 | return Skyflow(base_url=self.__url, token=OPTIONAL_TOKEN) 11 | 12 | def get_auth_api(self): 13 | return self.__api_client.authentication -------------------------------------------------------------------------------- /skyflow/vault/connection/_invoke_connection_response.py: -------------------------------------------------------------------------------- 1 | class InvokeConnectionResponse: 2 | def __init__(self, data=None, metadata=None, errors=None): 3 | self.data = data 4 | self.metadata = metadata if metadata else {} 5 | self.errors = errors if errors else None 6 | 7 | def __repr__(self): 8 | return f"ConnectionResponse('data'={self.data},'metadata'={self.metadata}), 'errors'={self.errors})" 9 | 10 | def __str__(self): 11 | return self.__repr__() -------------------------------------------------------------------------------- /skyflow/generated/rest/records/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .types import ( 6 | RecordServiceBulkGetRecordRequestOrderBy, 7 | RecordServiceBulkGetRecordRequestRedaction, 8 | RecordServiceGetRecordRequestRedaction, 9 | ) 10 | 11 | __all__ = [ 12 | "RecordServiceBulkGetRecordRequestOrderBy", 13 | "RecordServiceBulkGetRecordRequestRedaction", 14 | "RecordServiceGetRecordRequestRedaction", 15 | ] 16 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_file_av_scan_status.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | V1FileAvScanStatus = typing.Union[ 6 | typing.Literal[ 7 | "SCAN_NONE", 8 | "SCAN_CLEAN", 9 | "SCAN_INFECTED", 10 | "SCAN_DELETED", 11 | "SCAN_ERROR", 12 | "SCAN_PENDING", 13 | "SCAN_UNSCANNABLE", 14 | "SCAN_FILE_NOT_FOUND", 15 | "SCAN_INVALID", 16 | ], 17 | typing.Any, 18 | ] 19 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/deidentified_file_output_processed_file_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifiedFileOutputProcessedFileType = typing.Union[ 6 | typing.Literal[ 7 | "redacted_audio", 8 | "redacted_image", 9 | "redacted_transcription", 10 | "redacted_file", 11 | "redacted_text", 12 | "entities", 13 | "redacted_transcription_diarize_json", 14 | ], 15 | typing.Any, 16 | ] 17 | -------------------------------------------------------------------------------- /.github/workflows/internal-release.yml: -------------------------------------------------------------------------------- 1 | name: Internal Release 2 | 3 | on: 4 | push: 5 | tags-ignore: 6 | - '*.*' 7 | paths-ignore: 8 | - "setup.py" 9 | - "*.yml" 10 | - "*.md" 11 | - "skyflow/utils/_version.py" 12 | - "samples/**" 13 | branches: 14 | - release/* 15 | 16 | jobs: 17 | build-and-deploy: 18 | uses: ./.github/workflows/shared-build-and-deploy.yml 19 | with: 20 | ref: ${{ github.ref_name }} 21 | tag: 'internal' 22 | secrets: inherit 23 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/force_multipart.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | 4 | class ForceMultipartDict(dict): 5 | """ 6 | A dictionary subclass that always evaluates to True in boolean contexts. 7 | 8 | This is used to force multipart/form-data encoding in HTTP requests even when 9 | the dictionary is empty, which would normally evaluate to False. 10 | """ 11 | 12 | def __bool__(self): 13 | return True 14 | 15 | 16 | FORCE_MULTIPART = ForceMultipartDict() 17 | -------------------------------------------------------------------------------- /skyflow/utils/enums/__init__.py: -------------------------------------------------------------------------------- 1 | from .env import Env, EnvUrls 2 | from .log_level import LogLevel 3 | from .content_types import ContentType 4 | from .detect_entities import DetectEntities 5 | from .token_mode import TokenMode 6 | from .token_type import TokenType 7 | from .request_method import RequestMethod 8 | from .redaction_type import RedactionType 9 | from .detect_entities import DetectEntities 10 | from .detect_output_transcriptions import DetectOutputTranscriptions 11 | from .masking_method import MaskingMethod 12 | from .token_type import TokenType -------------------------------------------------------------------------------- /skyflow/vault/connection/_invoke_connection_request.py: -------------------------------------------------------------------------------- 1 | class InvokeConnectionRequest: 2 | def __init__(self, 3 | method, 4 | body = None, 5 | path_params = None, 6 | query_params = None, 7 | headers = None): 8 | self.body = body if body is not None else {} 9 | self.method = method 10 | self.path_params = path_params if path_params is not None else {} 11 | self.query_params = query_params if query_params is not None else {} 12 | self.headers = headers if headers is not None else {} -------------------------------------------------------------------------------- /skyflow/generated/rest/records/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .record_service_bulk_get_record_request_order_by import RecordServiceBulkGetRecordRequestOrderBy 6 | from .record_service_bulk_get_record_request_redaction import RecordServiceBulkGetRecordRequestRedaction 7 | from .record_service_get_record_request_redaction import RecordServiceGetRecordRequestRedaction 8 | 9 | __all__ = [ 10 | "RecordServiceBulkGetRecordRequestOrderBy", 11 | "RecordServiceBulkGetRecordRequestRedaction", 12 | "RecordServiceGetRecordRequestRedaction", 13 | ] 14 | -------------------------------------------------------------------------------- /skyflow/vault/data/__init__.py: -------------------------------------------------------------------------------- 1 | from ._insert_response import InsertResponse 2 | from ._insert_request import InsertRequest 3 | from ._get_request import GetRequest 4 | from ._get_response import GetResponse 5 | from ._delete_request import DeleteRequest 6 | from ._delete_response import DeleteResponse 7 | from ._update_request import UpdateRequest 8 | from ._update_response import UpdateResponse 9 | from ._upload_file_request import UploadFileRequest 10 | from ._query_request import QueryRequest 11 | from ._query_response import QueryResponse 12 | from ._file_upload_request import FileUploadRequest 13 | from ._file_upload_response import FileUploadResponse -------------------------------------------------------------------------------- /skyflow/vault/detect/_reidentify_text_request.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | from skyflow.utils.enums.detect_entities import DetectEntities 3 | 4 | class ReidentifyTextRequest: 5 | def __init__(self, text: str, 6 | redacted_entities: Optional[List[DetectEntities]] = None, 7 | masked_entities: Optional[List[DetectEntities]] = None, 8 | plain_text_entities: Optional[List[DetectEntities]] = None): 9 | self.text = text 10 | self.redacted_entities = redacted_entities 11 | self.masked_entities = masked_entities 12 | self.plain_text_entities = plain_text_entities 13 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_data_format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FileDataDataFormat = typing.Union[ 6 | typing.Literal[ 7 | "mp3", 8 | "wav", 9 | "pdf", 10 | "txt", 11 | "csv", 12 | "json", 13 | "jpg", 14 | "jpeg", 15 | "tif", 16 | "tiff", 17 | "png", 18 | "bmp", 19 | "xls", 20 | "xlsx", 21 | "doc", 22 | "docx", 23 | "ppt", 24 | "pptx", 25 | "xml", 26 | "dcm", 27 | "jsonl", 28 | ], 29 | typing.Any, 30 | ] 31 | -------------------------------------------------------------------------------- /skyflow/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from ..utils.enums import LogLevel, Env, TokenType 2 | from ._skyflow_messages import SkyflowMessages 3 | from ._version import SDK_VERSION 4 | from ._helpers import get_base_url, format_scope 5 | from ._utils import get_credentials, get_vault_url, construct_invoke_connection_request, get_metrics, parse_insert_response, handle_exception, parse_update_record_response, parse_delete_response, parse_detokenize_response, parse_tokenize_response, parse_query_response, parse_get_response, parse_invoke_connection_response, validate_api_key, encode_column_values, parse_deidentify_text_response, parse_reidentify_text_response, convert_detected_entity_to_entity_info 6 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_token_format.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from skyflow.utils.enums.detect_entities import DetectEntities 3 | from skyflow.utils.enums.token_type import TokenType 4 | 5 | class TokenFormat: 6 | def __init__(self, default: TokenType = TokenType.ENTITY_UNIQUE_COUNTER, 7 | vault_token: List[DetectEntities] = None, 8 | entity_unique_counter: List[DetectEntities] = None, 9 | entity_only: List[DetectEntities] = None): 10 | self.default = default 11 | self.vault_token = vault_token 12 | self.entity_unique_counter = entity_unique_counter 13 | self.entity_only = entity_only 14 | -------------------------------------------------------------------------------- /skyflow/vault/data/_file_upload_request.py: -------------------------------------------------------------------------------- 1 | from typing import BinaryIO 2 | 3 | class FileUploadRequest: 4 | def __init__(self, 5 | table: str, 6 | skyflow_id: str, 7 | column_name: str, 8 | file_path: str= None, 9 | base64: str= None, 10 | file_object: BinaryIO= None, 11 | file_name: str= None): 12 | self.table = table 13 | self.skyflow_id = skyflow_id 14 | self.column_name = column_name 15 | self.file_path = file_path 16 | self.base64 = base64 17 | self.file_object = file_object 18 | self.file_name = file_name 19 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/request_action_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RequestActionType = typing.Union[ 6 | typing.Literal[ 7 | "NONE", 8 | "ASSIGN", 9 | "CREATE", 10 | "DELETE", 11 | "EXECUTE", 12 | "LIST", 13 | "READ", 14 | "UNASSIGN", 15 | "UPDATE", 16 | "VALIDATE", 17 | "LOGIN", 18 | "ROTATE", 19 | "SCHEDULEROTATION", 20 | "SCHEDULEROTATIONALERT", 21 | "IMPORT", 22 | "GETIMPORTPARAMETERS", 23 | "PING", 24 | "GETCLOUDPROVIDER", 25 | ], 26 | typing.Any, 27 | ] 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/deidentified_file_output_processed_file_extension.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifiedFileOutputProcessedFileExtension = typing.Union[ 6 | typing.Literal[ 7 | "mp3", 8 | "wav", 9 | "pdf", 10 | "txt", 11 | "csv", 12 | "json", 13 | "jpg", 14 | "jpeg", 15 | "tif", 16 | "tiff", 17 | "png", 18 | "bmp", 19 | "xls", 20 | "xlsx", 21 | "doc", 22 | "docx", 23 | "ppt", 24 | "pptx", 25 | "xml", 26 | "dcm", 27 | ], 28 | typing.Any, 29 | ] 30 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/reidentified_file_output_processed_file_extension.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | ReidentifiedFileOutputProcessedFileExtension = typing.Union[ 6 | typing.Literal[ 7 | "mp3", 8 | "wav", 9 | "pdf", 10 | "txt", 11 | "csv", 12 | "json", 13 | "jpg", 14 | "jpeg", 15 | "tif", 16 | "tiff", 17 | "png", 18 | "bmp", 19 | "xls", 20 | "xlsx", 21 | "doc", 22 | "docx", 23 | "ppt", 24 | "pptx", 25 | "xml", 26 | "dcm", 27 | ], 28 | typing.Any, 29 | ] 30 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | 2 | ======= 3 | Skyflow 4 | ======= 5 | 6 | This is the Python SDK for the `Skyflow API `_. 7 | 8 | Getting Started 9 | --------------- 10 | You can install the package using the following command :: 11 | 12 | $ pip install skyflow 13 | 14 | What you need 15 | ------------- 16 | - A Skyflow account (You can also request for a demo `here `_) 17 | 18 | - A Skyflow Service Account 19 | 20 | Resources 21 | --------- 22 | - You can find the source code with examples at the official `Github `_ repository. 23 | - Checkout the official `Skyflow docs `_ for API Reference 24 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/error_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .error_response_error import ErrorResponseError 8 | 9 | 10 | class ErrorResponse(UniversalBaseModel): 11 | error: ErrorResponseError 12 | 13 | if IS_PYDANTIC_V2: 14 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 15 | else: 16 | 17 | class Config: 18 | frozen = True 19 | smart_union = True 20 | extra = pydantic.Extra.allow 21 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/api_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from typing import Any, Dict, Optional 4 | 5 | 6 | class ApiError(Exception): 7 | headers: Optional[Dict[str, str]] 8 | status_code: Optional[int] 9 | body: Any 10 | 11 | def __init__( 12 | self, 13 | *, 14 | headers: Optional[Dict[str, str]] = None, 15 | status_code: Optional[int] = None, 16 | body: Any = None, 17 | ) -> None: 18 | self.headers = headers 19 | self.status_code = status_code 20 | self.body = body 21 | 22 | def __str__(self) -> str: 23 | return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}" 24 | -------------------------------------------------------------------------------- /skyflow/utils/validations/__init__.py: -------------------------------------------------------------------------------- 1 | from ._validations import ( 2 | validate_vault_config, 3 | validate_insert_request, 4 | validate_connection_config, 5 | validate_update_vault_config, 6 | validate_update_connection_config, 7 | validate_credentials, 8 | validate_log_level, 9 | validate_delete_request, 10 | validate_query_request, 11 | validate_get_request, 12 | validate_update_request, 13 | validate_detokenize_request, 14 | validate_tokenize_request, 15 | validate_file_upload_request, 16 | validate_invoke_connection_params, 17 | validate_deidentify_text_request, 18 | validate_reidentify_text_request, 19 | validate_deidentify_file_request, 20 | validate_get_detect_run_request, 21 | ) -------------------------------------------------------------------------------- /skyflow/vault/detect/_file_input.py: -------------------------------------------------------------------------------- 1 | from io import BufferedReader 2 | 3 | class FileInput: 4 | """ 5 | Represents a file input for the vault detection process. 6 | 7 | Attributes: 8 | file (BufferedReader): The file object to be processed. This can be a file-like object or a binary string. 9 | file_path (str): The path to the file to be processed. 10 | """ 11 | 12 | def __init__(self, file: BufferedReader= None, file_path: str = None): 13 | self.file = file 14 | self.file_path = file_path 15 | 16 | def __repr__(self) -> str: 17 | return f"FileInput(file={self.file!r}, file_path={self.file_path!r})" 18 | 19 | def __str__(self) -> str: 20 | return self.__repr__() 21 | -------------------------------------------------------------------------------- /skyflow/vault/detect/__init__.py: -------------------------------------------------------------------------------- 1 | from ._date_transformation import DateTransformation 2 | from ._deidentify_text_request import DeidentifyTextRequest 3 | from ._deidentify_text_response import DeidentifyTextResponse 4 | from ._entity_info import EntityInfo 5 | from ._reidentify_text_request import ReidentifyTextRequest 6 | from ._reidentify_text_response import ReidentifyTextResponse 7 | from ._text_index import TextIndex 8 | from ._token_format import TokenFormat 9 | from ._transformations import Transformations 10 | from ._deidentify_file_request import DeidentifyFileRequest 11 | from ._audio_bleep import Bleep 12 | from ._deidentify_file_response import DeidentifyFileResponse 13 | from ._get_detect_run_request import GetDetectRunRequest 14 | from ._file_input import FileInput -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | # custom words file 3 | ignore-words-list = Skyflow,skyflow,skyflowapi,skyflowapis,deidentify,reidentify,detokenize,upsert,upserting,binlookup,byot,creds,fpe,devsecops,formdata,vaultid,dotenv,usecwd,runid,dateutil,Homogenous 4 | 5 | # Skip these files and folders 6 | skip = .git,.venv,venv,env,__pycache__,*.pyc,*.egg-info,dist,build,.idea,.vscode,*.log,requirements.txt,./skyflow/generated,setup.py 7 | 8 | # If you want to verify it is working, you can uncomment this line to see what files it checks 9 | # count = 10 | 11 | # Ignore lines that match these patterns 12 | # This ignores lines with long alphanumeric strings or UUIDs 13 | ignore-regex = \b[A-Z0-9]{20,}\b|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|\b[A-Za-z0-9_]{7,}\b(?=]) -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_filter_ops_action_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestFilterOpsActionType = typing.Union[ 6 | typing.Literal[ 7 | "NONE", 8 | "ASSIGN", 9 | "CREATE", 10 | "DELETE", 11 | "EXECUTE", 12 | "LIST", 13 | "READ", 14 | "UNASSIGN", 15 | "UPDATE", 16 | "VALIDATE", 17 | "LOGIN", 18 | "ROTATE", 19 | "SCHEDULEROTATION", 20 | "SCHEDULEROTATIONALERT", 21 | "IMPORT", 22 | "GETIMPORTPARAMETERS", 23 | "PING", 24 | "GETCLOUDPROVIDER", 25 | ], 26 | typing.Any, 27 | ] 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_tokenize_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1TokenizeRecordResponse(UniversalBaseModel): 10 | token: typing.Optional[str] = pydantic.Field(default=None) 11 | """ 12 | Token corresponding to a value. 13 | """ 14 | 15 | if IS_PYDANTIC_V2: 16 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 17 | else: 18 | 19 | class Config: 20 | frozen = True 21 | smart_union = True 22 | extra = pydantic.Extra.allow 23 | -------------------------------------------------------------------------------- /skyflow/vault/data/_insert_request.py: -------------------------------------------------------------------------------- 1 | from skyflow.utils.enums import TokenMode 2 | 3 | class InsertRequest: 4 | def __init__(self, 5 | table, 6 | values, 7 | tokens = None, 8 | upsert = None, 9 | homogeneous = False, 10 | token_mode = TokenMode.DISABLE, 11 | return_tokens = True, 12 | continue_on_error = False): 13 | self.table = table 14 | self.values = values 15 | self.tokens = tokens 16 | self.upsert = upsert 17 | self.homogeneous = homogeneous 18 | self.token_mode = token_mode 19 | self.return_tokens = return_tokens 20 | self.continue_on_error = continue_on_error 21 | 22 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_deidentify_text_response.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from ._entity_info import EntityInfo 3 | 4 | class DeidentifyTextResponse: 5 | def __init__(self, 6 | processed_text: str, 7 | entities: List[EntityInfo], 8 | word_count: int, 9 | char_count: int): 10 | self.processed_text = processed_text 11 | self.entities = entities 12 | self.word_count = word_count 13 | self.char_count = char_count 14 | 15 | def __repr__(self): 16 | return f"DeidentifyTextResponse(processed_text='{self.processed_text}', entities={self.entities}, word_count={self.word_count}, char_count={self.char_count})" 17 | 18 | def __str__(self): 19 | return self.__repr__() -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_get_file_scan_status_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_file_av_scan_status import V1FileAvScanStatus 8 | 9 | 10 | class V1GetFileScanStatusResponse(UniversalBaseModel): 11 | av_scan_status: typing.Optional[V1FileAvScanStatus] = None 12 | 13 | if IS_PYDANTIC_V2: 14 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 15 | else: 16 | 17 | class Config: 18 | frozen = True 19 | smart_union = True 20 | extra = pydantic.Extra.allow 21 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/identify_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class IdentifyResponse(UniversalBaseModel): 10 | """ 11 | Response after identifying text. 12 | """ 13 | 14 | text: str = pydantic.Field() 15 | """ 16 | Re-identified text. 17 | """ 18 | 19 | if IS_PYDANTIC_V2: 20 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 21 | else: 22 | 23 | class Config: 24 | frozen = True 25 | smart_union = True 26 | extra = pydantic.Extra.allow 27 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/protobuf_any.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class ProtobufAny(UniversalBaseModel): 12 | type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="@type")] = None 13 | 14 | if IS_PYDANTIC_V2: 15 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 16 | else: 17 | 18 | class Config: 19 | frozen = True 20 | smart_union = True 21 | extra = pydantic.Extra.allow 22 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/transformations.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .shift_dates import ShiftDates 8 | 9 | 10 | class Transformations(UniversalBaseModel): 11 | """ 12 | Transformations to apply to detected entities. 13 | """ 14 | 15 | shift_dates: typing.Optional[ShiftDates] = None 16 | 17 | if IS_PYDANTIC_V2: 18 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 19 | else: 20 | 21 | class Config: 22 | frozen = True 23 | smart_union = True 24 | extra = pydantic.Extra.allow 25 | -------------------------------------------------------------------------------- /skyflow/error/_skyflow_error.py: -------------------------------------------------------------------------------- 1 | from skyflow.utils import SkyflowMessages 2 | from skyflow.utils.logger import log_error 3 | 4 | class SkyflowError(Exception): 5 | def __init__(self, 6 | message, 7 | http_code, 8 | request_id = None, 9 | grpc_code = None, 10 | http_status = None, 11 | details = []): 12 | self.message = message 13 | self.http_code = http_code 14 | self.grpc_code = grpc_code 15 | self.http_status = http_status if http_status else SkyflowMessages.HttpStatus.BAD_REQUEST.value 16 | self.details = details 17 | self.request_id = request_id 18 | log_error(message, http_code, request_id, grpc_code, http_status, details) 19 | super().__init__() -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI Checks 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | check-commit-message: 7 | name: Check Commit Message 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Check JIRA ID 11 | uses: gsactions/commit-message-checker@v1 12 | with: 13 | pattern: '(\[?[A-Z]{1,5}-[1-9][0-9]*)|(\[AUTOMATED\])|(Merge)|(Release).+$' 14 | flags: 'gm' 15 | excludeDescription: 'true' 16 | checkAllCommitMessages: 'true' 17 | accessToken: ${{ secrets.PAT_ACTIONS }} 18 | error: 'One of your your commit messages is not matching the format with JIRA ID Ex: ( SDK-123 commit message )' 19 | 20 | test: 21 | uses: ./.github/workflows/shared-tests.yml 22 | with: 23 | python-version: '3.8' 24 | secrets: inherit 25 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/googlerpc_status.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .protobuf_any import ProtobufAny 8 | 9 | 10 | class GooglerpcStatus(UniversalBaseModel): 11 | code: typing.Optional[int] = None 12 | message: typing.Optional[str] = None 13 | details: typing.Optional[typing.List[ProtobufAny]] = None 14 | 15 | if IS_PYDANTIC_V2: 16 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 17 | else: 18 | 19 | class Config: 20 | frozen = True 21 | smart_union = True 22 | extra = pydantic.Extra.allow 23 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_get_query_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_field_records import V1FieldRecords 8 | 9 | 10 | class V1GetQueryResponse(UniversalBaseModel): 11 | records: typing.Optional[typing.List[V1FieldRecords]] = pydantic.Field(default=None) 12 | """ 13 | Records returned by the query. 14 | """ 15 | 16 | if IS_PYDANTIC_V2: 17 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 18 | else: 19 | 20 | class Config: 21 | frozen = True 22 | smart_union = True 23 | extra = pydantic.Extra.allow 24 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/deidentify_file_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class DeidentifyFileResponse(UniversalBaseModel): 10 | """ 11 | Response to deidentify a file. 12 | """ 13 | 14 | run_id: typing.Optional[str] = pydantic.Field(default=None) 15 | """ 16 | Status URL for the Detect run. 17 | """ 18 | 19 | if IS_PYDANTIC_V2: 20 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 21 | else: 22 | 23 | class Config: 24 | frozen = True 25 | smart_union = True 26 | extra = pydantic.Extra.allow 27 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_bulk_get_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_field_records import V1FieldRecords 8 | 9 | 10 | class V1BulkGetRecordResponse(UniversalBaseModel): 11 | records: typing.Optional[typing.List[V1FieldRecords]] = pydantic.Field(default=None) 12 | """ 13 | The specified records. 14 | """ 15 | 16 | if IS_PYDANTIC_V2: 17 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 18 | else: 19 | 20 | class Config: 21 | frozen = True 22 | smart_union = True 23 | extra = pydantic.Extra.allow 24 | -------------------------------------------------------------------------------- /skyflow/vault/data/_get_request.py: -------------------------------------------------------------------------------- 1 | class GetRequest: 2 | def __init__(self, 3 | table, 4 | ids = None, 5 | redaction_type = None, 6 | return_tokens = False, 7 | fields = None, 8 | offset = None, 9 | limit = None, 10 | download_url = None, 11 | column_name = None, 12 | column_values = None): 13 | self.table = table 14 | self.ids = ids 15 | self.redaction_type = redaction_type 16 | self.return_tokens = return_tokens 17 | self.fields = fields 18 | self.offset = offset 19 | self.limit = limit 20 | self.download_url = download_url 21 | self.column_name = column_name 22 | self.column_values = column_values -------------------------------------------------------------------------------- /skyflow/vault/detect/_entity_info.py: -------------------------------------------------------------------------------- 1 | from typing import Dict 2 | from ._text_index import TextIndex 3 | 4 | class EntityInfo: 5 | def __init__(self, token: str, value: str, text_index: TextIndex, 6 | processed_index: TextIndex, entity: str, scores: Dict[str, float]): 7 | self.token = token 8 | self.value = value 9 | self.text_index = text_index 10 | self.processed_index = processed_index 11 | self.entity = entity 12 | self.scores = scores 13 | 14 | def __repr__(self) -> str: 15 | return (f"EntityInfo(token='{self.token}', value='{self.value}', " 16 | f"text_index={self.text_index}, processed_index={self.processed_index}, " 17 | f"entity='{self.entity}', scores={self.scores})") 18 | 19 | def __str__(self) -> str: 20 | return self.__repr__() -------------------------------------------------------------------------------- /.semgreprules/customRule.yml: -------------------------------------------------------------------------------- 1 | rules: 2 | - id: check-sensitive-info 3 | message: >- 4 | Potential sensitive information found: $1 5 | severity: ERROR 6 | languages: 7 | - yaml 8 | - go 9 | - javascript 10 | - java 11 | - python 12 | - golang 13 | - docker 14 | patterns: 15 | - pattern-regex: (?i)\b(api[_-]key|api[_-]token|api[_-]secret[_-]key|api[_-]password|token|secret[_-]key|password|auth[_-]key|auth[_-]token|AUTH_PASSWORD)\s*[:=]\s*(['"]?)((?!YOUR_EXCLUSION_PATTERN_HERE)[A-Z]+.*?)\2 16 | 17 | - id: check-logger-appconfig 18 | message: >- 19 | Potential Logging configuration found: $1 20 | severity: ERROR 21 | languages: 22 | - yaml 23 | - go 24 | - javascript 25 | - java 26 | - python 27 | - golang 28 | - docker 29 | patterns: 30 | - pattern-regex: log\.Logger\(\).*(appConfig).* 31 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/audit_event_data.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class AuditEventData(UniversalBaseModel): 10 | """ 11 | Any Sensitive data that needs to be wrapped. 12 | """ 13 | 14 | content: typing.Optional[str] = pydantic.Field(default=None) 15 | """ 16 | The entire body of the data requested or the query fired. 17 | """ 18 | 19 | if IS_PYDANTIC_V2: 20 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 21 | else: 22 | 23 | class Config: 24 | frozen = True 25 | smart_union = True 26 | extra = pydantic.Extra.allow 27 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_insert_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_record_meta_properties import V1RecordMetaProperties 8 | 9 | 10 | class V1InsertRecordResponse(UniversalBaseModel): 11 | records: typing.Optional[typing.List[V1RecordMetaProperties]] = pydantic.Field(default=None) 12 | """ 13 | Identifiers for the inserted records. 14 | """ 15 | 16 | if IS_PYDANTIC_V2: 17 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 18 | else: 19 | 20 | class Config: 21 | frozen = True 22 | smart_union = True 23 | extra = pydantic.Extra.allow 24 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_tokenize_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_tokenize_record_response import V1TokenizeRecordResponse 8 | 9 | 10 | class V1TokenizeResponse(UniversalBaseModel): 11 | records: typing.Optional[typing.List[V1TokenizeRecordResponse]] = pydantic.Field(default=None) 12 | """ 13 | Tokens corresponding to the specified values. 14 | """ 15 | 16 | if IS_PYDANTIC_V2: 17 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 18 | else: 19 | 20 | class Config: 21 | frozen = True 22 | smart_union = True 23 | extra = pydantic.Extra.allow 24 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_detokenize_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_detokenize_record_response import V1DetokenizeRecordResponse 8 | 9 | 10 | class V1DetokenizeResponse(UniversalBaseModel): 11 | records: typing.Optional[typing.List[V1DetokenizeRecordResponse]] = pydantic.Field(default=None) 12 | """ 13 | Records corresponding to the specified tokens. 14 | """ 15 | 16 | if IS_PYDANTIC_V2: 17 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 18 | else: 19 | 20 | class Config: 21 | frozen = True 22 | smart_union = True 23 | extra = pydantic.Extra.allow 24 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_delete_file_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1DeleteFileResponse(UniversalBaseModel): 10 | skyflow_id: typing.Optional[str] = pydantic.Field(default=None) 11 | """ 12 | ID of the record. 13 | """ 14 | 15 | deleted: typing.Optional[bool] = pydantic.Field(default=None) 16 | """ 17 | If `true`, the file was deleted. 18 | """ 19 | 20 | if IS_PYDANTIC_V2: 21 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 22 | else: 23 | 24 | class Config: 25 | frozen = True 26 | smart_union = True 27 | extra = pydantic.Extra.allow 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_bin_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_card import V1Card 8 | 9 | 10 | class V1BinListResponse(UniversalBaseModel): 11 | """ 12 | Response to the Get BIN request. 13 | """ 14 | 15 | cards_data: typing.Optional[typing.List[V1Card]] = pydantic.Field(default=None) 16 | """ 17 | Card metadata associated with the specified BIN. 18 | """ 19 | 20 | if IS_PYDANTIC_V2: 21 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 22 | else: 23 | 24 | class Config: 25 | frozen = True 26 | smart_union = True 27 | extra = pydantic.Extra.allow 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_delete_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1DeleteRecordResponse(UniversalBaseModel): 10 | skyflow_id: typing.Optional[str] = pydantic.Field(default=None) 11 | """ 12 | ID of the deleted record. 13 | """ 14 | 15 | deleted: typing.Optional[bool] = pydantic.Field(default=None) 16 | """ 17 | If `true`, the record was deleted. 18 | """ 19 | 20 | if IS_PYDANTIC_V2: 21 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 22 | else: 23 | 24 | class Config: 25 | frozen = True 26 | smart_union = True 27 | extra = pydantic.Extra.allow 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_detokenize_record_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .redaction_enum_redaction import RedactionEnumRedaction 8 | 9 | 10 | class V1DetokenizeRecordRequest(UniversalBaseModel): 11 | token: typing.Optional[str] = pydantic.Field(default=None) 12 | """ 13 | Token that identifies the record to detokenize. 14 | """ 15 | 16 | redaction: typing.Optional[RedactionEnumRedaction] = None 17 | 18 | if IS_PYDANTIC_V2: 19 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 20 | else: 21 | 22 | class Config: 23 | frozen = True 24 | smart_union = True 25 | extra = pydantic.Extra.allow 26 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_update_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1UpdateRecordResponse(UniversalBaseModel): 10 | skyflow_id: typing.Optional[str] = pydantic.Field(default=None) 11 | """ 12 | ID of the updated record. 13 | """ 14 | 15 | tokens: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) 16 | """ 17 | Tokens for the record. 18 | """ 19 | 20 | if IS_PYDANTIC_V2: 21 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 22 | else: 23 | 24 | class Config: 25 | frozen = True 26 | smart_union = True 27 | extra = pydantic.Extra.allow 28 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_record_meta_properties.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1RecordMetaProperties(UniversalBaseModel): 10 | skyflow_id: typing.Optional[str] = pydantic.Field(default=None) 11 | """ 12 | ID of the inserted record. 13 | """ 14 | 15 | tokens: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) 16 | """ 17 | Tokens for the record. 18 | """ 19 | 20 | if IS_PYDANTIC_V2: 21 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 22 | else: 23 | 24 | class Config: 25 | frozen = True 26 | smart_union = True 27 | extra = pydantic.Extra.allow 28 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_deidentify_text_request.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | from skyflow.utils.enums.detect_entities import DetectEntities 3 | from ._token_format import TokenFormat 4 | from ._transformations import Transformations 5 | 6 | class DeidentifyTextRequest: 7 | def __init__(self, 8 | text: str, 9 | entities: Optional[List[DetectEntities]] = None, 10 | allow_regex_list: Optional[List[str]] = None, 11 | restrict_regex_list: Optional[List[str]] = None, 12 | token_format: Optional[TokenFormat] = None, 13 | transformations: Optional[Transformations] = None): 14 | self.text = text 15 | self.entities = entities 16 | self.allow_regex_list = allow_regex_list 17 | self.restrict_regex_list = restrict_regex_list 18 | self.token_format = token_format 19 | self.transformations = transformations 20 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/error_response_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .http_code import HttpCode 8 | 9 | 10 | class ErrorResponseError(UniversalBaseModel): 11 | grpc_code: int = pydantic.Field() 12 | """ 13 | gRPC status codes. See https://grpc.io/docs/guides/status-codes. 14 | """ 15 | 16 | http_code: HttpCode 17 | http_status: str 18 | message: str 19 | details: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = None 20 | 21 | if IS_PYDANTIC_V2: 22 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 23 | else: 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic.Extra.allow 29 | -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .types import ( 6 | AuditServiceListAuditEventsRequestFilterOpsActionType, 7 | AuditServiceListAuditEventsRequestFilterOpsContextAccessType, 8 | AuditServiceListAuditEventsRequestFilterOpsContextActorType, 9 | AuditServiceListAuditEventsRequestFilterOpsContextAuthMode, 10 | AuditServiceListAuditEventsRequestFilterOpsResourceType, 11 | AuditServiceListAuditEventsRequestSortOpsOrderBy, 12 | ) 13 | 14 | __all__ = [ 15 | "AuditServiceListAuditEventsRequestFilterOpsActionType", 16 | "AuditServiceListAuditEventsRequestFilterOpsContextAccessType", 17 | "AuditServiceListAuditEventsRequestFilterOpsContextActorType", 18 | "AuditServiceListAuditEventsRequestFilterOpsContextAuthMode", 19 | "AuditServiceListAuditEventsRequestFilterOpsResourceType", 20 | "AuditServiceListAuditEventsRequestSortOpsOrderBy", 21 | ] 22 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/audit_event_audit_resource_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditEventAuditResourceType = typing.Union[ 6 | typing.Literal[ 7 | "NONE_API", 8 | "ACCOUNT", 9 | "AUDIT", 10 | "BASE_DATA_TYPE", 11 | "FIELD_TEMPLATE", 12 | "FILE", 13 | "KEY", 14 | "POLICY", 15 | "PROTO_PARSE", 16 | "RECORD", 17 | "ROLE", 18 | "RULE", 19 | "SECRET", 20 | "SERVICE_ACCOUNT", 21 | "TOKEN", 22 | "USER", 23 | "VAULT", 24 | "VAULT_TEMPLATE", 25 | "WORKSPACE", 26 | "TABLE", 27 | "POLICY_TEMPLATE", 28 | "MEMBER", 29 | "TAG", 30 | "CONNECTION", 31 | "MIGRATION", 32 | "SCHEDULED_JOB", 33 | "JOB", 34 | "COLUMN_NAME", 35 | "NETWORK_TOKEN", 36 | "SUBSCRIPTION", 37 | ], 38 | typing.Any, 39 | ] 40 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_bulk_delete_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1BulkDeleteRecordResponse(UniversalBaseModel): 12 | record_id_response: typing_extensions.Annotated[ 13 | typing.Optional[typing.List[str]], FieldMetadata(alias="RecordIDResponse") 14 | ] = pydantic.Field(default=None) 15 | """ 16 | IDs for the deleted records, or `*` if all records were deleted. 17 | """ 18 | 19 | if IS_PYDANTIC_V2: 20 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 21 | else: 22 | 23 | class Config: 24 | frozen = True 25 | smart_union = True 26 | extra = pydantic.Extra.allow 27 | -------------------------------------------------------------------------------- /.github/workflows/semgrep.yml: -------------------------------------------------------------------------------- 1 | name: Semgrep 2 | 3 | # Run workflow each time code is pushed to your repository. 4 | on: 5 | push: 6 | branches: 7 | - main 8 | pull_request: 9 | branches: 10 | - main 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v3 17 | 18 | - name: Install Semgrep 19 | run: pip install semgrep 20 | 21 | - name: Run Semgrep 22 | run: | 23 | semgrep --config .semgreprules/customRule.yml --config auto --severity ERROR --sarif . > results.sarif 24 | 25 | - name: Upload SARIF file 26 | uses: github/codeql-action/upload-sarif@v3 27 | with: 28 | # Path to SARIF file relative to the root of the repository 29 | sarif_file: results.sarif 30 | 31 | - name: Upload results 32 | uses: actions/upload-artifact@v4 33 | with: 34 | name: semgrep-results 35 | path: results.sarif 36 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/audit_event_http_info.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class AuditEventHttpInfo(UniversalBaseModel): 12 | uri: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="URI")] = pydantic.Field(default=None) 13 | """ 14 | The http URI that is used. 15 | """ 16 | 17 | method: typing.Optional[str] = pydantic.Field(default=None) 18 | """ 19 | http method used. 20 | """ 21 | 22 | if IS_PYDANTIC_V2: 23 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 24 | else: 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic.Extra.allow 30 | -------------------------------------------------------------------------------- /skyflow/utils/logger/_log_helpers.py: -------------------------------------------------------------------------------- 1 | from ..enums import LogLevel 2 | from . import Logger 3 | 4 | 5 | def log_info(message, logger = None): 6 | if not logger: 7 | logger = Logger(LogLevel.INFO) 8 | 9 | logger.info(message) 10 | 11 | def log_error_log(message, logger=None): 12 | if not logger: 13 | logger = Logger(LogLevel.ERROR) 14 | logger.error(message) 15 | 16 | def log_error(message, http_code, request_id=None, grpc_code=None, http_status=None, details=None, logger=None): 17 | if not logger: 18 | logger = Logger(LogLevel.ERROR) 19 | 20 | log_data = { 21 | 'http_code': http_code, 22 | 'message': message 23 | } 24 | 25 | if grpc_code is not None: 26 | log_data['grpc_code'] = grpc_code 27 | if http_status is not None: 28 | log_data['http_status'] = http_status 29 | if request_id is not None: 30 | log_data['request_id'] = request_id 31 | if details is not None: 32 | log_data['details'] = details 33 | 34 | logger.error(log_data) -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/audit_service_list_audit_events_request_filter_ops_resource_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | AuditServiceListAuditEventsRequestFilterOpsResourceType = typing.Union[ 6 | typing.Literal[ 7 | "NONE_API", 8 | "ACCOUNT", 9 | "AUDIT", 10 | "BASE_DATA_TYPE", 11 | "FIELD_TEMPLATE", 12 | "FILE", 13 | "KEY", 14 | "POLICY", 15 | "PROTO_PARSE", 16 | "RECORD", 17 | "ROLE", 18 | "RULE", 19 | "SECRET", 20 | "SERVICE_ACCOUNT", 21 | "TOKEN", 22 | "USER", 23 | "VAULT", 24 | "VAULT_TEMPLATE", 25 | "WORKSPACE", 26 | "TABLE", 27 | "POLICY_TEMPLATE", 28 | "MEMBER", 29 | "TAG", 30 | "CONNECTION", 31 | "MIGRATION", 32 | "SCHEDULED_JOB", 33 | "JOB", 34 | "COLUMN_NAME", 35 | "NETWORK_TOKEN", 36 | "SUBSCRIPTION", 37 | ], 38 | typing.Any, 39 | ] 40 | -------------------------------------------------------------------------------- /.github/workflows/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Start with a concise summary of the PR. The first three sections are required. The questions present in each section is there to help you guide you what to add. They are meant to be overwritten by your comments. 2 | ## Why 3 | - Why are you making the change? 4 | - What is the underlying issue that you are trying to case, in case of fix? 5 | - Why is it needed by the feature you are working on? 6 | - What is the intent behind making the change? 7 | 8 | ## Goal 9 | - What is the intended outcome? 10 | - What part of the feature should start working? 11 | - What are the non-goals or will be covered in future PR? 12 | 13 | ## Testing 14 | - How was the code tested? 15 | - If you haven't written unit tests, why? 16 | - What more testing is needed? Do you intend to manually test it after deployment? 17 | - Do you have any concerns if this changed is released to prod? 18 | 19 | ## Tech debt 20 | - Is the PR adding to tech debt in any way? 21 | - Are you addressing some Tech debt in this PR? 22 | - If both the above are false, feel free to remove this section. -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_audit_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .v_1_audit_after_options import V1AuditAfterOptions 10 | from .v_1_audit_response_event import V1AuditResponseEvent 11 | 12 | 13 | class V1AuditResponse(UniversalBaseModel): 14 | event: typing.Optional[typing.List[V1AuditResponseEvent]] = pydantic.Field(default=None) 15 | """ 16 | Events matching the query. 17 | """ 18 | 19 | next_ops: typing_extensions.Annotated[typing.Optional[V1AuditAfterOptions], FieldMetadata(alias="nextOps")] = None 20 | 21 | if IS_PYDANTIC_V2: 22 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 23 | else: 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic.Extra.allow 29 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_tokenize_record_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1TokenizeRecordRequest(UniversalBaseModel): 12 | value: typing.Optional[str] = pydantic.Field(default=None) 13 | """ 14 | Existing value to return a token for. 15 | """ 16 | 17 | column_group: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="columnGroup")] = ( 18 | pydantic.Field(default=None) 19 | ) 20 | """ 21 | Name of the column group that the value belongs to. 22 | """ 23 | 24 | if IS_PYDANTIC_V2: 25 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 26 | else: 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic.Extra.allow 32 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_pdf.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class FileDataDeidentifyPdf(UniversalBaseModel): 12 | """ 13 | File to process. Files are specified as Base64-encoded data. 14 | """ 15 | 16 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 17 | """ 18 | Base64-encoded data of the file. 19 | """ 20 | 21 | data_format: typing.Literal["pdf"] = pydantic.Field(default="pdf") 22 | """ 23 | Format of the file. 24 | """ 25 | 26 | if IS_PYDANTIC_V2: 27 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 28 | else: 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic.Extra.allow 34 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_text.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class FileDataDeidentifyText(UniversalBaseModel): 12 | """ 13 | File to process. Files are specified as Base64-encoded data. 14 | """ 15 | 16 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 17 | """ 18 | Base64-encoded data of the file. 19 | """ 20 | 21 | data_format: typing.Literal["txt"] = pydantic.Field(default="txt") 22 | """ 23 | Format of the file. 24 | """ 25 | 26 | if IS_PYDANTIC_V2: 27 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 28 | else: 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic.Extra.allow 34 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_data_format import FileDataDataFormat 10 | 11 | 12 | class FileData(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Skyflow Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_get_auth_token_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1GetAuthTokenResponse(UniversalBaseModel): 12 | access_token: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="accessToken")] = ( 13 | pydantic.Field(default=None) 14 | ) 15 | """ 16 | AccessToken. 17 | """ 18 | 19 | token_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tokenType")] = pydantic.Field( 20 | default=None 21 | ) 22 | """ 23 | TokenType : Bearer. 24 | """ 25 | 26 | if IS_PYDANTIC_V2: 27 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 28 | else: 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic.Extra.allow 34 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_vault_schema_config.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .v_1_vault_field_mapping import V1VaultFieldMapping 8 | 9 | 10 | class V1VaultSchemaConfig(UniversalBaseModel): 11 | """ 12 | Details of the vault that stores additional card details. 13 | """ 14 | 15 | id: typing.Optional[str] = pydantic.Field(default=None) 16 | """ 17 | ID of the vault that stores card details. 18 | """ 19 | 20 | table_name: typing.Optional[str] = pydantic.Field(default=None) 21 | """ 22 | Name of the table that stores card details. 23 | """ 24 | 25 | mapping: typing.Optional[V1VaultFieldMapping] = None 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_field_records.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1FieldRecords(UniversalBaseModel): 10 | """ 11 | Record values and tokens. 12 | """ 13 | 14 | fields: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) 15 | """ 16 | Fields and values for the record. For example, `{'field_1':'value_1', 'field_2':'value_2'}`. 17 | """ 18 | 19 | tokens: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) 20 | """ 21 | Fields and tokens for the record. For example, `{'field_1':'token_1', 'field_2':'token_2'}`. 22 | """ 23 | 24 | if IS_PYDANTIC_V2: 25 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 26 | else: 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic.Extra.allow 32 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/datetime_utils.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | 5 | 6 | def serialize_datetime(v: dt.datetime) -> str: 7 | """ 8 | Serialize a datetime including timezone info. 9 | 10 | Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. 11 | 12 | UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. 13 | """ 14 | 15 | def _serialize_zoned_datetime(v: dt.datetime) -> str: 16 | if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): 17 | # UTC is a special case where we use "Z" at the end instead of "+00:00" 18 | return v.isoformat().replace("+00:00", "Z") 19 | else: 20 | # Delegate to the typical +/- offset format 21 | return v.isoformat() 22 | 23 | if v.tzinfo is not None: 24 | return _serialize_zoned_datetime(v) 25 | else: 26 | local_tz = dt.datetime.now().astimezone().tzinfo 27 | localized_dt = v.replace(tzinfo=local_tz) 28 | return _serialize_zoned_datetime(localized_dt) 29 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_reidentify_file.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_reidentify_file_data_format import FileDataReidentifyFileDataFormat 10 | 11 | 12 | class FileDataReidentifyFile(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataReidentifyFileDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_audio.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_audio_data_format import FileDataDeidentifyAudioDataFormat 10 | 11 | 12 | class FileDataDeidentifyAudio(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifyAudioDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_image.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_image_data_format import FileDataDeidentifyImageDataFormat 10 | 11 | 12 | class FileDataDeidentifyImage(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifyImageDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_document.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_document_data_format import FileDataDeidentifyDocumentDataFormat 10 | 11 | 12 | class FileDataDeidentifyDocument(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifyDocumentDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/upload_file_v_2_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class UploadFileV2Response(UniversalBaseModel): 12 | """ 13 | Response schema for uploading a file, optionally creating a new record. 14 | """ 15 | 16 | skyflow_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="skyflowID")] = pydantic.Field( 17 | default=None 18 | ) 19 | """ 20 | Skyflow ID of the record the file was uploaded to. 21 | """ 22 | 23 | file_metadata: typing_extensions.Annotated[ 24 | typing.Optional[typing.Optional[typing.Any]], FieldMetadata(alias="fileMetadata") 25 | ] = None 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_vault_field_mapping.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class V1VaultFieldMapping(UniversalBaseModel): 10 | """ 11 | Mapping of the fields in the vault to the fields to use for the lookup. 12 | """ 13 | 14 | card_number: typing.Optional[str] = pydantic.Field(default=None) 15 | """ 16 | Name of the column that stores the card number. 17 | """ 18 | 19 | card_last_four_digits: typing.Optional[str] = pydantic.Field(default=None) 20 | """ 21 | Name of the column that stores the card number suffix. 22 | """ 23 | 24 | card_expiry: typing.Optional[str] = pydantic.Field(default=None) 25 | """ 26 | Name of the column that stores the expiry date. 27 | """ 28 | 29 | if IS_PYDANTIC_V2: 30 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 31 | else: 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic.Extra.allow 37 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_spreadsheet.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_spreadsheet_data_format import FileDataDeidentifySpreadsheetDataFormat 10 | 11 | 12 | class FileDataDeidentifySpreadsheet(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifySpreadsheetDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Copyright (c) 2022 Skyflow, Inc. 3 | ''' 4 | from setuptools import setup, find_packages 5 | import sys 6 | 7 | 8 | if sys.version_info < (3, 8): 9 | raise RuntimeError("skyflow requires Python 3.8+") 10 | current_version = '2.0.0' 11 | 12 | setup( 13 | name='skyflow', 14 | version=current_version, 15 | author='Skyflow', 16 | author_email='service-ops@skyflow.com', 17 | packages=find_packages(where='.', exclude=['test*']), 18 | url='https://github.com/skyflowapi/skyflow-python/', 19 | license='LICENSE', 20 | description='Skyflow SDK for the Python programming language', 21 | long_description=open('README.rst').read(), 22 | install_requires=[ 23 | 'python_dateutil >= 2.5.3', 24 | 'setuptools >= 21.0.0', 25 | 'urllib3 >= 1.25.3, < 2.1.0', 26 | 'pydantic >= 2', 27 | 'typing-extensions >= 4.7.1', 28 | 'DateTime~=5.5', 29 | 'PyJWT~=2.9.0', 30 | 'requests~=2.32.3', 31 | 'coverage', 32 | 'cryptography', 33 | 'python-dotenv~=1.0.1', 34 | 'httpx' 35 | ], 36 | extras_require={ 37 | 'dev': [ 38 | 'codespell', 39 | ] 40 | }, 41 | python_requires=">=3.8", 42 | ) 43 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_presentation.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_presentation_data_format import FileDataDeidentifyPresentationDataFormat 10 | 11 | 12 | class FileDataDeidentifyPresentation(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifyPresentationDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/shift_dates.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .shift_dates_entity_types_item import ShiftDatesEntityTypesItem 8 | 9 | 10 | class ShiftDates(UniversalBaseModel): 11 | """ 12 | Shift dates by a specified number of days. 13 | """ 14 | 15 | min_days: typing.Optional[int] = pydantic.Field(default=None) 16 | """ 17 | Minimum number of days to shift the date by. 18 | """ 19 | 20 | max_days: typing.Optional[int] = pydantic.Field(default=None) 21 | """ 22 | Maximum number of days to shift the date by. 23 | """ 24 | 25 | entity_types: typing.Optional[typing.List[ShiftDatesEntityTypesItem]] = pydantic.Field(default=None) 26 | """ 27 | Entity types to shift dates for. 28 | """ 29 | 30 | if IS_PYDANTIC_V2: 31 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 32 | else: 33 | 34 | class Config: 35 | frozen = True 36 | smart_union = True 37 | extra = pydantic.Extra.allow 38 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/file_data_deidentify_structured_text.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .file_data_deidentify_structured_text_data_format import FileDataDeidentifyStructuredTextDataFormat 10 | 11 | 12 | class FileDataDeidentifyStructuredText(UniversalBaseModel): 13 | """ 14 | File to process. Files are specified as Base64-encoded data. 15 | """ 16 | 17 | base_64: typing_extensions.Annotated[str, FieldMetadata(alias="base64")] = pydantic.Field() 18 | """ 19 | Base64-encoded data of the file. 20 | """ 21 | 22 | data_format: FileDataDeidentifyStructuredTextDataFormat = pydantic.Field() 23 | """ 24 | Format of the file. 25 | """ 26 | 27 | if IS_PYDANTIC_V2: 28 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 29 | else: 30 | 31 | class Config: 32 | frozen = True 33 | smart_union = True 34 | extra = pydantic.Extra.allow 35 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/word_character_count.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class WordCharacterCount(UniversalBaseModel): 12 | """ 13 | Word and character count of the processed text. 14 | """ 15 | 16 | word_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="wordCount")] = pydantic.Field( 17 | default=None 18 | ) 19 | """ 20 | Number of words in the processed text. 21 | """ 22 | 23 | character_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="characterCount")] = ( 24 | pydantic.Field(default=None) 25 | ) 26 | """ 27 | Number of characters in the processed text. 28 | """ 29 | 30 | if IS_PYDANTIC_V2: 31 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 32 | else: 33 | 34 | class Config: 35 | frozen = True 36 | smart_union = True 37 | extra = pydantic.Extra.allow 38 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/detect_guardrails_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .detect_guardrails_response_validation import DetectGuardrailsResponseValidation 8 | 9 | 10 | class DetectGuardrailsResponse(UniversalBaseModel): 11 | text: str = pydantic.Field() 12 | """ 13 | Text that was checked against guardrails. 14 | """ 15 | 16 | toxic: typing.Optional[bool] = pydantic.Field(default=None) 17 | """ 18 | Whether the text is toxic. 19 | """ 20 | 21 | denied_topic: typing.Optional[bool] = pydantic.Field(default=None) 22 | """ 23 | Whether the text included a denied topic. 24 | """ 25 | 26 | validation: DetectGuardrailsResponseValidation = pydantic.Field() 27 | """ 28 | Whether the text passed validation. 29 | """ 30 | 31 | if IS_PYDANTIC_V2: 32 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 33 | else: 34 | 35 | class Config: 36 | frozen = True 37 | smart_union = True 38 | extra = pydantic.Extra.allow 39 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_audit_event_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .audit_event_data import AuditEventData 8 | 9 | 10 | class V1AuditEventResponse(UniversalBaseModel): 11 | """ 12 | Contains fields for defining Response Properties. 13 | """ 14 | 15 | code: typing.Optional[int] = pydantic.Field(default=None) 16 | """ 17 | The status of the overall operation. 18 | """ 19 | 20 | message: typing.Optional[str] = pydantic.Field(default=None) 21 | """ 22 | The status message for the overall operation. 23 | """ 24 | 25 | data: typing.Optional[AuditEventData] = None 26 | timestamp: typing.Optional[str] = pydantic.Field(default=None) 27 | """ 28 | time when this response is generated, use extention method to set it. 29 | """ 30 | 31 | if IS_PYDANTIC_V2: 32 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 33 | else: 34 | 35 | class Config: 36 | frozen = True 37 | smart_union = True 38 | extra = pydantic.Extra.allow 39 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/string_response_entities.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .locations import Locations 8 | 9 | 10 | class StringResponseEntities(UniversalBaseModel): 11 | """ 12 | Detected entities for String 13 | """ 14 | 15 | token: typing.Optional[str] = pydantic.Field(default=None) 16 | """ 17 | Processed text of the entity. 18 | """ 19 | 20 | value: typing.Optional[str] = pydantic.Field(default=None) 21 | """ 22 | Original text of the entity. 23 | """ 24 | 25 | location: typing.Optional[Locations] = None 26 | entity_type: typing.Optional[str] = pydantic.Field(default=None) 27 | """ 28 | Highest-rated label. 29 | """ 30 | 31 | entity_scores: typing.Optional[typing.Dict[str, float]] = pydantic.Field(default=None) 32 | """ 33 | Labels and their scores. 34 | """ 35 | 36 | if IS_PYDANTIC_V2: 37 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 38 | else: 39 | 40 | class Config: 41 | frozen = True 42 | smart_union = True 43 | extra = pydantic.Extra.allow 44 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/reidentify_file_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .reidentified_file_output import ReidentifiedFileOutput 8 | from .reidentify_file_response_output_type import ReidentifyFileResponseOutputType 9 | from .reidentify_file_response_status import ReidentifyFileResponseStatus 10 | 11 | 12 | class ReidentifyFileResponse(UniversalBaseModel): 13 | """ 14 | Response to get the status & response of a file re-identification request. 15 | """ 16 | 17 | status: typing.Optional[ReidentifyFileResponseStatus] = pydantic.Field(default=None) 18 | """ 19 | Status of the operation. 20 | """ 21 | 22 | output_type: typing.Optional[ReidentifyFileResponseOutputType] = pydantic.Field(default=None) 23 | """ 24 | Format of the output file. 25 | """ 26 | 27 | output: typing.Optional[ReidentifiedFileOutput] = None 28 | 29 | if IS_PYDANTIC_V2: 30 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 31 | else: 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic.Extra.allow 37 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/deidentify_string_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .string_response_entities import StringResponseEntities 8 | 9 | 10 | class DeidentifyStringResponse(UniversalBaseModel): 11 | """ 12 | Response to deidentify a string. 13 | """ 14 | 15 | processed_text: typing.Optional[str] = pydantic.Field(default=None) 16 | """ 17 | De-identified text. 18 | """ 19 | 20 | entities: typing.Optional[typing.List[StringResponseEntities]] = pydantic.Field(default=None) 21 | """ 22 | Detected entities. 23 | """ 24 | 25 | word_count: typing.Optional[int] = pydantic.Field(default=None) 26 | """ 27 | Number of words from the input text. 28 | """ 29 | 30 | character_count: typing.Optional[int] = pydantic.Field(default=None) 31 | """ 32 | Number of characters from the input text. 33 | """ 34 | 35 | if IS_PYDANTIC_V2: 36 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 37 | else: 38 | 39 | class Config: 40 | frozen = True 41 | smart_union = True 42 | extra = pydantic.Extra.allow 43 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_detokenize_record_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .detokenize_record_response_value_type import DetokenizeRecordResponseValueType 10 | 11 | 12 | class V1DetokenizeRecordResponse(UniversalBaseModel): 13 | token: typing.Optional[str] = pydantic.Field(default=None) 14 | """ 15 | Token of the record. 16 | """ 17 | 18 | value_type: typing_extensions.Annotated[ 19 | typing.Optional[DetokenizeRecordResponseValueType], FieldMetadata(alias="valueType") 20 | ] = None 21 | value: typing.Optional[str] = pydantic.Field(default=None) 22 | """ 23 | Data corresponding to the token. 24 | """ 25 | 26 | error: typing.Optional[str] = pydantic.Field(default=None) 27 | """ 28 | Error if token isn't found. 29 | """ 30 | 31 | if IS_PYDANTIC_V2: 32 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 33 | else: 34 | 35 | class Config: 36 | frozen = True 37 | smart_union = True 38 | extra = pydantic.Extra.allow 39 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/reidentified_file_output.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .reidentified_file_output_processed_file_extension import ReidentifiedFileOutputProcessedFileExtension 8 | 9 | 10 | class ReidentifiedFileOutput(UniversalBaseModel): 11 | """ 12 | Details of output files. Files are specified as Base64-encoded data. 13 | """ 14 | 15 | processed_file: typing.Optional[str] = pydantic.Field(default=None) 16 | """ 17 | File content in Base64 format. 18 | """ 19 | 20 | processed_file_type: typing.Optional[typing.Literal["reidentified_file"]] = pydantic.Field(default=None) 21 | """ 22 | Type of the processed file. 23 | """ 24 | 25 | processed_file_extension: typing.Optional[ReidentifiedFileOutputProcessedFileExtension] = pydantic.Field( 26 | default=None 27 | ) 28 | """ 29 | Extension of the processed file. 30 | """ 31 | 32 | if IS_PYDANTIC_V2: 33 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 34 | else: 35 | 36 | class Config: 37 | frozen = True 38 | smart_union = True 39 | extra = pydantic.Extra.allow 40 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/locations.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | 8 | 9 | class Locations(UniversalBaseModel): 10 | """ 11 | Locations of an entity in the text. 12 | """ 13 | 14 | start_index: typing.Optional[int] = pydantic.Field(default=None) 15 | """ 16 | Index of the first character of the string in the original text. 17 | """ 18 | 19 | end_index: typing.Optional[int] = pydantic.Field(default=None) 20 | """ 21 | Index of the last character of the string in the original text. 22 | """ 23 | 24 | start_index_processed: typing.Optional[int] = pydantic.Field(default=None) 25 | """ 26 | Index of the first character of the string in the processed text. 27 | """ 28 | 29 | end_index_processed: typing.Optional[int] = pydantic.Field(default=None) 30 | """ 31 | Index of the last character of the string in the processed text. 32 | """ 33 | 34 | if IS_PYDANTIC_V2: 35 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 36 | else: 37 | 38 | class Config: 39 | frozen = True 40 | smart_union = True 41 | extra = pydantic.Extra.allow 42 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_batch_operation_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1BatchOperationResponse(UniversalBaseModel): 12 | vault_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="vaultID")] = pydantic.Field( 13 | default=None 14 | ) 15 | """ 16 | ID of the vault. 17 | """ 18 | 19 | responses: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field( 20 | default=None 21 | ) 22 | """ 23 | Responses in the same order as in the request. Responses have the same payload structure as their corresponding APIs:
  • `POST` returns an Insert Records response.
  • `PUT` returns an Update Record response.
  • `GET` returns a Get Record response.
  • `DELETE` returns a Delete Record response.
24 | """ 25 | 26 | if IS_PYDANTIC_V2: 27 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 28 | else: 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic.Extra.allow 34 | -------------------------------------------------------------------------------- /ci-scripts/bump_version.sh: -------------------------------------------------------------------------------- 1 | Version=$1 2 | SEMVER=$Version 3 | 4 | if [ -z "$2" ] 5 | then 6 | echo "Bumping package version to $1" 7 | 8 | sed -E "s/current_version = .+/current_version = '$SEMVER'/g" setup.py > tempfile && cat tempfile > setup.py && rm -f tempfile 9 | sed -E "s/SDK_VERSION = .+/SDK_VERSION = '$SEMVER'/g" skyflow/utils/_version.py > tempfile && cat tempfile > skyflow/utils/_version.py && rm -f tempfile 10 | sed -E "s/__version__ = .+/__version__ = '$SEMVER'/g" skyflow/generated/rest/version.py > tempfile && cat tempfile > skyflow/generated/rest/version.py && rm -f tempfile 11 | 12 | echo -------------------------- 13 | echo "Done, Package now at $1" 14 | else 15 | # Use dev version with commit SHA 16 | DEV_VERSION="${SEMVER}.dev0+$(echo $2 | tr -dc '0-9a-f')" 17 | 18 | echo "Bumping package version to $DEV_VERSION" 19 | 20 | sed -E "s/current_version = .+/current_version = '$DEV_VERSION'/g" setup.py > tempfile && cat tempfile > setup.py && rm -f tempfile 21 | sed -E "s/SDK_VERSION = .+/SDK_VERSION = '$DEV_VERSION'/g" skyflow/utils/_version.py > tempfile && cat tempfile > skyflow/utils/_version.py && rm -f tempfile 22 | sed -E "s/__version__ = .+/__version__ = '$DEV_VERSION'/g" skyflow/generated/rest/version.py > tempfile && cat tempfile > skyflow/generated/rest/version.py && rm -f tempfile 23 | 24 | echo -------------------------- 25 | echo "Done, Package now at $DEV_VERSION" 26 | fi 27 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_audit_after_options.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1AuditAfterOptions(UniversalBaseModel): 12 | timestamp: typing.Optional[str] = pydantic.Field(default=None) 13 | """ 14 | Timestamp provided in the previous audit response's `nextOps` attribute. An alternate way to manage response pagination. Can't be used with `sortOps` or `offset`. For the first request in a series of audit requests, leave blank. 15 | """ 16 | 17 | change_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="changeID")] = pydantic.Field( 18 | default=None 19 | ) 20 | """ 21 | Change ID provided in the previous audit response's `nextOps` attribute. An alternate way to manage response pagination. Can't be used with `sortOps` or `offset`. For the first request in a series of audit requests, leave blank. 22 | """ 23 | 24 | if IS_PYDANTIC_V2: 25 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 26 | else: 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic.Extra.allow 32 | -------------------------------------------------------------------------------- /skyflow/generated/rest/audit/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .audit_service_list_audit_events_request_filter_ops_action_type import ( 6 | AuditServiceListAuditEventsRequestFilterOpsActionType, 7 | ) 8 | from .audit_service_list_audit_events_request_filter_ops_context_access_type import ( 9 | AuditServiceListAuditEventsRequestFilterOpsContextAccessType, 10 | ) 11 | from .audit_service_list_audit_events_request_filter_ops_context_actor_type import ( 12 | AuditServiceListAuditEventsRequestFilterOpsContextActorType, 13 | ) 14 | from .audit_service_list_audit_events_request_filter_ops_context_auth_mode import ( 15 | AuditServiceListAuditEventsRequestFilterOpsContextAuthMode, 16 | ) 17 | from .audit_service_list_audit_events_request_filter_ops_resource_type import ( 18 | AuditServiceListAuditEventsRequestFilterOpsResourceType, 19 | ) 20 | from .audit_service_list_audit_events_request_sort_ops_order_by import AuditServiceListAuditEventsRequestSortOpsOrderBy 21 | 22 | __all__ = [ 23 | "AuditServiceListAuditEventsRequestFilterOpsActionType", 24 | "AuditServiceListAuditEventsRequestFilterOpsContextAccessType", 25 | "AuditServiceListAuditEventsRequestFilterOpsContextActorType", 26 | "AuditServiceListAuditEventsRequestFilterOpsContextAuthMode", 27 | "AuditServiceListAuditEventsRequestFilterOpsResourceType", 28 | "AuditServiceListAuditEventsRequestSortOpsOrderBy", 29 | ] 30 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/format.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .format_masked_item import FormatMaskedItem 8 | from .format_plaintext_item import FormatPlaintextItem 9 | from .format_redacted_item import FormatRedactedItem 10 | 11 | 12 | class Format(UniversalBaseModel): 13 | """ 14 | Mapping of preferred data formatting options to entity types. Returned values are dependent on the configuration of the vault storing the data and the permissions of the user or account making the request. 15 | """ 16 | 17 | redacted: typing.Optional[typing.List[FormatRedactedItem]] = pydantic.Field(default=None) 18 | """ 19 | Entity types to fully redact. 20 | """ 21 | 22 | masked: typing.Optional[typing.List[FormatMaskedItem]] = pydantic.Field(default=None) 23 | """ 24 | Entity types to mask. 25 | """ 26 | 27 | plaintext: typing.Optional[typing.List[FormatPlaintextItem]] = pydantic.Field(default=None) 28 | """ 29 | Entity types to return in plaintext. 30 | """ 31 | 32 | if IS_PYDANTIC_V2: 33 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 34 | else: 35 | 36 | class Config: 37 | frozen = True 38 | smart_union = True 39 | extra = pydantic.Extra.allow 40 | -------------------------------------------------------------------------------- /tests/utils/test__helpers.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from skyflow.utils import get_base_url, format_scope 3 | 4 | VALID_URL = "https://example.com/path?query=1" 5 | BASE_URL = "https://example.com" 6 | EMPTY_URL = "" 7 | INVALID_URL = "invalid-url" 8 | SCOPES_LIST = ["admin", "user", "viewer"] 9 | FORMATTED_SCOPES = "role:admin role:user role:viewer" 10 | 11 | class TestHelperFunctions(unittest.TestCase): 12 | def test_get_base_url_valid_url(self): 13 | self.assertEqual(get_base_url(VALID_URL), BASE_URL) 14 | 15 | def test_get_base_url_empty_url(self): 16 | self.assertEqual(get_base_url(EMPTY_URL), "://") 17 | 18 | def test_get_base_url_invalid_url(self): 19 | self.assertEqual(get_base_url(INVALID_URL), "://") 20 | 21 | def test_format_scope_valid_scopes(self): 22 | self.assertEqual(format_scope(SCOPES_LIST), FORMATTED_SCOPES) 23 | 24 | def test_format_scope_empty_list(self): 25 | self.assertIsNone(format_scope([])) 26 | 27 | def test_format_scope_none(self): 28 | self.assertIsNone(format_scope(None)) 29 | 30 | def test_format_scope_single_scope(self): 31 | single_scope = ["admin"] 32 | expected_result = "role:admin" 33 | self.assertEqual(format_scope(single_scope), expected_result) 34 | 35 | def test_format_scope_special_characters(self): 36 | scopes_with_special_chars = ["admin", "user:write", "read-only"] 37 | expected_result = "role:admin role:user:write role:read-only" 38 | self.assertEqual(format_scope(scopes_with_special_chars), expected_result) -------------------------------------------------------------------------------- /docs/auth_credentials.md: -------------------------------------------------------------------------------- 1 | # Authentication credentials options 2 | 3 | > **Note:** Only one type of credential can be used at a time. If multiple credentials are provided, the last one added takes precedence. 4 | 5 | 1. **API keys** 6 | 7 | A unique identifier used to authenticate and authorize requests to an API. 8 | 9 | ```python 10 | credentials = { 11 | "api_key": "" 12 | } 13 | ``` 14 | 15 | 2. **Bearer tokens** 16 | 17 | A temporary access token used to authenticate API requests, typically included in the 18 | Authorization header. 19 | 20 | ```python 21 | credentials = { 22 | "token": "" 23 | } 24 | ``` 25 | 26 | 3. **Service account credentials file path** 27 | 28 | The file path pointing to a JSON file containing credentials for a service account, used 29 | for secure API access. 30 | 31 | ```python 32 | credentials = { 33 | "path": "" 34 | } 35 | ``` 36 | 37 | 4. **Service account credentials string** 38 | 39 | JSON-formatted string containing service account credentials, often used as an alternative to a file for programmatic authentication. 40 | 41 | ```python 42 | credentials = { 43 | "credentials_string": os.getenv("SKYFLOW_CREDENTIALS_JSON_STRING") 44 | } 45 | ``` 46 | 47 | 5. **Environment variables** 48 | 49 | If no credentials are explicitly provided, the SDK automatically looks for the `SKYFLOW_CREDENTIALS` environment variable. This variable must contain a JSON string like one of the examples above. 50 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/http_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from typing import Dict, Generic, TypeVar 4 | 5 | import httpx 6 | 7 | T = TypeVar("T") 8 | """Generic to represent the underlying type of the data wrapped by the HTTP response.""" 9 | 10 | 11 | class BaseHttpResponse: 12 | """Minimalist HTTP response wrapper that exposes response headers.""" 13 | 14 | _response: httpx.Response 15 | 16 | def __init__(self, response: httpx.Response): 17 | self._response = response 18 | 19 | @property 20 | def headers(self) -> Dict[str, str]: 21 | return dict(self._response.headers) 22 | 23 | 24 | class HttpResponse(Generic[T], BaseHttpResponse): 25 | """HTTP response wrapper that exposes response headers and data.""" 26 | 27 | _data: T 28 | 29 | def __init__(self, response: httpx.Response, data: T): 30 | super().__init__(response) 31 | self._data = data 32 | 33 | @property 34 | def data(self) -> T: 35 | return self._data 36 | 37 | def close(self) -> None: 38 | self._response.close() 39 | 40 | 41 | class AsyncHttpResponse(Generic[T], BaseHttpResponse): 42 | """HTTP response wrapper that exposes response headers and data.""" 43 | 44 | _data: T 45 | 46 | def __init__(self, response: httpx.Response, data: T): 47 | super().__init__(response) 48 | self._data = data 49 | 50 | @property 51 | def data(self) -> T: 52 | return self._data 53 | 54 | async def close(self) -> None: 55 | await self._response.aclose() 56 | -------------------------------------------------------------------------------- /skyflow/vault/detect/_file.py: -------------------------------------------------------------------------------- 1 | import io 2 | import mimetypes 3 | import time 4 | 5 | class File: 6 | def __init__(self, file: io.BytesIO = None): 7 | self.file = file 8 | 9 | @property 10 | def name(self) -> str: 11 | """Get file name""" 12 | if self.file: 13 | return getattr(self.file, 'name', 'unknown') 14 | return None 15 | 16 | @property 17 | def size(self) -> int: 18 | """Get file size in bytes""" 19 | if self.file: 20 | pos = self.file.tell() 21 | self.file.seek(0, io.SEEK_END) 22 | size = self.file.tell() 23 | self.file.seek(pos) 24 | return size 25 | return None 26 | 27 | @property 28 | def type(self) -> str: 29 | """Get file mime type""" 30 | if self.file: 31 | return mimetypes.guess_type(self.name)[0] or '' 32 | return None 33 | 34 | @property 35 | def last_modified(self) -> int: 36 | """Get file last modified timestamp in milliseconds""" 37 | if self.file: 38 | return int(time.time() * 1000) 39 | return None 40 | 41 | def seek(self, offset, whence=0): 42 | if self.file: 43 | return self.file.seek(offset, whence) 44 | 45 | def read(self, size=-1): 46 | if self.file: 47 | return self.file.read(size) 48 | 49 | def __repr__(self): 50 | return ( 51 | f"File(name={self.name!r}, size={self.size!r}, type={self.type!r}, " 52 | f"last_modified={self.last_modified!r})" 53 | ) 54 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .types import ( 6 | DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem, 7 | DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription, 8 | DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem, 9 | DeidentifyFileImageRequestDeidentifyImageEntityTypesItem, 10 | DeidentifyFileImageRequestDeidentifyImageMaskingMethod, 11 | DeidentifyFileRequestDeidentifyDocumentEntityTypesItem, 12 | DeidentifyFileRequestDeidentifyPresentationEntityTypesItem, 13 | DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem, 14 | DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem, 15 | DeidentifyFileRequestDeidentifyTextEntityTypesItem, 16 | DeidentifyFileRequestEntityTypesItem, 17 | ) 18 | 19 | __all__ = [ 20 | "DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem", 21 | "DeidentifyFileAudioRequestDeidentifyAudioOutputTranscription", 22 | "DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem", 23 | "DeidentifyFileImageRequestDeidentifyImageEntityTypesItem", 24 | "DeidentifyFileImageRequestDeidentifyImageMaskingMethod", 25 | "DeidentifyFileRequestDeidentifyDocumentEntityTypesItem", 26 | "DeidentifyFileRequestDeidentifyPresentationEntityTypesItem", 27 | "DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem", 28 | "DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem", 29 | "DeidentifyFileRequestDeidentifyTextEntityTypesItem", 30 | "DeidentifyFileRequestEntityTypesItem", 31 | ] 32 | -------------------------------------------------------------------------------- /samples/service_account/token_generation_example.py: -------------------------------------------------------------------------------- 1 | import json 2 | from skyflow.service_account import ( 3 | generate_bearer_token, 4 | generate_bearer_token_from_creds, 5 | is_expired, 6 | ) 7 | 8 | file_path = 'CREDENTIALS_FILE_PATH' 9 | bearer_token = '' 10 | 11 | # To generate Bearer Token from credentials string. 12 | skyflow_credentials = { 13 | 'clientID': '', 14 | 'clientName': '', 15 | 'tokenURI': '', 16 | 'keyID': '', 17 | 'privateKey': '', 18 | } 19 | credentials_string = json.dumps(skyflow_credentials) 20 | 21 | 22 | def get_bearer_token_from_file_path(): 23 | # Generate bearer token from credentials file path. 24 | global bearer_token 25 | 26 | try: 27 | if not is_expired(bearer_token): 28 | return bearer_token 29 | else: 30 | token, _ = generate_bearer_token(file_path) 31 | bearer_token = token 32 | return bearer_token 33 | 34 | except Exception as e: 35 | print(f'Error generating token from file path: {str(e)}') 36 | 37 | 38 | def get_bearer_token_from_credentials_string(): 39 | # Generate bearer token from credentials string. 40 | global bearer_token 41 | try: 42 | if not is_expired(bearer_token): 43 | return bearer_token 44 | else: 45 | token, _ = generate_bearer_token_from_creds(credentials_string) 46 | bearer_token = token 47 | return bearer_token 48 | except Exception as e: 49 | print(f"Error generating token from credentials string: {str(e)}") 50 | 51 | 52 | 53 | print(get_bearer_token_from_file_path()) 54 | 55 | print(get_bearer_token_from_credentials_string()) -------------------------------------------------------------------------------- /skyflow/generated/rest/core/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | # isort: skip_file 4 | 5 | from .api_error import ApiError 6 | from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper 7 | from .datetime_utils import serialize_datetime 8 | from .file import File, convert_file_dict_to_httpx_tuples, with_content_type 9 | from .http_client import AsyncHttpClient, HttpClient 10 | from .http_response import AsyncHttpResponse, HttpResponse 11 | from .jsonable_encoder import jsonable_encoder 12 | from .pydantic_utilities import ( 13 | IS_PYDANTIC_V2, 14 | UniversalBaseModel, 15 | UniversalRootModel, 16 | parse_obj_as, 17 | universal_field_validator, 18 | universal_root_validator, 19 | update_forward_refs, 20 | ) 21 | from .query_encoder import encode_query 22 | from .remove_none_from_dict import remove_none_from_dict 23 | from .request_options import RequestOptions 24 | from .serialization import FieldMetadata, convert_and_respect_annotation_metadata 25 | 26 | __all__ = [ 27 | "ApiError", 28 | "AsyncClientWrapper", 29 | "AsyncHttpClient", 30 | "AsyncHttpResponse", 31 | "BaseClientWrapper", 32 | "FieldMetadata", 33 | "File", 34 | "HttpClient", 35 | "HttpResponse", 36 | "IS_PYDANTIC_V2", 37 | "RequestOptions", 38 | "SyncClientWrapper", 39 | "UniversalBaseModel", 40 | "UniversalRootModel", 41 | "convert_and_respect_annotation_metadata", 42 | "convert_file_dict_to_httpx_tuples", 43 | "encode_query", 44 | "jsonable_encoder", 45 | "parse_obj_as", 46 | "remove_none_from_dict", 47 | "serialize_datetime", 48 | "universal_field_validator", 49 | "universal_root_validator", 50 | "update_forward_refs", 51 | "with_content_type", 52 | ] 53 | -------------------------------------------------------------------------------- /.github/workflows/shared-tests.yml: -------------------------------------------------------------------------------- 1 | name: Shared Test Steps 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | python-version: 7 | description: 'Python version to use' 8 | required: true 9 | type: string 10 | 11 | jobs: 12 | run-tests: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-python@v2 17 | with: 18 | python-version: ${{ inputs.python-version }} 19 | 20 | - name: create-json 21 | id: create-json 22 | uses: jsdaniell/create-json@1.1.2 23 | with: 24 | name: "credentials.json" 25 | json: ${{ secrets.VALID_SKYFLOW_CREDS_TEST }} 26 | 27 | - name: Build and install skyflow package 28 | run: | 29 | pip install --upgrade pip setuptools wheel 30 | python setup.py sdist bdist_wheel 31 | pip install dist/skyflow-*.whl 32 | pip install ".[dev]" 33 | 34 | - name: Run Spell Check 35 | run: codespell 36 | 37 | - name: 'Run Tests' 38 | run: | 39 | pip install -r requirements.txt 40 | python -m coverage run --source=skyflow --omit=skyflow/generated/*,skyflow/utils/validations/*,skyflow/vault/data/*,skyflow/vault/detect/*,skyflow/vault/tokens/*,skyflow/vault/connection/*,skyflow/error/*,skyflow/utils/enums/*,skyflow/vault/controller/_audit.py,skyflow/vault/controller/_bin_look_up.py -m unittest discover 41 | 42 | - name: coverage 43 | run: coverage xml -o test-coverage.xml 44 | 45 | - name: Codecov 46 | uses: codecov/codecov-action@v2.1.0 47 | with: 48 | token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }} 49 | files: test-coverage.xml 50 | name: codecov-skyflow-python 51 | verbose: true 52 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/deidentified_file_output.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .deidentified_file_output_processed_file_extension import DeidentifiedFileOutputProcessedFileExtension 10 | from .deidentified_file_output_processed_file_type import DeidentifiedFileOutputProcessedFileType 11 | 12 | 13 | class DeidentifiedFileOutput(UniversalBaseModel): 14 | """ 15 | Details of output files. Files are specified as Base64-encoded data. 16 | """ 17 | 18 | processed_file: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="processedFile")] = ( 19 | pydantic.Field(default=None) 20 | ) 21 | """ 22 | File content in Base64 format. 23 | """ 24 | 25 | processed_file_type: typing_extensions.Annotated[ 26 | typing.Optional[DeidentifiedFileOutputProcessedFileType], FieldMetadata(alias="processedFileType") 27 | ] = pydantic.Field(default=None) 28 | """ 29 | Type of the processed file. 30 | """ 31 | 32 | processed_file_extension: typing_extensions.Annotated[ 33 | typing.Optional[DeidentifiedFileOutputProcessedFileExtension], FieldMetadata(alias="processedFileExtension") 34 | ] = pydantic.Field(default=None) 35 | """ 36 | Extension of the processed file. 37 | """ 38 | 39 | if IS_PYDANTIC_V2: 40 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 41 | else: 42 | 43 | class Config: 44 | frozen = True 45 | smart_union = True 46 | extra = pydantic.Extra.allow 47 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/request_options.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | try: 6 | from typing import NotRequired # type: ignore 7 | except ImportError: 8 | from typing_extensions import NotRequired 9 | 10 | 11 | class RequestOptions(typing.TypedDict, total=False): 12 | """ 13 | Additional options for request-specific configuration when calling APIs via the SDK. 14 | This is used primarily as an optional final parameter for service functions. 15 | 16 | Attributes: 17 | - timeout_in_seconds: int. The number of seconds to await an API call before timing out. 18 | 19 | - max_retries: int. The max number of retries to attempt if the API call fails. 20 | 21 | - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict 22 | 23 | - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict 24 | 25 | - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict 26 | 27 | - chunk_size: int. The size, in bytes, to process each chunk of data being streamed back within the response. This equates to leveraging `chunk_size` within `requests` or `httpx`, and is only leveraged for file downloads. 28 | """ 29 | 30 | timeout_in_seconds: NotRequired[int] 31 | max_retries: NotRequired[int] 32 | additional_headers: NotRequired[typing.Dict[str, typing.Any]] 33 | additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] 34 | additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] 35 | chunk_size: NotRequired[int] 36 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/token_type_mapping.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 7 | from .token_type_mapping_default import TokenTypeMappingDefault 8 | from .token_type_mapping_entity_only_item import TokenTypeMappingEntityOnlyItem 9 | from .token_type_mapping_entity_unq_counter_item import TokenTypeMappingEntityUnqCounterItem 10 | from .token_type_mapping_vault_token_item import TokenTypeMappingVaultTokenItem 11 | 12 | 13 | class TokenTypeMapping(UniversalBaseModel): 14 | """ 15 | Mapping of token types to detected entities. 16 | """ 17 | 18 | vault_token: typing.Optional[typing.List[TokenTypeMappingVaultTokenItem]] = pydantic.Field(default=None) 19 | """ 20 | Entity types to replace with vault tokens. 21 | """ 22 | 23 | entity_only: typing.Optional[typing.List[TokenTypeMappingEntityOnlyItem]] = pydantic.Field(default=None) 24 | """ 25 | Entity types to replace with entity tokens. 26 | """ 27 | 28 | entity_unq_counter: typing.Optional[typing.List[TokenTypeMappingEntityUnqCounterItem]] = pydantic.Field( 29 | default=None 30 | ) 31 | """ 32 | Entity types to replace with entity tokens with unique counters. 33 | """ 34 | 35 | default: typing.Optional[TokenTypeMappingDefault] = pydantic.Field(default=None) 36 | """ 37 | Default token type to generate for detected entities. 38 | """ 39 | 40 | if IS_PYDANTIC_V2: 41 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 42 | else: 43 | 44 | class Config: 45 | frozen = True 46 | smart_union = True 47 | extra = pydantic.Extra.allow 48 | -------------------------------------------------------------------------------- /samples/service_account/scoped_token_generation_example.py: -------------------------------------------------------------------------------- 1 | import json 2 | from skyflow.service_account import ( 3 | generate_bearer_token, 4 | generate_bearer_token_from_creds, 5 | is_expired, 6 | ) 7 | 8 | file_path = '' 9 | bearer_token = '' 10 | 11 | # To generate Bearer Token from credentials string. 12 | skyflow_credentials = { 13 | 'clientID': '', 14 | 'clientName': '', 15 | 'tokenURI': '', 16 | 'keyID': '', 17 | 'privateKey': '', 18 | } 19 | credentials_string = json.dumps(skyflow_credentials) 20 | 21 | options = {'role_ids': ['ROLE_ID1', 'ROLE_ID2']} 22 | 23 | def get_scoped_bearer_token_from_file_path(): 24 | # Generate scoped bearer token from credentials file path. 25 | global bearer_token 26 | 27 | try: 28 | if not is_expired(bearer_token): 29 | return bearer_token 30 | else: 31 | token, _ = generate_bearer_token(file_path, options) 32 | bearer_token = token 33 | return bearer_token 34 | 35 | except Exception as e: 36 | print(f'Error generating token from file path: {str(e)}') 37 | 38 | 39 | 40 | def get_scoped_bearer_token_from_credentials_string(): 41 | # Generate scoped bearer token from credentials string. 42 | global bearer_token 43 | try: 44 | if not is_expired(bearer_token): 45 | return bearer_token 46 | else: 47 | token, _ = generate_bearer_token_from_creds(credentials_string, options) 48 | bearer_token = token 49 | return bearer_token 50 | except Exception as e: 51 | print(f"Error generating token from credentials string: {str(e)}") 52 | 53 | 54 | print(get_scoped_bearer_token_from_file_path()) 55 | 56 | print(get_scoped_bearer_token_from_credentials_string()) -------------------------------------------------------------------------------- /skyflow/utils/logger/_logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from ..enums.log_level import LogLevel 3 | 4 | 5 | class Logger: 6 | def __init__(self, level=LogLevel.ERROR): 7 | self.current_level = level 8 | self.logger = logging.getLogger('skyflow-python') 9 | self.logger.propagate = False # Prevent logs from being handled by parent loggers 10 | 11 | # Remove any existing handlers to avoid duplicates or inherited handlers 12 | if self.logger.hasHandlers(): 13 | self.logger.handlers.clear() 14 | 15 | self.set_log_level(level) 16 | 17 | handler = logging.StreamHandler() 18 | 19 | # Create a formatter that only includes the message without any prefixes 20 | formatter = logging.Formatter('%(message)s') 21 | handler.setFormatter(formatter) 22 | 23 | self.logger.addHandler(handler) 24 | 25 | def set_log_level(self, level): 26 | self.current_level = level 27 | log_level_mapping = { 28 | LogLevel.DEBUG: logging.DEBUG, 29 | LogLevel.INFO: logging.INFO, 30 | LogLevel.WARN: logging.WARNING, 31 | LogLevel.ERROR: logging.ERROR, 32 | LogLevel.OFF: logging.CRITICAL + 1 33 | } 34 | self.logger.setLevel(log_level_mapping[level]) 35 | 36 | def debug(self, message): 37 | if self.current_level.value <= LogLevel.DEBUG.value: 38 | self.logger.debug(message) 39 | 40 | def info(self, message): 41 | if self.current_level.value <= LogLevel.INFO.value: 42 | self.logger.info(message) 43 | 44 | def warn(self, message): 45 | if self.current_level.value <= LogLevel.WARN.value: 46 | self.logger.warning(message) 47 | 48 | def error(self, message): 49 | if self.current_level.value <= LogLevel.ERROR.value: 50 | self.logger.error(message) 51 | -------------------------------------------------------------------------------- /samples/service_account/token_generation_with_context_example.py: -------------------------------------------------------------------------------- 1 | import json 2 | from skyflow.service_account import ( 3 | generate_bearer_token, 4 | generate_bearer_token_from_creds, 5 | is_expired, 6 | ) 7 | 8 | file_path = 'CREDENTIALS_FILE_PATH' 9 | bearer_token = '' 10 | 11 | # To generate Bearer Token from credentials string. 12 | skyflow_credentials = { 13 | 'clientID': '', 14 | 'clientName': '', 15 | 'tokenURI': '', 16 | 'keyID': '', 17 | 'privateKey': '', 18 | } 19 | credentials_string = json.dumps(skyflow_credentials) 20 | 21 | options = {'ctx': ''} 22 | 23 | def get_bearer_token_with_context_from_file_path(): 24 | # Generate bearer token with context from credentials file path. 25 | global bearer_token 26 | 27 | try: 28 | if not is_expired(bearer_token): 29 | return bearer_token 30 | else: 31 | token, _ = generate_bearer_token(file_path, options) 32 | bearer_token = token 33 | return bearer_token 34 | 35 | except Exception as e: 36 | print(f'Error generating token from file path: {str(e)}') 37 | 38 | 39 | def get_bearer_token_with_context_from_credentials_string(): 40 | # Generate bearer token with context from credentials string. 41 | global bearer_token 42 | try: 43 | if not is_expired(bearer_token): 44 | return bearer_token 45 | else: 46 | token, _ = generate_bearer_token_from_creds(credentials_string, options) 47 | bearer_token = token 48 | return bearer_token 49 | except Exception as e: 50 | print(f"Error generating token from credentials string: {str(e)}") 51 | 52 | 53 | print(get_bearer_token_with_context_from_file_path()) 54 | 55 | print(get_bearer_token_with_context_from_credentials_string()) -------------------------------------------------------------------------------- /skyflow/vault/detect/_deidentify_file_response.py: -------------------------------------------------------------------------------- 1 | import io 2 | from skyflow.vault.detect._file import File 3 | 4 | class DeidentifyFileResponse: 5 | def __init__( 6 | self, 7 | file_base64: str = None, 8 | file: io.BytesIO = None, 9 | type: str = None, 10 | extension: str = None, 11 | word_count: int = None, 12 | char_count: int = None, 13 | size_in_kb: float = None, 14 | duration_in_seconds: float = None, 15 | page_count: int = None, 16 | slide_count: int = None, 17 | entities: list = None, # list of dicts with keys 'file' and 'extension' 18 | run_id: str = None, 19 | status: str = None, 20 | ): 21 | self.file_base64 = file_base64 22 | self.file = File(file) if file else None 23 | self.type = type 24 | self.extension = extension 25 | self.word_count = word_count 26 | self.char_count = char_count 27 | self.size_in_kb = size_in_kb 28 | self.duration_in_seconds = duration_in_seconds 29 | self.page_count = page_count 30 | self.slide_count = slide_count 31 | self.entities = entities if entities is not None else [] 32 | self.run_id = run_id 33 | self.status = status 34 | 35 | def __repr__(self): 36 | return ( 37 | f"DeidentifyFileResponse(" 38 | f"file_base64={self.file_base64!r}, file={self.file!r}, type={self.type!r}, " 39 | f"extension={self.extension!r}, word_count={self.word_count!r}, " 40 | f"char_count={self.char_count!r}, size_in_kb={self.size_in_kb!r}, " 41 | f"duration_in_seconds={self.duration_in_seconds!r}, page_count={self.page_count!r}, " 42 | f"slide_count={self.slide_count!r}, entities={self.entities!r}, " 43 | f"run_id={self.run_id!r}, status={self.status!r})" 44 | ) 45 | 46 | def __str__(self): 47 | return self.__repr__() -------------------------------------------------------------------------------- /samples/service_account/signed_token_generation_example.py: -------------------------------------------------------------------------------- 1 | import json 2 | from skyflow.service_account import ( 3 | is_expired, 4 | generate_signed_data_tokens, 5 | generate_signed_data_tokens_from_creds, 6 | ) 7 | 8 | file_path = 'CREDENTIALS_FILE_PATH' 9 | bearer_token = '' 10 | 11 | skyflow_credentials = { 12 | 'clientID': '', 13 | 'clientName': '', 14 | 'tokenURI': '', 15 | 'keyID': '', 16 | 'privateKey': '', 17 | } 18 | credentials_string = json.dumps(skyflow_credentials) 19 | 20 | 21 | options = { 22 | 'ctx': 'CONTEXT_ID', 23 | 'data_tokens': ['DATA_TOKEN1', 'DATA_TOKEN2'], 24 | 'time_to_live': 90, # in seconds 25 | } 26 | 27 | def get_signed_bearer_token_from_file_path(): 28 | # Generate signed bearer token from credentials file path. 29 | global bearer_token 30 | 31 | try: 32 | if not is_expired(bearer_token): 33 | return bearer_token 34 | else: 35 | data_token, signed_data_token = generate_signed_data_tokens(file_path, options) 36 | return data_token, signed_data_token 37 | 38 | except Exception as e: 39 | print(f'Error generating token from file path: {str(e)}') 40 | 41 | 42 | def get_signed_bearer_token_from_credentials_string(): 43 | # Generate signed bearer token from credentials string. 44 | global bearer_token 45 | 46 | try: 47 | if not is_expired(bearer_token): 48 | return bearer_token 49 | else: 50 | data_token, signed_data_token = generate_signed_data_tokens_from_creds(credentials_string, options) 51 | return data_token, signed_data_token 52 | 53 | except Exception as e: 54 | print(f'Error generating token from credentials string: {str(e)}') 55 | 56 | 57 | print(get_signed_bearer_token_from_file_path()) 58 | 59 | print(get_signed_bearer_token_from_credentials_string()) 60 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_audit_response_event.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | from .audit_event_context import AuditEventContext 10 | from .v_1_audit_event_response import V1AuditEventResponse 11 | from .v_1_audit_response_event_request import V1AuditResponseEventRequest 12 | 13 | 14 | class V1AuditResponseEvent(UniversalBaseModel): 15 | """ 16 | Audit event details. 17 | """ 18 | 19 | context: typing.Optional[AuditEventContext] = None 20 | request: typing.Optional[V1AuditResponseEventRequest] = None 21 | response: typing.Optional[V1AuditEventResponse] = None 22 | parent_account_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="parentAccountID")] = ( 23 | pydantic.Field(default=None) 24 | ) 25 | """ 26 | Parent account ID of the account that made the request, if any. 27 | """ 28 | 29 | account_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="accountID")] = pydantic.Field( 30 | default=None 31 | ) 32 | """ 33 | ID of the account that made the request. 34 | """ 35 | 36 | resource_i_ds: typing_extensions.Annotated[ 37 | typing.Optional[typing.List[str]], FieldMetadata(alias="resourceIDs") 38 | ] = pydantic.Field(default=None) 39 | """ 40 | IDs for resources involved in the event. Presented in `{resourceType}/{resourceID}` format. For example, `VAULT/cd1d815aa09b4cbfbb803bd20349f202`. 41 | """ 42 | 43 | if IS_PYDANTIC_V2: 44 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 45 | else: 46 | 47 | class Config: 48 | frozen = True 49 | smart_union = True 50 | extra = pydantic.Extra.allow 51 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/v_1_card.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | import typing_extensions 7 | from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel 8 | from ..core.serialization import FieldMetadata 9 | 10 | 11 | class V1Card(UniversalBaseModel): 12 | """ 13 | Card metadata of the requested BIN. 14 | """ 15 | 16 | bin: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="BIN")] = pydantic.Field(default=None) 17 | """ 18 | BIN of the card. 19 | """ 20 | 21 | issuer_name: typing.Optional[str] = pydantic.Field(default=None) 22 | """ 23 | Name of the card issuer bank. 24 | """ 25 | 26 | country_code: typing.Optional[str] = pydantic.Field(default=None) 27 | """ 28 | Country code of the card. 29 | """ 30 | 31 | currency: typing.Optional[str] = pydantic.Field(default=None) 32 | """ 33 | Currency of the card. 34 | """ 35 | 36 | card_type: typing.Optional[str] = pydantic.Field(default=None) 37 | """ 38 | Type of the card. 39 | """ 40 | 41 | card_category: typing.Optional[str] = pydantic.Field(default=None) 42 | """ 43 | Category of the card. 44 | """ 45 | 46 | card_scheme: typing.Optional[str] = pydantic.Field(default=None) 47 | """ 48 | Scheme of the card. 49 | """ 50 | 51 | card_last_four_digits: typing.Optional[str] = pydantic.Field(default=None) 52 | """ 53 | Last four digits of the card number. 54 | """ 55 | 56 | card_expiry: typing.Optional[str] = pydantic.Field(default=None) 57 | """ 58 | Expiry date of the card. 59 | """ 60 | 61 | if IS_PYDANTIC_V2: 62 | model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 63 | else: 64 | 65 | class Config: 66 | frozen = True 67 | smart_union = True 68 | extra = pydantic.Extra.allow 69 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/format_masked_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FormatMaskedItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/format_redacted_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FormatRedactedItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/format_plaintext_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | FormatPlaintextItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/token_type_mapping_entity_only_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | TokenTypeMappingEntityOnlyItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/token_type_mapping_vault_token_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | TokenTypeMappingVaultTokenItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/types/token_type_mapping_entity_unq_counter_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | TokenTypeMappingEntityUnqCounterItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/strings/types/deidentify_string_request_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyStringRequestEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_deidentify_text_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestDeidentifyTextEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_deidentify_document_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestDeidentifyDocumentEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_audio_request_deidentify_audio_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileAudioRequestDeidentifyAudioEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_image_request_deidentify_image_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileImageRequestDeidentifyImageEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_deidentify_spreadsheet_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestDeidentifySpreadsheetEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_deidentify_presentation_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestDeidentifyPresentationEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_document_pdf_request_deidentify_pdf_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileDocumentPdfRequestDeidentifyPdfEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/generated/rest/files/types/deidentify_file_request_deidentify_structured_text_entity_types_item.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | DeidentifyFileRequestDeidentifyStructuredTextEntityTypesItem = typing.Union[ 6 | typing.Literal[ 7 | "age", 8 | "bank_account", 9 | "credit_card", 10 | "credit_card_expiration", 11 | "cvv", 12 | "date", 13 | "date_interval", 14 | "dob", 15 | "driver_license", 16 | "email_address", 17 | "healthcare_number", 18 | "ip_address", 19 | "location", 20 | "name", 21 | "numerical_pii", 22 | "phone_number", 23 | "ssn", 24 | "url", 25 | "vehicle_id", 26 | "medical_code", 27 | "name_family", 28 | "name_given", 29 | "account_number", 30 | "event", 31 | "filename", 32 | "gender", 33 | "language", 34 | "location_address", 35 | "location_city", 36 | "location_coordinate", 37 | "location_country", 38 | "location_state", 39 | "location_zip", 40 | "marital_status", 41 | "money", 42 | "name_medical_professional", 43 | "occupation", 44 | "organization", 45 | "organization_medical_facility", 46 | "origin", 47 | "passport_number", 48 | "password", 49 | "physical_attribute", 50 | "political_affiliation", 51 | "religion", 52 | "time", 53 | "username", 54 | "zodiac_sign", 55 | "blood_type", 56 | "condition", 57 | "dose", 58 | "drug", 59 | "injury", 60 | "medical_process", 61 | "statistics", 62 | "routing_number", 63 | "corporate_action", 64 | "financial_metric", 65 | "product", 66 | "trend", 67 | "duration", 68 | "location_address_street", 69 | "all", 70 | "sexuality", 71 | "effect", 72 | "project", 73 | "organization_id", 74 | "day", 75 | "month", 76 | "year", 77 | ], 78 | typing.Any, 79 | ] 80 | -------------------------------------------------------------------------------- /skyflow/vault/controller/_connections.py: -------------------------------------------------------------------------------- 1 | import json 2 | import requests 3 | from skyflow.error import SkyflowError 4 | from skyflow.utils import construct_invoke_connection_request, SkyflowMessages, get_metrics, \ 5 | parse_invoke_connection_response 6 | from skyflow.utils.logger import log_info, log_error_log 7 | from skyflow.vault.connection import InvokeConnectionRequest 8 | 9 | 10 | class Connection: 11 | def __init__(self, vault_client): 12 | self.__vault_client = vault_client 13 | 14 | def invoke(self, request: InvokeConnectionRequest): 15 | session = requests.Session() 16 | 17 | config = self.__vault_client.get_config() 18 | bearer_token = self.__vault_client.get_bearer_token(config.get("credentials")) 19 | 20 | connection_url = config.get("connection_url") 21 | log_info(SkyflowMessages.Info.VALIDATING_INVOKE_CONNECTION_REQUEST.value, self.__vault_client.get_logger()) 22 | invoke_connection_request = construct_invoke_connection_request(request, connection_url, self.__vault_client.get_logger()) 23 | log_info(SkyflowMessages.Info.INVOKE_CONNECTION_REQUEST_RESOLVED.value, self.__vault_client.get_logger()) 24 | 25 | if not 'X-Skyflow-Authorization'.lower() in invoke_connection_request.headers: 26 | invoke_connection_request.headers['x-skyflow-authorization'] = bearer_token 27 | 28 | invoke_connection_request.headers['sky-metadata'] = json.dumps(get_metrics()) 29 | 30 | log_info(SkyflowMessages.Info.INVOKE_CONNECTION_TRIGGERED.value, self.__vault_client.get_logger()) 31 | 32 | try: 33 | response = session.send(invoke_connection_request) 34 | session.close() 35 | invoke_connection_response = parse_invoke_connection_response(response) 36 | return invoke_connection_response 37 | 38 | except Exception as e: 39 | log_error_log(SkyflowMessages.ErrorLogs.INVOKE_CONNECTION_REQUEST_REJECTED.value, self.__vault_client.get_logger()) 40 | if isinstance(e, SkyflowError): raise e 41 | raise SkyflowError(SkyflowMessages.Error.INVOKE_CONNECTION_FAILED.value, 42 | SkyflowMessages.ErrorCodes.SERVER_ERROR.value) -------------------------------------------------------------------------------- /samples/detect_api/get_detect_run.py: -------------------------------------------------------------------------------- 1 | from skyflow.error import SkyflowError 2 | from skyflow import Env, Skyflow, LogLevel 3 | from skyflow.vault.detect import GetDetectRunRequest 4 | 5 | """ 6 | * Skyflow Get Detect Run Example 7 | * 8 | * This example demonstrates how to: 9 | * 1. Configure credentials 10 | * 2. Set up vault configuration 11 | * 3. Create a get detect run request 12 | * 4. Call getDetectRun to poll for file processing results 13 | * 5. Handle response and errors 14 | """ 15 | 16 | def perform_get_detect_run(): 17 | try: 18 | # Step 1: Configure Credentials 19 | credentials = { 20 | 'path': '/path/to/credentials.json' # Path to credentials file 21 | } 22 | 23 | # Step 2: Configure Vault 24 | vault_config = { 25 | 'vault_id': '', # Replace with your vault ID 26 | 'cluster_id': '', # Replace with your cluster ID 27 | 'env': Env.PROD, # Deployment environment 28 | 'credentials': credentials 29 | } 30 | 31 | # Step 3: Configure & Initialize Skyflow Client 32 | skyflow_client = ( 33 | Skyflow.builder() 34 | .add_vault_config(vault_config) 35 | .set_log_level(LogLevel.INFO) # Use LogLevel.ERROR in production 36 | .build() 37 | ) 38 | 39 | # Step 4: Create GetDetectRunRequest 40 | get_detect_run_request = GetDetectRunRequest( 41 | run_id='' # Replace with the runId from deidentifyFile call 42 | ) 43 | 44 | # Step 5: Call getDetectRun API 45 | response = skyflow_client.detect().get_detect_run(get_detect_run_request) 46 | 47 | # Handle Successful Response 48 | print("\nGet Detect Run Response:", response) 49 | 50 | except SkyflowError as error: 51 | # Handle Skyflow-specific errors 52 | print('\nSkyflow Error:', { 53 | 'http_code': error.http_code, 54 | 'grpc_code': error.grpc_code, 55 | 'http_status': error.http_status, 56 | 'message': error.message, 57 | 'details': error.details 58 | }) 59 | except Exception as error: 60 | # Handle unexpected errors 61 | print('Unexpected Error:', error) 62 | -------------------------------------------------------------------------------- /skyflow/generated/rest/core/query_encoder.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from typing import Any, Dict, List, Optional, Tuple 4 | 5 | import pydantic 6 | 7 | 8 | # Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict 9 | def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: 10 | result = [] 11 | for k, v in dict_flat.items(): 12 | key = f"{key_prefix}[{k}]" if key_prefix is not None else k 13 | if isinstance(v, dict): 14 | result.extend(traverse_query_dict(v, key)) 15 | elif isinstance(v, list): 16 | for arr_v in v: 17 | if isinstance(arr_v, dict): 18 | result.extend(traverse_query_dict(arr_v, key)) 19 | else: 20 | result.append((key, arr_v)) 21 | else: 22 | result.append((key, v)) 23 | return result 24 | 25 | 26 | def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]: 27 | if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): 28 | if isinstance(query_value, pydantic.BaseModel): 29 | obj_dict = query_value.dict(by_alias=True) 30 | else: 31 | obj_dict = query_value 32 | return traverse_query_dict(obj_dict, query_key) 33 | elif isinstance(query_value, list): 34 | encoded_values: List[Tuple[str, Any]] = [] 35 | for value in query_value: 36 | if isinstance(value, pydantic.BaseModel) or isinstance(value, dict): 37 | if isinstance(value, pydantic.BaseModel): 38 | obj_dict = value.dict(by_alias=True) 39 | elif isinstance(value, dict): 40 | obj_dict = value 41 | 42 | encoded_values.extend(single_query_encoder(query_key, obj_dict)) 43 | else: 44 | encoded_values.append((query_key, value)) 45 | 46 | return encoded_values 47 | 48 | return [(query_key, query_value)] 49 | 50 | 51 | def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: 52 | if query is None: 53 | return None 54 | 55 | encoded_query = [] 56 | for k, v in query.items(): 57 | encoded_query.extend(single_query_encoder(k, v)) 58 | return encoded_query 59 | -------------------------------------------------------------------------------- /samples/detect_api/reidentify_text.py: -------------------------------------------------------------------------------- 1 | from skyflow.error import SkyflowError 2 | from skyflow import Env, Skyflow, LogLevel 3 | from skyflow.utils.enums import DetectEntities 4 | from skyflow.vault.detect import ReidentifyTextRequest 5 | 6 | """ 7 | * Skyflow Text Re-identification Example 8 | * 9 | * This example demonstrates how to: 10 | * 1. Configure credentials 11 | * 2. Set up vault configuration 12 | * 3. Create a reidentify text request 13 | * 4. Use all available options for reidentification 14 | * 5. Handle response and errors 15 | """ 16 | 17 | def perform_text_reidentification(): 18 | try: 19 | # Step 1: Configure Credentials 20 | credentials = { 21 | 'path': '/path/to/credentials.json' # Path to credentials file 22 | } 23 | 24 | # Step 2: Configure Vault 25 | vault_config = { 26 | 'vault_id': '', # Replace with your vault ID 27 | 'cluster_id': '', # Replace with your cluster ID 28 | 'env': Env.PROD, # Deployment environment 29 | 'credentials': credentials 30 | } 31 | 32 | # Step 3: Configure & Initialize Skyflow Client 33 | skyflow_client = ( 34 | Skyflow.builder() 35 | .add_vault_config(vault_config) 36 | .set_log_level(LogLevel.ERROR) 37 | .build() 38 | ) 39 | 40 | # Step 4: Prepare Sample Redacted Text 41 | redacted_text = "" # Replace with your redacted text 42 | 43 | # Step 5: Create Reidentify Request 44 | reidentify_request = ReidentifyTextRequest( 45 | text=redacted_text, 46 | plain_text_entities=[DetectEntities.PHONE_NUMBER] 47 | ) 48 | 49 | # Step 6: Perform Text Reidentification 50 | response = skyflow_client.detect().reidentify_text(reidentify_request) 51 | 52 | # Step 7: Handle Successful Response 53 | print("\nReidentify Text Response:", response) 54 | 55 | except SkyflowError as error: 56 | # Handle Skyflow-specific errors 57 | print('\nSkyflow Error:', { 58 | 'http_code': error.http_code, 59 | 'grpc_code': error.grpc_code, 60 | 'http_status': error.http_status, 61 | 'message': error.message, 62 | 'details': error.details 63 | }) 64 | except Exception as error: 65 | # Handle unexpected errors 66 | print('Unexpected Error:', error) 67 | -------------------------------------------------------------------------------- /samples/vault_api/update_record.py: -------------------------------------------------------------------------------- 1 | from skyflow.error import SkyflowError 2 | from skyflow import Env 3 | from skyflow import Skyflow, LogLevel 4 | from skyflow.vault.data import UpdateRequest 5 | 6 | """ 7 | * Skyflow Secure Data Update Example 8 | * 9 | * This example demonstrates how to: 10 | * 1. Configure Skyflow client credentials 11 | * 2. Set up vault configuration 12 | * 3. Create an update request 13 | * 4. Handle response and errors 14 | """ 15 | 16 | def perform_secure_data_update(): 17 | try: 18 | credentials = { 19 | 'api_key': '' # Using API Key authentication 20 | } 21 | 22 | # Step 2: Configure Vault 23 | primary_vault_config = { 24 | 'vault_id': '', # primary vault 25 | 'cluster_id': '', # Cluster ID from your vault URL 26 | 'env': Env.PROD, # Deployment environment (PROD by default) 27 | 'credentials': credentials # Authentication method 28 | } 29 | 30 | # Step 3: Configure & Initialize Skyflow Client 31 | skyflow_client = ( 32 | Skyflow.builder() 33 | .add_vault_config(primary_vault_config) 34 | .set_log_level(LogLevel.ERROR) # Logging verbosity 35 | .build() 36 | ) 37 | 38 | # Step 4: Prepare Update Data 39 | update_data = { 40 | 'skyflow_id': '', # Skyflow ID of the record to update 41 | 'card_number': '' # Updated sensitive data 42 | } 43 | 44 | # Step 5: Create Update Request 45 | update_request = UpdateRequest( 46 | table='', 47 | data=update_data, 48 | return_tokens=True # Optional: Get tokens for updated data 49 | ) 50 | 51 | # Step 7: Perform Secure Update 52 | response = skyflow_client.vault(primary_vault_config.get('vault_id')).update(update_request) 53 | 54 | # Handle Successful Response 55 | print('Update successful: ', response) 56 | 57 | except SkyflowError as error: 58 | # Comprehensive Error Handling 59 | print('Skyflow Specific Error: ', { 60 | 'code': error.http_code, 61 | 'message': error.message, 62 | 'details': error.details 63 | }) 64 | except Exception as error: 65 | print('Unexpected Error:', error) 66 | 67 | # Invoke the secure data update function 68 | perform_secure_data_update() --------------------------------------------------------------------------------