1 | import * as iam from '@aws-cdk/aws-iam';
|
2 | import * as cdk from '@aws-cdk/core';
|
3 | import { Construct } from 'constructs';
|
4 | import { RetentionDays } from './log-group';
|
5 | import { Construct as CoreConstruct } from '@aws-cdk/core';
|
6 | /**
|
7 | * Construction properties for a LogRetention.
|
8 | */
|
9 | export interface LogRetentionProps {
|
10 | /**
|
11 | * The log group name.
|
12 | */
|
13 | readonly logGroupName: string;
|
14 | /**
|
15 | * The region where the log group should be created
|
16 | * @default - same region as the stack
|
17 | */
|
18 | readonly logGroupRegion?: string;
|
19 | /**
|
20 | * The number of days log events are kept in CloudWatch Logs.
|
21 | */
|
22 | readonly retention: RetentionDays;
|
23 | /**
|
24 | * The IAM role for the Lambda function associated with the custom resource.
|
25 | *
|
26 | * @default - A new role is created
|
27 | */
|
28 | readonly role?: iam.IRole;
|
29 | /**
|
30 | * Retry options for all AWS API calls.
|
31 | *
|
32 | * @default - AWS SDK default retry options
|
33 | */
|
34 | readonly logRetentionRetryOptions?: LogRetentionRetryOptions;
|
35 | }
|
36 | /**
|
37 | * Retry options for all AWS API calls.
|
38 | */
|
39 | export interface LogRetentionRetryOptions {
|
40 | /**
|
41 | * The maximum amount of retries.
|
42 | *
|
43 | * @default 3 (AWS SDK default)
|
44 | */
|
45 | readonly maxRetries?: number;
|
46 | /**
|
47 | * The base duration to use in the exponential backoff for operation retries.
|
48 | *
|
49 | * @default Duration.millis(100) (AWS SDK default)
|
50 | */
|
51 | readonly base?: cdk.Duration;
|
52 | }
|
53 | /**
|
54 | * Creates a custom resource to control the retention policy of a CloudWatch Logs
|
55 | * log group. The log group is created if it doesn't already exist. The policy
|
56 | * is removed when `retentionDays` is `undefined` or equal to `Infinity`.
|
57 | * Log group can be created in the region that is different from stack region by
|
58 | * specifying `logGroupRegion`
|
59 | */
|
60 | export declare class LogRetention extends CoreConstruct {
|
61 | /**
|
62 | * The ARN of the LogGroup.
|
63 | */
|
64 | readonly logGroupArn: string;
|
65 | constructor(scope: Construct, id: string, props: LogRetentionProps);
|
66 | /**
|
67 | * Helper method to ensure that only one instance of LogRetentionFunction resources are in the stack mimicking the
|
68 | * behaviour of @aws-cdk/aws-lambda's SingletonFunction to prevent circular dependencies
|
69 | */
|
70 | private ensureSingletonLogRetentionFunction;
|
71 | }
|