lambda_deployment 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c555d8f5bc6229e393db36abbec28ddc63bbd069e0b2ae9e8bfe6834defe839
4
- data.tar.gz: 4be42a0390772d6a818d8d29fae28a14039a460e4ea82d89c11a925837f43151
3
+ metadata.gz: fb181784ea6c2e689d3764c7d279bb5ac5f15dffbd8757fb6116c1ab93c33c6f
4
+ data.tar.gz: 9896bc6785d225576cbbef4d2603ef3434f8834f31536deb239e7cc8e7f96ffa
5
5
  SHA512:
6
- metadata.gz: 6038133e04087a5a6c7fbdcc1ef10a69d5088aabcef030e6c813677043052ffbbd4b22f5c08c4c268443124f20cec7bd83f5aa31fe18484701dfbf09a07ab58c
7
- data.tar.gz: 498bcf25c424c3330c6bb76f45ceab85a9b1578bea23bc8765771aa0321b9d99653569e089da43d682b501f6f72c7687134ead37ebfbe0d2321a2a51e4e11f3e
6
+ metadata.gz: 76a5bbd81f7d0e4a6bce2106290b7b9acf9d5653909b018df3d40d54b8d3e4a0015eb9b8aea42ec5df8f5f6d2a376449a4e4060763b768986155c8505c486340
7
+ data.tar.gz: 7943a6afef63f6e5873f0f8b4fa6086ab5952fd02fed7d539a1a46a5331fbbf750a5f3cac062d2b7018030de458a7ac6d487a922e9da45f7fe705e1f0312fe7a
data/README.md CHANGED
@@ -66,6 +66,7 @@ project: my-dev-lambda-name # required: name of lambda function
66
66
  region: us-east-1 # optional: specify AWS region (will override $AWS_REGION)
67
67
  s3_bucket: my-test-bucket # optional: specify s3 bucket (will override $LAMBDA_S3_BUCKET)
68
68
  s3_sse: AES256 # optional: set server side encryption on s3 objects (will override $LAMBDA_S3_SSE)
69
+ concurrency: # optional: set reserved concurrency limit (-1 to delete)
69
70
  environment:
70
71
  FOO: bar # optional: set some env vars for your Lambda
71
72
  ```
@@ -2,7 +2,7 @@ require 'dotenv'
2
2
 
3
3
  module LambdaDeployment
4
4
  class Configuration
5
- attr_reader :kms_key_arn, :file_path, :project, :region, :s3_bucket, :s3_key, :s3_sse
5
+ attr_reader :concurrency, :kms_key_arn, :file_path, :project, :region, :s3_bucket, :s3_key, :s3_sse
6
6
 
7
7
  def load_config(config_file)
8
8
  config = YAML.load_file(config_file)
@@ -17,6 +17,8 @@ module LambdaDeployment
17
17
 
18
18
  @config_env = config.fetch('environment', {})
19
19
  @kms_key_arn = config.fetch('kms_key_arn', ENV.fetch('LAMBDA_KMS_KEY_ARN', nil))
20
+
21
+ @concurrency = config.fetch('concurrency', nil)
20
22
  end
21
23
 
22
24
  # lambda aliases must satisfy (?!^[0-9]+$)([a-zA-Z0-9-_]+)
@@ -10,6 +10,7 @@ module LambdaDeployment
10
10
  upload_to_s3
11
11
  update_function_code
12
12
  update_environment
13
+ update_concurrency
13
14
  return unless @config.alias_name
14
15
  version = publish_version
15
16
  begin
@@ -38,6 +39,19 @@ module LambdaDeployment
38
39
  )
39
40
  end
40
41
 
42
+ def update_concurrency
43
+ return unless @config.concurrency
44
+ # Allow a value of -1 to remove concurrency limit
45
+ if @config.concurrency == -1
46
+ @client.delete_function_concurrency(function_name: @config.project)
47
+ else
48
+ @client.put_function_concurrency(
49
+ function_name: @config.project,
50
+ reserved_concurrent_executions: @config.concurrency
51
+ )
52
+ end
53
+ end
54
+
41
55
  def update_environment
42
56
  environment = {}
43
57
  @config.environment.map { |k, v| environment[k] = encrypt(v) }
@@ -1,3 +1,3 @@
1
1
  module LambdaDeployment
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_deployment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zendesk CloudOps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-20 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms