-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpedidos_endpoints.tf
100 lines (86 loc) · 3.78 KB
/
pedidos_endpoints.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Resource /pedidos
resource "aws_api_gateway_resource" "pedidos" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_rest_api.api.root_resource_id
path_part = "pedidos"
}
# POST method for /pedidos
resource "aws_api_gateway_method" "pedidos_post" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos.id
http_method = "POST"
authorization = "COGNITO_USER_POOLS"
authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
}
# Integration for /pedidos POST
resource "aws_api_gateway_integration" "pedidos_post_integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos.id
http_method = aws_api_gateway_method.pedidos_post.http_method
type = "AWS_PROXY"
integration_http_method = "POST"
uri = aws_lambda_function.lambda_proxy.invoke_arn
}
# GET method for /pedidos
resource "aws_api_gateway_method" "pedidos_get" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos.id
http_method = "GET"
authorization = "COGNITO_USER_POOLS"
authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
}
# Integration for /pedidos GET
resource "aws_api_gateway_integration" "pedidos_get_integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos.id
http_method = aws_api_gateway_method.pedidos_get.http_method
type = "AWS_PROXY"
integration_http_method = "POST"
uri = aws_lambda_function.lambda_proxy.invoke_arn
}
# Resource /pedidos/{id}
resource "aws_api_gateway_resource" "pedido_id" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_resource.pedidos.id
path_part = "{id}"
}
# GET method for /pedidos/{id}
resource "aws_api_gateway_method" "pedido_id_get" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedido_id.id
http_method = "GET"
authorization = "COGNITO_USER_POOLS"
authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
}
# Integration for /pedidos/{id} GET
resource "aws_api_gateway_integration" "pedido_id_get_integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedido_id.id
http_method = aws_api_gateway_method.pedido_id_get.http_method
type = "AWS_PROXY"
integration_http_method = "POST"
uri = aws_lambda_function.lambda_proxy.invoke_arn
}
# Resource /pedidos/pagamento
resource "aws_api_gateway_resource" "pedidos_pagamento" {
rest_api_id = aws_api_gateway_rest_api.api.id
parent_id = aws_api_gateway_resource.pedidos.id
path_part = "pagamento"
}
# POST method for /pedidos/pagamento
resource "aws_api_gateway_method" "pedidos_pagamento_post" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos_pagamento.id
http_method = "POST"
authorization = "COGNITO_USER_POOLS"
authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
}
# Integration for /pedidos/pagamento POST
resource "aws_api_gateway_integration" "pedidos_pagamento_post_integration" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.pedidos_pagamento.id
http_method = aws_api_gateway_method.pedidos_pagamento_post.http_method
type = "AWS_PROXY"
integration_http_method = "POST"
uri = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:739842188003:function:LambdaPagamentos:prod/invocations"
}