sfn-lambda 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 687938d6c0855b30342de6b52eb87a837043aabe
4
- data.tar.gz: e38d4701d422e4a108a045b9fbeb5c2c8e439a98
3
+ metadata.gz: 34e8c66fc19d1b07f06a4a99dc65d7f4bc4e33a7
4
+ data.tar.gz: 27c8d94e336a916720f140a2a1ca353f46fbe5c4
5
5
  SHA512:
6
- metadata.gz: 5c76cb6f390565b252cbd115de9073cf2033171617c754fd65c2f99e4dca2cd30ce76841cd5dae27f1c15643ff0a2b6e8d2bd014dae45705229b50d06f9325c9
7
- data.tar.gz: 3135cd6699333754d1825d00ddc1633e4d702e118ae737e1b6dfbd89f75c42c392d157ee70883fe738b48d300c11833bf8bdb202abf785635da62a82a45886ed
6
+ metadata.gz: d3289f7ecbd543648780808f02e2cddd4bd5bdf87ee98e8d762a9b6fc7bd9d952975db608f975d003271673f52e99d2141632fa11ba9de6f1e23ba5be7cd84d5
7
+ data.tar.gz: 058abcd791ff17fc0759285ca68c981490cba18e223cec9899caf64400e5bba75f6af86899c2e1c62a7e6e85b6fd123c261c790f53ff58b4c7990c4aaa1e15b8
@@ -1,2 +1,5 @@
1
+ # v0.1.2
2
+ * Fix property namespaces, function/handler, and include role (#2)
3
+
1
4
  # v0.1.0
2
5
  * Initial release
data/README.md CHANGED
@@ -37,6 +37,7 @@ Now enable the `sfn-lambda` callback in the `.sfn` configuration file:
37
37
  Configuration.new do
38
38
  ...
39
39
  callbacks do
40
+ require ['sfn-lambda']
40
41
  default ['lambda']
41
42
  end
42
43
  ...
@@ -112,7 +113,7 @@ Using the python example described within the lambda documentation:
112
113
 
113
114
  we can define our handler code:
114
115
 
115
- * `./lambda/python2.7/my_handler.py`
116
+ * `./lambda/python2.7/my_function.py`
116
117
 
117
118
  ```python
118
119
  def my_handler(event, context):
@@ -129,7 +130,15 @@ the newly created file:
129
130
 
130
131
  ```ruby
131
132
  SparkleFormation.new(:lambda_test) do
132
- lambda!(:my_handler)
133
+ lambda!(:my_function, :handler => :my_handler)
134
+ end
135
+ ```
136
+
137
+ If the handler argument is not specified the default value is 'handler'.
138
+
139
+ ```ruby
140
+ SparkleFormation.new(:lambda_test) do
141
+ lambda!(:my_function)
133
142
  end
134
143
  ```
135
144
 
@@ -142,8 +151,9 @@ $ sfn print --file lambda_test
142
151
  "MyHandlerLambdaFunction": {
143
152
  "Type": "AWS::Lambda::Function",
144
153
  "Properties": {
145
- "Handler": "python2.7",
146
- "FunctionName": "my_handler",
154
+ "Handler": "index.my_handler",
155
+ "Runtime": "python2.7"
156
+ "FunctionName": "my_function",
147
157
  "ZipFile": "def my_handler(event, context):\n message = 'Hello {} {}!'.format(event['first_name'], event['last_name'])\n return {\n 'message' : message\n }\n\n"
148
158
  }
149
159
  }
@@ -156,7 +166,7 @@ can be specified within the call:
156
166
 
157
167
  ```ruby
158
168
  SparkleFormation.new(:lambda_test) do
159
- lambda!(:my_handler, :runtime => 'python2.7')
169
+ lambda!(:my_function, :handler => :my_handler, :runtime => 'python2.7')
160
170
  end
161
171
  ```
162
172
 
@@ -165,8 +175,8 @@ custom name can be added as well:
165
175
 
166
176
  ```ruby
167
177
  SparkleFormation.new(:lambda_test) do
168
- lambda!(:my_handler, :first, :runtime => 'python2.7')
169
- lambda!(:my_handler, :second, :runtime => 'python2.7')
178
+ lambda!(:my_function, :first, :handler => :my_handler, :runtime => 'python2.7')
179
+ lambda!(:my_function, :second, :handler => :my_handler, :runtime => 'python2.7')
170
180
  end
171
181
  ```
172
182
 
@@ -10,8 +10,12 @@ class SparkleFormation
10
10
  end
11
11
  __t_stringish(fn_name)
12
12
  __t_stringish(fn_uniq_name) unless fn_uniq_name.is_a?(::NilClass)
13
+ fn_handler = 'handler'
13
14
  if(fn_opts)
14
15
  fn_runtime = fn_opts[:runtime] if fn_opts[:runtime]
16
+ fn_handler = fn_opts[:handler] if fn_opts[:handler]
17
+ fn_role = fn_opts[:role] if fn_opts[:role]
18
+ fn_function_name = fn_opts[:function_name] if fn_opts[:function_name]
15
19
  end
16
20
  unless(fn_runtime.is_a?(::NilClass))
17
21
  __t_stringish(fn_runtime)
@@ -21,16 +25,19 @@ class SparkleFormation
21
25
  [fn_name, fn_uniq_name].compact.map(&:to_s).join('_'),
22
26
  :resource_name_suffix => :lambda_function
23
27
  )
24
- new_fn.properties.handler lookup[:runtime]
25
- new_fn.properties.function_name fn_name
28
+ new_fn.properties.handler fn_handler
29
+ new_fn.properties.runtime lookup[:runtime]
30
+ new_fn.properties.function_name fn_function_name || fn_name
26
31
  content = ::SfnLambda.control.format_content(lookup)
27
32
  if(content[:raw])
28
- new_fn.properties.zip_file content[:raw]
33
+ new_fn.properties.code.zip_file content[:raw]
34
+ new_fn.properties.handler "index.#{fn_handler}"
35
+ new_fn.properties.role fn_role
29
36
  else
30
- new_fn.properties.s3_bucket content[:bucket]
31
- new_fn.properties.s3_key content[:key]
37
+ new_fn.properties.code.s3_bucket content[:bucket]
38
+ new_fn.properties.code.s3_key content[:key]
32
39
  if(content[:version])
33
- new_fn.properties.s3_object_version content[:version]
40
+ new_fn.properties.code.s3_object_version content[:version]
34
41
  end
35
42
  end
36
43
  new_fn
@@ -1,3 +1,3 @@
1
1
  module SfnLambda
2
- VERSION = Gem::Version.new('0.1.0')
2
+ VERSION = Gem::Version.new('0.1.2')
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfn-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sparkle_formation