source/cdk_solution_helper_py/helpers_cdk/aws_solutions/cdk/aws_lambda/environment.py [22:48]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@dataclass
class Environment:
    """
    Tracks environment variables common to AWS Lambda functions deployed by this solution
    """

    scope: IFunction
    solution_name: EnvironmentVariable = field(init=False, repr=False)
    solution_id: EnvironmentVariable = field(init=False, repr=False)
    solution_version: EnvironmentVariable = field(init=False, repr=False)
    log_level: EnvironmentVariable = field(init=False, repr=False)
    powertools_service_name: EnvironmentVariable = field(init=False, repr=False)

    def __post_init__(self):
        cloudwatch_namespace_id = f"personalize_solution_{Aws.STACK_NAME}"
        cloudwatch_service_id_default = f"Workflow"

        self.solution_name = EnvironmentVariable(self.scope, "SOLUTION_NAME")
        self.solution_id = EnvironmentVariable(self.scope, "SOLUTION_ID")
        self.solution_version = EnvironmentVariable(self.scope, "SOLUTION_VERSION")
        self.log_level = EnvironmentVariable(self.scope, "LOG_LEVEL", "INFO")
        self.powertools_service_name = EnvironmentVariable(
            self.scope, "POWERTOOLS_SERVICE_NAME", cloudwatch_service_id_default
        )
        self.powertools_metrics_namespace = EnvironmentVariable(
            self.scope, "POWERTOOLS_METRICS_NAMESPACE", cloudwatch_namespace_id
        )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



source/infrastructure/personalize/aws_lambda/functions/environment.py [22:48]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@dataclass
class Environment:
    """
    Tracks environment variables common to AWS Lambda functions deployed by this solution
    """

    scope: IFunction
    solution_name: EnvironmentVariable = field(init=False, repr=False)
    solution_id: EnvironmentVariable = field(init=False, repr=False)
    solution_version: EnvironmentVariable = field(init=False, repr=False)
    log_level: EnvironmentVariable = field(init=False, repr=False)
    powertools_service_name: EnvironmentVariable = field(init=False, repr=False)

    def __post_init__(self):
        cloudwatch_namespace_id = f"personalize_solution_{Aws.STACK_NAME}"
        cloudwatch_service_id_default = f"Workflow"

        self.solution_name = EnvironmentVariable(self.scope, "SOLUTION_NAME")
        self.solution_id = EnvironmentVariable(self.scope, "SOLUTION_ID")
        self.solution_version = EnvironmentVariable(self.scope, "SOLUTION_VERSION")
        self.log_level = EnvironmentVariable(self.scope, "LOG_LEVEL", "INFO")
        self.powertools_service_name = EnvironmentVariable(
            self.scope, "POWERTOOLS_SERVICE_NAME", cloudwatch_service_id_default
        )
        self.powertools_metrics_namespace = EnvironmentVariable(
            self.scope, "POWERTOOLS_METRICS_NAMESPACE", cloudwatch_namespace_id
        )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



