def other_lambdas(self): """ Indicates whether the companion REST API responds to HTTP requests. """ response = { lambda_name: self._lambda(lambda_name) for lambda_name in config.lambda_names() if lambda_name != self.lambda_name } response['up'] = all(v['up'] for v in response.values()) return response
def manage_lambdas(self, enabled: bool): paginator = self._lambda.get_paginator('list_functions') lambda_prefixes = [ config.qualified_resource_name(lambda_infix) for lambda_infix in config.lambda_names() ] assert all(lambda_prefixes) for lambda_page in paginator.paginate(FunctionVersion='ALL', MaxItems=500): for lambda_name in [ metadata['FunctionName'] for metadata in lambda_page['Functions'] ]: if any( lambda_name.startswith(prefix) for prefix in lambda_prefixes): self.manage_lambda(lambda_name, enabled)
def _other_lambda_names(self) -> List[str]: return [ lambda_name for lambda_name in config.lambda_names() if lambda_name != self.lambda_name() ]
from azul import ( config, ) from azul.deployment import ( aws, emit_tf, ) emit_tf({ "module": { # Not using config.project_root because, "A local path must begin with # either ./ or ../" # https://www.terraform.io/docs/modules/sources.html#local-paths f"chalice_{lambda_name}": { "source": f"./{lambda_name}", "role_arn": "${aws_iam_role." + lambda_name + ".arn}", "layer_arn": "${aws_lambda_layer_version.dependencies.arn}", "es_endpoint": aws.es_endpoint if config.share_es_domain else ("${aws_elasticsearch_domain.index.endpoint}", 443), "es_instance_count": aws.es_instance_count if config.share_es_domain else "${aws_elasticsearch_domain.index.cluster_config[0].instance_count}", } for lambda_name in config.lambda_names() } })