Class: Bauble::Resources::ApiGatewayV2

Inherits:
Resource
  • Object
show all
Defined in:
lib/bauble/resources/api_gateway_v2.rb

Overview

AWS API Gateway v2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#resource_name

Constructor Details

#initialize(app, name:) ⇒ ApiGatewayV2

Returns a new instance of ApiGatewayV2.



12
13
14
15
16
17
# File 'lib/bauble/resources/api_gateway_v2.rb', line 12

def initialize(app, name:)
  super(app)
  @app = app
  @name = name
  @routes = []
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



10
11
12
# File 'lib/bauble/resources/api_gateway_v2.rb', line 10

def app
  @app
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/bauble/resources/api_gateway_v2.rb', line 10

def name
  @name
end

#routesObject

Returns the value of attribute routes.



10
11
12
# File 'lib/bauble/resources/api_gateway_v2.rb', line 10

def routes
  @routes
end

Instance Method Details

#add_route(route_key:, function:) ⇒ Object



27
28
29
# File 'lib/bauble/resources/api_gateway_v2.rb', line 27

def add_route(route_key:, function:)
  routes << { route_key: route_key, target_lambda_arn: "${#{function.name}.arn}", function_name: function.name }
end

#bundleObject



31
32
33
# File 'lib/bauble/resources/api_gateway_v2.rb', line 31

def bundle
  true
end

#synthesizeObject



19
20
21
22
23
24
25
# File 'lib/bauble/resources/api_gateway_v2.rb', line 19

def synthesize
  base_hash = api_hash
  base_hash.merge!(routes_hash)
  base_hash.merge!(deploymeny_hash)
  base_hash.merge!(synthesize_permissions)
  base_hash
end