@aws-cdk/aws-logs
Version:
The CDK Construct Library for AWS::Logs
1,037 lines • 213 kB
JavaScript
"use strict";
var _a, _b, _c, _d, _e, _f, _g;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfnSubscriptionFilter = exports.CfnResourcePolicy = exports.CfnQueryDefinition = exports.CfnMetricFilter = exports.CfnLogStream = exports.CfnLogGroup = exports.CfnDestination = void 0;
const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
// Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Generated from the AWS CloudFormation Resource Specification
// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html
// @cfn2ts:meta@ {"generated":"2023-06-19T15:14:53.111Z","fingerprint":"llnG/qlR+NiSCttCc1xKsjVrffuZQp0ajLLbXy2+BOo="}
/* eslint-disable max-len */ // This is generated code - line lengths are difficult to control
const cdk = require("@aws-cdk/core");
const cfn_parse = require("@aws-cdk/core/lib/helpers-internal");
/**
* Determine whether the given properties match those of a `CfnDestinationProps`
*
* @param properties - the TypeScript properties of a `CfnDestinationProps`
*
* @returns the result of the validation.
*/
function CfnDestinationPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('destinationName', cdk.requiredValidator)(properties.destinationName));
errors.collect(cdk.propertyValidator('destinationName', cdk.validateString)(properties.destinationName));
errors.collect(cdk.propertyValidator('destinationPolicy', cdk.validateString)(properties.destinationPolicy));
errors.collect(cdk.propertyValidator('roleArn', cdk.requiredValidator)(properties.roleArn));
errors.collect(cdk.propertyValidator('roleArn', cdk.validateString)(properties.roleArn));
errors.collect(cdk.propertyValidator('targetArn', cdk.requiredValidator)(properties.targetArn));
errors.collect(cdk.propertyValidator('targetArn', cdk.validateString)(properties.targetArn));
return errors.wrap('supplied properties not correct for "CfnDestinationProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::Destination` resource
*
* @param properties - the TypeScript properties of a `CfnDestinationProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::Destination` resource.
*/
// @ts-ignore TS6133
function cfnDestinationPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDestinationPropsValidator(properties).assertSuccess();
return {
DestinationName: cdk.stringToCloudFormation(properties.destinationName),
RoleArn: cdk.stringToCloudFormation(properties.roleArn),
TargetArn: cdk.stringToCloudFormation(properties.targetArn),
DestinationPolicy: cdk.stringToCloudFormation(properties.destinationPolicy),
};
}
// @ts-ignore TS6133
function CfnDestinationPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('destinationName', 'DestinationName', cfn_parse.FromCloudFormation.getString(properties.DestinationName));
ret.addPropertyResult('roleArn', 'RoleArn', cfn_parse.FromCloudFormation.getString(properties.RoleArn));
ret.addPropertyResult('targetArn', 'TargetArn', cfn_parse.FromCloudFormation.getString(properties.TargetArn));
ret.addPropertyResult('destinationPolicy', 'DestinationPolicy', properties.DestinationPolicy != null ? cfn_parse.FromCloudFormation.getString(properties.DestinationPolicy) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::Destination`
*
* The AWS::Logs::Destination resource specifies a CloudWatch Logs destination. A destination encapsulates a physical resource (such as an Amazon Kinesis data stream) and enables you to subscribe that resource to a stream of log events.
*
* @cloudformationResource AWS::Logs::Destination
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html
*/
class CfnDestination extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::Destination`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnDestination.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnDestinationProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnDestination);
}
throw error;
}
cdk.requireProperty(props, 'destinationName', this);
cdk.requireProperty(props, 'roleArn', this);
cdk.requireProperty(props, 'targetArn', this);
this.attrArn = cdk.Token.asString(this.getAtt('Arn'));
this.destinationName = props.destinationName;
this.roleArn = props.roleArn;
this.targetArn = props.targetArn;
this.destinationPolicy = props.destinationPolicy;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnDestinationPropsFromCloudFormation(resourceProperties);
const ret = new CfnDestination(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnDestination.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
destinationName: this.destinationName,
roleArn: this.roleArn,
targetArn: this.targetArn,
destinationPolicy: this.destinationPolicy,
};
}
renderProperties(props) {
return cfnDestinationPropsToCloudFormation(props);
}
}
exports.CfnDestination = CfnDestination;
_a = JSII_RTTI_SYMBOL_1;
CfnDestination[_a] = { fqn: "@aws-cdk/aws-logs.CfnDestination", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnDestination.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::Destination";
/**
* Determine whether the given properties match those of a `CfnLogGroupProps`
*
* @param properties - the TypeScript properties of a `CfnLogGroupProps`
*
* @returns the result of the validation.
*/
function CfnLogGroupPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('dataProtectionPolicy', cdk.validateObject)(properties.dataProtectionPolicy));
errors.collect(cdk.propertyValidator('kmsKeyId', cdk.validateString)(properties.kmsKeyId));
errors.collect(cdk.propertyValidator('logGroupName', cdk.validateString)(properties.logGroupName));
errors.collect(cdk.propertyValidator('retentionInDays', cdk.validateNumber)(properties.retentionInDays));
errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags));
return errors.wrap('supplied properties not correct for "CfnLogGroupProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::LogGroup` resource
*
* @param properties - the TypeScript properties of a `CfnLogGroupProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::LogGroup` resource.
*/
// @ts-ignore TS6133
function cfnLogGroupPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnLogGroupPropsValidator(properties).assertSuccess();
return {
DataProtectionPolicy: cdk.objectToCloudFormation(properties.dataProtectionPolicy),
KmsKeyId: cdk.stringToCloudFormation(properties.kmsKeyId),
LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),
RetentionInDays: cdk.numberToCloudFormation(properties.retentionInDays),
Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),
};
}
// @ts-ignore TS6133
function CfnLogGroupPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('dataProtectionPolicy', 'DataProtectionPolicy', properties.DataProtectionPolicy != null ? cfn_parse.FromCloudFormation.getAny(properties.DataProtectionPolicy) : undefined);
ret.addPropertyResult('kmsKeyId', 'KmsKeyId', properties.KmsKeyId != null ? cfn_parse.FromCloudFormation.getString(properties.KmsKeyId) : undefined);
ret.addPropertyResult('logGroupName', 'LogGroupName', properties.LogGroupName != null ? cfn_parse.FromCloudFormation.getString(properties.LogGroupName) : undefined);
ret.addPropertyResult('retentionInDays', 'RetentionInDays', properties.RetentionInDays != null ? cfn_parse.FromCloudFormation.getNumber(properties.RetentionInDays) : undefined);
ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::LogGroup`
*
* The `AWS::Logs::LogGroup` resource specifies a log group. A log group defines common properties for log streams, such as their retention and access control rules. Each log stream must belong to one log group.
*
* You can create up to 1,000,000 log groups per Region per account. You must use the following guidelines when naming a log group:
*
* - Log group names must be unique within a Region for an AWS account.
* - Log group names can be between 1 and 512 characters long.
* - Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
*
* @cloudformationResource AWS::Logs::LogGroup
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html
*/
class CfnLogGroup extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::LogGroup`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props = {}) {
super(scope, id, { type: CfnLogGroup.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnLogGroupProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnLogGroup);
}
throw error;
}
this.attrArn = cdk.Token.asString(this.getAtt('Arn'));
this.dataProtectionPolicy = props.dataProtectionPolicy;
this.kmsKeyId = props.kmsKeyId;
this.logGroupName = props.logGroupName;
this.retentionInDays = props.retentionInDays;
this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::Logs::LogGroup", props.tags, { tagPropertyName: 'tags' });
if (this.node.scope && cdk.Resource.isResource(this.node.scope)) {
this.node.addValidation({ validate: () => this.cfnOptions.deletionPolicy === undefined
? ['\'AWS::Logs::LogGroup\' is a stateful resource type, and you must specify a Removal Policy for it. Call \'resource.applyRemovalPolicy()\'.']
: [] });
}
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnLogGroupPropsFromCloudFormation(resourceProperties);
const ret = new CfnLogGroup(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnLogGroup.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
dataProtectionPolicy: this.dataProtectionPolicy,
kmsKeyId: this.kmsKeyId,
logGroupName: this.logGroupName,
retentionInDays: this.retentionInDays,
tags: this.tags.renderTags(),
};
}
renderProperties(props) {
return cfnLogGroupPropsToCloudFormation(props);
}
}
exports.CfnLogGroup = CfnLogGroup;
_b = JSII_RTTI_SYMBOL_1;
CfnLogGroup[_b] = { fqn: "@aws-cdk/aws-logs.CfnLogGroup", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnLogGroup.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::LogGroup";
/**
* Determine whether the given properties match those of a `CfnLogStreamProps`
*
* @param properties - the TypeScript properties of a `CfnLogStreamProps`
*
* @returns the result of the validation.
*/
function CfnLogStreamPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('logGroupName', cdk.requiredValidator)(properties.logGroupName));
errors.collect(cdk.propertyValidator('logGroupName', cdk.validateString)(properties.logGroupName));
errors.collect(cdk.propertyValidator('logStreamName', cdk.validateString)(properties.logStreamName));
return errors.wrap('supplied properties not correct for "CfnLogStreamProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::LogStream` resource
*
* @param properties - the TypeScript properties of a `CfnLogStreamProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::LogStream` resource.
*/
// @ts-ignore TS6133
function cfnLogStreamPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnLogStreamPropsValidator(properties).assertSuccess();
return {
LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),
LogStreamName: cdk.stringToCloudFormation(properties.logStreamName),
};
}
// @ts-ignore TS6133
function CfnLogStreamPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('logGroupName', 'LogGroupName', cfn_parse.FromCloudFormation.getString(properties.LogGroupName));
ret.addPropertyResult('logStreamName', 'LogStreamName', properties.LogStreamName != null ? cfn_parse.FromCloudFormation.getString(properties.LogStreamName) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::LogStream`
*
* The `AWS::Logs::LogStream` resource specifies an Amazon CloudWatch Logs log stream in a specific log group. A log stream represents the sequence of events coming from an application instance or resource that you are monitoring.
*
* There is no limit on the number of log streams that you can create for a log group.
*
* You must use the following guidelines when naming a log stream:
*
* - Log stream names must be unique within the log group.
* - Log stream names can be between 1 and 512 characters long.
* - The ':' (colon) and '*' (asterisk) characters are not allowed.
*
* @cloudformationResource AWS::Logs::LogStream
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html
*/
class CfnLogStream extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::LogStream`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnLogStream.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnLogStreamProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnLogStream);
}
throw error;
}
cdk.requireProperty(props, 'logGroupName', this);
this.logGroupName = props.logGroupName;
this.logStreamName = props.logStreamName;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnLogStreamPropsFromCloudFormation(resourceProperties);
const ret = new CfnLogStream(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnLogStream.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
logGroupName: this.logGroupName,
logStreamName: this.logStreamName,
};
}
renderProperties(props) {
return cfnLogStreamPropsToCloudFormation(props);
}
}
exports.CfnLogStream = CfnLogStream;
_c = JSII_RTTI_SYMBOL_1;
CfnLogStream[_c] = { fqn: "@aws-cdk/aws-logs.CfnLogStream", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnLogStream.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::LogStream";
/**
* Determine whether the given properties match those of a `CfnMetricFilterProps`
*
* @param properties - the TypeScript properties of a `CfnMetricFilterProps`
*
* @returns the result of the validation.
*/
function CfnMetricFilterPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('filterName', cdk.validateString)(properties.filterName));
errors.collect(cdk.propertyValidator('filterPattern', cdk.requiredValidator)(properties.filterPattern));
errors.collect(cdk.propertyValidator('filterPattern', cdk.validateString)(properties.filterPattern));
errors.collect(cdk.propertyValidator('logGroupName', cdk.requiredValidator)(properties.logGroupName));
errors.collect(cdk.propertyValidator('logGroupName', cdk.validateString)(properties.logGroupName));
errors.collect(cdk.propertyValidator('metricTransformations', cdk.requiredValidator)(properties.metricTransformations));
errors.collect(cdk.propertyValidator('metricTransformations', cdk.listValidator(CfnMetricFilter_MetricTransformationPropertyValidator))(properties.metricTransformations));
return errors.wrap('supplied properties not correct for "CfnMetricFilterProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::MetricFilter` resource
*
* @param properties - the TypeScript properties of a `CfnMetricFilterProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::MetricFilter` resource.
*/
// @ts-ignore TS6133
function cfnMetricFilterPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnMetricFilterPropsValidator(properties).assertSuccess();
return {
FilterPattern: cdk.stringToCloudFormation(properties.filterPattern),
LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),
MetricTransformations: cdk.listMapper(cfnMetricFilterMetricTransformationPropertyToCloudFormation)(properties.metricTransformations),
FilterName: cdk.stringToCloudFormation(properties.filterName),
};
}
// @ts-ignore TS6133
function CfnMetricFilterPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('filterPattern', 'FilterPattern', cfn_parse.FromCloudFormation.getString(properties.FilterPattern));
ret.addPropertyResult('logGroupName', 'LogGroupName', cfn_parse.FromCloudFormation.getString(properties.LogGroupName));
ret.addPropertyResult('metricTransformations', 'MetricTransformations', cfn_parse.FromCloudFormation.getArray(CfnMetricFilterMetricTransformationPropertyFromCloudFormation)(properties.MetricTransformations));
ret.addPropertyResult('filterName', 'FilterName', properties.FilterName != null ? cfn_parse.FromCloudFormation.getString(properties.FilterName) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::MetricFilter`
*
* The `AWS::Logs::MetricFilter` resource specifies a metric filter that describes how CloudWatch Logs extracts information from logs and transforms it into Amazon CloudWatch metrics. If you have multiple metric filters that are associated with a log group, all the filters are applied to the log streams in that group.
*
* The maximum number of metric filters that can be associated with a log group is 100.
*
* @cloudformationResource AWS::Logs::MetricFilter
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html
*/
class CfnMetricFilter extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::MetricFilter`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnMetricFilter.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnMetricFilterProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnMetricFilter);
}
throw error;
}
cdk.requireProperty(props, 'filterPattern', this);
cdk.requireProperty(props, 'logGroupName', this);
cdk.requireProperty(props, 'metricTransformations', this);
this.filterPattern = props.filterPattern;
this.logGroupName = props.logGroupName;
this.metricTransformations = props.metricTransformations;
this.filterName = props.filterName;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnMetricFilterPropsFromCloudFormation(resourceProperties);
const ret = new CfnMetricFilter(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnMetricFilter.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
filterPattern: this.filterPattern,
logGroupName: this.logGroupName,
metricTransformations: this.metricTransformations,
filterName: this.filterName,
};
}
renderProperties(props) {
return cfnMetricFilterPropsToCloudFormation(props);
}
}
exports.CfnMetricFilter = CfnMetricFilter;
_d = JSII_RTTI_SYMBOL_1;
CfnMetricFilter[_d] = { fqn: "@aws-cdk/aws-logs.CfnMetricFilter", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnMetricFilter.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::MetricFilter";
/**
* Determine whether the given properties match those of a `DimensionProperty`
*
* @param properties - the TypeScript properties of a `DimensionProperty`
*
* @returns the result of the validation.
*/
function CfnMetricFilter_DimensionPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));
errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));
errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value));
errors.collect(cdk.propertyValidator('value', cdk.validateString)(properties.value));
return errors.wrap('supplied properties not correct for "DimensionProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::MetricFilter.Dimension` resource
*
* @param properties - the TypeScript properties of a `DimensionProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::MetricFilter.Dimension` resource.
*/
// @ts-ignore TS6133
function cfnMetricFilterDimensionPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnMetricFilter_DimensionPropertyValidator(properties).assertSuccess();
return {
Key: cdk.stringToCloudFormation(properties.key),
Value: cdk.stringToCloudFormation(properties.value),
};
}
// @ts-ignore TS6133
function CfnMetricFilterDimensionPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('key', 'Key', cfn_parse.FromCloudFormation.getString(properties.Key));
ret.addPropertyResult('value', 'Value', cfn_parse.FromCloudFormation.getString(properties.Value));
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `MetricTransformationProperty`
*
* @param properties - the TypeScript properties of a `MetricTransformationProperty`
*
* @returns the result of the validation.
*/
function CfnMetricFilter_MetricTransformationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('defaultValue', cdk.validateNumber)(properties.defaultValue));
errors.collect(cdk.propertyValidator('dimensions', cdk.listValidator(CfnMetricFilter_DimensionPropertyValidator))(properties.dimensions));
errors.collect(cdk.propertyValidator('metricName', cdk.requiredValidator)(properties.metricName));
errors.collect(cdk.propertyValidator('metricName', cdk.validateString)(properties.metricName));
errors.collect(cdk.propertyValidator('metricNamespace', cdk.requiredValidator)(properties.metricNamespace));
errors.collect(cdk.propertyValidator('metricNamespace', cdk.validateString)(properties.metricNamespace));
errors.collect(cdk.propertyValidator('metricValue', cdk.requiredValidator)(properties.metricValue));
errors.collect(cdk.propertyValidator('metricValue', cdk.validateString)(properties.metricValue));
errors.collect(cdk.propertyValidator('unit', cdk.validateString)(properties.unit));
return errors.wrap('supplied properties not correct for "MetricTransformationProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::MetricFilter.MetricTransformation` resource
*
* @param properties - the TypeScript properties of a `MetricTransformationProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::MetricFilter.MetricTransformation` resource.
*/
// @ts-ignore TS6133
function cfnMetricFilterMetricTransformationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnMetricFilter_MetricTransformationPropertyValidator(properties).assertSuccess();
return {
DefaultValue: cdk.numberToCloudFormation(properties.defaultValue),
Dimensions: cdk.listMapper(cfnMetricFilterDimensionPropertyToCloudFormation)(properties.dimensions),
MetricName: cdk.stringToCloudFormation(properties.metricName),
MetricNamespace: cdk.stringToCloudFormation(properties.metricNamespace),
MetricValue: cdk.stringToCloudFormation(properties.metricValue),
Unit: cdk.stringToCloudFormation(properties.unit),
};
}
// @ts-ignore TS6133
function CfnMetricFilterMetricTransformationPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('defaultValue', 'DefaultValue', properties.DefaultValue != null ? cfn_parse.FromCloudFormation.getNumber(properties.DefaultValue) : undefined);
ret.addPropertyResult('dimensions', 'Dimensions', properties.Dimensions != null ? cfn_parse.FromCloudFormation.getArray(CfnMetricFilterDimensionPropertyFromCloudFormation)(properties.Dimensions) : undefined);
ret.addPropertyResult('metricName', 'MetricName', cfn_parse.FromCloudFormation.getString(properties.MetricName));
ret.addPropertyResult('metricNamespace', 'MetricNamespace', cfn_parse.FromCloudFormation.getString(properties.MetricNamespace));
ret.addPropertyResult('metricValue', 'MetricValue', cfn_parse.FromCloudFormation.getString(properties.MetricValue));
ret.addPropertyResult('unit', 'Unit', properties.Unit != null ? cfn_parse.FromCloudFormation.getString(properties.Unit) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `CfnQueryDefinitionProps`
*
* @param properties - the TypeScript properties of a `CfnQueryDefinitionProps`
*
* @returns the result of the validation.
*/
function CfnQueryDefinitionPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('logGroupNames', cdk.listValidator(cdk.validateString))(properties.logGroupNames));
errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('queryString', cdk.requiredValidator)(properties.queryString));
errors.collect(cdk.propertyValidator('queryString', cdk.validateString)(properties.queryString));
return errors.wrap('supplied properties not correct for "CfnQueryDefinitionProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::QueryDefinition` resource
*
* @param properties - the TypeScript properties of a `CfnQueryDefinitionProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::QueryDefinition` resource.
*/
// @ts-ignore TS6133
function cfnQueryDefinitionPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnQueryDefinitionPropsValidator(properties).assertSuccess();
return {
Name: cdk.stringToCloudFormation(properties.name),
QueryString: cdk.stringToCloudFormation(properties.queryString),
LogGroupNames: cdk.listMapper(cdk.stringToCloudFormation)(properties.logGroupNames),
};
}
// @ts-ignore TS6133
function CfnQueryDefinitionPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('name', 'Name', cfn_parse.FromCloudFormation.getString(properties.Name));
ret.addPropertyResult('queryString', 'QueryString', cfn_parse.FromCloudFormation.getString(properties.QueryString));
ret.addPropertyResult('logGroupNames', 'LogGroupNames', properties.LogGroupNames != null ? cfn_parse.FromCloudFormation.getStringArray(properties.LogGroupNames) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::QueryDefinition`
*
* Creates a query definition for CloudWatch Logs Insights. For more information, see [Analyzing Log Data with CloudWatch Logs Insights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html) .
*
* @cloudformationResource AWS::Logs::QueryDefinition
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-querydefinition.html
*/
class CfnQueryDefinition extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::QueryDefinition`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnQueryDefinition.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnQueryDefinitionProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnQueryDefinition);
}
throw error;
}
cdk.requireProperty(props, 'name', this);
cdk.requireProperty(props, 'queryString', this);
this.attrQueryDefinitionId = cdk.Token.asString(this.getAtt('QueryDefinitionId'));
this.name = props.name;
this.queryString = props.queryString;
this.logGroupNames = props.logGroupNames;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnQueryDefinitionPropsFromCloudFormation(resourceProperties);
const ret = new CfnQueryDefinition(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnQueryDefinition.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
name: this.name,
queryString: this.queryString,
logGroupNames: this.logGroupNames,
};
}
renderProperties(props) {
return cfnQueryDefinitionPropsToCloudFormation(props);
}
}
exports.CfnQueryDefinition = CfnQueryDefinition;
_e = JSII_RTTI_SYMBOL_1;
CfnQueryDefinition[_e] = { fqn: "@aws-cdk/aws-logs.CfnQueryDefinition", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnQueryDefinition.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::QueryDefinition";
/**
* Determine whether the given properties match those of a `CfnResourcePolicyProps`
*
* @param properties - the TypeScript properties of a `CfnResourcePolicyProps`
*
* @returns the result of the validation.
*/
function CfnResourcePolicyPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('policyDocument', cdk.requiredValidator)(properties.policyDocument));
errors.collect(cdk.propertyValidator('policyDocument', cdk.validateString)(properties.policyDocument));
errors.collect(cdk.propertyValidator('policyName', cdk.requiredValidator)(properties.policyName));
errors.collect(cdk.propertyValidator('policyName', cdk.validateString)(properties.policyName));
return errors.wrap('supplied properties not correct for "CfnResourcePolicyProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::ResourcePolicy` resource
*
* @param properties - the TypeScript properties of a `CfnResourcePolicyProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::ResourcePolicy` resource.
*/
// @ts-ignore TS6133
function cfnResourcePolicyPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnResourcePolicyPropsValidator(properties).assertSuccess();
return {
PolicyDocument: cdk.stringToCloudFormation(properties.policyDocument),
PolicyName: cdk.stringToCloudFormation(properties.policyName),
};
}
// @ts-ignore TS6133
function CfnResourcePolicyPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('policyDocument', 'PolicyDocument', cfn_parse.FromCloudFormation.getString(properties.PolicyDocument));
ret.addPropertyResult('policyName', 'PolicyName', cfn_parse.FromCloudFormation.getString(properties.PolicyName));
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::Logs::ResourcePolicy`
*
* Creates or updates a resource policy that allows other AWS services to put log events to this account. An account can have up to 10 resource policies per AWS Region.
*
* @cloudformationResource AWS::Logs::ResourcePolicy
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-resourcepolicy.html
*/
class CfnResourcePolicy extends cdk.CfnResource {
/**
* Create a new `AWS::Logs::ResourcePolicy`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_logs_CfnResourcePolicyProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnResourcePolicy);
}
throw error;
}
cdk.requireProperty(props, 'policyDocument', this);
cdk.requireProperty(props, 'policyName', this);
this.policyDocument = props.policyDocument;
this.policyName = props.policyName;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnResourcePolicyPropsFromCloudFormation(resourceProperties);
const ret = new CfnResourcePolicy(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
policyDocument: this.policyDocument,
policyName: this.policyName,
};
}
renderProperties(props) {
return cfnResourcePolicyPropsToCloudFormation(props);
}
}
exports.CfnResourcePolicy = CfnResourcePolicy;
_f = JSII_RTTI_SYMBOL_1;
CfnResourcePolicy[_f] = { fqn: "@aws-cdk/aws-logs.CfnResourcePolicy", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME = "AWS::Logs::ResourcePolicy";
/**
* Determine whether the given properties match those of a `CfnSubscriptionFilterProps`
*
* @param properties - the TypeScript properties of a `CfnSubscriptionFilterProps`
*
* @returns the result of the validation.
*/
function CfnSubscriptionFilterPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('destinationArn', cdk.requiredValidator)(properties.destinationArn));
errors.collect(cdk.propertyValidator('destinationArn', cdk.validateString)(properties.destinationArn));
errors.collect(cdk.propertyValidator('distribution', cdk.validateString)(properties.distribution));
errors.collect(cdk.propertyValidator('filterName', cdk.validateString)(properties.filterName));
errors.collect(cdk.propertyValidator('filterPattern', cdk.requiredValidator)(properties.filterPattern));
errors.collect(cdk.propertyValidator('filterPattern', cdk.validateString)(properties.filterPattern));
errors.collect(cdk.propertyValidator('logGroupName', cdk.requiredValidator)(properties.logGroupName));
errors.collect(cdk.propertyValidator('logGroupName', cdk.validateString)(properties.logGroupName));
errors.collect(cdk.propertyValidator('roleArn', cdk.validateString)(properties.roleArn));
return errors.wrap('supplied properties not correct for "CfnSubscriptionFilterProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::Logs::SubscriptionFilter` resource
*
* @param properties - the TypeScript properties of a `CfnSubscriptionFilterProps`
*
* @returns the AWS CloudFormation properties of an `AWS::Logs::SubscriptionFilter` resource.
*/
// @ts-ignore TS6133
function cfnSubscriptionFilterPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnSubscriptionFilterPropsValidator(properties).assertSuccess();
return {
DestinationArn: cdk.stringToCloudFormation(properties.destinationArn),
FilterPattern: cdk.stringToCloudFormation(properties.filterPattern),
LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),
Distribution: cdk.stringToCloudFormation(properties.distribution),
FilterName: cdk.stringToCloudFormation(properties.filterName),
RoleArn: cdk.stringToCloudFormation(properties.roleArn),
};
}
// @ts-ignore TS6133
function CfnSubscriptionFilterPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('destinationArn', 'DestinationArn', cfn_parse.FromCloudFormation.getString(properties.DestinationArn));
ret.addPropertyResult('filterPattern', 'FilterPattern', cfn_parse.FromCloudFormation.getString(properties.FilterPattern));
ret.addPropertyResult('logGroupName', 'LogGroupName', cfn_parse.FromCloudFormation.getString(properties.LogGroupName));
ret.addPropertyResult('distribution', 'Distribution', properties.Distribution != null ? cfn_parse.FromCloudFormation.getString(properties.Distribution) : undefined);
ret.addPropertyResult('filterName', 'FilterName', properties.FilterName != null ? cfn_parse.FromCloudFormation.getString(properties.FilterName) : undefined);
ret.addProp