Sha256: ee8fdef9cafc7c0beb1cfd4b6c3b71b64f68fd3f1323645b446a2a4e6b79a169

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

class Jets::Cfn::TemplateBuilders
  class ApiGatewayDeploymentBuilder
    include Interface
    include Jets::AwsServices

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

    # compose is an interface method
    def compose
      return if @options[:stack_type] == :minimal

      puts "Building API Gateway Deployment template."
      add_parameter("RestApi", Description: "RestApi")

      map = Jets::Cfn::TemplateMappers::ApiGatewayDeploymentMapper.new(path=nil,s3_bucket=nil)
      add_resource(map.logical_id, "AWS::ApiGateway::Deployment",
        Description: "Version #{map.timestamp} deployed by jets",
        RestApiId: "!Ref RestApi",
        StageName: map.stage_name,
      )

      add_output("RestApiUrl", Value: "!Sub 'https://${RestApi}.execute-api.${AWS::Region}.amazonaws.com/#{map.stage_name}/'")
    end

    # template_path is an interface method
    def template_path
      Jets::Naming.api_gateway_deployment_template_path
    end

    # do not bother writing a template if routes are empty
    def write
      super unless Jets::Router.routes.empty?
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
jets-0.8.0 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.7.1 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.7.0 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.9 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.8 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.7 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.6 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.5 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.4 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.3 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.2 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.1 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.6.0 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.8 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.7 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.6 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.5 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.4 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.3 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb
jets-0.5.2 lib/jets/cfn/template_builders/api_gateway_deployment_builder.rb