Class: Jets::Resource::ApiGateway::Method
- Defined in:
- lib/jets/resource/api_gateway/method.rb
Direct Known Subclasses
Instance Method Summary collapse
- #cors ⇒ Object
- #definition ⇒ Object
-
#initialize(route) ⇒ Method
constructor
route - Jets::Route.
- #method_logical_id ⇒ Object
- #replacements ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(route) ⇒ Method
route - Jets::Route
11 12 13 |
# File 'lib/jets/resource/api_gateway/method.rb', line 11 def initialize(route) @route = route end |
Instance Method Details
#cors ⇒ Object
48 49 50 |
# File 'lib/jets/resource/api_gateway/method.rb', line 48 def cors Cors.new(@route) end |
#definition ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jets/resource/api_gateway/method.rb', line 15 def definition { method_logical_id => { type: "AWS::ApiGateway::Method", properties: { resource_id: "!Ref #{resource_id}", rest_api_id: "!Ref RestApi", http_method: @route.method, request_parameters: {}, authorization_type: "NONE", integration: { integration_http_method: "POST", type: "AWS_PROXY", uri: "!Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${{namespace}LambdaFunction.Arn}/invocations" }, method_responses: [] } } } end |
#method_logical_id ⇒ Object
36 37 38 |
# File 'lib/jets/resource/api_gateway/method.rb', line 36 def method_logical_id "{namespace}_api_method" end |
#replacements ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/jets/resource/api_gateway/method.rb', line 40 def replacements # mimic task to grab replacements, we want the namespace to be the lambda function's namespace resources = [definition] task = Jets::Lambda::Task.new(@route.controller_name, @route.action_name, resources: resources) task.replacements end |