forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteg.app.ts
46 lines (41 loc) · 1.45 KB
/
integ.app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { App, Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as amplify from '../lib';
class TestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const amplifyApp = new amplify.App(this, 'App', {
basicAuth: amplify.BasicAuth.fromGeneratedPassword('aws'),
autoBranchCreation: {},
customResponseHeaders: [
{
pattern: '*.json',
headers: {
'custom-header-name-1': 'custom-header-value-1',
'custom-header-name-2': 'custom-header-value-2',
},
},
{
pattern: '/path/*',
headers: {
'custom-header-name-1': 'custom-header-value-2',
'x-aws-url-suffix': `this-is-the-suffix-${Stack.of(this).urlSuffix}`,
},
},
],
platform: amplify.Platform.WEB_COMPUTE,
});
amplifyApp.addCustomRule({
source: '/source',
target: '/target',
// NOTE: This is optional according to the API but Cloudformation is breaking without it
// Resource handler returned message: "Invalid request provided: Status field in rewrite custom rules should not be empty
status: amplify.RedirectStatus.TEMPORARY_REDIRECT,
});
const mainBranch = amplifyApp.addBranch('main');
mainBranch.addEnvironment('key', 'value');
}
}
const app = new App();
new TestStack(app, 'cdk-amplify-app');
app.synth();