Regardless what is set in MethodResponses and IntegrationOptions, the cdk synth command output cloud formation wouldn't have those configuration as part of its Cloud Formation output when using cdk for .NET.
Here is the .NET C# code, you can see there are some configurations related to Status code 200
var serviceResourceMethodResponses = new Dictionary<string, object>[] { new Dictionary<string, object>()};
serviceResourceMethodResponses[0].Add("StatusCode", "200");
serviceResourceMethodResponses[0].Add("ResponseModels", new Dictionary<string, string> { { "application/json", "Empty" } });
var integrationResponseOptions = new IntegrationOptions
{
IntegrationResponses = new IntegrationResponse[] { new IntegrationResponse {
StatusCode = "200",
ResponseTemplates = new Dictionary<string, string> { {"application/json", "" } }
}}
};
var serviceGet = new CfnMethod_(this, "serviceGetId", new CfnMethodProps
{
HttpMethod = "GET",
Integration = new IntegrationProps
{
Type = IntegrationType.AwsProxy,
Options = integrationResponseOptions,
IntegrationHttpMethod = "GET",
Uri = $"arn:aws:apigateway:{region}:lambda:path/2015-03-31/functions/{DemoAPIG.FunctionArn}/invocations"
},
ResourceId = serviceResource.ResourceId,
ApiKeyRequired = false,
AuthorizationType = "AWS_IAM",
RestApiId = apigForWorkDocsGoService.RestApiId,
MethodResponses = serviceResourceMethodResponses
});
serviceGet.AddDependsOn(serviceResource);
Here is the Cloud Formation Output from cdk synth command and no integration configuration nor the method response configuration
serviceGetId:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: GET
ResourceId:
Ref: serviceResourceId
RestApiId:
Ref: apigForDemoServiceId
ApiKeyRequired: false
AuthorizationType: AWS_IAM
Integration:
IntegrationHttpMethod: GET
Type: AWS_PROXY
Uri:
Fn::Join:
- ""
- - arn:aws:apigateway:ap-northeast-1:lambda:path/2015-03-31/functions/
- Fn::GetAtt:
- DemoAPIGId
- Arn
- /invocations
DependsOn:
- serviceResourceId
Metadata:
aws:cdk:path: nrt-prod/serviceGetId
Regardless what is set in MethodResponses and IntegrationOptions, the cdk synth command output cloud formation wouldn't have those configuration as part of its Cloud Formation output when using cdk for .NET.
Here is the .NET C# code, you can see there are some configurations related to Status code 200
Here is the Cloud Formation Output from cdk synth command and no integration configuration nor the method response configuration