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, #sns, #sts

Methods included from AwsServices::StackStatus

#stack_exists?, #stack_in_progress?

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
# File 'lib/jets/cfn/builders/api_deployment_builder.rb', line 12

def compose
  return unless @options[:templates] || @options[:stack_type] != :minimal

  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



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

def template_path
  Jets::Naming.api_deployment_template_path
end

#writeObject

do not bother writing a template if routes are empty



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

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