Class: Jets::Cfn::Builders::ControllerBuilder
- Inherits:
-
BaseChildBuilder
- Object
- BaseChildBuilder
- Jets::Cfn::Builders::ControllerBuilder
- Defined in:
- lib/jets/cfn/builders/controller_builder.rb
Instance Method Summary collapse
- #add_api_gateway_parameters ⇒ Object
- #add_routes ⇒ Object
-
#compose ⇒ Object
compose is an interface method for Interface module.
-
#scoped_routes ⇒ Object
routes scoped to this controller template.
Methods inherited from BaseChildBuilder
#add_class_iam_policy, #add_common_parameters, #add_function, #add_function_iam_policy, #add_functions, #depends_on_params, #initialize, #template_path, #validate_function_names!
Methods included from Interface
#add_description, #add_output, #add_outputs, #add_parameter, #add_parameters, #add_resource, #add_resources, #add_template_resource, #build, #post_process_template, #template, #text, #write
Constructor Details
This class inherits a constructor from Jets::Cfn::Builders::BaseChildBuilder
Instance Method Details
#add_api_gateway_parameters ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jets/cfn/builders/controller_builder.rb', line 17 def add_api_gateway_parameters return if Jets::Router.routes.empty? add_parameter("RestApi", Description: "RestApi") scoped_routes.each do |route| resource = Jets::Resource::ApiGateway::Resource.new(route.path) add_parameter(resource.logical_id, description: resource.desc) if route. add_parameter(route., description: route.) end end if @app_class. add_parameter(@app_class., description: @app_class.) end end |
#add_routes ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/jets/cfn/builders/controller_builder.rb', line 34 def add_routes scoped_routes.each_with_index do |route, i| method = Jets::Resource::ApiGateway::Method.new(route) add_resource(method) add_resource(method.) add_resource(method.cors) if Jets.config.cors end end |
#compose ⇒ Object
compose is an interface method for Interface module
9 10 11 12 13 14 15 |
# File 'lib/jets/cfn/builders/controller_builder.rb', line 9 def compose add_common_parameters add_api_gateway_parameters add_functions add_routes add_resources end |