UNPKG

4 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 * Both configFileType and configFileValue must be used together
49 * to define a custom configuration source.
50 *
51 * @default - determined by checking configFileValue with S3 ARN.
52 */
53 readonly configFileType?: FirelensConfigFileType;
54 /**
55 * Custom configuration file, S3 ARN or a file path
56 * Both configFileType and configFileValue must be used together
57 * to define a custom configuration source.
58 *
59 * @default - no config file value
60 */
61 readonly configFileValue?: string;
62}
63/**
64 * Firelens Configuration
65 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-taskdef
66 */
67export interface FirelensConfig {
68 /**
69 * The log router to use
70 * @default - fluentbit
71 */
72 readonly type: FirelensLogRouterType;
73 /**
74 * Firelens options
75 * @default - no additional options
76 */
77 readonly options?: FirelensOptions;
78}
79/**
80 * The properties in a firelens log router.
81 */
82export interface FirelensLogRouterProps extends ContainerDefinitionProps {
83 /**
84 * Firelens configuration
85 */
86 readonly firelensConfig: FirelensConfig;
87}
88/**
89 * The options for creating a firelens log router.
90 */
91export interface FirelensLogRouterDefinitionOptions extends ContainerDefinitionOptions {
92 /**
93 * Firelens configuration
94 */
95 readonly firelensConfig: FirelensConfig;
96}
97/**
98 * Obtain Fluent Bit image in Amazon ECR and setup corresponding IAM permissions.
99 * ECR image pull permissions will be granted in task execution role.
100 * Cloudwatch logs, Kinesis data stream or firehose permissions will be grant by check options in logDriverConfig.
101 * https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-using-fluentbit
102 */
103export declare function obtainDefaultFluentBitECRImage(task: TaskDefinition, logDriverConfig?: LogDriverConfig, imageTag?: string): ContainerImage;
104/**
105 * Firelens log router
106 */
107export declare class FirelensLogRouter extends ContainerDefinition {
108 /**
109 * Firelens configuration
110 */
111 readonly firelensConfig: FirelensConfig;
112 /**
113 * Constructs a new instance of the FirelensLogRouter class.
114 */
115 constructor(scope: Construct, id: string, props: FirelensLogRouterProps);
116 /**
117 * Render this container definition to a CloudFormation object
118 */
119 renderContainerDefinition(_taskDefinition?: TaskDefinition): CfnTaskDefinition.ContainerDefinitionProperty;
120}