@aws-solutions-constructs/core
Version:
Core CDK Construct for patterns library
118 lines (117 loc) • 6.69 kB
TypeScript
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import * as cdk from 'aws-cdk-lib';
import { Construct } from "constructs";
export declare const COMMERCIAL_REGION_LAMBDA_NODE_RUNTIME: cdk.aws_lambda.Runtime;
export declare const COMMERCIAL_REGION_LAMBDA_NODE_STRING = "nodejs20.x";
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*/
export declare function overrideProps(defaultProps: object, userProps: object, concatArray?: boolean, suppressWarnings?: boolean): any;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*/
export declare function printWarning(message: string): void;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* @summary Creates a resource name in the style of the CDK (string+hash) - this value should be used for logical IDs, but
* not Physical Names, as it will not be static within a single stack instance lifetime, or it will not be different in
* different stack instances
* @param {string[]} parts - the various string components of the name (eg - stackName, solutions construct ID, L2 construct ID)
* @param {number} maxLength - the longest string that can be returned
* @returns {string} - a string with concatenated parts (truncated if necessary) + a hash of the full concatenated parts
*
* This is based upon this discussion - https://github.com/aws/aws-cdk/issues/1424
*/
export declare function generateResourceName(parts: string[], maxLength: number, randomize?: boolean): string;
export declare function generatePhysicalLogGroupName(prefix: string, parts: string[]): string;
export declare function generatePhysicalRestApiName(prefix: string, parts: string[]): string;
export declare function generatePhysicalOacName(prefix: string, parts: string[]): string;
export declare function generatePhysicalKendraIndexName(prefix: string, parts: string[]): string;
export declare function generatePhysicalInferenceProfileName(prefix: string, parts: string[]): string;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* @summary Creates a physical resource name in the style of the CDK (string+hash) - this value incorporates Stack ID,
* so it will remain static in multiple updates of a single stack, but will be different in a separate stack instance
* @param {string[]} parts - the various string components of the name (eg - stackName, solutions construct ID, L2 construct ID)
* @param {number} maxLength - the longest string that can be returned
* @returns {string} - a string with concatenated parts (truncated if necessary) + a hash of the full concatenated parts
*
*/
export declare function generatePhysicalName(prefix: string, parts: string[], maxLength: number): string;
/**
* Removes all non-alphanumeric characters in a string.
*/
export declare function removeNonAlphanumeric(s: string): string;
/**
* The CFN NAG suppress rule interface
* @interface CfnNagSuppressRule
*/
export interface CfnNagSuppressRule {
readonly id: string;
readonly reason: string;
}
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* Adds CFN NAG suppress rules to the CDK resource.
* @param resource The CDK resource
* @param rules The CFN NAG suppress rules
*/
export declare function addCfnSuppressRules(resource: cdk.Resource | cdk.CfnResource, rules: CfnNagSuppressRule[]): void;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* Adds CfnGuard suppress rules to the CDK resource.
* @param resource The CDK resource
* @param rules The CfnGaurd rules to suppress
*/
export declare function addCfnGuardSuppressRules(resource: any, rules: string[]): void;
export declare function suppressVpcCustomerHandlerRoleWarnings(stack: cdk.Stack): void;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* Creates the props to be used to instantiate a CDK L2 construct within a Solutions Construct
*
* @param defaultProps The default props to be used by the construct
* @param clientProps Optional properties passed in from the client in the props object
* @param constructProps Optional properties required by the construct for the construct to work (override any other values)
* @returns The properties to use - all values prioritized:
* 1) constructProps value
* 2) clientProps value
* 3) defaultProps value
*/
export declare function consolidateProps(defaultProps: object, clientProps?: object, constructProps?: object, concatArray?: boolean): any;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*
* Generates a name unique to this location in this stack with this stackname. Truncates to under 64 characters if needed.
* (will allow 2 copies of the stack with different stack names, but will collide if both stacks have the same name)
*
* @param scope the construct within to create the name
* @param resourceId an id for the construct about to be created under scope (empty string if name is for scoep)
* @returns a unique name
*
* Note: This appears to overlap with GenerateResourceName above (I wrote it before noticing that
* function). As this offloads the logic to the CDK, I'm leaving this here but someone may want to
* blend these routines in the future.
*/
export declare function generateName(scope: Construct, resourceId?: string): string;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*/
export declare function CheckListValues(allowedPermissions: string[], submittedValues: string[], valueType: string): void;
export declare function CheckBooleanWithDefault(value: boolean | undefined, defaultValue: boolean): boolean;
export declare function CheckStringWithDefault(value: string | undefined, defaultValue: string): string;