Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
seshubaws authored Dec 20, 2023
2 parents b0213a1 + cedb5c9 commit 64d6352
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 3 deletions.
108 changes: 106 additions & 2 deletions aws_lambda_powertools/utilities/parameters/ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,57 @@ def _raise_if_errors_key_is_present(parameters: Dict, reserved_parameter: str, r
)


@overload
def get_parameter(
name: str,
transform: None = None,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
**sdk_options,
) -> str:
...


@overload
def get_parameter(
name: str,
transform: Literal["json"],
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
**sdk_options,
) -> dict:
...


@overload
def get_parameter(
name: str,
transform: Optional[str] = None,
transform: Literal["binary"],
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
**sdk_options,
) -> Union[str, dict, bytes]:
...


@overload
def get_parameter(
name: str,
transform: Literal["auto"],
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
**sdk_options,
) -> bytes:
...


def get_parameter(
name: str,
transform: TransformOptions = None,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
Expand Down Expand Up @@ -625,9 +673,65 @@ def get_parameter(
)


@overload
def get_parameters(
path: str,
transform: Optional[str] = None,
transform: None = None,
recursive: bool = True,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
raise_on_transform_error: bool = False,
**sdk_options,
) -> Dict[str, str]:
...


@overload
def get_parameters(
path: str,
transform: Literal["json"],
recursive: bool = True,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
raise_on_transform_error: bool = False,
**sdk_options,
) -> Dict[str, dict]:
...


@overload
def get_parameters(
path: str,
transform: Literal["binary"],
recursive: bool = True,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
raise_on_transform_error: bool = False,
**sdk_options,
) -> Dict[str, bytes]:
...


@overload
def get_parameters(
path: str,
transform: Literal["auto"],
recursive: bool = True,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
max_age: Optional[int] = None,
raise_on_transform_error: bool = False,
**sdk_options,
) -> Union[Dict[str, bytes], Dict[str, dict], Dict[str, str]]:
...


def get_parameters(
path: str,
transform: TransformOptions = None,
recursive: bool = True,
decrypt: Optional[bool] = None,
force_fetch: bool = False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def lambda_handler(event: dict, context: LambdaContext) -> dict:
try:
# Retrieve a single parameter
endpoint_comments: str = parameters.get_parameter("/lambda-powertools/endpoint_comments") # type: ignore[assignment] # noqa: E501
endpoint_comments = parameters.get_parameter("/lambda-powertools/endpoint_comments")

# the value of this parameter is https://jsonplaceholder.typicode.com/comments/
comments: requests.Response = requests.get(endpoint_comments)
Expand Down

0 comments on commit 64d6352

Please sign in to comment.