UNPKG

3.71 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { TaskDefinition } from './base/task-definition';
3import { ContainerDefinition, ContainerDefinitionOptions, ContainerDefinitionProps } from './container-definition';
4import { ContainerImage } from './container-image';
5import { CfnTaskDefinition } from './ecs.generated';
6import { LogDriverConfig } from './log-drivers/log-driver';
7/**
8 * Firelens log router type, fluentbit or fluentd.
9 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html
10 */
11export declare enum FirelensLogRouterType {
12 /**
13 * fluentbit
14 */
15 FLUENTBIT = "fluentbit",
16 /**
17 * fluentd
18 */
19 FLUENTD = "fluentd"
20}
21/**
22 * Firelens configuration file type, s3 or file path.
23 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-taskdef-customconfig
24 */
25export declare enum FirelensConfigFileType {
26 /**
27 * s3
28 */
29 S3 = "s3",
30 /**
31 * fluentd
32 */
33 FILE = "file"
34}
35/**
36 * The options for firelens log router
37 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-taskdef-customconfig
38 */
39export interface FirelensOptions {
40 /**
41 * By default, Amazon ECS adds additional fields in your log entries that help identify the source of the logs.
42 * You can disable this action by setting enable-ecs-log-metadata to false.
43 * @default - true
44 */
45 readonly enableECSLogMetadata?: boolean;
46 /**
47 * Custom configuration file, s3 or file
48 * @default - determined by checking configFileValue with S3 ARN.
49 */
50 readonly configFileType?: FirelensConfigFileType;
51 /**
52 * Custom configuration file, S3 ARN or a file path
53 */
54 readonly configFileValue: string;
55}
56/**
57 * Firelens Configuration
58 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-taskdef
59 */
60export interface FirelensConfig {
61 /**
62 * The log router to use
63 * @default - fluentbit
64 */
65 readonly type: FirelensLogRouterType;
66 /**
67 * Firelens options
68 * @default - no additional options
69 */
70 readonly options?: FirelensOptions;
71}
72/**
73 * The properties in a firelens log router.
74 */
75export interface FirelensLogRouterProps extends ContainerDefinitionProps {
76 /**
77 * Firelens configuration
78 */
79 readonly firelensConfig: FirelensConfig;
80}
81/**
82 * The options for creating a firelens log router.
83 */
84export interface FirelensLogRouterDefinitionOptions extends ContainerDefinitionOptions {
85 /**
86 * Firelens configuration
87 */
88 readonly firelensConfig: FirelensConfig;
89}
90/**
91 * Obtain Fluent Bit image in Amazon ECR and setup corresponding IAM permissions.
92 * ECR image pull permissions will be granted in task execution role.
93 * Cloudwatch logs, Kinesis data stream or firehose permissions will be grant by check options in logDriverConfig.
94 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-using-fluentbit
95 */
96export declare function obtainDefaultFluentBitECRImage(task: TaskDefinition, logDriverConfig?: LogDriverConfig, imageTag?: string): ContainerImage;
97/**
98 * Firelens log router
99 */
100export declare class FirelensLogRouter extends ContainerDefinition {
101 /**
102 * Firelens configuration
103 */
104 readonly firelensConfig: FirelensConfig;
105 /**
106 * Constructs a new instance of the FirelensLogRouter class.
107 */
108 constructor(scope: Construct, id: string, props: FirelensLogRouterProps);
109 /**
110 * Render this container definition to a CloudFormation object
111 */
112 renderContainerDefinition(_taskDefinition?: TaskDefinition): CfnTaskDefinition.ContainerDefinitionProperty;
113}