ruby-manta 2.0.0 → 2.0.1

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
  SHA1:
3
- metadata.gz: e741a0fbcb8ccef97c5efdac3290bd22c9bbcd74
4
- data.tar.gz: 01bc9d49ec9fd487314fe5ef3f624b2f4f156f8c
3
+ metadata.gz: 4b636e55491d14ec82b6c9d2bb7db81b3a27e8e2
4
+ data.tar.gz: 13359dea81e874109311d507442f20999d6e6311
5
5
  SHA512:
6
- metadata.gz: d2a09a41b30212d25f174e5aa3c0672bcc66ae84870305e6fb7abf64195315314db2fdbdc12c4dfc3c5f07f547a223f1e3eb50e6778bb3ab6b70641d29451d60
7
- data.tar.gz: 3e95d53baa10a0f77694e1490322421336714480c260447b867b78db9d85219ee92ab94c355f4891d98702476a5930717c566b9181cf23d2f95b6ecf2de5f0ba
6
+ metadata.gz: 932ad21b320335849abdade93cc2d51fdc18a3ae3672d4ce42886c61a11a8c9b246ead95fecff4cef713f18ccfd014bfb7e30e0a8ade652ba68caf1bebcbd1ba
7
+ data.tar.gz: c66a383843d985524cacfa07a9660674de8dfd36cba20f0df13ef44b97b1bc0b7fb2ca069b6ab94a9c5d1ec41e32baa76310aeec38ec071cdecd4643126dfc91
data/README.md CHANGED
@@ -76,7 +76,9 @@ hurried friend, is an example demonstrating some of ruby-manta's usage:
76
76
  # only ever need a single instance of this in a program.
77
77
  priv_key_data = File.read(priv_key)
78
78
  client = RubyManta::MantaClient.new(host, user, priv_key_data,
79
- :disable_ssl_verification => true)
79
+ :disable_ssl_verification => true,
80
+ # :subuser => 'monte'
81
+ )
80
82
 
81
83
  # Create an directory in Manta solely for this example run.
82
84
  dir_path = '/' + user + '/stor/ruby-manta-example'
@@ -165,6 +167,15 @@ supports it either.
165
167
 
166
168
 
167
169
 
170
+ Changes in 2.0.0
171
+ ----------------
172
+ * MantaClient was moved into the namespace RubyManta::MantaClient. Compatibility
173
+ with the namespaceless 1.0.0 MantaClient was maintained, but it may not be
174
+ there in the future, so please update your application code.
175
+ * Subuser support was added to the client.
176
+
177
+
178
+
168
179
  Public and Private spaces
169
180
  -------------------------
170
181
 
@@ -204,10 +215,37 @@ at the resulting objects.
204
215
 
205
216
 
206
217
 
218
+ Subusers
219
+ ---------
220
+ The Joyent public cloud and Smart Data Center now support subusers - that is
221
+ users with their own unique ACLs who are managed by the primary account holder.
222
+ It may be useful to have a Manta-specific subuser so that your applications do
223
+ not have the primary account's credentials stored on their servers. This helps
224
+ mitigate the risk if a system is compromised. You can find the ACLs needed to
225
+ add a Manta only user on the
226
+ [Joyent RBAC Rules Support Page](https://docs.joyent.com/jpc/rbac/rules#mantaactions).
227
+
228
+ If you want to enable for Manta access for a single user, you will need to grant
229
+ them:
230
+
231
+ * putdirectory
232
+ * getdirectory
233
+ * deletedirectory
234
+ * putobject
235
+ * getobject
236
+ * deleteobject
237
+ * putlink
238
+ * createjob
239
+ * listjobs
240
+ * getjob
241
+ * managejob
242
+
243
+
244
+
207
245
  The API
208
246
  =======
209
247
 
210
- A note on sematics
248
+ A note on semantics
211
249
  ------------------
212
250
 
213
251
  All methods throw exceptions upon failure. If a method doesn't throw, the
data/example.rb CHANGED
@@ -18,7 +18,9 @@ raise 'You must specify LOCAL_DIR' unless upload_dir
18
18
  # only ever need a single instance of this in a program.
19
19
  priv_key_data = File.read(priv_key)
20
20
  client = RubyManta::MantaClient.new(host, user, priv_key_data,
21
- :disable_ssl_verification => true)
21
+ :disable_ssl_verification => true,
22
+ # :subuser => 'monte',
23
+ )
22
24
 
23
25
  # Create an directory in Manta solely for this example run.
24
26
  dir_path = '/' + user + '/stor/ruby-manta-example'
@@ -334,9 +334,9 @@ module RubyManta
334
334
  listing = response.first
335
335
 
336
336
  listing.inject([]) do |memo, obj|
337
- if obj['type'] == 'dir_path'
337
+ if obj['type'] == 'directory'
338
338
  sub_dir = "#{dir_path}/#{obj['name']}"
339
- sub_search = find(sub_dir, regex)
339
+ sub_search = find(sub_dir, regex: regex)
340
340
  memo.push(*sub_search)
341
341
  end
342
342
 
@@ -1,3 +1,3 @@
1
1
  module RubyManta
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
@@ -12,7 +12,7 @@ class TestMantaClient < Minitest::Test
12
12
  @@user = ENV['MANTA_USER']
13
13
 
14
14
  unless host && key && @@user
15
- $stderr.puts 'Require HOST, USER and KEY env variables to run tests.'
15
+ $stderr.puts 'Require MANTA_URL, MANTA_USER and MANTA_KEY env variables to run tests.'
16
16
  $stderr.puts 'E.g. MANTA_USER=john MANTA_KEY=~/.ssh/john MANTA_URL=https://us-east.manta.joyent.com bundle exec rake test'
17
17
  exit
18
18
  end
@@ -757,4 +757,45 @@ class TestMantaClient < Minitest::Test
757
757
  assert headers.is_a? Hash
758
758
  end
759
759
  end
760
+
761
+ def test_find_subdirectory_regex
762
+ copies = 15
763
+
764
+ @@client.put_directory("#{@@test_dir_path}/a")
765
+ @@client.put_directory("#{@@test_dir_path}/b")
766
+
767
+ begin
768
+ copies.times do |i|
769
+ dir_name = i % 2 == 0 ? 'a' : 'b'
770
+ @@client.put_object("#{@@test_dir_path}/#{dir_name}/find_object_#{i}", 'test_find_regex')
771
+ end
772
+
773
+ @@client.put_object(@@test_dir_path + '/dog_biscuit', 'dont match me')
774
+
775
+ results = @@client.find(@@test_dir_path, regex: '^find_object_.*')
776
+
777
+ assert_equal copies, results.length
778
+
779
+ copies.times do |i|
780
+ dir_name = i % 2 == 0 ? 'a' : 'b'
781
+ assert results.include? "#{@@test_dir_path}/#{dir_name}/find_object_#{i}"
782
+ end
783
+
784
+ refute results.include? @@test_dir_path + '/dog_biscuit'
785
+ ensure
786
+ copies.times do |i|
787
+ dir_name = i % 2 == 0 ? 'a' : 'b'
788
+ result, headers = @@client.delete_object("#{@@test_dir_path}/#{dir_name}/find_object_#{i}")
789
+ assert_equal result, true
790
+ assert headers.is_a? Hash
791
+ end
792
+
793
+ result, headers = @@client.delete_object(@@test_dir_path + "/dog_biscuit")
794
+ assert_equal result, true
795
+ assert headers.is_a? Hash
796
+
797
+ @@client.delete_directory("#{@@test_dir_path}/a")
798
+ @@client.delete_directory("#{@@test_dir_path}/b")
799
+ end
800
+ end
760
801
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-manta
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joyent