Skip to content

Commit f400ce8

Browse files
author
AWS
committed
Release: 1.6.6
1 parent 9e266ad commit f400ce8

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.5
1+
1.6.6

sources/aft-lambda-layer/aft_common/account_provisioning_framework.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,12 @@ def get_ssm_parameters_names_by_path(session: Session, path: str) -> List[str]:
309309

310310

311311
def delete_ssm_parameters(session: Session, parameters: Sequence[str]) -> None:
312-
313-
if len(parameters) > 0:
312+
batches = utils.yield_batches_from_list(
313+
parameters, batch_size=10
314+
) # Max batch size for API
315+
for batched_names in batches:
314316
client = session.client("ssm")
315-
response = client.delete_parameters(Names=parameters)
317+
response = client.delete_parameters(Names=batched_names)
316318

317319

318320
def put_ssm_parameters(session: Session, parameters: Dict[str, str]) -> None:

sources/aft-lambda-layer/aft_common/aft_utils.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
TYPE_CHECKING,
1010
Any,
1111
Dict,
12+
Iterable,
1213
List,
13-
Literal,
1414
Optional,
1515
Sequence,
1616
Union,
@@ -534,3 +534,15 @@ def get_aws_partition(session: Session, region: Optional[str] = None) -> str:
534534

535535
partition = session.get_partition_for_region(region) # type: ignore
536536
return cast(str, partition)
537+
538+
539+
def yield_batches_from_list(
540+
input: Sequence[Any], batch_size: int
541+
) -> Iterable[Sequence[Any]]:
542+
if batch_size <= 0:
543+
return []
544+
545+
idx = 0
546+
while idx < len(input):
547+
yield input[idx : idx + batch_size]
548+
idx += batch_size

sources/aft-lambda-layer/aft_common/organizations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
import re
55
from copy import deepcopy
6+
from tokenize import String
67
from typing import TYPE_CHECKING, List, Optional, Tuple
78

89
from aft_common.aft_utils import get_logger
@@ -74,6 +75,10 @@ def get_name_and_id_from_nested_ou(
7475
name = nested_ou_name[: first_id_idx - 1]
7576
return (name, id)
7677

78+
@staticmethod
79+
def get_nested_ou_format_from_name_and_id(ou_name: str, ou_id: str) -> str:
80+
return f"{ou_name} ({ou_id})"
81+
7782
def get_root_ou_id(self) -> str:
7883
return self.orgs_client.list_roots()["Roots"][0]["Id"]
7984

0 commit comments

Comments
 (0)