nifty-cloud-sdk 1.9.beta1 → 1.11.beta1
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.
- data/README.rdoc +17 -0
- data/lib/NIFTY/Cloud/availability_zones.rb +24 -1
- data/lib/NIFTY/Cloud/images.rb +6 -3
- data/lib/NIFTY/Cloud/instances.rb +7 -1
- data/lib/NIFTY/Cloud/load_balancers.rb +1 -0
- data/lib/NIFTY/Cloud/security_groups.rb +2 -0
- data/lib/NIFTY/version.rb +1 -1
- data/test/test_Cloud_availability_zones.rb +54 -13
- data/test/test_Cloud_images.rb +11 -2
- data/test/test_Cloud_instances.rb +21 -5
- data/test/test_Cloud_load_balancers.rb +4 -4
- data/test/test_Cloud_security_groups.rb +3 -2
- metadata +5 -5
data/README.rdoc
CHANGED
|
@@ -350,6 +350,23 @@ RunInstances の例)
|
|
|
350
350
|
puts "Error Message: #{e.error_message}"
|
|
351
351
|
end
|
|
352
352
|
|
|
353
|
+
=== リージョン/ゾーンの指定方法
|
|
354
|
+
|
|
355
|
+
==== リージョン指定方法
|
|
356
|
+
|
|
357
|
+
環境変数または NIFTY::Cloud::Base オブジェクト生成時のコンストラクタにてご指定ください。
|
|
358
|
+
|
|
359
|
+
環境変数:
|
|
360
|
+
|
|
361
|
+
export NIFTY_CLOUD_ENDPOINT_URL='https://east-1.cp.cloud.nifty.com/api/'
|
|
362
|
+
|
|
363
|
+
コンストラクタ:
|
|
364
|
+
|
|
365
|
+
ncs4r = NIFTY::Cloud::Base.new(:server => 'west-1.cp.cloud.nifty.com', :path => '/api/')
|
|
366
|
+
|
|
367
|
+
==== ゾーン指定方法
|
|
368
|
+
|
|
369
|
+
各メソッドのドキュメントをご参照ください。
|
|
353
370
|
|
|
354
371
|
== 謝辞
|
|
355
372
|
|
|
@@ -3,8 +3,13 @@ module NIFTY
|
|
|
3
3
|
class Base < NIFTY::Base
|
|
4
4
|
ZONES_IGNORED_PARAMS = Regexp.new(/ZoneName\.\d+/)
|
|
5
5
|
|
|
6
|
-
# API「DescribeAvailabilityZones
|
|
6
|
+
# API「DescribeAvailabilityZones」を実行し、利用可能なゾーンの情報を取得します。
|
|
7
7
|
#
|
|
8
|
+
# ファイアウォールが利用可能なゾーンでは、securityGroupSupportedタグにtrueが返ります。
|
|
9
|
+
#
|
|
10
|
+
# サーバー、ロードバランサー、ファイアウォール作成時にゾーンを省略した場合、isDefaultタグがtrueのゾーンに作成されます。
|
|
11
|
+
#
|
|
12
|
+
# @option options [Array<String>] :zone_name ゾーン名
|
|
8
13
|
# @return [Hash] レスポンスXML解析結果
|
|
9
14
|
#
|
|
10
15
|
# @example
|
|
@@ -18,6 +23,24 @@ module NIFTY
|
|
|
18
23
|
|
|
19
24
|
return response_generator(params)
|
|
20
25
|
end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# API「DescribeRegions」を実行し、利用可能なリージョンの情報を取得します。
|
|
29
|
+
#
|
|
30
|
+
# @option options [Array<String>] :region_name リージョン名
|
|
31
|
+
# @return [Hash] レスポンスXML解析結果
|
|
32
|
+
#
|
|
33
|
+
# @example
|
|
34
|
+
# describe_regions(:region_name => 'east-1')
|
|
35
|
+
#
|
|
36
|
+
def describe_regions( options={} )
|
|
37
|
+
params = {'Action' => 'DescribeRegions'}
|
|
38
|
+
params.merge!(pathlist('RegionName', options[:region_name]))
|
|
39
|
+
|
|
40
|
+
params.reject! {|k, v| ZONES_IGNORED_PARAMS =~ k } if @@ignore_amz_params
|
|
41
|
+
|
|
42
|
+
return response_generator(params)
|
|
43
|
+
end
|
|
21
44
|
end
|
|
22
45
|
end
|
|
23
46
|
end
|
data/lib/NIFTY/Cloud/images.rb
CHANGED
|
@@ -47,9 +47,11 @@ module NIFTY
|
|
|
47
47
|
# タイムアウトした場合は、API「DescribeImages」のレスポンス「imageState」でカスタマイズイメージのステータスを確認できます。
|
|
48
48
|
# 処理が失敗した場合、カスタマイズイメージは保存されず、エラーが返されます。
|
|
49
49
|
#
|
|
50
|
-
# @option options [String] :instance_id
|
|
51
|
-
# @option options [String] :name
|
|
52
|
-
# @option options [Boolean] :left_instance
|
|
50
|
+
# @option options [String] :instance_id イメージ化元サーバー(必須)
|
|
51
|
+
# @option options [String] :name イメージ名(必須)
|
|
52
|
+
# @option options [Boolean] :left_instance イメージ化元サーバーを残す
|
|
53
|
+
# @option options [String] :region_name リージョン情報
|
|
54
|
+
# @option options [String] :availability_zone ゾーン情報
|
|
53
55
|
# 許可値: true(サーバーを残す) | false(サーバーを残さない)
|
|
54
56
|
# @return [Hash] レスポンスXML解析結果
|
|
55
57
|
#
|
|
@@ -64,6 +66,7 @@ module NIFTY
|
|
|
64
66
|
|
|
65
67
|
params = { 'Action' => 'CreateImage' }
|
|
66
68
|
params.merge!(opts_to_prms(options, [:instance_id, :name, :description, :no_reboot, :left_instance]))
|
|
69
|
+
params.merge!(opts_to_prms(options, [:region_name, :availability_zone], 'Placement'))
|
|
67
70
|
|
|
68
71
|
params.reject! {|k, v| IMAGES_IGNORED_PARAMS =~ k } if @@ignore_amz_params
|
|
69
72
|
|
|
@@ -163,6 +163,8 @@ module NIFTY
|
|
|
163
163
|
# 許可値: 半角英数字
|
|
164
164
|
# @option options [String] :ip_type IPアドレスタイプ
|
|
165
165
|
# 許可値: static | dynamic | none
|
|
166
|
+
# @option options [Boolean] :agreement Red Hat Enterprise Linux 5.8 64bit / 6.3 64bit を指定した場合の同意
|
|
167
|
+
# 許可値: true (同意する) | false (同意しない)
|
|
166
168
|
# @return [Hash] レスポンスXML解析結果
|
|
167
169
|
#
|
|
168
170
|
# @example
|
|
@@ -185,6 +187,7 @@ module NIFTY
|
|
|
185
187
|
raise ArgumentError, "Invalid :accounting_type provided." unless blank?(options[:accounting_type]) || ACCOUNTING_TYPE.include?(options[:accounting_type].to_s)
|
|
186
188
|
raise ArgumentError, "Invalid :ip_type provided." unless blank?(options[:ip_type]) || IP_TYPE.include?(options[:ip_type].to_s)
|
|
187
189
|
raise ArgumentError, ":base64_encoded must be 'true' or 'false'." unless [true, false].include?(options[:base64_encoded])
|
|
190
|
+
raise ArgumentError, "Invalid :agreement provided." unless blank?(options[:agreement]) || BOOLEAN.include?(options[:agreement].to_s)
|
|
188
191
|
|
|
189
192
|
user_data = extract_user_data(options)
|
|
190
193
|
options[:user_data] = user_data
|
|
@@ -200,7 +203,7 @@ module NIFTY
|
|
|
200
203
|
:ebs_no_device => 'Ebs.NoDevice' })) unless blank?(options[:block_device_mapping])
|
|
201
204
|
params.merge!(opts_to_prms(options, [:image_id, :min_count, :max_count, :key_name, :additional_info, :user_data, :addressing_type,
|
|
202
205
|
:instance_type, :kernel_id, :ramdisk_id, :subnet_id, :disable_api_termination, :instance_initiated_shutdown_behavior,
|
|
203
|
-
:accounting_type, :instance_id, :admin, :password, :ip_type]))
|
|
206
|
+
:accounting_type, :instance_id, :admin, :password, :ip_type, :agreement]))
|
|
204
207
|
params.merge!(opts_to_prms(options, [:availability_zone, :group_name], 'Placement'))
|
|
205
208
|
|
|
206
209
|
params.reject! {|k, v| INSTANCES_IGNORED_PARAMS =~ k } if @@ignore_amz_params
|
|
@@ -321,6 +324,8 @@ module NIFTY
|
|
|
321
324
|
# [Integer] :instance_port - 宛先ポート
|
|
322
325
|
# @option options [Array<String>] :security_group ファイアウォールグループ名
|
|
323
326
|
# @option options [Integer] :copy_count コピー台数
|
|
327
|
+
# @option options [String] :region_name リージョン情報
|
|
328
|
+
# @option options [String] :availability_zone ゾーン情報
|
|
324
329
|
# @return [Hash] レスポンスXML解析結果
|
|
325
330
|
#
|
|
326
331
|
# @example
|
|
@@ -363,6 +368,7 @@ module NIFTY
|
|
|
363
368
|
params.merge!(pathlist('CopyInstance.SecurityGroup', options[:security_group]))
|
|
364
369
|
params.merge!(opts_to_prms(options, [:instance_id, :copy_count]))
|
|
365
370
|
params.merge!(opts_to_prms(options, [:instance_name, :instance_type, :accounting_type], 'CopyInstance'))
|
|
371
|
+
params.merge!(opts_to_prms(options, [:region_name, :availability_zone], 'CopyInstance.Placement'))
|
|
366
372
|
|
|
367
373
|
return response_generator(params)
|
|
368
374
|
end
|
|
@@ -83,6 +83,7 @@ module NIFTY
|
|
|
83
83
|
# @option options [String] :ip_version グローバルIP アドレスのバージョン
|
|
84
84
|
# 許可値: v4
|
|
85
85
|
# @option options [String] :accounting_type 利用料金タイプ
|
|
86
|
+
# @option options [String] :availability_zones ゾーン情報
|
|
86
87
|
# 許可値: 1(月額課金) | 2(従量課金)
|
|
87
88
|
# @return [Hash] レスポンスXML解析結果
|
|
88
89
|
#
|
|
@@ -87,6 +87,7 @@ module NIFTY
|
|
|
87
87
|
# @option options [String] :group_name ファイアウォールグループ名(必須)
|
|
88
88
|
# 使用可能文字: 半角英数字
|
|
89
89
|
# @option options [String] :group_description ファイアウォールグループのメモ
|
|
90
|
+
# @option options [String] :availability_zone ゾーン情報
|
|
90
91
|
# @return [Hash] レスポンスXML解析結果
|
|
91
92
|
#
|
|
92
93
|
# @example
|
|
@@ -98,6 +99,7 @@ module NIFTY
|
|
|
98
99
|
|
|
99
100
|
params = {'Action' => 'CreateSecurityGroup'}
|
|
100
101
|
params.merge!(opts_to_prms(options, [:group_name, :group_description]))
|
|
102
|
+
params.merge!(opts_to_prms(options, [:availability_zone], 'Placement'))
|
|
101
103
|
|
|
102
104
|
return response_generator(params)
|
|
103
105
|
end
|
data/lib/NIFTY/version.rb
CHANGED
|
@@ -19,27 +19,52 @@ context "availability_zones" do
|
|
|
19
19
|
:signature_version => '2', :signature_method => 'HmacSHA256')
|
|
20
20
|
|
|
21
21
|
@describe_availability_zones_response_body = <<-RESPONSE
|
|
22
|
-
<DescribeAvailabilityZonesResponse xmlns="
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
<DescribeAvailabilityZonesResponse xmlns="https://cp.cloud.nifty.com/api/">
|
|
23
|
+
<availabilityZoneInfo>
|
|
24
|
+
<item>
|
|
25
|
+
<zoneName>east-11</zoneName>
|
|
26
|
+
<zoneState>available</zoneState>
|
|
27
|
+
<regionName>east-1</regionName>
|
|
28
|
+
<messageSet>
|
|
29
|
+
<item>
|
|
30
|
+
<message/>
|
|
31
|
+
</item>
|
|
32
|
+
</messageSet>
|
|
33
|
+
<securityGroupSupported>true</securityGroupSupported>
|
|
34
|
+
<isDefault>true</isDefault>
|
|
35
|
+
</item>
|
|
36
|
+
</availabilityZoneInfo>
|
|
37
|
+
</DescribeAvailabilityZonesResponse>
|
|
38
|
+
RESPONSE
|
|
39
|
+
@describe_regions_response_body = <<-RESPONSE
|
|
40
|
+
<DescribeRegionsResponse xmlns="https://cp.cloud.nifty.com/api/">
|
|
41
|
+
<requestId>f6dd8353-eb6b-6b4fd32e4f05</requestId>
|
|
42
|
+
<regionInfo>
|
|
43
|
+
<item>
|
|
44
|
+
<regionName>east-1</regionName>
|
|
45
|
+
<regionEndpoint>east-1.cloud.nifty.com</regionEndpoint>
|
|
46
|
+
<messageSet>
|
|
47
|
+
<item>
|
|
48
|
+
<message/>
|
|
49
|
+
</item>
|
|
50
|
+
</messageSet>
|
|
51
|
+
<isDefault>true</isDefault>
|
|
52
|
+
</item>
|
|
53
|
+
</regionInfo>
|
|
54
|
+
</DescribeRegionsResponse>
|
|
31
55
|
RESPONSE
|
|
32
|
-
|
|
33
56
|
end
|
|
34
57
|
|
|
35
58
|
|
|
36
59
|
# describe_availability_zones
|
|
37
60
|
specify "describe_availability_zones - レスポンスを正しく解析できるか" do
|
|
38
61
|
@api.stubs(:exec_request).returns stub(:body => @describe_availability_zones_response_body, :is_a? => true)
|
|
39
|
-
response = @api.describe_availability_zones(:zone_name => '
|
|
40
|
-
response.availabilityZoneInfo.item[0].zoneName.should.equal '
|
|
62
|
+
response = @api.describe_availability_zones(:zone_name => 'east-11')
|
|
63
|
+
response.availabilityZoneInfo.item[0].zoneName.should.equal 'east-11'
|
|
41
64
|
response.availabilityZoneInfo.item[0].zoneState.should.equal 'available'
|
|
42
|
-
response.availabilityZoneInfo.item[0].regionName.should.equal '
|
|
65
|
+
response.availabilityZoneInfo.item[0].regionName.should.equal 'east-1'
|
|
66
|
+
response.availabilityZoneInfo.item[0].securityGroupSupported.should.equal 'true'
|
|
67
|
+
response.availabilityZoneInfo.item[0].isDefault.should.equal 'true'
|
|
43
68
|
end
|
|
44
69
|
|
|
45
70
|
specify "describe_availability_zones - :key_name正常" do
|
|
@@ -48,4 +73,20 @@ context "availability_zones" do
|
|
|
48
73
|
lambda { @api.describe_availability_zones(:zone_name => %w(foo bar)) }.should.not.raise(NIFTY::ArgumentError)
|
|
49
74
|
end
|
|
50
75
|
|
|
76
|
+
# describe_regions
|
|
77
|
+
specify "describe_regions - レスポンスを正しく解析できるか" do
|
|
78
|
+
@api.stubs(:exec_request).returns stub(:body => @describe_regions_response_body, :is_a? => true)
|
|
79
|
+
response = @api.describe_regions(:zone_name => 'east-11')
|
|
80
|
+
response.requestId.should.equal 'f6dd8353-eb6b-6b4fd32e4f05'
|
|
81
|
+
response.regionInfo.item[0].regionName.should.equal 'east-1'
|
|
82
|
+
response.regionInfo.item[0].regionEndpoint.should.equal 'east-1.cloud.nifty.com'
|
|
83
|
+
response.regionInfo.item[0].isDefault.should.equal 'true'
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
specify "describe_regions - :region_name正常" do
|
|
87
|
+
@api.stubs(:exec_request).returns stub(:body => @describe_availability_zones_response_body, :is_a? => true)
|
|
88
|
+
lambda { @api.describe_regions(:region_name => 'foo') }.should.not.raise(NIFTY::ArgumentError)
|
|
89
|
+
lambda { @api.describe_regions(:region_name => %w(foo bar)) }.should.not.raise(NIFTY::ArgumentError)
|
|
90
|
+
end
|
|
91
|
+
|
|
51
92
|
end
|
data/test/test_Cloud_images.rb
CHANGED
|
@@ -38,6 +38,10 @@ context "images" do
|
|
|
38
38
|
<imageType>machine</imageType>
|
|
39
39
|
<platform>centos</platform>
|
|
40
40
|
<name>CentOS 5.3 32bit Plain</name>
|
|
41
|
+
<placement>
|
|
42
|
+
<regionName>east-1</regionName>
|
|
43
|
+
<availabilityZone>east-11</availabilityZone>
|
|
44
|
+
</placement>
|
|
41
45
|
<rootDeviceType>disk</rootDeviceType>
|
|
42
46
|
</item>
|
|
43
47
|
</imagesSet>
|
|
@@ -74,10 +78,13 @@ context "images" do
|
|
|
74
78
|
"Name" => "a",
|
|
75
79
|
"Description" => "a",
|
|
76
80
|
"NoReboot" => "a",
|
|
77
|
-
"LeftInstance" => "true"
|
|
81
|
+
"LeftInstance" => "true",
|
|
82
|
+
"Placement.RegionName" => "east-1",
|
|
83
|
+
"Placement.AvailabilityZone" => "east-11"
|
|
78
84
|
).returns stub(:body => @create_image_response_body, :is_a? => true)
|
|
79
85
|
@api.stubs(:exec_request).returns stub(:body => @create_image_response_body, :is_a? => true)
|
|
80
|
-
response = @api.create_image( :instance_id => "a", :name => "a", :description => "a", :no_reboot => "a", :left_instance => true
|
|
86
|
+
response = @api.create_image( :instance_id => "a", :name => "a", :description => "a", :no_reboot => "a", :left_instance => true,
|
|
87
|
+
:region_name => "east-1", :availability_zone => "east-11" )
|
|
81
88
|
end
|
|
82
89
|
|
|
83
90
|
specify "create_image - :instance_id, :name正常" do
|
|
@@ -131,6 +138,8 @@ context "images" do
|
|
|
131
138
|
response.imagesSet.item[0].imageType.should.equal 'machine'
|
|
132
139
|
response.imagesSet.item[0].platform.should.equal 'centos'
|
|
133
140
|
response.imagesSet.item[0].name.should.equal 'CentOS 5.3 32bit Plain'
|
|
141
|
+
response.imagesSet.item[0].placement.regionName.should.equal 'east-1'
|
|
142
|
+
response.imagesSet.item[0].placement.availabilityZone.should.equal 'east-11'
|
|
134
143
|
response.imagesSet.item[0].rootDeviceType.should.equal 'disk'
|
|
135
144
|
end
|
|
136
145
|
|
|
@@ -22,6 +22,7 @@ context "instances" do
|
|
|
22
22
|
@valid_ip_type = %w(static dynamic none)
|
|
23
23
|
@accounting_type = [1, 2, '1', '2']
|
|
24
24
|
@windows_image_id = [12, 16, '12', '16']
|
|
25
|
+
@valid_agreement = [true, false, 'true', 'false']
|
|
25
26
|
|
|
26
27
|
@basic_run_instances_options = {:security_group => "gr01", :image_id => 2, :key_name => 'foo', :password => 'password'}
|
|
27
28
|
@basic_import_instance_options = {:ovf => "dummy"}
|
|
@@ -85,7 +86,7 @@ context "instances" do
|
|
|
85
86
|
<instanceType>mini</instanceType>
|
|
86
87
|
<launchTime>2010-05-17T11:22:33.456Z</launchTime>
|
|
87
88
|
<placement>
|
|
88
|
-
<availabilityZone>
|
|
89
|
+
<availabilityZone>east-11</availabilityZone>
|
|
89
90
|
</placement>
|
|
90
91
|
<kernelId />
|
|
91
92
|
<ramdiskId />
|
|
@@ -268,7 +269,7 @@ context "instances" do
|
|
|
268
269
|
response.reservationSet.item[0].instancesSet.item[0].amiLaunchIndex.should.equal nil
|
|
269
270
|
response.reservationSet.item[0].instancesSet.item[0].instanceType.should.equal "mini"
|
|
270
271
|
response.reservationSet.item[0].instancesSet.item[0].launchTime.should.equal "2010-05-17T11:22:33.456Z"
|
|
271
|
-
response.reservationSet.item[0].instancesSet.item[0].placement.availabilityZone.should.equal "
|
|
272
|
+
response.reservationSet.item[0].instancesSet.item[0].placement.availabilityZone.should.equal "east-11"
|
|
272
273
|
response.reservationSet.item[0].instancesSet.item[0].kernelId.should.equal nil
|
|
273
274
|
response.reservationSet.item[0].instancesSet.item[0].ramdiskId.should.equal nil
|
|
274
275
|
response.reservationSet.item[0].instancesSet.item[0].platform.should.equal nil
|
|
@@ -482,7 +483,8 @@ context "instances" do
|
|
|
482
483
|
'InstanceId' => 'server01',
|
|
483
484
|
'Admin' => 'admin',
|
|
484
485
|
'Password' => 'pass',
|
|
485
|
-
'IpType' => 'static'
|
|
486
|
+
'IpType' => 'static',
|
|
487
|
+
'Agreement' => 'true'
|
|
486
488
|
).returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
487
489
|
@api.stubs(:exec_request).returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
488
490
|
response = @api.run_instances(:image_id => 1, :min_count => 1, :max_count => 3, :key_name => 'key', :security_group => %w(gr1 gr2), :user_data => 'data',
|
|
@@ -493,7 +495,7 @@ context "instances" do
|
|
|
493
495
|
{:device_name => 'dev2', :virtual_name => 'vir2', :ebs_snapshot_id => 'snap2', :ebs_volume_size => 'size2',
|
|
494
496
|
:ebs_delete_on_termination => 'del2', :ebs_no_device => 'nodev2'}],
|
|
495
497
|
:monitoring_enabled => 'en', :subnet_id => 'sub', :disable_api_termination => false, :instance_initiated_shutdown_behavior => 'aaa',
|
|
496
|
-
:accounting_type => 1, :instance_id => 'server01', :admin => 'admin', :password => 'pass', :ip_type => 'static')
|
|
498
|
+
:accounting_type => 1, :instance_id => 'server01', :admin => 'admin', :password => 'pass', :ip_type => 'static', :agreement => true)
|
|
497
499
|
end
|
|
498
500
|
|
|
499
501
|
specify "run_instances - :image_id, :key_name, :password正常" do
|
|
@@ -623,6 +625,13 @@ context "instances" do
|
|
|
623
625
|
end
|
|
624
626
|
end
|
|
625
627
|
|
|
628
|
+
specify "run_instances - :agreement正常" do
|
|
629
|
+
@api.stubs(:exec_request).returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
630
|
+
@valid_agreement.each do |agreement|
|
|
631
|
+
lambda { @api.run_instances(@basic_run_instances_options.merge(:agreement => agreement)) }.should.not.raise(NIFTY::ArgumentError)
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
|
|
626
635
|
specify "run_instances - :image_id未指定/不正" do
|
|
627
636
|
lambda { @api.run_instances }.should.raise(NIFTY::ArgumentError)
|
|
628
637
|
lambda { @api.run_instances(:image_id => '') }.should.raise(NIFTY::ArgumentError)
|
|
@@ -672,6 +681,11 @@ context "instances" do
|
|
|
672
681
|
lambda { @api.run_instances(@basic_run_instances_options.merge(:ip_type => 5)) }.should.raise(NIFTY::ArgumentError)
|
|
673
682
|
end
|
|
674
683
|
|
|
684
|
+
specify "run_instances - :agreement不正" do
|
|
685
|
+
lambda { @api.run_instances(@basic_run_instances_options.merge(:agreement => 'agree')) }.should.raise(NIFTY::ArgumentError)
|
|
686
|
+
lambda { @api.run_instances(@basic_run_instances_options.merge(:agreement => 1)) }.should.raise(NIFTY::ArgumentError)
|
|
687
|
+
end
|
|
688
|
+
|
|
675
689
|
|
|
676
690
|
# start_instances
|
|
677
691
|
specify "start_instances - レスポンスを正しく解析できるか" do
|
|
@@ -873,6 +887,8 @@ context "instances" do
|
|
|
873
887
|
'CopyInstance.InstanceType' => 'mini',
|
|
874
888
|
'CopyInstance.AccountingType' => '1',
|
|
875
889
|
'CopyInstance.ipType' => 'static',
|
|
890
|
+
'CopyInstance.Placement.RegionName' => 'east-1',
|
|
891
|
+
'CopyInstance.Placement.AvailabilityZone' => 'east-11',
|
|
876
892
|
'CopyInstance.LoadBalancers.1.LoadBalancerName' => 'lb1',
|
|
877
893
|
'CopyInstance.LoadBalancers.1.LoadBalancerPort' => '80',
|
|
878
894
|
'CopyInstance.LoadBalancers.1.InstancePort' => '80',
|
|
@@ -887,7 +903,7 @@ context "instances" do
|
|
|
887
903
|
response = @api.copy_instances( :instance_id => "server01", :instance_name => 'cpy', :instance_type => 'mini', :accounting_type => 1, :ip_type => 'static',
|
|
888
904
|
:load_balancers => [{:load_balancer_name => 'lb1', :load_balancer_port => 80, :instance_port => 80},
|
|
889
905
|
{:load_balancer_name => 'lb2', :load_balancer_port => 80, :instance_port => 80}],
|
|
890
|
-
:security_group => %w(gr1 gr2), :copy_count => 2
|
|
906
|
+
:security_group => %w(gr1 gr2), :copy_count => 2, :region_name => 'east-1', :availability_zone => 'east-11'
|
|
891
907
|
)
|
|
892
908
|
end
|
|
893
909
|
|
|
@@ -133,7 +133,7 @@ context "load_balancers" do
|
|
|
133
133
|
</IPAddresses>
|
|
134
134
|
</Filter>
|
|
135
135
|
<AvailabilityZones>
|
|
136
|
-
<member>
|
|
136
|
+
<member>east-11</member>
|
|
137
137
|
</AvailabilityZones>
|
|
138
138
|
<CreatedTime>2010-05-17T11:22:33.456Z</CreatedTime>
|
|
139
139
|
<AccountingType>1</AccountingType>
|
|
@@ -186,7 +186,7 @@ context "load_balancers" do
|
|
|
186
186
|
</IPAddresses>
|
|
187
187
|
</Filter>
|
|
188
188
|
<AvailabilityZones>
|
|
189
|
-
<member>
|
|
189
|
+
<member>east-12</member>
|
|
190
190
|
</AvailabilityZones>
|
|
191
191
|
<CreatedTime>2010-05-17T11:22:43.789Z</CreatedTime>
|
|
192
192
|
<AccountingType>1</AccountingType>
|
|
@@ -693,7 +693,7 @@ context "load_balancers" do
|
|
|
693
693
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Filter.FilterType.should.equal '1'
|
|
694
694
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Filter.IPAddresses.member[0].should.equal '111.111.111.111'
|
|
695
695
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Filter.IPAddresses.member[1].should.equal '111.111.111.112'
|
|
696
|
-
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].AvailabilityZones.member[0].should.equal '
|
|
696
|
+
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].AvailabilityZones.member[0].should.equal 'east-11'
|
|
697
697
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].CreatedTime.should.equal '2010-05-17T11:22:33.456Z'
|
|
698
698
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Option.SessionStickinessPolicy.Enabled.should.equal 'true'
|
|
699
699
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Option.SessionStickinessPolicy.ExpirationPeriod.should.equal '10'
|
|
@@ -717,7 +717,7 @@ context "load_balancers" do
|
|
|
717
717
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].HealthCheck.HealthyThreshold.should.equal '1'
|
|
718
718
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].Filter.FilterType.should.equal '1'
|
|
719
719
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].Filter.IPAddresses.member[0].should.equal '*.*.*.*'
|
|
720
|
-
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].AvailabilityZones.member[0].should.equal '
|
|
720
|
+
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].AvailabilityZones.member[0].should.equal 'east-12'
|
|
721
721
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[1].member[0].CreatedTime.should.equal '2010-05-17T11:22:43.789Z'
|
|
722
722
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Option.SessionStickinessPolicy.Enabled.should.equal 'true'
|
|
723
723
|
response.DescribeLoadBalancersResult.LoadBalancerDescriptions[0].member[0].Option.SessionStickinessPolicy.ExpirationPeriod.should.equal '10'
|
|
@@ -175,10 +175,11 @@ context "security_groups" do
|
|
|
175
175
|
specify "create_security_group - パラメータが正しく作られるか" do
|
|
176
176
|
@api.stubs(:make_request).with("Action" => "CreateSecurityGroup",
|
|
177
177
|
"GroupName" => "a",
|
|
178
|
-
"GroupDescription" => "a"
|
|
178
|
+
"GroupDescription" => "a",
|
|
179
|
+
"Placement.AvailabilityZone" => "east-12"
|
|
179
180
|
).returns stub(:body => @create_security_group_response_body, :is_a? => true)
|
|
180
181
|
@api.stubs(:exec_request).returns stub(:body => @create_security_group_response_body, :is_a? => true)
|
|
181
|
-
response = @api.create_security_group(:group_name => "a", :group_description => "a")
|
|
182
|
+
response = @api.create_security_group(:group_name => "a", :group_description => "a", :availability_zone => "east-12")
|
|
182
183
|
end
|
|
183
184
|
|
|
184
185
|
specify "create_security_group - :group_name正常" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nifty-cloud-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 62196249
|
|
5
|
+
prerelease: 5
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
8
|
+
- 11
|
|
9
9
|
- beta
|
|
10
10
|
- 1
|
|
11
|
-
version: 1.
|
|
11
|
+
version: 1.11.beta1
|
|
12
12
|
platform: ruby
|
|
13
13
|
authors:
|
|
14
14
|
- NIFTY Corporation
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2012-11-
|
|
19
|
+
date: 2012-11-25 00:00:00 +09:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|