Class: Jets::Cfn::Resource::ApiGateway::BasePath::Function
Instance Method Summary
collapse
#env_properties, #environment, #jets_env
Methods inherited from Base
#attributes, #logical_id, #outputs, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type
#camelize
Instance Method Details
#code_s3_key ⇒ Object
52
53
54
55
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 52
def code_s3_key
checksum = Jets::Builders::Md5.checksums["stage/code"]
"jets/code/code-#{checksum}.zip" end
|
#definition ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 5
def definition
{
BasePathFunction: {
Type: "AWS::Lambda::Function",
Properties: {
FunctionName: function_name,
Description: "Jets#base_path",
Code: {
S3Bucket: "!Ref S3Bucket",
S3Key: code_s3_key,
},
Role: "!GetAtt BasePathRole.Arn",
Handler: handler,
Runtime: get_runtime,
Timeout: 60,
MemorySize: 1536,
Environment: env_properties[:Environment],
Layers: layers,
}
}
}
end
|
#function_name ⇒ Object
JETS_RESET is respected here because CloudFormation Custom Resources do not allow updates to the ServiceToken property. Changing the base-path Lambda Function name results in a CloudFormation error:
Modifying service token is not allowed
44
45
46
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 44
def function_name
"#{Jets.project_namespace}-jets-base-path"
end
|
#get_runtime ⇒ Object
28
29
30
31
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 28
def get_runtime
props = camelize(Jets.application.config.function.to_h)
props[:Runtime] || Jets.ruby_runtime
end
|
#handler ⇒ Object
48
49
50
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 48
def handler
"handlers/functions/jets/base_path.lambda_handler"
end
|
#layers ⇒ Object
33
34
35
36
|
# File 'lib/jets/cfn/resource/api_gateway/base_path/function.rb', line 33
def layers
return Jets.config.lambda.layers if Jets.config.pro.disable
["!Ref GemLayer"] + Jets.config.lambda.layers
end
|