-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-22140] Add API schemas for SFTP, FTP, FTPS, WebDAV, Samba file s…
…ources (#187)
- Loading branch information
1 parent
d83ad79
commit 23e489f
Showing
39 changed files
with
1,364 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add API schemas for SFTP, FTP, FTPS, WebDAV, Samba file sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from syncmaster.schemas.v1.auth.basic import ( | ||
BasicAuthSchema, | ||
CreateBasicAuthSchema, | ||
ReadBasicAuthSchema, | ||
UpdateBasicAuthSchema, | ||
) | ||
from syncmaster.schemas.v1.auth.s3 import ( | ||
CreateS3AuthSchema, | ||
ReadS3AuthSchema, | ||
S3AuthSchema, | ||
UpdateS3AuthSchema, | ||
) | ||
from syncmaster.schemas.v1.auth.samba import ( | ||
CreateSambaAuthSchema, | ||
ReadSambaAuthSchema, | ||
SambaAuthSchema, | ||
UpdateSambaAuthSchema, | ||
) | ||
from syncmaster.schemas.v1.auth.token import AuthTokenSchema, TokenPayloadSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, SecretStr | ||
|
||
|
||
class S3AuthSchema(BaseModel): | ||
type: Literal["s3"] | ||
|
||
|
||
class CreateS3AuthSchema(S3AuthSchema): | ||
access_key: str | ||
secret_key: SecretStr | ||
|
||
|
||
class ReadS3AuthSchema(S3AuthSchema): | ||
access_key: str | ||
|
||
|
||
class UpdateS3AuthSchema(S3AuthSchema): | ||
access_key: str | None = None | ||
secret_key: SecretStr | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, SecretStr | ||
|
||
|
||
class SambaAuthSchema(BaseModel): | ||
type: Literal["samba"] | ||
|
||
|
||
class CreateSambaAuthSchema(SambaAuthSchema): | ||
user: str | ||
password: SecretStr | ||
auth_type: Literal["NTLMv1", "NTLMv2"] = "NTLMv2" | ||
|
||
|
||
class ReadSambaAuthSchema(SambaAuthSchema): | ||
user: str | ||
auth_type: Literal["NTLMv1", "NTLMv2"] | ||
|
||
|
||
class UpdateSambaAuthSchema(SambaAuthSchema): | ||
user: str | None = None | ||
password: SecretStr | None = None | ||
auth_type: Literal["NTLMv1", "NTLMv2"] | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from pydantic import BaseModel | ||
|
||
|
||
class TokenPayloadSchema(BaseModel): | ||
user_id: int | ||
|
||
|
||
class AuthTokenSchema(BaseModel): | ||
access_token: str | ||
token_type: str | ||
expires_at: float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from syncmaster.schemas.v1.auth import ( | ||
CreateBasicAuthSchema, | ||
ReadBasicAuthSchema, | ||
UpdateBasicAuthSchema, | ||
) | ||
from syncmaster.schemas.v1.connection_types import FTP_TYPE | ||
from syncmaster.schemas.v1.connections.connection_base import ( | ||
CreateConnectionBaseSchema, | ||
ReadConnectionBaseSchema, | ||
UpdateConnectionBaseSchema, | ||
) | ||
|
||
|
||
class CreateFTPConnectionDataSchema(BaseModel): | ||
host: str | ||
port: int | ||
|
||
|
||
class ReadFTPConnectionDataSchema(BaseModel): | ||
host: str | ||
port: int | ||
|
||
|
||
class UpdateFTPConnectionDataSchema(BaseModel): | ||
host: str | None = None | ||
port: int | None = None | ||
|
||
|
||
class CreateFTPConnectionSchema(CreateConnectionBaseSchema): | ||
type: FTP_TYPE = Field(..., description="Connection type") | ||
data: CreateFTPConnectionDataSchema = Field( | ||
..., | ||
alias="connection_data", | ||
description=( | ||
"Data required to connect to the remote server. These are the parameters that are specified in the URL request." | ||
), | ||
) | ||
auth_data: CreateBasicAuthSchema = Field( | ||
description="Credentials for authorization", | ||
) | ||
|
||
|
||
class ReadFTPConnectionSchema(ReadConnectionBaseSchema): | ||
type: FTP_TYPE | ||
data: ReadFTPConnectionDataSchema = Field(alias="connection_data") | ||
auth_data: ReadBasicAuthSchema | None = None | ||
|
||
|
||
class UpdateFTPConnectionSchema(UpdateConnectionBaseSchema): | ||
type: FTP_TYPE | ||
data: UpdateFTPConnectionDataSchema | None = Field(alias="connection_data", default=None) | ||
auth_data: UpdateBasicAuthSchema | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from syncmaster.schemas.v1.auth import ( | ||
CreateBasicAuthSchema, | ||
ReadBasicAuthSchema, | ||
UpdateBasicAuthSchema, | ||
) | ||
from syncmaster.schemas.v1.connection_types import FTPS_TYPE | ||
from syncmaster.schemas.v1.connections.connection_base import ( | ||
CreateConnectionBaseSchema, | ||
ReadConnectionBaseSchema, | ||
UpdateConnectionBaseSchema, | ||
) | ||
|
||
|
||
class CreateFTPSConnectionDataSchema(BaseModel): | ||
host: str | ||
port: int | ||
|
||
|
||
class ReadFTPSConnectionDataSchema(BaseModel): | ||
host: str | ||
port: int | ||
|
||
|
||
class UpdateFTPSConnectionDataSchema(BaseModel): | ||
host: str | None = None | ||
port: int | None = None | ||
|
||
|
||
class CreateFTPSConnectionSchema(CreateConnectionBaseSchema): | ||
type: FTPS_TYPE = Field(..., description="Connection type") | ||
data: CreateFTPSConnectionDataSchema = Field( | ||
..., | ||
alias="connection_data", | ||
description=( | ||
"Data required to connect to the remote server. These are the parameters that are specified in the URL request." | ||
), | ||
) | ||
auth_data: CreateBasicAuthSchema = Field( | ||
description="Credentials for authorization", | ||
) | ||
|
||
|
||
class ReadFTPSConnectionSchema(ReadConnectionBaseSchema): | ||
type: FTPS_TYPE | ||
data: ReadFTPSConnectionDataSchema = Field(alias="connection_data") | ||
auth_data: ReadBasicAuthSchema | None = None | ||
|
||
|
||
class UpdateFTPSConnectionSchema(UpdateConnectionBaseSchema): | ||
type: FTPS_TYPE | ||
data: UpdateFTPSConnectionDataSchema | None = Field(alias="connection_data", default=None) | ||
auth_data: UpdateBasicAuthSchema | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.