ecs_composex.compose.x_resources package ¶
Submodules ¶
ecs_composex.compose.x_resources.api_x_resources module ¶
- class ecs_composex.compose.x_resources.api_x_resources. ApiXResource ( name , definition , module , settings ) [source] ¶
-
Bases:
ServicesXResource
Class for Resources that only require API / IAM access to be defined
ecs_composex.compose.x_resources.environment_x_resources module ¶
- class ecs_composex.compose.x_resources.environment_x_resources. AwsEnvironmentResource ( name , definition , module , settings ) [source] ¶
-
Bases:
XResource
Class for AWS Resources that are used by other AWS Resources. The services do not use these resources directly
- Variables :
-
lookup_only ( bool ) – Whether the XResource should only be looked up.
ecs_composex.compose.x_resources.helpers module ¶
- ecs_composex.compose.x_resources.helpers. get_setting_key ( name , settings_dict ) [source] ¶
-
Allows for flexibility in the syntax, i.e. to make access/Access both valid
- Return type :
-
str
- ecs_composex.compose.x_resources.helpers. set_new_resources ( x_resources , supports_uses_default = False ) [source] ¶
-
Function to create a list of new resources. Check if empty resource is supported
- ecs_composex.compose.x_resources.helpers. set_resources ( settings , resource_class , module ) [source] ¶
-
Method to define the ComposeXResource for each service. First updates the resources dict
- Parameters :
-
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
resource_class ( ecs_composex.common.compose_resources.XResource ) –
-
module ( XResourceModule ) –
-
ecs_composex.compose.x_resources.network_x_resources module ¶
- class ecs_composex.compose.x_resources.network_x_resources. DatabaseXResource ( name , definition , module , settings ) [source] ¶
-
Bases:
NetworkXResource
Class for network resources that share common properties
- Variables :
-
-
db_secret_arn_parameter ( ecs_composex.common.cfn_params.Parameter ) –
-
db_cluster_endpoint_param ( ecs_composex.common.cfn_params.Parameter ) –
-
- to_ecs ( settings , modules , root_stack = None ) [source] ¶
-
Maps a database service to ECS services
- Parameters :
-
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
modules ( ModManager ) –
-
root_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
- Return type :
-
None
- class ecs_composex.compose.x_resources.network_x_resources. NetworkXResource ( name , definition , module , settings ) [source] ¶
-
Bases:
ServicesXResource
Class for resources that need VPC and SecurityGroups to be managed for Ingress
- cleanse_external_targets ( ) [source] ¶
-
Will automatically remove the target families which are set as external
- Return type :
-
None
- remove_services_after_family_cleanups ( ) [source] ¶
-
After the family services have been removed from the target, we ensure that we deal with the services which may or may not be in the targets already
- Return type :
-
None
ecs_composex.compose.x_resources.services_resources module ¶
- class ecs_composex.compose.x_resources.services_resources. ServicesXResource ( name , definition , module , settings ) [source] ¶
-
Bases:
XResource
Class for XResource that would be linked to services for IAM / Ingress
- Variables :
-
-
families_targets ( list [ tuple ] ) – List of the service targets to associate access with
-
families_scaling ( list [ tuple ] ) – List of the services target to associate scaling with
-
- static define_service_to_associate ( service_name , family_name , settings ) [source] ¶
-
- Return type :
- handle_families_scaling_expansion_dict ( service_name , service , settings ) [source] ¶
-
Method to list all families and services that are targets of the resource. Allows to implement family and service level association to resource
- Return type :
-
None
- handle_families_targets_expansion_dict ( service_name , service_def , settings ) [source] ¶
-
Method to list all families and services that are targets of the resource. Allows to implement family and service level association to resource
- Return type :
-
None
- set_services_scaling ( settings ) [source] ¶
-
Method to map services and families targets of the services defined. TargetStructure: (family, family_wide, services[], access)
- set_services_targets ( settings ) [source] ¶
-
Method to map services and families targets of the services defined. TargetStructure: (family, family_wide, services[], access)
- Return type :
-
None
Module contents ¶
Module to define the ComposeX Resources into a simple object to make it easier to navigate through.
- class ecs_composex.compose.x_resources. XResource ( name , definition , module , settings ) [source] ¶
-
Bases:
object
Class to represent each defined resource in the template
- Variables :
-
-
policies_scaffolds ( dict ) – IAM policies template to use to generate IAM policies for the given resource
-
name ( str ) – The name of the resource as defined in compose file
-
definition ( dict ) – The definition of the resource as defined in compose file
-
logical_name ( str ) – Name of the resource to use in CFN template as for export/import
-
requires_vpc ( bool ) – Whether or not the resource requires a VPC to function (i.e. RDS)
-
- add_new_output_attribute ( attribute_id , attribute_config , generate_outputs = True ) [source] ¶
-
Adds a new output to attributes and re-generates all outputs
- cloud_control_attributes_mapping_lookup ( resource_type , resource_id , ** kwargs ) [source] ¶
-
Method to map the resource properties to the CCAPI description :rtype:
tuple
[dict
,dict
] :return:
- property compose_x_arn : str ¶
- define_export_name ( output_definition , attribute_parameter ) [source] ¶
-
Method to define the export name for the resource :return:
- property env_var_prefix : str ¶
- generate_cfn_mappings_from_lookup_properties ( ) [source] ¶
-
Sets the .mappings attribute based on the lookup_attributes for CFN purposes
- generate_ref_env_var ( target ) [source] ¶
-
Method to define all the env var of a resource based on its own defined output attributes
- Return type :
-
list
- generate_resource_service_env_vars ( target , target_definition ) [source] ¶
-
Generates env vars based on ReturnValues set for a give service. When the resource is new, adds the parameter to the services stack appropriately.
- Return type :
-
list
- get_resource_attribute_value ( parameter , family ) [source] ¶
-
Finds the value
- Return type :
-
typing.Optional
[tuple
]
- lookup_resource ( arn_re , native_lookup_function , cfn_resource_type , tagging_api_id , subattribute_key = None , use_arn_for_id = False ) [source] ¶
-
Method to self-identify properties. It will try to use AWS Cloud Control API if possible, otherwise fallback to using boto3 descriptions functions to create a mapping of the attributes.
- property mod_mapping_key : str ¶
- property mod_res_key : str ¶
- property parameters : dict ¶
- property property_to_parameter_mapping ¶
- set_attributes_from_mapping ( attribute_parameter ) [source] ¶
-
Method to define the attribute outputs for lookup resources, which use FindInMap or Ref
- Parameters :
-
attribute_parameter ( ecs_composex.common.cfn_params.Parameter ) – The parameter mapped to the resource attribute
- Returns :
-
The FindInMap setting for mapped resource
- set_new_resource_outputs ( output_definition , attribute_parameter ) [source] ¶
-
Method to define the outputs for the resource when new
- set_update_container_env_var ( family , parameter , env_var_name ) [source] ¶
-
Function that will set or update the value of a given env var from Return value of a resource. If the resource is new, adding the parameter to the top stack If the resource is lookup, point to the mapping.
- Return type :
-
list
- property uses_default : bool ¶