crossing 0.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/bin/crossing +51 -0
  3. data/lib/crossing.rb +17 -0
  4. metadata +67 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmZkYWM0MWU2YzRlNzE4NzgyMjk4ZTFlMjFlOTYyYzUyZWE1NzBiOQ==
5
+ data.tar.gz: !binary |-
6
+ MGQ2YzlmNTVhMGVjM2Q3MTIyOGQ0MjQwZjk3ODdhMjVmZDg3YjRjNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTMxZDFjY2E2NGM3OTkzNTAyOTI2ZDk4MWE0NDRjNjgxNjY1ZDgxYzU5YTc3
10
+ ZDkzNDA3OTdkYWZjMGNlNzcxM2JkN2JlN2ZlMDNlMTA0MWYyYWU4NTA3MGRj
11
+ ZWM4MTFiZjIwMjNlNzc4NTZmZDQwZTU2ZTY2OGU0NmU2NjA5NjM=
12
+ data.tar.gz: !binary |-
13
+ MDUwMWM0OTQxMmRiODRmMGZjMWJkNWQ2NWVhYzBlNDEwMzBiNDQ5MTVlYWQ0
14
+ MDE5OTAwYjJkMTE2ZDM0Mjk1MTI1NGY1NmY4MDQ4YjYwNzRlZWUwYmRkNWI0
15
+ OWZlZDJlYThlOTZjY2FiNTk1YmI3MGM0NmVmMjM5ZDY2NDYwZGI=
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ require 'crossing'
4
+
5
+ options = { bucket: nil, file: nil, key: nil }
6
+ arguments = OptionParser.new do |opts|
7
+ opts.banner = 'Usage: crossing [options]'
8
+
9
+ opts.separator ''
10
+
11
+ # Read in arguments
12
+ opts.on('-b', '--bucket bucket', 'Bucket') do |bucket|
13
+ options[:bucket] = bucket
14
+ end
15
+
16
+ opts.on('-f', '--file file', 'File') do |file|
17
+ options[:file] = file
18
+ end
19
+
20
+ opts.on('-k', '--key key', 'Key') do |key|
21
+ options[:key] = key
22
+ end
23
+
24
+ opts.on('-a', '--action action', 'Action') do |action|
25
+ options[:action] = action
26
+ end
27
+
28
+ opts.on('-h', '--help', 'Displays Help') do
29
+ puts opts
30
+ exit
31
+ end
32
+ end
33
+
34
+ arguments.parse!
35
+
36
+ # options.each do |key|
37
+ # if options[key].nil?
38
+ # raise "#{key} is required...aborting"
39
+ # end
40
+ # end
41
+ kms = Aws::KMS::Client.new
42
+ s3 = Aws::S3::Encryption::Client.new(
43
+ kms_key_id: options[:key],
44
+ kms_client: kms
45
+ )
46
+ encrypt = Crossing.new(s3)
47
+ if options[:action] == 'put'
48
+ encrypt.put(options[:bucket], options[:file], 'This is a test')
49
+ else
50
+ puts "I don't know how to handle that action."
51
+ end
@@ -0,0 +1,17 @@
1
+ require 'aws-sdk'
2
+
3
+ # Documentation incoming
4
+ class Crossing
5
+ def initialize(s3_client)
6
+ raise 'You did not pass in an S3 client...aborting' if s3_client.nil?
7
+ @s3_client = s3_client
8
+ end
9
+
10
+ def put(bucket, filename)
11
+ file = File.new(filename, 'r')
12
+ @s3_client.put_object(bucket: bucket, key: filename, body: file.read)
13
+ end
14
+
15
+ def get(bucket, file)
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crossing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Ulick
8
+ - Stelligent
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-02-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aws-sdk
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '2'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '2'
28
+ description: The native AWS command line does not have an easy way to upload encrypted
29
+ files to S3. The Ruby SDK has a way to do this, but not everyone wants to use it.
30
+ This utility allows you to do client side encrypted uploads to S3 from the command
31
+ line, which is useful for uploads from your CI system to docker containers.
32
+ email: john.ulick@stelligent.com
33
+ executables:
34
+ - crossing
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - bin/crossing
39
+ - lib/crossing.rb
40
+ homepage: http://www.stelligent.com
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ - lib
49
+ - bin
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '1.9'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.4.8
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Utility for storing objects in S3 while taking advantage of client side envelope
66
+ encryption with KMS.
67
+ test_files: []