Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_syncmaster /syncmaster /schemas /v1 /connections /s3.py
| # SPDX-FileCopyrightText: 2023-present MTS PJSC | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from typing import Literal | |
| from pydantic import BaseModel, Field, ValidationInfo, field_validator | |
| from syncmaster.schemas.v1.auth import ( | |
| CreateS3AuthSchema, | |
| ReadS3AuthSchema, | |
| ) | |
| from syncmaster.schemas.v1.auth.s3 import UpdateS3AuthSchema | |
| from syncmaster.schemas.v1.connection_types import S3_TYPE | |
| from syncmaster.schemas.v1.connections.connection_base import ( | |
| CreateConnectionBaseSchema, | |
| ReadConnectionBaseSchema, | |
| ) | |
| class ReadS3ConnectionDataSchema(BaseModel): | |
| host: str | |
| bucket: str | |
| protocol: Literal["http", "https"] = "https" | |
| region: str | |
| port: int | None = Field(default=None, gt=0, le=65535, validate_default=True) | |
| bucket_style: Literal["domain", "path"] = "path" | |
| additional_params: dict = Field(default_factory=dict) | |
| class CreateS3ConnectionDataSchema(ReadS3ConnectionDataSchema): | |
| def validate_port(cls, port: int | None, info: ValidationInfo) -> int: | |
| protocol = info.data.get("protocol") | |
| if port is None: | |
| return 443 if protocol == "https" else 80 | |
| return port | |
| class ReadS3ConnectionSchema(ReadConnectionBaseSchema): | |
| type: S3_TYPE = Field(description="Connection type") | |
| data: ReadS3ConnectionDataSchema = Field( | |
| alias="connection_data", | |
| description="Data required to connect to the S3 bucket", | |
| ) | |
| auth_data: ReadS3AuthSchema | None = Field( | |
| default=None, | |
| description="Credentials for authorization", | |
| ) | |
| class CreateS3ConnectionSchema(CreateConnectionBaseSchema): | |
| type: S3_TYPE = Field(description="Connection type") | |
| data: CreateS3ConnectionDataSchema = Field( | |
| alias="connection_data", | |
| description="Data required to connect to the S3 bucket", | |
| ) | |
| auth_data: CreateS3AuthSchema = Field( | |
| description="S3 bucket credentials", | |
| ) | |
| class UpdateS3ConnectionSchema(CreateS3ConnectionSchema): | |
| auth_data: UpdateS3AuthSchema = Field( | |
| description="S3 bucket credentials", | |
| ) | |
Xet Storage Details
- Size:
- 2.12 kB
- Xet hash:
- 8211c7a594284a6222a3b38c705f40f7556392e7c592a244a7d8f3134821bf11
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.