Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_syncmaster /syncmaster /dto /connections.py
| # SPDX-FileCopyrightText: 2023-present MTS PJSC | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from dataclasses import dataclass, field | |
| from typing import ClassVar, Literal | |
| class ConnectionDTO: | |
| type: ClassVar[str] | |
| class PostgresConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| database_name: str | |
| additional_params: dict = field(default_factory=dict) | |
| type: ClassVar[str] = "postgres" | |
| class ClickhouseConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| database_name: str | None = None | |
| additional_params: dict = field(default_factory=dict) | |
| type: ClassVar[str] = "clickhouse" | |
| class MSSQLConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| database_name: str | |
| additional_params: dict = field(default_factory=dict) | |
| type: ClassVar[str] = "mssql" | |
| class MySQLConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| database_name: str | None = None | |
| additional_params: dict = field(default_factory=dict) | |
| type: ClassVar[str] = "mysql" | |
| class OracleConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| additional_params: dict = field(default_factory=dict) | |
| sid: str | None = None | |
| service_name: str | None = None | |
| type: ClassVar[str] = "oracle" | |
| class HiveConnectionDTO(ConnectionDTO): | |
| user: str | |
| password: str | |
| cluster: str | |
| type: ClassVar[str] = "hive" | |
| class IcebergConnectionBaseDTO(ConnectionDTO): | |
| rest_catalog_url: str | |
| flavor: ClassVar[str] | |
| type: ClassVar[str] = "iceberg" | |
| class IcebergRESTCatalogS3DirectConnectionBaseDTO(IcebergConnectionBaseDTO): | |
| s3_warehouse_path: str | |
| s3_host: str | |
| s3_bucket: str | |
| s3_bucket_style: Literal["domain", "path"] | |
| s3_region: str | |
| s3_access_key: str | |
| s3_secret_key: str | |
| s3_port: int | None | |
| s3_protocol: str | |
| s3_additional_params: dict = field(default_factory=dict) | |
| implementation: ClassVar[str] = "iceberg_rest_s3_direct" | |
| class IcebergRESTCatalogBearerAuthS3BasicDTO(IcebergRESTCatalogS3DirectConnectionBaseDTO): | |
| rest_catalog_token: str | |
| rest_catalog_auth_type: Literal["bearer"] = "bearer" | |
| class IcebergRESTCatalogOAuth2ClientCredentialsS3BasicDTO(IcebergRESTCatalogS3DirectConnectionBaseDTO): | |
| rest_catalog_oauth2_client_id: str | |
| rest_catalog_oauth2_client_secret: str | |
| rest_catalog_oauth2_scopes: list[str] | |
| rest_catalog_oauth2_resource: str | None = None | |
| rest_catalog_oauth2_audience: str | None = None | |
| rest_catalog_oauth2_token_endpoint: str | None = None | |
| rest_catalog_auth_type: Literal["oauth2"] = "oauth2" | |
| class IcebergRESTCatalogS3DelegatedConnectionBaseDTO(IcebergConnectionBaseDTO): | |
| s3_warehouse_name: str | None = None | |
| s3_access_delegation: Literal["vended-credentials", "remote-signing"] = "vended-credentials" | |
| implementation: ClassVar[str] = "iceberg_rest_s3_delegated" | |
| class IcebergRESTCatalogBearerAuthS3DelegatedDTO(IcebergRESTCatalogS3DelegatedConnectionBaseDTO): | |
| rest_catalog_token: str | |
| rest_catalog_auth_type: Literal["bearer"] = "bearer" | |
| class IcebergRESTCatalogOAuth2ClientCredentialsS3DelegatedDTO(IcebergRESTCatalogS3DelegatedConnectionBaseDTO): | |
| rest_catalog_oauth2_client_id: str | |
| rest_catalog_oauth2_client_secret: str | |
| rest_catalog_oauth2_scopes: list[str] | |
| rest_catalog_oauth2_resource: str | None = None | |
| rest_catalog_oauth2_audience: str | None = None | |
| rest_catalog_oauth2_token_endpoint: str | None = None | |
| rest_catalog_auth_type: Literal["oauth2"] = "oauth2" | |
| # TODO: should be refactored | |
| def get_iceberg_rest_catalog_s3_direct_connection_dto( | |
| **data, | |
| ) -> IcebergRESTCatalogBearerAuthS3BasicDTO | IcebergRESTCatalogOAuth2ClientCredentialsS3BasicDTO: | |
| if "rest_catalog_oauth2_client_id" in data: | |
| return IcebergRESTCatalogOAuth2ClientCredentialsS3BasicDTO(**data) | |
| return IcebergRESTCatalogBearerAuthS3BasicDTO(**data) | |
| def get_iceberg_rest_catalog_s3_delegated_connection_dto( | |
| **data, | |
| ) -> IcebergRESTCatalogBearerAuthS3DelegatedDTO | IcebergRESTCatalogOAuth2ClientCredentialsS3DelegatedDTO: | |
| if "rest_catalog_oauth2_client_id" in data: | |
| return IcebergRESTCatalogOAuth2ClientCredentialsS3DelegatedDTO(**data) | |
| return IcebergRESTCatalogBearerAuthS3DelegatedDTO(**data) | |
| def get_iceberg_connection_dto(**data) -> IcebergConnectionBaseDTO: | |
| if "s3_warehouse_path" in data: | |
| return get_iceberg_rest_catalog_s3_direct_connection_dto(**data) | |
| return get_iceberg_rest_catalog_s3_delegated_connection_dto(**data) | |
| class HDFSConnectionDTO(ConnectionDTO): | |
| user: str | |
| password: str | |
| cluster: str | |
| type: ClassVar[str] = "hdfs" | |
| class S3ConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| access_key: str | |
| secret_key: str | |
| bucket: str | |
| bucket_style: Literal["domain", "path"] | |
| region: str | |
| additional_params: dict = field(default_factory=dict) | |
| protocol: str = "https" | |
| type: ClassVar[str] = "s3" | |
| class SFTPConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| type: ClassVar[str] = "sftp" | |
| class FTPConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| type: ClassVar[str] = "ftp" | |
| class FTPSConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| type: ClassVar[str] = "ftps" | |
| class SambaConnectionDTO(ConnectionDTO): | |
| host: str | |
| share: str | |
| user: str | |
| password: str | |
| protocol: Literal["SMB", "NetBIOS"] = "SMB" | |
| auth_type: Literal["NTLMv1", "NTLMv2"] = "NTLMv2" | |
| domain: str = "" | |
| port: int | None = None | |
| type: ClassVar[str] = "samba" | |
| class WebDAVConnectionDTO(ConnectionDTO): | |
| host: str | |
| port: int | |
| user: str | |
| password: str | |
| protocol: Literal["http", "https"] = "https" | |
| type: ClassVar[str] = "webdav" | |
Xet Storage Details
- Size:
- 6.21 kB
- Xet hash:
- 61fa3ff0d71e31476cd5679663d79ab4e6a140a23eb3b969859d44e921b21f70
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.