# API Reference ## Constructs ### RdsDump #### Initializers ```typescript import { RdsDump } from 'cdk-rds-dump' new RdsDump(scope: Construct, id: string, __2: RdsDumpProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | __2 | RdsDumpProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `__2`Required - *Type:* RdsDumpProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | with | Applies one or more mixins to this construct. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `with` ```typescript public with(mixins: ...IMixin[]): IConstruct ``` Applies one or more mixins to this construct. Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple `with()` calls if subsequent mixins should apply to added constructs. ###### `mixins`Required - *Type:* ...constructs.IMixin[] The mixins to apply. --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### `isConstruct` ```typescript import { RdsDump } from 'cdk-rds-dump' RdsDump.isConstruct(x: any) ``` Checks if `x` is a construct. Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked. Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ## Structs ### RdsDumpProps #### Initializer ```typescript import { RdsDumpProps } from 'cdk-rds-dump' const rdsDumpProps: RdsDumpProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | databaseName | string | Database name to dump. | | dbEngine | DbEngine | Select DB engine type. | | rdsCluster | aws-cdk-lib.aws_rds.DatabaseCluster | RDS Cluster to dump. | | schedule | aws-cdk-lib.aws_events.Schedule | Schedule to dump. | | createS3GatewayEndpoint | boolean | Whether to create an S3 Gateway Endpoint for the VPC where the RDS is located. | | createSecretsManagerVPCEndpoint | boolean | Whether to create an Interface Endpoint for the Secrets Manager. | | idSuffix | string | Suffix to add to the resource ID. | | lambdaEnv | {[ key: string ]: string} | Environment variables to set in the lambda function. | | lambdaNsg | aws-cdk-lib.aws_ec2.ISecurityGroup[] | Security group to allow access to the lambda function. | | memorySize | number | The amount of memory in MB allocated to the Lambda function. | | secretId | string | Secret id for database connection information stored in the Secrets Manager. | | secretsManagerVPCEndpointNsgId | string | List of IDs of security groups to attach to the Interface Endpoint for Secrets Manager. | | unsecurePassword | string | Database Password. | | unsecureUserName | string | Database username. | --- ##### `databaseName`Required ```typescript public readonly databaseName: string; ``` - *Type:* string Database name to dump. --- ##### `dbEngine`Required ```typescript public readonly dbEngine: DbEngine; ``` - *Type:* DbEngine Select DB engine type. Currently only mysql can be selected. --- ##### `rdsCluster`Required ```typescript public readonly rdsCluster: DatabaseCluster; ``` - *Type:* aws-cdk-lib.aws_rds.DatabaseCluster RDS Cluster to dump. --- ##### `schedule`Required ```typescript public readonly schedule: Schedule; ``` - *Type:* aws-cdk-lib.aws_events.Schedule Schedule to dump. See aws-cdk-lib/aws-events.Schedule. ex. import * as events from 'aws-cdk-lib/aws-events' // It is executed daily at 00:00 UTC. events.Schedule.cron({ minute: "0", hour: "0" }) --- ##### `createS3GatewayEndpoint`Optional ```typescript public readonly createS3GatewayEndpoint: boolean; ``` - *Type:* boolean - *Default:* false Whether to create an S3 Gateway Endpoint for the VPC where the RDS is located. --- ##### `createSecretsManagerVPCEndpoint`Optional ```typescript public readonly createSecretsManagerVPCEndpoint: boolean; ``` - *Type:* boolean - *Default:* false Whether to create an Interface Endpoint for the Secrets Manager. It is recommended to use a secret stored in the Secrets Manager, but in that case, the lambda doing the dump needs a route to access the Secrets Manager. If createSecretsManagerVPCEndpoint is true, an Interface Endpoint is created to allow access to the Secrets Manager. --- ##### `idSuffix`Optional ```typescript public readonly idSuffix: string; ``` - *Type:* string - *Default:* no suffix Suffix to add to the resource ID. --- ##### `lambdaEnv`Optional ```typescript public readonly lambdaEnv: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} - *Default:* no environment variables Environment variables to set in the lambda function. ex. { "ENV_VAR": "value" } --- ##### `lambdaNsg`Optional ```typescript public readonly lambdaNsg: ISecurityGroup[]; ``` - *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup[] - *Default:* use auto generated security group Security group to allow access to the lambda function. --- ##### `memorySize`Optional ```typescript public readonly memorySize: number; ``` - *Type:* number - *Default:* 1024 The amount of memory in MB allocated to the Lambda function. --- ##### `secretId`Optional ```typescript public readonly secretId: string; ``` - *Type:* string - *Default:* use database cluster's secret Secret id for database connection information stored in the Secrets Manager. We recommend using the secret stored in the Secrets Manager as the connection information to the DB, but it is also possible to specify the user name and password directly. If secretId is set, the corresponding secret on SecretsManager is retrieved to access the DB. --- ##### `secretsManagerVPCEndpointNsgId`Optional ```typescript public readonly secretsManagerVPCEndpointNsgId: string; ``` - *Type:* string - *Default:* use auto generated security group List of IDs of security groups to attach to the Interface Endpoint for Secrets Manager. Only used if createSecretsManagerVPCEndpoint is true. --- ##### `unsecurePassword`Optional ```typescript public readonly unsecurePassword: string; ``` - *Type:* string - *Default:* do not use unsecurePassword Database Password. We recommend using the secret stored in the Secrets Manager as the connection information to the DB, but it is also possible to specify the user name and password directly. unsecurePassword is a parameter to pass the password when the `unsecureUsername` is used. --- ##### `unsecureUserName`Optional ```typescript public readonly unsecureUserName: string; ``` - *Type:* string - *Default:* do not use unsecureUserName Database username. We recommend using the secret stored in the Secrets Manager as the connection information to the DB, but it is also possible to specify the user name and password directly. unsecureUserName is a parameter to pass the user name when the `unsecurePassword` is used. --- ## Enums ### DbEngine #### Members | **Name** | **Description** | | --- | --- | | MYSQL | *No description.* | --- ##### `MYSQL` ---