Skip to content

Commit bf5a80f

Browse files
authored
refactor(parser): Improve Transfer Family models with examples and descriptions (#7294)
* refactor(parser): Improve Transfer Family models with examples and descriptions Enhances the Transfer Family parser models with field descriptions and examples using Pydantic's Field() functionality. This improvement provides better documentation and metadata for Transfer Family event parsing, following the pattern established in PR #7100. All field descriptions are based on official AWS Transfer Family Lambda authorizer documentation and include realistic examples from actual test events. Closes #7119 * security: fix password examples to avoid security hotspots Replace specific password examples with placeholder format to resolve SonarQube security hotspots while maintaining documentation value. * security: remove IP address examples as requested Remove IP address examples from source_ip field to avoid triggering security pipelines in customer environments as requested by leandrodamascena.
1 parent f21fcb7 commit bf5a80f

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

aws_lambda_powertools/utilities/parser/models/transfer_family.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,27 @@
55

66

77
class TransferFamilyAuthorizer(BaseModel):
8-
username: str
9-
password: Optional[str] = None
10-
protocol: Literal["SFTP", "FTP", "FTPS"]
11-
server_id: str = Field(..., alias="serverId")
12-
source_ip: IPvAnyAddress = Field(..., alias="sourceIp")
8+
username: str = Field(
9+
description="The username of the user attempting to authenticate.",
10+
examples=["bobusa", "john.doe", "sftp-user-123", "data-transfer-user"],
11+
)
12+
password: Optional[str] = Field(
13+
default=None,
14+
description="The password for authentication.",
15+
examples=["<password>", "<user-password>", None],
16+
)
17+
protocol: Literal["SFTP", "FTP", "FTPS"] = Field(
18+
description="The protocol used for the connection.",
19+
examples=["SFTP", "FTPS", "FTP"],
20+
)
21+
server_id: str = Field(
22+
...,
23+
alias="serverId",
24+
description="The server ID of the Transfer Family server.",
25+
examples=["s-abcd123456", "s-1234567890abcdef0", "s-example123"],
26+
)
27+
source_ip: IPvAnyAddress = Field(
28+
...,
29+
alias="sourceIp",
30+
description="The IP address of the client connecting to the Transfer Family server.",
31+
)

0 commit comments

Comments
 (0)