aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
163 lines (162 loc) • 5.5 kB
TypeScript
import type { Construct } from 'constructs';
import type { IEngine } from './engine';
import type { IResource } from '../../core';
import { RemovalPolicy, Resource } from '../../core';
import type { aws_rds } from '../../interfaces';
/**
* Options for `IParameterGroup.bindToCluster`.
* Empty for now, but can be extended later.
*/
export interface ParameterGroupClusterBindOptions {
}
/**
* The type returned from `IParameterGroup.bindToCluster`.
*/
export interface ParameterGroupClusterConfig {
/** The name of this parameter group. */
readonly parameterGroupName: string;
}
/**
* Options for `IParameterGroup.bindToInstance`.
* Empty for now, but can be extended later.
*/
export interface ParameterGroupInstanceBindOptions {
}
/**
* The type returned from `IParameterGroup.bindToInstance`.
*/
export interface ParameterGroupInstanceConfig {
/** The name of this parameter group. */
readonly parameterGroupName: string;
}
/**
* A parameter group.
* Represents both a cluster parameter group,
* and an instance parameter group.
*/
export interface IParameterGroup extends IResource, aws_rds.IDBParameterGroupRef, aws_rds.IDBClusterParameterGroupRef {
/**
* Method called when this Parameter Group is used when defining a database cluster.
*/
bindToCluster(options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig;
/**
* Method called when this Parameter Group is used when defining a database instance.
*/
bindToInstance(options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig;
/**
* Adds a parameter to this group.
* If this is an imported parameter group,
* this method does nothing.
*
* @returns true if the parameter was actually added
* (i.e., this ParameterGroup is not imported),
* false otherwise
*/
addParameter(key: string, value: string): boolean;
}
/**
* Properties for a parameter group
*/
export interface ParameterGroupProps {
/**
* The database engine for this parameter group.
*/
readonly engine: IEngine;
/**
* The name of this parameter group.
*
* @default - CloudFormation-generated name
*/
readonly name?: string;
/**
* Description for this parameter group
*
* @default a CDK generated description
*/
readonly description?: string;
/**
* The parameters in this parameter group
*
* @default - None
*/
readonly parameters?: {
[key: string]: string;
};
/**
* The CloudFormation policy to apply when the instance is removed from the
* stack or replaced during an update.
*
* @default - RemovalPolicy.DESTROY
*/
readonly removalPolicy?: RemovalPolicy;
}
/**
* A parameter group.
* Represents both a cluster parameter group (AWS::RDS::DBClusterParameterGroup),
* and an instance parameter group (AWS::RDS::DBParameterGroup).
*
* @resource AWS::RDS::DBParameterGroup
*/
export declare class ParameterGroup extends Resource implements IParameterGroup {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Imports a parameter group
*/
static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup;
/**
* Creates a standalone instance parameter group.
*
* This method allows you to explicitly create a parameter group
* without binding it to a database instance.
*
* @returns instance parameter group (AWS::RDS::DBParameterGroup)
*/
static forInstance(scope: Construct, id: string, props: ParameterGroupProps): IParameterGroup;
/**
* Creates a standalone cluster parameter group.
*
* This method allows you to explicitly create a parameter group
* without binding it to a database cluster.
*
* @returns cluster parameter group (AWS::RDS::DBClusterParameterGroup)
*/
static forCluster(scope: Construct, id: string, props: ParameterGroupProps): IParameterGroup;
private readonly parameters;
private readonly family;
private readonly removalPolicy?;
private readonly description?;
private readonly name?;
private clusterCfnGroup?;
private instanceCfnGroup?;
constructor(scope: Construct, id: string, props: ParameterGroupProps);
bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig;
bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig;
/**
* Add a parameter to this parameter group
*
* @param key The key of the parameter to be added
* @param value The value of the parameter to be added
*/
addParameter(key: string, value: string): boolean;
/**
* Creates the instance parameter group CloudFormation resource if it doesn't exist.
* @returns parameter group name
*/
private createInstanceParameterGroup;
/**
* Creates the cluster parameter group CloudFormation resource if it doesn't exist.
* @returns parameter group name
*/
private createClusterParameterGroup;
/**
* A reference to this parameter group as a DB parameter group
*/
get dbParameterGroupRef(): aws_rds.DBParameterGroupReference;
/**
* A reference to this parameter group as a DB cluster parameter group
*/
get dbClusterParameterGroupRef(): aws_rds.DBClusterParameterGroupReference;
}