diff --git a/presets/library/cloudfront-invalidation-panel/preset.mjs b/presets/library/cloudfront-invalidation-panel/preset.mjs new file mode 100644 index 0000000..6e1afff --- /dev/null +++ b/presets/library/cloudfront-invalidation-panel/preset.mjs @@ -0,0 +1,3 @@ +import { extend, extract } from '../../../src/index.js' + +export default [extend('presets/base/typescript-cdk'), extract()] diff --git a/presets/library/cloudfront-invalidation-panel/templates/README.md b/presets/library/cloudfront-invalidation-panel/templates/README.md new file mode 100644 index 0000000..bcd10ab --- /dev/null +++ b/presets/library/cloudfront-invalidation-panel/templates/README.md @@ -0,0 +1,25 @@ +

+ + Buttonize.io + +

+ +--- + +## CloudFront Invalidation Panel + +[![CloudFront Invalidation Panel](https://github.com/buttonize/create-buttonize/assets/6282843/aeb73d4a-e502-4d3b-b1b6-d3ee5538349d)](https://buttonize.io/library/cloudfront-invalidation-panel) + +Learn more about CloudFront Invalidation Panel Construct [here](https://buttonize.io/library/cloudfront-invalidation-panel). + +## CDK + +The `cdk.json` file tells the CDK Toolkit how to execute your app. + +### Useful commands + +* `npm run build` compile typescript to js +* `npm run watch` watch for changes and compile +* `npx cdk deploy` deploy this stack to your default AWS account/region +* `npx cdk diff` compare deployed stack with current state +* `npx cdk synth` emits the synthesized CloudFormation template diff --git a/presets/library/cloudfront-invalidation-panel/templates/lib/example-stack.ts b/presets/library/cloudfront-invalidation-panel/templates/lib/example-stack.ts new file mode 100644 index 0000000..93bffb2 --- /dev/null +++ b/presets/library/cloudfront-invalidation-panel/templates/lib/example-stack.ts @@ -0,0 +1,31 @@ +import * as cdk from 'aws-cdk-lib' +import { Distribution } from 'aws-cdk-lib/aws-cloudfront' +import { HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins' +import { Buttonize } from 'buttonize/cdk' +import { CloudFrontInvalidationPanel } from 'buttonize/library' +import { Construct } from 'constructs' + +export class ExampleStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props) + + Buttonize.init(this, { + apiKey: '@@apiKey' + }) + + const yourDistribution = new Distribution(this, 'YourDistribution', { + defaultBehavior: { + origin: new HttpOrigin('google.com') + } + }) + + new CloudFrontInvalidationPanel(this, 'CloudFrontPanel', { + distribution: yourDistribution, + paths: { + All: '/*', + Users: '/users', + 'Landing page': '/en/lp/mega-campaign' + } + }) + } +}