lambda_wrap 0.13.0 → 0.14.0

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: 41235b2c4309067bbb4c5cf4411eea32a1197f94
4
- data.tar.gz: 82f1b8d8e6576a0a8e41c8cc1993511ab51a0dd9
3
+ metadata.gz: a768d452eb54ba635015184a2aca9df160b8e3e7
4
+ data.tar.gz: bf2f039cdedc097c13dc99088081ccdafcf186d8
5
5
  SHA512:
6
- metadata.gz: 57873463302ea598243046674434faffb2f2d95af09e3b063c6f2aa8c37ed601d037bb9cf5e9dbce4ca4b8a6efc490b752d070fe752d9257aee0233051d0dc62
7
- data.tar.gz: 266f1475b719ee54b5b47ba240861b5189f9bea02bb5d4257fc78df81b3f26ea7659754a03233ebd07d0773d2b217a58c7f3ad34e4870b998e113d08f158a230
6
+ metadata.gz: f7ada31848484a06eac240266a0f43e27f218556ff25648f3b00c1c160d92f60cde8725c2f7dd95dc033b74efe90552f161cdb5f15b63007e941ccf852959e7d
7
+ data.tar.gz: ee600ffb27b596f93b799ce68d1ccc53d2b4068cb2d94c20c0b7460d2ef911ae97ec653da81bbd54c54b514a20c15a1d3c1c9e0d3b142667ba243f4892a50adc
@@ -0,0 +1,35 @@
1
+ require 'aws-sdk'
2
+
3
+ module LambdaWrap
4
+ ##
5
+ # The S3BucketManager simplifies would have functions to help add policies etcc to S3 bucket.
6
+ class S3BucketManager
7
+ #
8
+ # The constructor creates an instance of s3 bucket
9
+ # * Validating basic AWS configuration
10
+ # * Creating the underlying client to interact with the AWS SDK.
11
+ # * Defining the temporary path of the api-gateway-importer jar file
12
+ def initialize
13
+ @s3bucket = Aws::S3::Client.new()
14
+ end
15
+
16
+ ##
17
+ # Adds policy to the bucket
18
+ #
19
+ # *Arguments*
20
+ # [s3_bucket_name] S3 bucket name.
21
+ # [policy] Policy to be added to the bucket
22
+ def setup_policy(s3_bucket_name, policy)
23
+ # Validate the parameters
24
+ raise "S3 bucket is not provided" unless s3_bucket_name
25
+ raise "Policy json is not provided" unless policy
26
+
27
+ @s3bucket.put_bucket_policy({
28
+ bucket: s3_bucket_name,
29
+ policy: policy.to_json
30
+ })
31
+ puts "Created/Updated policy: #{policy} in S3 bucket #{s3_bucket_name}"
32
+ end
33
+
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_wrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Thurner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-13 00:00:00.000000000 Z
13
+ date: 2016-07-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk
@@ -51,6 +51,7 @@ files:
51
51
  - lib/lambda_wrap/api_gateway_manager.rb
52
52
  - lib/lambda_wrap/dynamo_db_manager.rb
53
53
  - lib/lambda_wrap/lambda_manager.rb
54
+ - lib/lambda_wrap/s3_bucket_manager.rb
54
55
  - lib/lambda_wrap/zip_file_generator.rb
55
56
  homepage: https://github.com/Cimpress-MCP/LambdaWrap
56
57
  licenses: