Created
January 22, 2021 19:13
-
-
Save btakita/1fdeef92dacc6127177cd27567fb28dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const pay_apigateway_b = _b('pay_apigateway', (ctx: aws_run_ctx_type) => { | |
const { construct } = ctx | |
const pay_host = pay_host_b(ctx) | |
const local_az_certificate = local_az_certificate_b(ctx) | |
const pay_apigateway = new RestApi(construct, `${pay_host}-apigateway`, { | |
restApiName: `${pay_host}-apigateway`, | |
deploy: true, | |
defaultCorsPreflightOptions: { | |
allowOrigins: ['*'], | |
allowHeaders: [ | |
'*', 'Content-Type', 'X-Amz-Date', 'Authorization', | |
'X-Api-Key', 'X-Amz-Security-Token', 'X-Amz-User-Agent' | |
], | |
allowMethods: Cors.ALL_METHODS, | |
}, | |
domainName: { | |
domainName: pay_host, | |
certificate: local_az_certificate, | |
endpointType: EndpointType.REGIONAL, | |
}, | |
}) | |
const pay_bucket = pay_bucket_b(ctx) | |
const assets_integration = new HttpIntegration(`${pay_bucket.bucketWebsiteUrl}/{proxy}`, { | |
proxy: true, | |
options: { | |
requestParameters: { | |
'integration.request.path.proxy': 'method.request.path.proxy', | |
}, | |
}, | |
}) | |
pay_apigateway.root.addMethod('ANY', assets_integration, { | |
requestParameters: { | |
'method.request.path.proxy': true, | |
} | |
}) | |
pay_apigateway.root.addResource('{proxy+}') | |
.addMethod('ANY', assets_integration, { | |
requestParameters: { | |
'method.request.path.proxy': true, | |
} | |
}) | |
new CfnOutput(construct, 'pay_apigateway.domainName', { | |
value: pay_apigateway.domainName.domainName, | |
}) | |
new CfnOutput(construct, 'pay_apigateway.domainNameAliasDomainName', { | |
value: pay_apigateway.domainName.domainNameAliasDomainName, | |
}) | |
new CfnOutput(construct, 'pay_apigateway.domainNameAliasHostedZoneId', { | |
value: pay_apigateway.domainName.domainNameAliasHostedZoneId, | |
}) | |
return pay_apigateway | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment