nifty-cloud-sdk 1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/CHANGELOG +112 -0
  2. data/Gemfile +4 -0
  3. data/INSTALL +30 -0
  4. data/LICENSE.txt +58 -0
  5. data/README.rdoc +375 -0
  6. data/Rakefile +61 -0
  7. data/lib/NIFTY.rb +405 -0
  8. data/lib/NIFTY/Cloud.rb +24 -0
  9. data/lib/NIFTY/Cloud/availability_zones.rb +23 -0
  10. data/lib/NIFTY/Cloud/certificates.rb +283 -0
  11. data/lib/NIFTY/Cloud/images.rb +134 -0
  12. data/lib/NIFTY/Cloud/instances.rb +372 -0
  13. data/lib/NIFTY/Cloud/keypairs.rb +76 -0
  14. data/lib/NIFTY/Cloud/load_balancers.rb +433 -0
  15. data/lib/NIFTY/Cloud/security_groups.rb +357 -0
  16. data/lib/NIFTY/Cloud/volumes.rb +140 -0
  17. data/lib/NIFTY/config.rb +41 -0
  18. data/lib/NIFTY/exceptions.rb +32 -0
  19. data/lib/NIFTY/responses.rb +19 -0
  20. data/lib/NIFTY/version.rb +3 -0
  21. data/nifty-cloud-sdk.gemspec +28 -0
  22. data/sample/availability_zones/describe-availability-zones.rb +37 -0
  23. data/sample/certificate/create-ssl-certificate.rb +41 -0
  24. data/sample/certificate/delete-ssl-certificate.rb +28 -0
  25. data/sample/certificate/describe-ssl-certificate-attribute.rb +58 -0
  26. data/sample/certificate/describe-ssl-certificates.rb +49 -0
  27. data/sample/certificate/download-ssl-certificate.rb +31 -0
  28. data/sample/certificate/modify-ssl-certificate-attribute.rb +29 -0
  29. data/sample/certificate/register-corporate-info-for-certificate.rb +57 -0
  30. data/sample/certificate/upload-ssl-certificate.rb +32 -0
  31. data/sample/images/create-image.rb +33 -0
  32. data/sample/images/delete-image.rb +26 -0
  33. data/sample/images/describe-images.rb +70 -0
  34. data/sample/images/modify-image-attribute.rb +33 -0
  35. data/sample/instances/cancel_copy_instances.rb +26 -0
  36. data/sample/instances/copy-instances.rb +41 -0
  37. data/sample/instances/describe-instance-attribute.rb +78 -0
  38. data/sample/instances/describe-instances.rb +100 -0
  39. data/sample/instances/modify-instance-attribute.rb +30 -0
  40. data/sample/instances/reboot-instances.rb +29 -0
  41. data/sample/instances/run-instances.rb +104 -0
  42. data/sample/instances/start-instances.rb +36 -0
  43. data/sample/instances/stop-instances.rb +35 -0
  44. data/sample/instances/terminate-instances.rb +34 -0
  45. data/sample/keypairs/create-key-pair.rb +31 -0
  46. data/sample/keypairs/delete-key-pair.rb +28 -0
  47. data/sample/keypairs/describe-key-pairs.rb +31 -0
  48. data/sample/load_balancers/configure-health-check.rb +41 -0
  49. data/sample/load_balancers/create-load-balancer.rb +35 -0
  50. data/sample/load_balancers/delete-load-balancer.rb +28 -0
  51. data/sample/load_balancers/deregister-instances-from-load-balancer.rb +35 -0
  52. data/sample/load_balancers/describe-instance-health.rb +36 -0
  53. data/sample/load_balancers/describe-load-balancers.rb +89 -0
  54. data/sample/load_balancers/register-instances-with-load-balancer.rb +33 -0
  55. data/sample/load_balancers/register-port-with-load-balancer.rb +37 -0
  56. data/sample/load_balancers/set-filter-for-load-balancer.rb +38 -0
  57. data/sample/load_balancers/update-load-balancer.rb +33 -0
  58. data/sample/security_groups/authorize-security-group-ingress.rb +36 -0
  59. data/sample/security_groups/create-security-group.rb +29 -0
  60. data/sample/security_groups/delete-security-group.rb +28 -0
  61. data/sample/security_groups/deregister-instances-from-security-group.rb +31 -0
  62. data/sample/security_groups/describe-security-activities.rb +33 -0
  63. data/sample/security_groups/describe-security-groups.rb +59 -0
  64. data/sample/security_groups/register-instances-with-security-group.rb +31 -0
  65. data/sample/security_groups/revoke-security-group-ingress.rb +36 -0
  66. data/sample/security_groups/update-security-group.rb +30 -0
  67. data/sample/volumes/attach-volumes.rb +34 -0
  68. data/sample/volumes/create-volume.rb +38 -0
  69. data/sample/volumes/delete-volume.rb +28 -0
  70. data/sample/volumes/describe-volumes.rb +44 -0
  71. data/sample/volumes/detach-volume.rb +35 -0
  72. data/test/test_Cloud.rb +186 -0
  73. data/test/test_Cloud_availability_zones.rb +50 -0
  74. data/test/test_Cloud_certificates.rb +627 -0
  75. data/test/test_Cloud_images.rb +284 -0
  76. data/test/test_Cloud_instances.rb +941 -0
  77. data/test/test_Cloud_keypairs.rb +177 -0
  78. data/test/test_Cloud_load_balancers.rb +1183 -0
  79. data/test/test_Cloud_responses.rb +43 -0
  80. data/test/test_Cloud_security_groups.rb +699 -0
  81. data/test/test_Cloud_volumes.rb +325 -0
  82. data/test/test_helper.rb +23 -0
  83. metadata +275 -0
@@ -0,0 +1,325 @@
1
+ #--
2
+ # ニフティクラウドSDK for Ruby
3
+ #
4
+ # Ruby Gem Name:: nifty-cloud-sdk
5
+ # Author:: NIFTY Corporation
6
+ # Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://cloud.nifty.com/api/
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "volumes" do
14
+
15
+ before do
16
+ @api = NIFTY::Cloud::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret",
17
+ :server => 'cp.cloud.nifty.com', :path => '/api/1.7/', :user_agent => 'NIFTY Cloud API Ruby SDK',
18
+ :signature_version => '2', :signature_method => 'HmacSHA256')
19
+ @valid_create_size = [
20
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20',
21
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20
22
+ ]
23
+ @valid_create_type = [
24
+ '1', '2', '3', '4', '5', '6',
25
+ 1, 2, 3, 4, 5, 6
26
+ ]
27
+ @basic_create_volume_options = {:size => 1, :instance_id => 'server01'}
28
+
29
+ @describe_volumes_response_body = <<-RESPONSE
30
+ <DescribeVolumesResponse xmlns="http://xxxx.nifty.com/xxx/xxx/">
31
+ <volumeSet>
32
+ <item>
33
+ <volumeId>vol-4282672b</volumeId>
34
+ <size>800</size>
35
+ <diskType>Disk40</diskType>
36
+ <snapshotId/>
37
+ <availabilityZone>ap-japan-1a</availabilityZone>
38
+ <status>in-use</status>
39
+ <createTime>2008-05-07T11:51:50.000Z</createTime>
40
+ <attachmentSet>
41
+ <item>
42
+ <volumeId>vol-4282672b</volumeId>
43
+ <instanceId>i-6058a509</instanceId>
44
+ <device>/dev/sdh</device>
45
+ <status>attached</status>
46
+ <attachTime>2008-05-07T12:51:50.000Z</attachTime>
47
+ </item>
48
+ </attachmentSet>
49
+ </item>
50
+ </volumeSet>
51
+ </DescribeVolumesResponse>
52
+ RESPONSE
53
+
54
+ @create_volume_response_body = <<-RESPONSE
55
+ <CreateVolumeResponse xmlns="http://xxxx.nifty.com/xxx/xxx/">
56
+ <volumeId>disk05</volumeId>
57
+ <size>800</size>
58
+ <snapshotId/>
59
+ <availabilityZone>ap-japan-1a</availabilityZone>
60
+ <status>creating</status>
61
+ <createTime>2008-05-07T11:51:50.000Z</createTime>
62
+ </CreateVolumeResponse>
63
+ RESPONSE
64
+
65
+ @delete_volume_response_body = <<-RESPONSE
66
+ <DeleteVolumeResponse xmlns="http://xxxx.nifty.com/xxx/xxx/">
67
+ <return>true</return>
68
+ </DeleteVolumeResponse>
69
+ RESPONSE
70
+
71
+ @attach_volume_response_body = <<-RESPONSE
72
+ <AttachVolumeResponse xmlns="http://xxxx.nifty.com/xxx/xxx/">
73
+ <volumeId>vol-4d826724</volumeId>
74
+ <instanceId>i-6058a509</instanceId>
75
+ <device>SCSI(0:1)</device>
76
+ <status>attaching</status>
77
+ <attachTime>2008-05-07T11:51:50.000Z</attachTime>
78
+ </AttachVolumeResponse>
79
+ RESPONSE
80
+
81
+ @detach_volume_response_body = <<-RESPONSE
82
+ <DetachVolumeResponse xmlns="http://xxxx.nifty.com/xxx/xxx/">
83
+ <volumeId>vol-4d826724</volumeId>
84
+ <instanceId>i-6058a509</instanceId>
85
+ <device>/dev/sdh</device>
86
+ <status>detaching</status>
87
+ <attachTime>2008-05-08T11:51:50.000Z</attachTime>
88
+ </DetachVolumeResponse>
89
+ RESPONSE
90
+ end
91
+
92
+ # describe_volumes
93
+ specify "describe_volumes - レスポンスを正しく解析できるか" do
94
+ @api.stubs(:exec_request).returns stub(:body => @describe_volumes_response_body, :is_a? => true)
95
+ response = @api.describe_volumes
96
+ response.volumeSet.item[0].volumeId.should.equal 'vol-4282672b'
97
+ response.volumeSet.item[0]['size'].should.equal '800'
98
+ response.volumeSet.item[0].diskType.should.equal 'Disk40'
99
+ response.volumeSet.item[0].snapshotId.should.equal nil
100
+ response.volumeSet.item[0].availabilityZone.should.equal 'ap-japan-1a'
101
+ response.volumeSet.item[0].status.should.equal 'in-use'
102
+ response.volumeSet.item[0].createTime.should.equal '2008-05-07T11:51:50.000Z'
103
+ response.volumeSet.item[0].attachmentSet.item[0].volumeId.should.equal 'vol-4282672b'
104
+ response.volumeSet.item[0].attachmentSet.item[0].instanceId.should.equal 'i-6058a509'
105
+ response.volumeSet.item[0].attachmentSet.item[0].device.should.equal '/dev/sdh'
106
+ response.volumeSet.item[0].attachmentSet.item[0].status.should.equal 'attached'
107
+ response.volumeSet.item[0].attachmentSet.item[0].attachTime.should.equal '2008-05-07T12:51:50.000Z'
108
+ end
109
+
110
+ specify "describe_volumes - パラメータが正しく作られるか" do
111
+ @api.stubs(:make_request).with("Action" => "DescribeVolumes",
112
+ "VolumeId.1" => "vol1",
113
+ "VolumeId.2" => "vol2"
114
+ ).returns stub(:body => @describe_volumes_response_body, :is_a? => true)
115
+ @api.stubs(:exec_request).returns stub(:body => @describe_volumes_response_body, :is_a? => true)
116
+ response = @api.describe_volumes( :volume_id => %w(vol1 vol2) )
117
+ end
118
+
119
+ specify "describe_volumes - :volume_id正常" do
120
+ @api.stubs(:exec_request).returns stub(:body => @describe_volumes_response_body, :is_a? => true)
121
+ lambda { @api.describe_volumes(:volume_id => 'vol1') }.should.not.raise(NIFTY::ArgumentError)
122
+ lambda { @api.describe_volumes(:volume_id => %w(vol1 vol2)) }.should.not.raise(NIFTY::ArgumentError)
123
+ end
124
+
125
+
126
+ # create_volume
127
+ specify "create_volume - レスポンスを正しく解析できるか" do
128
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
129
+ response = @api.create_volume(@basic_create_volume_options)
130
+ response.volumeId.should.equal 'disk05'
131
+ response['size'].should.equal '800'
132
+ response.snapshotId.should.equal nil
133
+ response.availabilityZone.should.equal 'ap-japan-1a'
134
+ response.status.should.equal 'creating'
135
+ response.createTime.should.equal '2008-05-07T11:51:50.000Z'
136
+ end
137
+
138
+ specify "create_volume - パラメータが正しく作られるか" do
139
+ @api.stubs(:make_request).with("Action" => "CreateVolume",
140
+ "Size" => "1",
141
+ "SnapshotId" => "a",
142
+ "AvailabilityZone" => "a",
143
+ "VolumeId" => "a",
144
+ "DiskType" => "1",
145
+ "InstanceId" => "a"
146
+ ).returns stub(:body => @create_volume_response_body, :is_a? => true)
147
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
148
+ response = @api.create_volume(:instance_id => "a", :size => 1, :snapshot_id => "a", :availability_zone => "a", :volume_id => "a", :disk_type => 1 )
149
+ end
150
+
151
+ specify "create_volume - :size, instance_id正常" do
152
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
153
+ @valid_create_size.each do |size|
154
+ lambda { @api.create_volume(:size => size, :instance_id => 'foo') }.should.not.raise(NIFTY::ArgumentError)
155
+ end
156
+ end
157
+
158
+ specify "create_volume - :snapshot_id正常" do
159
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
160
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:snapshot_id => 'snapshot')) }.should.not.raise(NIFTY::ArgumentError)
161
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:snapshot_id => 5)) }.should.not.raise(NIFTY::ArgumentError)
162
+ end
163
+
164
+ specify "create_volume - :availability_zone正常" do
165
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
166
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:availability_zone => 'zone')) }.should.not.raise(NIFTY::ArgumentError)
167
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:availability_zone => 5)) }.should.not.raise(NIFTY::ArgumentError)
168
+ end
169
+
170
+ specify "create_volume - :volume_id正常" do
171
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
172
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:volume_id => 'volume')) }.should.not.raise(NIFTY::ArgumentError)
173
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:volume_id => 5)) }.should.not.raise(NIFTY::ArgumentError)
174
+ end
175
+
176
+ specify "create_volume - :disk_type正常" do
177
+ @api.stubs(:exec_request).returns stub(:body => @create_volume_response_body, :is_a? => true)
178
+ @valid_create_type.each do |type|
179
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:disk_type => type)) }.should.not.raise(NIFTY::ArgumentError)
180
+ end
181
+ end
182
+
183
+ specify "create_volume - :size未指定" do
184
+ lambda { @api.create_volume }.should.raise(NIFTY::ArgumentError)
185
+ lambda { @api.create_volume(:size => nil) }.should.raise(NIFTY::ArgumentError)
186
+ lambda { @api.create_volume(:size => '') }.should.raise(NIFTY::ArgumentError)
187
+ end
188
+
189
+ specify "create_volume - :disk_type不正" do
190
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:disk_type => 'type')) }.should.raise(NIFTY::ArgumentError)
191
+ lambda { @api.create_volume(@basic_create_volume_options.merge(:disk_type => 10)) }.should.raise(NIFTY::ArgumentError)
192
+ end
193
+
194
+ specify "create_volume - :instance_id未指定" do
195
+ lambda { @api.create_volume(:size => 1) }.should.raise(NIFTY::ArgumentError)
196
+ lambda { @api.create_volume(:size => 1, :key_name => nil) }.should.raise(NIFTY::ArgumentError)
197
+ lambda { @api.create_volume(:size => 1, :key_name => '') }.should.raise(NIFTY::ArgumentError)
198
+ end
199
+
200
+
201
+ # delete_volume
202
+ specify "delete_volume - レスポンスを正しく解析できるか" do
203
+ @api.stubs(:exec_request).returns stub(:body => @delete_volume_response_body, :is_a? => true)
204
+ response = @api.delete_volume(:volume_id => 'vol')
205
+ response.return.should.equal 'true'
206
+ end
207
+
208
+ specify "delete_volume - パラメータが正しく作られるか" do
209
+ @api.stubs(:make_request).with("Action" => "DeleteVolume", "VolumeId" => "a").returns stub(:body => @delete_volume_response_body, :is_a? => true)
210
+ @api.stubs(:exec_request).returns stub(:body => @delete_volume_response_body, :is_a? => true)
211
+ response = @api.delete_volume(:volume_id => "a")
212
+ end
213
+
214
+ specify "delete_volume - :volume_id正常" do
215
+ @api.stubs(:exec_request).returns stub(:body => @delete_volume_response_body, :is_a? => true)
216
+ lambda { @api.delete_volume(:volume_id => 'foo') }.should.not.raise(NIFTY::ArgumentError)
217
+ end
218
+
219
+ specify "delete_volume - :volume_id未指定" do
220
+ lambda { @api.delete_volume }.should.raise(NIFTY::ArgumentError)
221
+ lambda { @api.delete_volume(:volume_id => nil) }.should.raise(NIFTY::ArgumentError)
222
+ lambda { @api.delete_volume(:volume_id => '') }.should.raise(NIFTY::ArgumentError)
223
+ end
224
+
225
+
226
+ # attach_volume
227
+ specify "attach_volume - レスポンスを正しく解析できるか" do
228
+ @api.stubs(:exec_request).returns stub(:body => @attach_volume_response_body, :is_a? => true)
229
+ response = @api.attach_volume(:volume_id => 'vol', :instance_id => 'ins')
230
+ response.volumeId.should.equal 'vol-4d826724'
231
+ response.instanceId.should.equal 'i-6058a509'
232
+ response.device.should.equal 'SCSI(0:1)'
233
+ response.status.should.equal 'attaching'
234
+ response.attachTime.should.equal '2008-05-07T11:51:50.000Z'
235
+ end
236
+
237
+ specify "attach_volume - パラメータが正しく作られるか" do
238
+ @api.stubs(:make_request).with("Action" => "AttachVolume",
239
+ "VolumeId" => "a",
240
+ "InstanceId" => "a",
241
+ "Device" => "a"
242
+ ).returns stub(:body => @attach_volume_response_body, :is_a? => true)
243
+ @api.stubs(:exec_request).returns stub(:body => @attach_volume_response_body, :is_a? => true)
244
+ response = @api.attach_volume( :instance_id => "a", :volume_id => "a", :device => "a" )
245
+ end
246
+
247
+ specify "attach_volume - :volume_id, instance_id正常" do
248
+ @api.stubs(:exec_request).returns stub(:body => @attach_volume_response_body, :is_a? => true)
249
+ lambda { @api.attach_volume(:volume_id => 'foo', :instance_id => 'bar') }.should.not.raise(NIFTY::ArgumentError)
250
+ end
251
+
252
+ specify "attach_volume - :volume_id未指定" do
253
+ lambda { @api.attach_volume }.should.raise(NIFTY::ArgumentError)
254
+ lambda { @api.attach_volume(:volume_id => nil) }.should.raise(NIFTY::ArgumentError)
255
+ lambda { @api.attach_volume(:volume_id => '') }.should.raise(NIFTY::ArgumentError)
256
+ end
257
+
258
+ specify "attach_volume - :instance_id未指定" do
259
+ lambda { @api.attach_volume(:volume_id => 'foo') }.should.raise(NIFTY::ArgumentError)
260
+ lambda { @api.attach_volume(:volume_id => 'foo', :instance_id => nil) }.should.raise(NIFTY::ArgumentError)
261
+ lambda { @api.attach_volume(:volume_id => 'foo', :instance_id => '') }.should.raise(NIFTY::ArgumentError)
262
+ end
263
+
264
+ specify "attach_volume - :device正常" do
265
+ @api.stubs(:exec_request).returns stub(:body => @attach_volume_response_body, :is_a? => true)
266
+ lambda { @api.attach_volume(:volume_id => 'foo', :instance_id => 'bar', :device => 'dev') }.should.not.raise(NIFTY::ArgumentError)
267
+ end
268
+
269
+
270
+ # detach_volume
271
+ specify "detach_volume - レスポンスを正しく解析できるか" do
272
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
273
+ response = @api.detach_volume(:volume_id => 'vol')
274
+ response = @api.detach_volume(:volume_id => 'vol', :instance_id => 'ins')
275
+ response.volumeId.should.equal 'vol-4d826724'
276
+ response.instanceId.should.equal 'i-6058a509'
277
+ response.device.should.equal '/dev/sdh'
278
+ response.status.should.equal 'detaching'
279
+ response.attachTime.should.equal '2008-05-08T11:51:50.000Z'
280
+ end
281
+
282
+ specify "detach_volume - パラメータが正しく作られるか" do
283
+ @api.stubs(:make_request).with("Action" => "DetachVolume",
284
+ "VolumeId" => "a",
285
+ "InstanceId" => "a",
286
+ "Device" => "a",
287
+ "Force" => "false"
288
+ ).returns stub(:body => @detach_volume_response_body, :is_a? => true)
289
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
290
+ response = @api.detach_volume( :instance_id => "a", :volume_id => "a", :device => "a", :force => false )
291
+ end
292
+
293
+ specify "detach_volume - :volume_id正常" do
294
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
295
+ lambda { @api.detach_volume(:volume_id => 'foo') }.should.not.raise(NIFTY::ArgumentError)
296
+ end
297
+
298
+ specify "detach_volume - :volume_id未指定" do
299
+ lambda { @api.detach_volume }.should.raise(NIFTY::ArgumentError)
300
+ lambda { @api.detach_volume(:volume_id => nil) }.should.raise(NIFTY::ArgumentError)
301
+ lambda { @api.detach_volume(:volume_id => '') }.should.raise(NIFTY::ArgumentError)
302
+ end
303
+
304
+ specify "detach_volume - :instance_id正常" do
305
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
306
+ lambda { @api.detach_volume(:volume_id => 'foo', :instance_id => 'bar') }.should.not.raise(NIFTY::ArgumentError)
307
+ end
308
+
309
+ specify "detach_volume - :device正常" do
310
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
311
+ lambda { @api.detach_volume(:volume_id => 'foo', :device => 'bar') }.should.not.raise(NIFTY::ArgumentError)
312
+ end
313
+
314
+ specify "detach_volume - :force正常" do
315
+ @api.stubs(:exec_request).returns stub(:body => @detach_volume_response_body, :is_a? => true)
316
+ lambda { @api.detach_volume(:volume_id => 'foo', :force => true) }.should.not.raise(NIFTY::ArgumentError)
317
+ lambda { @api.detach_volume(:volume_id => 'foo', :force => false) }.should.not.raise(NIFTY::ArgumentError)
318
+ end
319
+
320
+ specify "detach_volume - :force異常" do
321
+ lambda { @api.detach_volume(:volume_id => 'foo', :force => 'foo') }.should.raise(NIFTY::ArgumentError)
322
+ lambda { @api.detach_volume(:volume_id => 'foo', :force => 1) }.should.raise(NIFTY::ArgumentError)
323
+ end
324
+
325
+ end
@@ -0,0 +1,23 @@
1
+ #--
2
+ # ニフティクラウドSDK for Ruby
3
+ #
4
+ # Ruby Gem Name:: nifty-cloud-sdk
5
+ # Author:: NIFTY Corporation
6
+ # Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://cloud.nifty.com/api/
9
+ #++
10
+
11
+ require 'rubygems'
12
+ gem 'test-unit'
13
+
14
+ %w[ test/unit test/spec mocha ].each { |f|
15
+ begin
16
+ require f
17
+ rescue LoadError
18
+ abort "Unable to load required gem for test: #{f}"
19
+ end
20
+ }
21
+
22
+ require File.dirname(__FILE__) + '/../lib/NIFTY'
23
+
metadata ADDED
@@ -0,0 +1,275 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nifty-cloud-sdk
3
+ version: !ruby/object:Gem::Version
4
+ hash: 1
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 7
9
+ version: "1.7"
10
+ platform: ruby
11
+ authors:
12
+ - NIFTY Corporation
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-08-16 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: xml-simple
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 15
29
+ segments:
30
+ - 1
31
+ - 0
32
+ - 12
33
+ version: 1.0.12
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 41
45
+ segments:
46
+ - 0
47
+ - 9
48
+ - 9
49
+ version: 0.9.9
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: test-unit
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 15
61
+ segments:
62
+ - 2
63
+ - 1
64
+ - 2
65
+ version: 2.1.2
66
+ type: :development
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: test-spec
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 55
77
+ segments:
78
+ - 0
79
+ - 10
80
+ - 0
81
+ version: 0.10.0
82
+ type: :development
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: rcov
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 41
93
+ segments:
94
+ - 0
95
+ - 9
96
+ - 9
97
+ version: 0.9.9
98
+ type: :development
99
+ version_requirements: *id005
100
+ - !ruby/object:Gem::Dependency
101
+ name: perftools.rb
102
+ prerelease: false
103
+ requirement: &id006 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ - 5
112
+ - 4
113
+ version: 0.5.4
114
+ type: :development
115
+ version_requirements: *id006
116
+ - !ruby/object:Gem::Dependency
117
+ name: yard
118
+ prerelease: false
119
+ requirement: &id007 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ - 6
128
+ - 2
129
+ version: 0.6.2
130
+ type: :development
131
+ version_requirements: *id007
132
+ description: It is an operation library for Nifty Cloud APIs that the server making, starting, stoping, and the server status confirming etc.
133
+ email:
134
+ executables: []
135
+
136
+ extensions: []
137
+
138
+ extra_rdoc_files:
139
+ - LICENSE.txt
140
+ - README.rdoc
141
+ files:
142
+ - Gemfile
143
+ - Rakefile
144
+ - nifty-cloud-sdk.gemspec
145
+ - LICENSE.txt
146
+ - INSTALL
147
+ - CHANGELOG
148
+ - README.rdoc
149
+ - lib/NIFTY/Cloud/certificates.rb
150
+ - lib/NIFTY/Cloud/availability_zones.rb
151
+ - lib/NIFTY/Cloud/images.rb
152
+ - lib/NIFTY/Cloud/security_groups.rb
153
+ - lib/NIFTY/Cloud/instances.rb
154
+ - lib/NIFTY/Cloud/keypairs.rb
155
+ - lib/NIFTY/Cloud/volumes.rb
156
+ - lib/NIFTY/Cloud/load_balancers.rb
157
+ - lib/NIFTY/responses.rb
158
+ - lib/NIFTY/config.rb
159
+ - lib/NIFTY/Cloud.rb
160
+ - lib/NIFTY/version.rb
161
+ - lib/NIFTY/exceptions.rb
162
+ - lib/NIFTY.rb
163
+ - sample/security_groups/create-security-group.rb
164
+ - sample/security_groups/update-security-group.rb
165
+ - sample/security_groups/describe-security-activities.rb
166
+ - sample/security_groups/delete-security-group.rb
167
+ - sample/security_groups/register-instances-with-security-group.rb
168
+ - sample/security_groups/describe-security-groups.rb
169
+ - sample/security_groups/revoke-security-group-ingress.rb
170
+ - sample/security_groups/deregister-instances-from-security-group.rb
171
+ - sample/security_groups/authorize-security-group-ingress.rb
172
+ - sample/certificate/download-ssl-certificate.rb
173
+ - sample/certificate/delete-ssl-certificate.rb
174
+ - sample/certificate/describe-ssl-certificate-attribute.rb
175
+ - sample/certificate/modify-ssl-certificate-attribute.rb
176
+ - sample/certificate/register-corporate-info-for-certificate.rb
177
+ - sample/certificate/describe-ssl-certificates.rb
178
+ - sample/certificate/create-ssl-certificate.rb
179
+ - sample/certificate/upload-ssl-certificate.rb
180
+ - sample/availability_zones/describe-availability-zones.rb
181
+ - sample/keypairs/delete-key-pair.rb
182
+ - sample/keypairs/create-key-pair.rb
183
+ - sample/keypairs/describe-key-pairs.rb
184
+ - sample/volumes/attach-volumes.rb
185
+ - sample/volumes/describe-volumes.rb
186
+ - sample/volumes/create-volume.rb
187
+ - sample/volumes/detach-volume.rb
188
+ - sample/volumes/delete-volume.rb
189
+ - sample/images/delete-image.rb
190
+ - sample/images/describe-images.rb
191
+ - sample/images/modify-image-attribute.rb
192
+ - sample/images/create-image.rb
193
+ - sample/instances/reboot-instances.rb
194
+ - sample/instances/cancel_copy_instances.rb
195
+ - sample/instances/terminate-instances.rb
196
+ - sample/instances/modify-instance-attribute.rb
197
+ - sample/instances/run-instances.rb
198
+ - sample/instances/start-instances.rb
199
+ - sample/instances/copy-instances.rb
200
+ - sample/instances/describe-instance-attribute.rb
201
+ - sample/instances/stop-instances.rb
202
+ - sample/instances/describe-instances.rb
203
+ - sample/load_balancers/describe-load-balancers.rb
204
+ - sample/load_balancers/register-port-with-load-balancer.rb
205
+ - sample/load_balancers/create-load-balancer.rb
206
+ - sample/load_balancers/configure-health-check.rb
207
+ - sample/load_balancers/deregister-instances-from-load-balancer.rb
208
+ - sample/load_balancers/delete-load-balancer.rb
209
+ - sample/load_balancers/update-load-balancer.rb
210
+ - sample/load_balancers/set-filter-for-load-balancer.rb
211
+ - sample/load_balancers/describe-instance-health.rb
212
+ - sample/load_balancers/register-instances-with-load-balancer.rb
213
+ - test/test_Cloud.rb
214
+ - test/test_Cloud_load_balancers.rb
215
+ - test/test_Cloud_instances.rb
216
+ - test/test_Cloud_responses.rb
217
+ - test/test_Cloud_certificates.rb
218
+ - test/test_Cloud_volumes.rb
219
+ - test/test_Cloud_availability_zones.rb
220
+ - test/test_Cloud_images.rb
221
+ - test/test_helper.rb
222
+ - test/test_Cloud_security_groups.rb
223
+ - test/test_Cloud_keypairs.rb
224
+ has_rdoc: true
225
+ homepage: http://cloud.nifty.com/api/
226
+ licenses: []
227
+
228
+ post_install_message:
229
+ rdoc_options:
230
+ - --title
231
+ - NIFTY Cloud SDK documentation
232
+ - --line-numbers
233
+ - --main
234
+ - README.rdoc
235
+ - -c
236
+ - UTF-8
237
+ require_paths:
238
+ - lib
239
+ required_ruby_version: !ruby/object:Gem::Requirement
240
+ none: false
241
+ requirements:
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ hash: 3
245
+ segments:
246
+ - 0
247
+ version: "0"
248
+ required_rubygems_version: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ hash: 3
254
+ segments:
255
+ - 0
256
+ version: "0"
257
+ requirements: []
258
+
259
+ rubyforge_project:
260
+ rubygems_version: 1.6.2
261
+ signing_key:
262
+ specification_version: 3
263
+ summary: NIFTY Cloud SDK for Ruby
264
+ test_files:
265
+ - test/test_Cloud.rb
266
+ - test/test_Cloud_load_balancers.rb
267
+ - test/test_Cloud_instances.rb
268
+ - test/test_Cloud_responses.rb
269
+ - test/test_Cloud_certificates.rb
270
+ - test/test_Cloud_volumes.rb
271
+ - test/test_Cloud_availability_zones.rb
272
+ - test/test_Cloud_images.rb
273
+ - test/test_helper.rb
274
+ - test/test_Cloud_security_groups.rb
275
+ - test/test_Cloud_keypairs.rb