Class: Jets::Cfn::Resource::ApiGateway::BasePath::Mapping

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

Instance Method Summary collapse

Methods inherited from Base

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

Methods included from Util::Camelize

#camelize

Instance Method Details

#definitionObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jets/cfn/resource/api_gateway/base_path/mapping.rb', line 21

def definition
  function_logical_id = "BasePathFunction" # lambda function that supports custom resource
  {
    BasePathMapping: {
      Type: "Custom::BasePathMapping",
      Properties: {
        ServiceToken: "!GetAtt #{function_logical_id}.Arn",
        # A change to any of these properties updates the CloudFormation Custom Resource
        # IE: It runs the Lambda function that implements the custom resource
        BasePath: Jets.config.domain.base_path, # '' empty path represents root
        DomainName: "!Ref DomainName",
        RestApiId: "!Ref RestApi",
        Stage: Jets::Cfn::Resource::ApiGateway::Deployment.stage_name,
      },
    }
  }
end

#outputsObject



39
40
41
42
43
# File 'lib/jets/cfn/resource/api_gateway/base_path/mapping.rb', line 39

def outputs
  {
    BasePathMapping: "!Ref BasePathMapping",
  }
end