Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
},
DefaultRootObject: "index.html",
Enabled: true,
HttpVersion: "http2",
// Logging: {
// IncludeCookies: false,
// Bucket: '', // TODO:
// Prefix: '' // TODO:
// },
Origins: [
{
Id: "s3Origin",
DomainName: cloudform_1.Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: cloudform_1.Fn.Join("/", [
"origin-access-identity/cloudfront",
cloudform_1.Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100",
ViewerCertificate: {
AcmCertificateArn: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}Certificate`),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
DefaultRootObject: "index.html",
Enabled: true,
HttpVersion: "http2",
// Logging: {
// IncludeCookies: false,
// Bucket: '', // TODO:
// Prefix: '' // TODO:
// },
Origins: [
{
Id: "s3Origin",
DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: Fn.Join("/", [
"origin-access-identity/cloudfront",
Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
ViewerCertificate: {
AcmCertificateArn: Fn.ImportValue(
`${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
if (branch === "master") {
(template.Resources as any).RecordSet = ServerRecordSet;
(template.Resources as any).DomainName = DomainName;
(template as any).Outputs.DistributionDomainName = {
Description: "DomainName.DistributionDomainName for api branch RecordSet to reference",
Value: Fn.GetAtt("DomainName", "DistributionDomainName"),
Export: {
Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionDomainName`
}
};
(template as any).Outputs.DistributionHostedZoneId = {
Description:
"DomainName.DistributionHostedZoneId for api branch RecordSet to reference",
Value: Fn.GetAtt("DomainName", "DistributionHostedZoneId"),
Export: {
Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionHostedZoneId`
}
};
}
// const parseSegment = (segment: Handlers, currentPath: string): void =>
// Object.entries(segment).forEach(([name, segmentOrRoute]) => {
// if (
// segmentOrRoute.handler &&
// typeof segmentOrRoute.handler === "function"
// ) {
// const Name = capitalizeFirstLetter(name);
// const handlerDefinition = {
// Type: "AWS::Serverless::Function",
Resources: {
BasePathMapping: BasePathMapping(branch),
LogGroup,
ApiGateway,
GatewayResponseDefault4XX,
GatewayResponseDefault5XX
}
};
if (branch === "master") {
(template.Resources as any).RecordSet = ServerRecordSet;
(template.Resources as any).DomainName = DomainName;
(template as any).Outputs.DistributionDomainName = {
Description: "DomainName.DistributionDomainName for api branch RecordSet to reference",
Value: Fn.GetAtt("DomainName", "DistributionDomainName"),
Export: {
Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionDomainName`
}
};
(template as any).Outputs.DistributionHostedZoneId = {
Description:
"DomainName.DistributionHostedZoneId for api branch RecordSet to reference",
Value: Fn.GetAtt("DomainName", "DistributionHostedZoneId"),
Export: {
Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionHostedZoneId`
}
};
}
// const parseSegment = (segment: Handlers, currentPath: string): void =>
Forward: "none"
}
}
},
DefaultRootObject: "index.html",
Enabled: true,
HttpVersion: "http2",
// Logging: {
// IncludeCookies: false,
// Bucket: '', // TODO:
// Prefix: '' // TODO:
// },
Origins: [
{
Id: "s3Origin",
DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: Fn.Join("/", [
"origin-access-identity/cloudfront",
Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
ViewerCertificate: {
AcmCertificateArn: Fn.ImportValue(
`${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
},
DefaultRootObject: "index.html",
Enabled: true,
HttpVersion: "http2",
// Logging: {
// IncludeCookies: false,
// Bucket: '', // TODO:
// Prefix: '' // TODO:
// },
Origins: [
{
Id: "s3Origin",
DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: Fn.Join("/", [
"origin-access-identity/cloudfront",
Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
ViewerCertificate: {
AcmCertificateArn: Fn.ImportValue(
`${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
// },
Origins: [
{
Id: "s3Origin",
DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: Fn.Join("/", [
"origin-access-identity/cloudfront",
Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
ViewerCertificate: {
AcmCertificateArn: Fn.ImportValue(
`${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
// // @ts-ignore
// template.Resources[Name] = handlerDefinition;
// return;
// }
// // recursively parse as a path segment
// return parseSegment(segmentOrRoute, `${currentPath}/${name}`);
// });
// const handlers = getHandlers();
// parseSegment(handlers, "handlers");
return CF(template);
};
ResourceFactory.prototype.makeElasticSearchDataSource = function () {
var logicalName = ResourceFactory.ElasticSearchDomainLogicalID;
return new appSync_1.default.DataSource({
ApiId: cloudform_1.Fn.GetAtt(ResourceFactory.GraphQLAPILogicalID, 'ApiId'),
Name: logicalName,
Type: 'AMAZON_ELASTICSEARCH',
ServiceRoleArn: cloudform_1.Fn.GetAtt(ResourceFactory.IAMRoleLogicalID, 'Arn'),
ElasticsearchConfig: {
AwsRegion: cloudform_1.Fn.Select(3, cloudform_1.Fn.Split(':', cloudform_1.Fn.GetAtt(logicalName, 'DomainArn'))),
Endpoint: cloudform_1.Fn.Join('', [
'https://',
cloudform_1.Fn.GetAtt(logicalName, 'DomainEndpoint')
])
}
});
};
/**
ResourceFactory.prototype.makeElasticSearchDataSource = function () {
var logicalName = amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.ElasticSearchDomainLogicalID;
return new appSync_1.default.DataSource({
ApiId: cloudform_1.Fn.GetAtt(amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: logicalName,
Type: 'AMAZON_ELASTICSEARCH',
ServiceRoleArn: cloudform_1.Fn.GetAtt(amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.ElasticSearchAccessIAMRoleLogicalID, 'Arn'),
ElasticsearchConfig: {
AwsRegion: cloudform_1.Fn.Select(3, cloudform_1.Fn.Split(':', cloudform_1.Fn.GetAtt(logicalName, 'DomainArn'))),
Endpoint: cloudform_1.Fn.Join('', [
'https://',
cloudform_1.Fn.GetAtt(logicalName, 'DomainEndpoint')
])
}
});
};
/**