MCPcopy Create free account
hub / github.com/Uniswap/uniswapx-parameterization-api / constructor

Method constructor

bin/stacks/api-stack.ts:42–646  ·  view source on GitHub ↗
(
    parent: Construct,
    name: string,
    props: cdk.StackProps & {
      provisionedConcurrency: number;
      internalApiKey?: string;
      throttlingOverride?: string;
      chatbotSNSArn?: string;
      stage: string;
      envVars: Record<string, string>;
    }
  )

Source from the content-addressed store, hash-verified

40 public readonly url: CfnOutput;
41
42 constructor(
43 parent: Construct,
44 name: string,
45 props: cdk.StackProps & {
46 provisionedConcurrency: number;
47 internalApiKey?: string;
48 throttlingOverride?: string;
49 chatbotSNSArn?: string;
50 stage: string;
51 envVars: Record<string, string>;
52 }
53 ) {
54 super(parent, name, props);
55 const region = cdk.Stack.of(this).region;
56 const { provisionedConcurrency, internalApiKey, stage, chatbotSNSArn } = props;
57
58 /*
59 * API Gateway Initialization
60 */
61 const accessLogGroup = new aws_logs.LogGroup(this, `${SERVICE_NAME}APIGAccessLogs`);
62
63 const api = new aws_apigateway.RestApi(this, `${SERVICE_NAME}`, {
64 restApiName: `${SERVICE_NAME}`,
65 deployOptions: {
66 tracingEnabled: true,
67 metricsEnabled: true,
68 loggingLevel: MethodLoggingLevel.ERROR,
69 accessLogDestination: new aws_apigateway.LogGroupLogDestination(accessLogGroup),
70 accessLogFormat: aws_apigateway.AccessLogFormat.jsonWithStandardFields({
71 ip: false,
72 caller: false,
73 user: false,
74 requestTime: true,
75 httpMethod: true,
76 resourcePath: true,
77 status: true,
78 protocol: true,
79 responseLength: true,
80 }),
81 },
82 defaultCorsPreflightOptions: {
83 allowOrigins: aws_apigateway.Cors.ALL_ORIGINS,
84 allowMethods: aws_apigateway.Cors.ALL_METHODS,
85 },
86 });
87
88 const ipThrottlingACL = new aws_waf.CfnWebACL(this, `${SERVICE_NAME}IPThrottlingACL`, {
89 defaultAction: { allow: {} },
90 scope: 'REGIONAL',
91 visibilityConfig: {
92 sampledRequestsEnabled: true,
93 cloudWatchMetricsEnabled: true,
94 metricName: `${SERVICE_NAME}IPBasedThrottling`,
95 },
96 customResponseBodies: {
97 [`${SERVICE_NAME}ThrottledResponseBody`]: {
98 contentType: 'APPLICATION_JSON',
99 content: '{"errorCode": "TOO_MANY_REQUESTS"}',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected