Sha256: e62e2d206c0208555e7f70f08ceb0e53ec26e4753a13bf3468a9bfc9bf909baa

Contents?: true

Size: 1.18 KB

Versions: 22

Compression:

Stored size: 1.18 KB

Contents

class Jets::Cfn::TemplateMappers
  class ApiGatewayDeploymentMapper < ChildMapper
    def logical_id
      self.class.logical_id
    end

    def timestamp
      self.class.timestamp
    end

    # stage_name: stag, stag-1, stag-2, etc
    def stage_name
      self.class.stage_name
    end

    def parameters
      {
        RestApi: "!GetAtt ApiGateway.Outputs.RestApi"
      }
    end

    def depends_on
      expression = "#{Jets::Naming.template_path_prefix}-*_controller*"
      controller_logical_ids = []
      Dir.glob(expression).each do |path|
        next unless File.file?(path)
        # @s3_bucket is available from the inherited ChildMapper class
        map = ChildMapper.new(path, @s3_bucket)
        controller_logical_ids << map.logical_id
      end
      controller_logical_ids
    end

    # Returns: "ApiGatewayDeployment[timestamp]"
    def self.logical_id
      "ApiGatewayDeployment#{timestamp}"
    end

    @@timestamp = nil
    def self.timestamp
      @@timestamp ||= Time.now.strftime("%Y%m%d%H%M%S")
    end

    def self.stage_name
      [Jets.config.short_env, Jets.config.env_extra].compact.join('_').gsub('-','_') # Stage name only allows a-zA-Z0-9_
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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