Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston committed Nov 20, 2023
1 parent 0cc3b9f commit 548b4a4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion ecs_composex/aps/aps_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def add_extra_outputs(self):
def create_aps_log_group(
new_aps: ManagedPrometheus,
props: dict,
macro_value: Union[bool, dict],
macro_value: bool | dict,
template: Template,
) -> None:
"""Handles the CreateNewLogGroup macro parameter"""
Expand Down
4 changes: 2 additions & 2 deletions ecs_composex/kinesis/kcl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def add_cloudwatch_metric_data_permission(family: ComposeFamily) -> None:
)


def define_dynamodb_statement(dynamodb_definition: Union[bool, dict]) -> list:
def define_dynamodb_statement(dynamodb_definition: bool | dict) -> list:
sid = "DynamodbKCL"
if isinstance(dynamodb_definition, bool):
statement = [
Expand Down Expand Up @@ -108,7 +108,7 @@ def define_dynamodb_statement(dynamodb_definition: Union[bool, dict]) -> list:


def add_dynamodb_permissions(
family: ComposeFamily, dynamodb_definition: Union[bool, dict]
family: ComposeFamily, dynamodb_definition: bool | dict
) -> None:
"""
Adds permissions to access DynamoDB
Expand Down
68 changes: 33 additions & 35 deletions ecs_composex/mods_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def __init__(
res_key: str,
x_class,
posix_path,
resource_class: Union[
XResource,
ServicesXResource,
ApiXResource,
AwsEnvironmentResource,
NetworkXResource,
DatabaseXResource,
] = None,
resource_class: (
XResource
| ServicesXResource
| ApiXResource
| AwsEnvironmentResource
| NetworkXResource
| DatabaseXResource
) = None,
definition: dict = None,
):
if definition and not isinstance(definition, dict):
Expand Down Expand Up @@ -90,14 +90,14 @@ def __del__(self):
@property
def resource_class(
self,
) -> Union[
XResource,
ServicesXResource,
ApiXResource,
AwsEnvironmentResource,
NetworkXResource,
DatabaseXResource,
]:
) -> (
XResource
| ServicesXResource
| ApiXResource
| AwsEnvironmentResource
| NetworkXResource
| DatabaseXResource
):
return self._resource_class

@property
Expand Down Expand Up @@ -153,29 +153,29 @@ def resources(
self,
) -> dict[
str,
Union[
XResource,
ServicesXResource,
ApiXResource,
AwsEnvironmentResource,
NetworkXResource,
DatabaseXResource,
],
(
XResource
| ServicesXResource
| ApiXResource
| AwsEnvironmentResource
| NetworkXResource
| DatabaseXResource
),
]:
return self._resources

@property
def resources_list(
self,
) -> list[
Union[
XResource,
ServicesXResource,
ApiXResource,
AwsEnvironmentResource,
NetworkXResource,
DatabaseXResource,
]
(
XResource
| ServicesXResource
| ApiXResource
| AwsEnvironmentResource
| NetworkXResource
| DatabaseXResource
)
]:
return [_res for _res in self._resources.values() if _res is not None]

Expand Down Expand Up @@ -343,9 +343,7 @@ def add_module_from_module_def(self, res_key: str, mod_key: str, module_name: st
if extension_module:
return extension_module

def load_module(
self, res_key: str, res_def: Union[dict, bool]
) -> Union[XResourceModule, None]:
def load_module(self, res_key: str, res_def: dict | bool) -> XResourceModule | None:
if not res_key.startswith(X_KEY):
return
mod_key = re.sub(X_KEY, "", res_key)
Expand Down
2 changes: 1 addition & 1 deletion ecs_composex/rds/rds_db_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def override_set_properties(props: dict, db: Rds) -> None:
)


def determine_resource_type(db_name: str, properties: dict) -> Union[type, None]:
def determine_resource_type(db_name: str, properties: dict) -> type | None:
"""
Function to determine if the properties are the ones of a DB Cluster or DB Instance.
Default assumes DBCluster if it can't make it out from properties.
Expand Down
2 changes: 1 addition & 1 deletion ecs_composex/rds/rds_parameter_groups_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_db_cluster_engine_parameter_group_defaults(

def get_family_from_engine_version(
engine_name: str, engine_version: str, session: Session = None
) -> Union[str, None]:
) -> str | None:
"""
Get the engine family from engine name and version
"""
Expand Down
4 changes: 2 additions & 2 deletions ecs_composex/rds_resources_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def add_secrets_access_policy(
service_family: ComposeFamily,
secret_import,
db: DatabaseXResource,
use_task_role: Union[bool, dict] = False,
use_task_role: bool | dict = False,
) -> None:
"""
Function to add or append policy to access DB Secret for the Execution Role
Expand Down Expand Up @@ -451,7 +451,7 @@ def add_secrets_access_policy(


def handle_task_role_access(
use_task_role: Union[dict, bool],
use_task_role: dict | bool,
policy: PolicyType,
secret_import,
task_role,
Expand Down
2 changes: 1 addition & 1 deletion ecs_composex/resource_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def define_iam_permissions(
dest_resource_template,
policy_title,
access_type_policy_model,
access_definition: Union[str, dict],
access_definition: str | dict,
resource_arns,
access_subkey: str = None,
roles=None,
Expand Down

0 comments on commit 548b4a4

Please sign in to comment.