Class: Jets::Cfn::Resource::Nested::Api::Mapping

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/cfn/resource/nested/api/mapping.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #outputs, #template_filename, #template_url

Methods inherited from Base

#attributes, #logical_id, #outputs, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type

Methods included from Util::Camelize

#camelize

Constructor Details

This class inherits a constructor from Jets::Cfn::Resource::Nested::Base

Instance Method Details

#definitionObject

interface method



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/jets/cfn/resource/nested/api/mapping.rb', line 4

def definition
  {
    ApiMapping: {
      Type: "AWS::CloudFormation::Stack",
      Properties: {
        TemplateURL: template_url,
        Parameters: parameters,
      },
      DependsOn: depends_on,
    }
  }
end

#depends_onObject



29
30
31
# File 'lib/jets/cfn/resource/nested/api/mapping.rb', line 29

def depends_on
  [Jets::Cfn::Resource::ApiGateway::Deployment.logical_id]
end

#parametersObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jets/cfn/resource/nested/api/mapping.rb', line 17

def parameters
  p = {
    GemLayer: "!Ref GemLayer",
    IamRole: "!GetAtt IamRole.Arn",
    RestApi: "!GetAtt ApiGateway.Outputs.RestApi",
    S3Bucket: "!Ref S3Bucket",
  }
  p[:DomainName] = "!GetAtt ApiGateway.Outputs.DomainName" if Jets.custom_domain?
  p[:BasePath] = Jets.config.domain.base_path
  p
end