Class: Jets::Cfn::Builders::ApiDeploymentBuilder

Inherits:
Object
  • Object
show all
Includes:
AwsServices, Interface
Defined in:
lib/jets/cfn/builders/api_deployment_builder.rb

Instance Method Summary collapse

Methods included from AwsServices

#cfn, #lambda, #logs, #s3, #s3_resource, #stack_exists?, #stack_in_progress?, #sts

Methods included from Interface

#add_output, #add_outputs, #add_parameter, #add_parameters, #add_resource, #add_resources, #add_template_resource, #build, #post_process_template, #template, #text

Constructor Details

#initialize(options = {}) ⇒ ApiDeploymentBuilder

Returns a new instance of ApiDeploymentBuilder.



6
7
8
9
# File 'lib/jets/cfn/builders/api_deployment_builder.rb', line 6

def initialize(options={})
  @options = options
  @template = ActiveSupport::HashWithIndifferentAccess.new(Resources: {})
end

Instance Method Details

#composeObject

compose is an interface method



12
13
14
15
16
17
18
19
20
# File 'lib/jets/cfn/builders/api_deployment_builder.rb', line 12

def compose
  return if @options[:stack_type] == :minimal

  puts "Building API Gateway Deployment template."
  deployment = Jets::Resource::ApiGateway::Deployment.new
  add_resource(deployment)
  add_parameters(deployment.parameters)
  add_outputs(deployment.outputs)
end

#template_pathObject

template_path is an interface method



23
24
25
# File 'lib/jets/cfn/builders/api_deployment_builder.rb', line 23

def template_path
  Jets::Naming.api_deployment_template_path
end

#writeObject

do not bother writing a template if routes are empty



28
29
30
# File 'lib/jets/cfn/builders/api_deployment_builder.rb', line 28

def write
  super unless Jets::Router.routes.empty?
end