lambda

package
v0.0.96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogRetentionController_IsConstruct

func LogRetentionController_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func LogRetentionController_IsOwnedResource

func LogRetentionController_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise.

func LogRetentionController_IsResource

func LogRetentionController_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource.

func NewLogRetentionController_Override

func NewLogRetentionController_Override(l LogRetentionController, scope constructs.IConstruct, id *string, props *LogRetentionControllerProps)

Creates a new instance of the LogRetentionController class.

Types

type ExecutionLogOptions

type ExecutionLogOptions struct {
	// Determines whether execution data is included in your log.
	//
	// When set to
	// `false`, data is excluded.
	// See: [StateMachine LoggingConfiguration.IncludeExecutionData](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-loggingconfiguration.html#cfn-stepfunctions-statemachine-loggingconfiguration-includeexecutiondata)
	//
	// Default: true.
	//
	IncludeExecutionData *bool `field:"required" json:"includeExecutionData" yaml:"includeExecutionData"`
	// Defines which category of execution history events are logged.
	// See: [StateMachine LoggingConfiguration.Level](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-loggingconfiguration.html#cfn-stepfunctions-statemachine-loggingconfiguration-level)
	//
	// Default: LogLevel.ALL
	//
	Level awsstepfunctions.LogLevel `field:"required" json:"level" yaml:"level"`
	// Controls whether logging from the state machine is enabled.
	// See: [StateMachine LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)
	//
	// Default: true.
	//
	Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
	// Specifies a log group which will receive execution events from the state machine.
	//
	// If no log group is passed and loggin is enabled, a log group will be
	// created automatically.
	// See: [StateMachine LoggingConfiguration.Destinations.CloudWatchLogsLogGroup.LogGroupArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-cloudwatchlogsloggroup.html#cfn-stepfunctions-statemachine-cloudwatchlogsloggroup-loggrouparn)
	//
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// The number of days execution logging events should be retained before being deleted.
	//
	// This value is ignored if `logGroup` is passed.
	// See: [LogGroup RetentionInDays](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays)
	//
	Retention awslogs.RetentionDays `field:"optional" json:"retention" yaml:"retention"`
}

Options for configuring logging from an executing state machine.

type LogRetentionController

type LogRetentionController interface {
	awscdk.Resource
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	Env() *awscdk.ResourceEnvironment
	// Execution logging configuration for the state machine that is used to configure log retention for log groups created via AWS Lambda.
	// See: [StateMachine LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)
	//
	ExecutionLogging() *ExecutionLogOptions
	// The log group which will receive execution events from the state machine.
	ExecutionLogGroup() awslogs.ILogGroup
	// The EventBridge rule that detects the creation of new log groups with a name matching the prefix used by AWS Lambda.
	LogGroupCreatedRule() awsevents.Rule
	// The tree node.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	PhysicalName() *string
	// The length of time logs sent to log groups created by AWS Lambda should be retained before being deleted.
	// See: [LogGroup RetentionInDays](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays)
	//
	Retention() awslogs.RetentionDays
	// The stack in which this resource is defined.
	Stack() awscdk.Stack
	// The state machine that is triggered to add a retention policy for all new log groups that trigger the EventBridge rule.
	StateMachine() awsstepfunctions.StateMachine
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	ToString() *string
}

Deploys a solution that automatically sets a log retention policy for all CloudWatch log groups created by AWS Lamba.

The controller consists of an EventBridge rule that detects the creation of new log groups and a state machine that sets a retention policy for any log groups that triggered the rule.

The rule triggers for any log group that is created with a name that starts with `/aws/lambda/`.

Currently existing log groups created by AWS Lambda are not affected by the policy. It is also possible that log groups created by means other than AWS Lambda that have a retention policy specified could have their retention policy overridden if the log group name starts with `/aws/lambda/`. See: [Reduce log-storage costs by automating retention settings in Amazon CloudWatch](https://aws.amazon.com/blogs/infrastructure-and-automation/reduce-log-storage-costs-by-automating-retention-settings-in-amazon-cloudwatch/)

func NewLogRetentionController

func NewLogRetentionController(scope constructs.IConstruct, id *string, props *LogRetentionControllerProps) LogRetentionController

Creates a new instance of the LogRetentionController class.

type LogRetentionControllerProps

type LogRetentionControllerProps struct {
	// The AWS account ID this resource belongs to.
	// Default: - the resource is in the same account as the stack it belongs to.
	//
	Account *string `field:"optional" json:"account" yaml:"account"`
	// ARN to deduce region and account from.
	//
	// The ARN is parsed and the account and region are taken from the ARN.
	// This should be used for imported resources.
	//
	// Cannot be supplied together with either `account` or `region`.
	// Default: - take environment from `account`, `region` parameters, or use Stack environment.
	//
	EnvironmentFromArn *string `field:"optional" json:"environmentFromArn" yaml:"environmentFromArn"`
	// The value passed in by users to the physical name prop of the resource.
	//
	// - `undefined` implies that a physical name will be allocated by
	//   CloudFormation during deployment.
	// - a concrete value implies a specific physical name
	// - `PhysicalName.GENERATE_IF_NEEDED` is a marker that indicates that a physical will only be generated
	//   by the CDK if it is needed for cross-environment references. Otherwise, it will be allocated by CloudFormation.
	// Default: - The physical name will be allocated by CloudFormation at deployment time.
	//
	PhysicalName *string `field:"optional" json:"physicalName" yaml:"physicalName"`
	// The AWS region this resource belongs to.
	// Default: - the resource is in the same region as the stack it belongs to.
	//
	Region *string `field:"optional" json:"region" yaml:"region"`
	// Execution logging configuration for the state machine that is used to configure log retention for log groups created via AWS Lambda.
	// See: [StateMachine LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)
	//
	ExecutionLogging *ExecutionLogOptions `field:"optional" json:"executionLogging" yaml:"executionLogging"`
	// The length of time logs sent to log groups created by AWS Lambda should be retained before being deleted.
	// See: [LogGroup RetentionInDays](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays)
	//
	Retention awslogs.RetentionDays `field:"optional" json:"retention" yaml:"retention"`
}

Configuration for the LogRetentionController resource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL