Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface AwsSdkCall {
/**
* The parameters for the service action
*
* @default - no paramters
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
*/
readonly parameters?: any;
Expand Down Expand Up @@ -114,6 +115,11 @@ export interface AwsSdkCall {
readonly outputPath?: string;
}

/**
* Properties for AwsCustomResource.
*
* Note that at least onCreate, onUpdate or onDelete must be specified.
*/
export interface AwsCustomResourceProps {
/**
* Cloudformation Resource type.
Expand All @@ -124,7 +130,6 @@ export interface AwsCustomResourceProps {

/**
* The AWS SDK call to make when the resource is created.
* At least onCreate, onUpdate or onDelete must be specified.
*
* @default - the call when the resource is updated
*/
Expand Down Expand Up @@ -177,11 +182,20 @@ export interface AwsCustomResourceProps {
readonly timeout?: cdk.Duration
}

/**
* Defines a custom resource that is materialized using specific AWS API calls.
*
* Use this to bridge any gap that might exist in the CloudFormation Coverage.
* You can specify exactly which calls are invoked for the 'CREATE', 'UPDATE' and 'DELETE' life cycle events.
*
*/
export class AwsCustomResource extends cdk.Construct implements iam.IGrantable {
public readonly grantPrincipal: iam.IPrincipal;

private readonly customResource: CustomResource;

// 'props' cannot be optional, even though all its properties are optional.
// this is because at least one sdk call must be provided.
constructor(scope: cdk.Construct, id: string, props: AwsCustomResourceProps) {
super(scope, id);

Expand Down
8 changes: 2 additions & 6 deletions packages/@aws-cdk/custom-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@
"stability": "experimental",
"awslint": {
"exclude": [
"construct-ctor-props-optional:@aws-cdk/custom-resources.AwsCustomResource",
"props-physical-name:@aws-cdk/custom-resources.AsyncCustomResourceProps",
"docs-public-apis:@aws-cdk/custom-resources.AwsCustomResource",
"docs-public-apis:@aws-cdk/custom-resources.AwsCustomResourceProps",
"props-default-doc:@aws-cdk/custom-resources.AwsSdkCall.parameters"
"construct-ctor-props-optional:@aws-cdk/custom-resources.AwsCustomResource"
]
}
}
}