UNPKG

@aws-cdk/aws-lambda

Version:

The CDK Construct Library for AWS::Lambda

944 lines 754 kB
"use strict"; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; Object.defineProperty(exports, "__esModule", { value: true }); exports.CfnVersion = exports.CfnUrl = exports.CfnPermission = exports.CfnLayerVersionPermission = exports.CfnLayerVersion = exports.CfnFunction = exports.CfnEventSourceMapping = exports.CfnEventInvokeConfig = exports.CfnCodeSigningConfig = exports.CfnAlias = 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:16:32.465Z","fingerprint":"3bCcwXZ2OnzivovSaoc754I3gfLcOqR16UXiiABMBj4="} /* 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 `CfnAliasProps` * * @param properties - the TypeScript properties of a `CfnAliasProps` * * @returns the result of the validation. */ function CfnAliasPropsValidator(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('description', cdk.validateString)(properties.description)); errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName)); errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName)); errors.collect(cdk.propertyValidator('functionVersion', cdk.requiredValidator)(properties.functionVersion)); errors.collect(cdk.propertyValidator('functionVersion', cdk.validateString)(properties.functionVersion)); errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name)); errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('provisionedConcurrencyConfig', CfnAlias_ProvisionedConcurrencyConfigurationPropertyValidator)(properties.provisionedConcurrencyConfig)); errors.collect(cdk.propertyValidator('routingConfig', CfnAlias_AliasRoutingConfigurationPropertyValidator)(properties.routingConfig)); return errors.wrap('supplied properties not correct for "CfnAliasProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::Alias` resource * * @param properties - the TypeScript properties of a `CfnAliasProps` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::Alias` resource. */ // @ts-ignore TS6133 function cfnAliasPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAliasPropsValidator(properties).assertSuccess(); return { FunctionName: cdk.stringToCloudFormation(properties.functionName), FunctionVersion: cdk.stringToCloudFormation(properties.functionVersion), Name: cdk.stringToCloudFormation(properties.name), Description: cdk.stringToCloudFormation(properties.description), ProvisionedConcurrencyConfig: cfnAliasProvisionedConcurrencyConfigurationPropertyToCloudFormation(properties.provisionedConcurrencyConfig), RoutingConfig: cfnAliasAliasRoutingConfigurationPropertyToCloudFormation(properties.routingConfig), }; } // @ts-ignore TS6133 function CfnAliasPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('functionName', 'FunctionName', cfn_parse.FromCloudFormation.getString(properties.FunctionName)); ret.addPropertyResult('functionVersion', 'FunctionVersion', cfn_parse.FromCloudFormation.getString(properties.FunctionVersion)); ret.addPropertyResult('name', 'Name', cfn_parse.FromCloudFormation.getString(properties.Name)); ret.addPropertyResult('description', 'Description', properties.Description != null ? cfn_parse.FromCloudFormation.getString(properties.Description) : undefined); ret.addPropertyResult('provisionedConcurrencyConfig', 'ProvisionedConcurrencyConfig', properties.ProvisionedConcurrencyConfig != null ? CfnAliasProvisionedConcurrencyConfigurationPropertyFromCloudFormation(properties.ProvisionedConcurrencyConfig) : undefined); ret.addPropertyResult('routingConfig', 'RoutingConfig', properties.RoutingConfig != null ? CfnAliasAliasRoutingConfigurationPropertyFromCloudFormation(properties.RoutingConfig) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::Lambda::Alias` * * The `AWS::Lambda::Alias` resource creates an [alias](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) for a Lambda function version. Use aliases to provide clients with a function identifier that you can update to invoke a different version. * * You can also map an alias to split invocation requests between two versions. Use the `RoutingConfig` parameter to specify a second version and the percentage of invocation requests that it receives. * * @cloudformationResource AWS::Lambda::Alias * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html */ class CfnAlias extends cdk.CfnResource { /** * Create a new `AWS::Lambda::Alias`. * * @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: CfnAlias.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_lambda_CfnAliasProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnAlias); } throw error; } cdk.requireProperty(props, 'functionName', this); cdk.requireProperty(props, 'functionVersion', this); cdk.requireProperty(props, 'name', this); this.functionName = props.functionName; this.functionVersion = props.functionVersion; this.name = props.name; this.description = props.description; this.provisionedConcurrencyConfig = props.provisionedConcurrencyConfig; this.routingConfig = props.routingConfig; } /** * 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 = CfnAliasPropsFromCloudFormation(resourceProperties); const ret = new CfnAlias(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", CfnAlias.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { functionName: this.functionName, functionVersion: this.functionVersion, name: this.name, description: this.description, provisionedConcurrencyConfig: this.provisionedConcurrencyConfig, routingConfig: this.routingConfig, }; } renderProperties(props) { return cfnAliasPropsToCloudFormation(props); } } exports.CfnAlias = CfnAlias; _a = JSII_RTTI_SYMBOL_1; CfnAlias[_a] = { fqn: "@aws-cdk/aws-lambda.CfnAlias", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnAlias.CFN_RESOURCE_TYPE_NAME = "AWS::Lambda::Alias"; /** * Determine whether the given properties match those of a `AliasRoutingConfigurationProperty` * * @param properties - the TypeScript properties of a `AliasRoutingConfigurationProperty` * * @returns the result of the validation. */ function CfnAlias_AliasRoutingConfigurationPropertyValidator(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('additionalVersionWeights', cdk.requiredValidator)(properties.additionalVersionWeights)); errors.collect(cdk.propertyValidator('additionalVersionWeights', cdk.listValidator(CfnAlias_VersionWeightPropertyValidator))(properties.additionalVersionWeights)); return errors.wrap('supplied properties not correct for "AliasRoutingConfigurationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::Alias.AliasRoutingConfiguration` resource * * @param properties - the TypeScript properties of a `AliasRoutingConfigurationProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::Alias.AliasRoutingConfiguration` resource. */ // @ts-ignore TS6133 function cfnAliasAliasRoutingConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlias_AliasRoutingConfigurationPropertyValidator(properties).assertSuccess(); return { AdditionalVersionWeights: cdk.listMapper(cfnAliasVersionWeightPropertyToCloudFormation)(properties.additionalVersionWeights), }; } // @ts-ignore TS6133 function CfnAliasAliasRoutingConfigurationPropertyFromCloudFormation(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('additionalVersionWeights', 'AdditionalVersionWeights', cfn_parse.FromCloudFormation.getArray(CfnAliasVersionWeightPropertyFromCloudFormation)(properties.AdditionalVersionWeights)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ProvisionedConcurrencyConfigurationProperty` * * @param properties - the TypeScript properties of a `ProvisionedConcurrencyConfigurationProperty` * * @returns the result of the validation. */ function CfnAlias_ProvisionedConcurrencyConfigurationPropertyValidator(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('provisionedConcurrentExecutions', cdk.requiredValidator)(properties.provisionedConcurrentExecutions)); errors.collect(cdk.propertyValidator('provisionedConcurrentExecutions', cdk.validateNumber)(properties.provisionedConcurrentExecutions)); return errors.wrap('supplied properties not correct for "ProvisionedConcurrencyConfigurationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::Alias.ProvisionedConcurrencyConfiguration` resource * * @param properties - the TypeScript properties of a `ProvisionedConcurrencyConfigurationProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::Alias.ProvisionedConcurrencyConfiguration` resource. */ // @ts-ignore TS6133 function cfnAliasProvisionedConcurrencyConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlias_ProvisionedConcurrencyConfigurationPropertyValidator(properties).assertSuccess(); return { ProvisionedConcurrentExecutions: cdk.numberToCloudFormation(properties.provisionedConcurrentExecutions), }; } // @ts-ignore TS6133 function CfnAliasProvisionedConcurrencyConfigurationPropertyFromCloudFormation(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('provisionedConcurrentExecutions', 'ProvisionedConcurrentExecutions', cfn_parse.FromCloudFormation.getNumber(properties.ProvisionedConcurrentExecutions)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `VersionWeightProperty` * * @param properties - the TypeScript properties of a `VersionWeightProperty` * * @returns the result of the validation. */ function CfnAlias_VersionWeightPropertyValidator(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('functionVersion', cdk.requiredValidator)(properties.functionVersion)); errors.collect(cdk.propertyValidator('functionVersion', cdk.validateString)(properties.functionVersion)); errors.collect(cdk.propertyValidator('functionWeight', cdk.requiredValidator)(properties.functionWeight)); errors.collect(cdk.propertyValidator('functionWeight', cdk.validateNumber)(properties.functionWeight)); return errors.wrap('supplied properties not correct for "VersionWeightProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::Alias.VersionWeight` resource * * @param properties - the TypeScript properties of a `VersionWeightProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::Alias.VersionWeight` resource. */ // @ts-ignore TS6133 function cfnAliasVersionWeightPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlias_VersionWeightPropertyValidator(properties).assertSuccess(); return { FunctionVersion: cdk.stringToCloudFormation(properties.functionVersion), FunctionWeight: cdk.numberToCloudFormation(properties.functionWeight), }; } // @ts-ignore TS6133 function CfnAliasVersionWeightPropertyFromCloudFormation(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('functionVersion', 'FunctionVersion', cfn_parse.FromCloudFormation.getString(properties.FunctionVersion)); ret.addPropertyResult('functionWeight', 'FunctionWeight', cfn_parse.FromCloudFormation.getNumber(properties.FunctionWeight)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnCodeSigningConfigProps` * * @param properties - the TypeScript properties of a `CfnCodeSigningConfigProps` * * @returns the result of the validation. */ function CfnCodeSigningConfigPropsValidator(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('allowedPublishers', cdk.requiredValidator)(properties.allowedPublishers)); errors.collect(cdk.propertyValidator('allowedPublishers', CfnCodeSigningConfig_AllowedPublishersPropertyValidator)(properties.allowedPublishers)); errors.collect(cdk.propertyValidator('codeSigningPolicies', CfnCodeSigningConfig_CodeSigningPoliciesPropertyValidator)(properties.codeSigningPolicies)); errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description)); return errors.wrap('supplied properties not correct for "CfnCodeSigningConfigProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig` resource * * @param properties - the TypeScript properties of a `CfnCodeSigningConfigProps` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig` resource. */ // @ts-ignore TS6133 function cfnCodeSigningConfigPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCodeSigningConfigPropsValidator(properties).assertSuccess(); return { AllowedPublishers: cfnCodeSigningConfigAllowedPublishersPropertyToCloudFormation(properties.allowedPublishers), CodeSigningPolicies: cfnCodeSigningConfigCodeSigningPoliciesPropertyToCloudFormation(properties.codeSigningPolicies), Description: cdk.stringToCloudFormation(properties.description), }; } // @ts-ignore TS6133 function CfnCodeSigningConfigPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('allowedPublishers', 'AllowedPublishers', CfnCodeSigningConfigAllowedPublishersPropertyFromCloudFormation(properties.AllowedPublishers)); ret.addPropertyResult('codeSigningPolicies', 'CodeSigningPolicies', properties.CodeSigningPolicies != null ? CfnCodeSigningConfigCodeSigningPoliciesPropertyFromCloudFormation(properties.CodeSigningPolicies) : undefined); ret.addPropertyResult('description', 'Description', properties.Description != null ? cfn_parse.FromCloudFormation.getString(properties.Description) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::Lambda::CodeSigningConfig` * * Details about a [Code signing configuration](https://docs.aws.amazon.com/lambda/latest/dg/configuration-codesigning.html) . * * @cloudformationResource AWS::Lambda::CodeSigningConfig * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-codesigningconfig.html */ class CfnCodeSigningConfig extends cdk.CfnResource { /** * Create a new `AWS::Lambda::CodeSigningConfig`. * * @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: CfnCodeSigningConfig.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_lambda_CfnCodeSigningConfigProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnCodeSigningConfig); } throw error; } cdk.requireProperty(props, 'allowedPublishers', this); this.attrCodeSigningConfigArn = cdk.Token.asString(this.getAtt('CodeSigningConfigArn')); this.attrCodeSigningConfigId = cdk.Token.asString(this.getAtt('CodeSigningConfigId')); this.allowedPublishers = props.allowedPublishers; this.codeSigningPolicies = props.codeSigningPolicies; this.description = props.description; } /** * 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 = CfnCodeSigningConfigPropsFromCloudFormation(resourceProperties); const ret = new CfnCodeSigningConfig(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", CfnCodeSigningConfig.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { allowedPublishers: this.allowedPublishers, codeSigningPolicies: this.codeSigningPolicies, description: this.description, }; } renderProperties(props) { return cfnCodeSigningConfigPropsToCloudFormation(props); } } exports.CfnCodeSigningConfig = CfnCodeSigningConfig; _b = JSII_RTTI_SYMBOL_1; CfnCodeSigningConfig[_b] = { fqn: "@aws-cdk/aws-lambda.CfnCodeSigningConfig", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnCodeSigningConfig.CFN_RESOURCE_TYPE_NAME = "AWS::Lambda::CodeSigningConfig"; /** * Determine whether the given properties match those of a `AllowedPublishersProperty` * * @param properties - the TypeScript properties of a `AllowedPublishersProperty` * * @returns the result of the validation. */ function CfnCodeSigningConfig_AllowedPublishersPropertyValidator(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('signingProfileVersionArns', cdk.requiredValidator)(properties.signingProfileVersionArns)); errors.collect(cdk.propertyValidator('signingProfileVersionArns', cdk.listValidator(cdk.validateString))(properties.signingProfileVersionArns)); return errors.wrap('supplied properties not correct for "AllowedPublishersProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig.AllowedPublishers` resource * * @param properties - the TypeScript properties of a `AllowedPublishersProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig.AllowedPublishers` resource. */ // @ts-ignore TS6133 function cfnCodeSigningConfigAllowedPublishersPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCodeSigningConfig_AllowedPublishersPropertyValidator(properties).assertSuccess(); return { SigningProfileVersionArns: cdk.listMapper(cdk.stringToCloudFormation)(properties.signingProfileVersionArns), }; } // @ts-ignore TS6133 function CfnCodeSigningConfigAllowedPublishersPropertyFromCloudFormation(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('signingProfileVersionArns', 'SigningProfileVersionArns', cfn_parse.FromCloudFormation.getStringArray(properties.SigningProfileVersionArns)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CodeSigningPoliciesProperty` * * @param properties - the TypeScript properties of a `CodeSigningPoliciesProperty` * * @returns the result of the validation. */ function CfnCodeSigningConfig_CodeSigningPoliciesPropertyValidator(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('untrustedArtifactOnDeployment', cdk.requiredValidator)(properties.untrustedArtifactOnDeployment)); errors.collect(cdk.propertyValidator('untrustedArtifactOnDeployment', cdk.validateString)(properties.untrustedArtifactOnDeployment)); return errors.wrap('supplied properties not correct for "CodeSigningPoliciesProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig.CodeSigningPolicies` resource * * @param properties - the TypeScript properties of a `CodeSigningPoliciesProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::CodeSigningConfig.CodeSigningPolicies` resource. */ // @ts-ignore TS6133 function cfnCodeSigningConfigCodeSigningPoliciesPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCodeSigningConfig_CodeSigningPoliciesPropertyValidator(properties).assertSuccess(); return { UntrustedArtifactOnDeployment: cdk.stringToCloudFormation(properties.untrustedArtifactOnDeployment), }; } // @ts-ignore TS6133 function CfnCodeSigningConfigCodeSigningPoliciesPropertyFromCloudFormation(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('untrustedArtifactOnDeployment', 'UntrustedArtifactOnDeployment', cfn_parse.FromCloudFormation.getString(properties.UntrustedArtifactOnDeployment)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnEventInvokeConfigProps` * * @param properties - the TypeScript properties of a `CfnEventInvokeConfigProps` * * @returns the result of the validation. */ function CfnEventInvokeConfigPropsValidator(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('destinationConfig', CfnEventInvokeConfig_DestinationConfigPropertyValidator)(properties.destinationConfig)); errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName)); errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName)); errors.collect(cdk.propertyValidator('maximumEventAgeInSeconds', cdk.validateNumber)(properties.maximumEventAgeInSeconds)); errors.collect(cdk.propertyValidator('maximumRetryAttempts', cdk.validateNumber)(properties.maximumRetryAttempts)); errors.collect(cdk.propertyValidator('qualifier', cdk.requiredValidator)(properties.qualifier)); errors.collect(cdk.propertyValidator('qualifier', cdk.validateString)(properties.qualifier)); return errors.wrap('supplied properties not correct for "CfnEventInvokeConfigProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig` resource * * @param properties - the TypeScript properties of a `CfnEventInvokeConfigProps` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig` resource. */ // @ts-ignore TS6133 function cfnEventInvokeConfigPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnEventInvokeConfigPropsValidator(properties).assertSuccess(); return { FunctionName: cdk.stringToCloudFormation(properties.functionName), Qualifier: cdk.stringToCloudFormation(properties.qualifier), DestinationConfig: cfnEventInvokeConfigDestinationConfigPropertyToCloudFormation(properties.destinationConfig), MaximumEventAgeInSeconds: cdk.numberToCloudFormation(properties.maximumEventAgeInSeconds), MaximumRetryAttempts: cdk.numberToCloudFormation(properties.maximumRetryAttempts), }; } // @ts-ignore TS6133 function CfnEventInvokeConfigPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('functionName', 'FunctionName', cfn_parse.FromCloudFormation.getString(properties.FunctionName)); ret.addPropertyResult('qualifier', 'Qualifier', cfn_parse.FromCloudFormation.getString(properties.Qualifier)); ret.addPropertyResult('destinationConfig', 'DestinationConfig', properties.DestinationConfig != null ? CfnEventInvokeConfigDestinationConfigPropertyFromCloudFormation(properties.DestinationConfig) : undefined); ret.addPropertyResult('maximumEventAgeInSeconds', 'MaximumEventAgeInSeconds', properties.MaximumEventAgeInSeconds != null ? cfn_parse.FromCloudFormation.getNumber(properties.MaximumEventAgeInSeconds) : undefined); ret.addPropertyResult('maximumRetryAttempts', 'MaximumRetryAttempts', properties.MaximumRetryAttempts != null ? cfn_parse.FromCloudFormation.getNumber(properties.MaximumRetryAttempts) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::Lambda::EventInvokeConfig` * * The `AWS::Lambda::EventInvokeConfig` resource configures options for [asynchronous invocation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html) on a version or an alias. * * By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it. * * @cloudformationResource AWS::Lambda::EventInvokeConfig * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventinvokeconfig.html */ class CfnEventInvokeConfig extends cdk.CfnResource { /** * Create a new `AWS::Lambda::EventInvokeConfig`. * * @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: CfnEventInvokeConfig.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_lambda_CfnEventInvokeConfigProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnEventInvokeConfig); } throw error; } cdk.requireProperty(props, 'functionName', this); cdk.requireProperty(props, 'qualifier', this); this.functionName = props.functionName; this.qualifier = props.qualifier; this.destinationConfig = props.destinationConfig; this.maximumEventAgeInSeconds = props.maximumEventAgeInSeconds; this.maximumRetryAttempts = props.maximumRetryAttempts; } /** * 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 = CfnEventInvokeConfigPropsFromCloudFormation(resourceProperties); const ret = new CfnEventInvokeConfig(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", CfnEventInvokeConfig.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { functionName: this.functionName, qualifier: this.qualifier, destinationConfig: this.destinationConfig, maximumEventAgeInSeconds: this.maximumEventAgeInSeconds, maximumRetryAttempts: this.maximumRetryAttempts, }; } renderProperties(props) { return cfnEventInvokeConfigPropsToCloudFormation(props); } } exports.CfnEventInvokeConfig = CfnEventInvokeConfig; _c = JSII_RTTI_SYMBOL_1; CfnEventInvokeConfig[_c] = { fqn: "@aws-cdk/aws-lambda.CfnEventInvokeConfig", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnEventInvokeConfig.CFN_RESOURCE_TYPE_NAME = "AWS::Lambda::EventInvokeConfig"; /** * Determine whether the given properties match those of a `DestinationConfigProperty` * * @param properties - the TypeScript properties of a `DestinationConfigProperty` * * @returns the result of the validation. */ function CfnEventInvokeConfig_DestinationConfigPropertyValidator(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('onFailure', CfnEventInvokeConfig_OnFailurePropertyValidator)(properties.onFailure)); errors.collect(cdk.propertyValidator('onSuccess', CfnEventInvokeConfig_OnSuccessPropertyValidator)(properties.onSuccess)); return errors.wrap('supplied properties not correct for "DestinationConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.DestinationConfig` resource * * @param properties - the TypeScript properties of a `DestinationConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.DestinationConfig` resource. */ // @ts-ignore TS6133 function cfnEventInvokeConfigDestinationConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnEventInvokeConfig_DestinationConfigPropertyValidator(properties).assertSuccess(); return { OnFailure: cfnEventInvokeConfigOnFailurePropertyToCloudFormation(properties.onFailure), OnSuccess: cfnEventInvokeConfigOnSuccessPropertyToCloudFormation(properties.onSuccess), }; } // @ts-ignore TS6133 function CfnEventInvokeConfigDestinationConfigPropertyFromCloudFormation(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('onFailure', 'OnFailure', properties.OnFailure != null ? CfnEventInvokeConfigOnFailurePropertyFromCloudFormation(properties.OnFailure) : undefined); ret.addPropertyResult('onSuccess', 'OnSuccess', properties.OnSuccess != null ? CfnEventInvokeConfigOnSuccessPropertyFromCloudFormation(properties.OnSuccess) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `OnFailureProperty` * * @param properties - the TypeScript properties of a `OnFailureProperty` * * @returns the result of the validation. */ function CfnEventInvokeConfig_OnFailurePropertyValidator(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('destination', cdk.requiredValidator)(properties.destination)); errors.collect(cdk.propertyValidator('destination', cdk.validateString)(properties.destination)); return errors.wrap('supplied properties not correct for "OnFailureProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.OnFailure` resource * * @param properties - the TypeScript properties of a `OnFailureProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.OnFailure` resource. */ // @ts-ignore TS6133 function cfnEventInvokeConfigOnFailurePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnEventInvokeConfig_OnFailurePropertyValidator(properties).assertSuccess(); return { Destination: cdk.stringToCloudFormation(properties.destination), }; } // @ts-ignore TS6133 function CfnEventInvokeConfigOnFailurePropertyFromCloudFormation(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('destination', 'Destination', cfn_parse.FromCloudFormation.getString(properties.Destination)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `OnSuccessProperty` * * @param properties - the TypeScript properties of a `OnSuccessProperty` * * @returns the result of the validation. */ function CfnEventInvokeConfig_OnSuccessPropertyValidator(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('destination', cdk.requiredValidator)(properties.destination)); errors.collect(cdk.propertyValidator('destination', cdk.validateString)(properties.destination)); return errors.wrap('supplied properties not correct for "OnSuccessProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.OnSuccess` resource * * @param properties - the TypeScript properties of a `OnSuccessProperty` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::EventInvokeConfig.OnSuccess` resource. */ // @ts-ignore TS6133 function cfnEventInvokeConfigOnSuccessPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnEventInvokeConfig_OnSuccessPropertyValidator(properties).assertSuccess(); return { Destination: cdk.stringToCloudFormation(properties.destination), }; } // @ts-ignore TS6133 function CfnEventInvokeConfigOnSuccessPropertyFromCloudFormation(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('destination', 'Destination', cfn_parse.FromCloudFormation.getString(properties.Destination)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnEventSourceMappingProps` * * @param properties - the TypeScript properties of a `CfnEventSourceMappingProps` * * @returns the result of the validation. */ function CfnEventSourceMappingPropsValidator(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('amazonManagedKafkaEventSourceConfig', CfnEventSourceMapping_AmazonManagedKafkaEventSourceConfigPropertyValidator)(properties.amazonManagedKafkaEventSourceConfig)); errors.collect(cdk.propertyValidator('batchSize', cdk.validateNumber)(properties.batchSize)); errors.collect(cdk.propertyValidator('bisectBatchOnFunctionError', cdk.validateBoolean)(properties.bisectBatchOnFunctionError)); errors.collect(cdk.propertyValidator('destinationConfig', CfnEventSourceMapping_DestinationConfigPropertyValidator)(properties.destinationConfig)); errors.collect(cdk.propertyValidator('documentDbEventSourceConfig', CfnEventSourceMapping_DocumentDBEventSourceConfigPropertyValidator)(properties.documentDbEventSourceConfig)); errors.collect(cdk.propertyValidator('enabled', cdk.validateBoolean)(properties.enabled)); errors.collect(cdk.propertyValidator('eventSourceArn', cdk.validateString)(properties.eventSourceArn)); errors.collect(cdk.propertyValidator('filterCriteria', CfnEventSourceMapping_FilterCriteriaPropertyValidator)(properties.filterCriteria)); errors.collect(cdk.propertyValidator('functionName', cdk.requiredValidator)(properties.functionName)); errors.collect(cdk.propertyValidator('functionName', cdk.validateString)(properties.functionName)); errors.collect(cdk.propertyValidator('functionResponseTypes', cdk.listValidator(cdk.validateString))(properties.functionResponseTypes)); errors.collect(cdk.propertyValidator('maximumBatchingWindowInSeconds', cdk.validateNumber)(properties.maximumBatchingWindowInSeconds)); errors.collect(cdk.propertyValidator('maximumRecordAgeInSeconds', cdk.validateNumber)(properties.maximumRecordAgeInSeconds)); errors.collect(cdk.propertyValidator('maximumRetryAttempts', cdk.validateNumber)(properties.maximumRetryAttempts)); errors.collect(cdk.propertyValidator('parallelizationFactor', cdk.validateNumber)(properties.parallelizationFactor)); errors.collect(cdk.propertyValidator('queues', cdk.listValidator(cdk.validateString))(properties.queues)); errors.collect(cdk.propertyValidator('scalingConfig', CfnEventSourceMapping_ScalingConfigPropertyValidator)(properties.scalingConfig)); errors.collect(cdk.propertyValidator('selfManagedEventSource', CfnEventSourceMapping_SelfManagedEventSourcePropertyValidator)(properties.selfManagedEventSource)); errors.collect(cdk.propertyValidator('selfManagedKafkaEventSourceConfig', CfnEventSourceMapping_SelfManagedKafkaEventSourceConfigPropertyValidator)(properties.selfManagedKafkaEventSourceConfig)); errors.collect(cdk.propertyValidator('sourceAccessConfigurations', cdk.listValidator(CfnEventSourceMapping_SourceAccessConfigurationPropertyValidator))(properties.sourceAccessConfigurations)); errors.collect(cdk.propertyValidator('startingPosition', cdk.validateString)(properties.startingPosition)); errors.collect(cdk.propertyValidator('startingPositionTimestamp', cdk.validateNumber)(properties.startingPositionTimestamp)); errors.collect(cdk.propertyValidator('topics', cdk.listValidator(cdk.validateString))(properties.topics)); errors.collect(cdk.propertyValidator('tumblingWindowInSeconds', cdk.validateNumber)(properties.tumblingWindowInSeconds)); return errors.wrap('supplied properties not correct for "CfnEventSourceMappingProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::Lambda::EventSourceMapping` resource * * @param properties - the TypeScript properties of a `CfnEventSourceMappingProps` * * @returns the AWS CloudFormation properties of an `AWS::Lambda::EventSourceMapping` resource. */ // @ts-ignore TS6133 function cfnEventSourceMappingPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnEventSourceMappingPropsValidator(properties).assertSuccess(); return { FunctionName: cdk.stringToCloudFormation(properties.functionName), AmazonManagedKafkaEventSourceConfig: cfnEventSourceMappingAmazonManagedKafkaEventSourceConfigPropertyToCloudFormation(properties.amazonManagedKafkaEventSourceConfig), BatchSize: cdk.numberToCloudFormation(properties.batchSize), BisectBatchOnFunctionError: cdk.booleanToCloudFormation(properties.bisectBatchOnFunctionError), DestinationConfig: cfnEventSourceMappingDestinationConfigPropertyToCloudFormation(properties.destinationConfig), DocumentDBEventSourceConfig: cfnEventSourceMappingDocumentDBEventSourceConfigPropertyToCloudFormation(properties.documentDbEventSourceConfig), Enabled: cdk.booleanToCloudFormation(properties.enabled), EventSourceArn: cdk.stringToCloudFormation(properties.eventSourceArn), FilterCriteria: cfnEventSourceMappingFilterCriteriaPropertyToCloudFormation(properties.filterCriteria), FunctionResponseTypes: cdk.listMapper(cdk.stringToCloudFormation)(properties.functionResponseTypes), MaximumBatchingWindowInSeconds: cdk.numberToCloudFormation(properties.maximumBatchingWindowInSeconds), MaximumRecordAgeInSeconds: cdk.numberToCloudFormation(properties.maximumRecordAgeInSeconds), MaximumRetryAttempts: cdk.numberToCloudFormation(properties.maximumRetryAttempts), ParallelizationFactor: cdk.numberToCloudFormation(properties.parallelizationFactor), Queues: cdk.listMapper(cdk.stringToCloudFormation)(properties.queues), ScalingConfig: cfnEventSourceMappingScalingConfigPropertyToCloudFormation(properties.scalingConfig), SelfManagedEventSource: cfnEventSourceMappingSelfManagedEventSourcePropertyToCloudFormation(properties.selfManagedEventSource), SelfManagedKafkaEventSourceConfig: cfnEventSourceMappingSelfManagedKafkaEventSourceConfigPropertyToCloudFormation(properties.selfManagedKafkaEventSourceConfig), SourceAccessConfigurations: cdk.listMapper(cfnEventSourceMappingSourceAccessConfigurationPropertyToCloudFormation)(properties.sourceAccessConfigurations), StartingPosition: cdk.stringToCloudFormation(properties.startingPosition), StartingPositionTimestamp: cdk.numberToCloudFormation(properties.startingPositionTimestamp), Topics: cdk.listMapper(cdk.stringToCloudFormation)(properties.topics), TumblingWindowInSeconds: cdk.numberToCloudFormation(properties.tumblingWindowInSeconds), }; } // @ts-ignore TS6133 function CfnEventSourceMappingPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('functionName', 'FunctionName', cfn_parse.FromCloudFormation.getString(properties.FunctionName)); ret.addPropertyResult('amazonManagedKafkaEventSourceConfig',