# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 resource "aws_api_gateway_resource" "sessions" { rest_api_id = aws_api_gateway_rest_api.api.id parent_id = aws_api_gateway_rest_api.api.root_resource_id path_part = "sessions" } resource "aws_api_gateway_method" "sessions_options_method" { rest_api_id = aws_api_gateway_rest_api.api.id resource_id = aws_api_gateway_resource.sessions.id authorization = "NONE" http_method = "OPTIONS" } resource "aws_api_gateway_method_response" "sessions_options_200" { rest_api_id = aws_api_gateway_rest_api.api.id resource_id = aws_api_gateway_resource.sessions.id http_method = aws_api_gateway_method.sessions_options_method.http_method status_code = "200" response_models = { "application/json" = "Empty" } response_parameters = { "method.response.header.Access-Control-Allow-Headers" = true, "method.response.header.Access-Control-Allow-Methods" = true, "method.response.header.Access-Control-Allow-Origin" = true } } resource "aws_api_gateway_integration" "sessions_options_integration" { rest_api_id = aws_api_gateway_rest_api.api.id resource_id = aws_api_gateway_resource.sessions.id http_method = aws_api_gateway_method.sessions_options_method.http_method type = "MOCK" request_templates = { "application/json" = "{\"statusCode\": 200}" } } resource "aws_api_gateway_integration_response" "sessions_options_integration_response" { rest_api_id = aws_api_gateway_rest_api.api.id resource_id = aws_api_gateway_resource.sessions.id http_method = aws_api_gateway_method.sessions_options_method.http_method status_code = aws_api_gateway_method_response.sessions_options_200.status_code response_parameters = { "method.response.header.Access-Control-Allow-Headers" = "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'", "method.response.header.Access-Control-Allow-Methods" = "'GET,OPTIONS,POST,PUT,DELETE'", "method.response.header.Access-Control-Allow-Origin" = "'*'" } }