@cdklabs/cdk-amazonmq
Version:
<!--BEGIN STABILITY BANNER-->
175 lines (174 loc) • 5.67 kB
TypeScript
import { Duration, Reference } from "aws-cdk-lib";
import { Connections, IConnectable, IVpc, SecurityGroup, SubnetSelection } from "aws-cdk-lib/aws-ec2";
import { IGrantable, IPrincipal, IRole, PolicyStatement } from "aws-cdk-lib/aws-iam";
import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
import { Logging, PhysicalResourceId } from "aws-cdk-lib/custom-resources";
import { Construct } from "constructs";
import { IRabbitMqBroker } from "../rabbitmq-broker";
/**
* All http request methods
*/
export declare enum HttpMethods {
GET = "GET",
POST = "POST",
PUT = "PUT",
DELETE = "DELETE"
}
/**
* A RabbitMQ Management HTTP API call
*/
export interface RabbitMqApiCall {
/**
* The RabbitMQ Management HTTP API call path.
*/
readonly path: string;
/**
* The HTTP Method used when invoking the RabbitMQ Management HTTP API call.
* @default GET
*/
readonly method?: HttpMethods;
/**
* The payload expected by the RabbitMQ Management HTTP API call.
*/
readonly payload?: {
[key: string]: any;
};
/**
* The physical resource id of the custom resource for this call.
* Mandatory for onCreate call.
* In onUpdate, you can omit this to passthrough it from request.
*
* @default - no physical resource id
*/
readonly physicalResourceId?: PhysicalResourceId;
/**
* Restrict the data returned by the custom resource to specific paths in the API response.
*
* Use this to limit the data returned by the custom resource if working with API calls that could potentially result in custom response objects exceeding the hard limit of 4096 bytes.
*/
readonly outputPaths?: string[];
/**
* A property used to configure logging during lambda function execution.
*
* Note: The default Logging configuration is all. This configuration will enable logging on all logged data
* in the lambda handler. This includes:
* - The event object that is received by the lambda handler
* - The response received after making a API call
* - The response object that the lambda handler will return
* - SDK versioning information
* - Caught and uncaught errors
*
* @default Logging.all()
*/
readonly logging?: Logging;
}
/**
* The IAM Policy that will be applied to the calls.
*/
export declare class RabbitMqCustomResourcePolicy {
readonly statements: PolicyStatement[];
/**
* Use this constant to configure access to any resource.
*/
static readonly ANY_RESOURCE: string[];
/**
* Explicit IAM Policy Statements.
*
* @param statements the statements to propagate to the SDK calls.
*/
static fromStatements(statements: PolicyStatement[]): RabbitMqCustomResourcePolicy;
/**
* @param statements statements for explicit policy.
* @param resources resources for auto-generated from SDK calls.
*/
private constructor();
}
/**
* Properties for RabbitMqCustomResource.
*
* Note that at least onCreate, onUpdate or onDelete must be specified.
*/
export interface RabbitMqCustomResourceProps {
/**
* The broker to send requests to.
*/
readonly broker: IRabbitMqBroker;
/**
* The secret containing the broker login credentials.
*/
readonly credentials: ISecret;
/**
* The RabbitMQ Management HTTP API call to make when the resource is created
*
* @default - the call when the resource is updated
*/
readonly onCreate?: RabbitMqApiCall;
/**
* The RabbitMQ Management HTTP API call to make when the resource is updated
*
* @default - no call
*/
readonly onUpdate?: RabbitMqApiCall;
/**
* The RabbitMQ Management HTTP API call to make when the resource is updated
*
* @default - no call
*/
readonly onDelete?: RabbitMqApiCall;
/**
* The vpc to connect to.
*/
readonly vpc?: IVpc;
/**
* The vpc subnets to connect to.
*/
readonly vpcSubnets?: SubnetSelection;
/**
* The security groups to assign to the function.
*/
readonly securityGroups?: SecurityGroup[];
/**
* LogGroup retention to use for the function
*
* @default RetentionDays.INFINITE
* @deprecated use logGroup instead
*/
readonly logRetention?: RetentionDays;
/**
* The logGroup to use for the function
*/
readonly logGroup?: LogGroup;
/**
* The timeout for the custom resource.
*
* @default Duration.minutes(1)
*/
readonly timeout?: Duration;
/**
* The execution role for the function.
*/
readonly role?: IRole;
/**
* The policies to attach to the function's role
*/
readonly policy?: RabbitMqCustomResourcePolicy;
}
/**
* @experimental
*
* Defines a custom resource that is materialized using specific RabbitMQ Management HTTP API calls.
*
* Use this to interact with the Amazon MQ for RabbitMQ broker. You can specify exactly which calls are invoked for the 'CREATE', 'UPDATE' and 'DELETE' life cycle events.
*/
export declare class RabbitMqCustomResource extends Construct implements IConnectable, IGrantable {
readonly connections: Connections;
readonly grantPrincipal: IPrincipal;
private readonly resource;
constructor(scope: Construct, id: string, props: RabbitMqCustomResourceProps);
getResponseField(key: string): string;
getResponseFieldReference(key: string): Reference;
private formatSdkCall;
private encodeJson;
private renderUniqueId;
}