nifty-cloud-sdk 1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +112 -0
- data/Gemfile +4 -0
- data/INSTALL +30 -0
- data/LICENSE.txt +58 -0
- data/README.rdoc +375 -0
- data/Rakefile +61 -0
- data/lib/NIFTY.rb +405 -0
- data/lib/NIFTY/Cloud.rb +24 -0
- data/lib/NIFTY/Cloud/availability_zones.rb +23 -0
- data/lib/NIFTY/Cloud/certificates.rb +283 -0
- data/lib/NIFTY/Cloud/images.rb +134 -0
- data/lib/NIFTY/Cloud/instances.rb +372 -0
- data/lib/NIFTY/Cloud/keypairs.rb +76 -0
- data/lib/NIFTY/Cloud/load_balancers.rb +433 -0
- data/lib/NIFTY/Cloud/security_groups.rb +357 -0
- data/lib/NIFTY/Cloud/volumes.rb +140 -0
- data/lib/NIFTY/config.rb +41 -0
- data/lib/NIFTY/exceptions.rb +32 -0
- data/lib/NIFTY/responses.rb +19 -0
- data/lib/NIFTY/version.rb +3 -0
- data/nifty-cloud-sdk.gemspec +28 -0
- data/sample/availability_zones/describe-availability-zones.rb +37 -0
- data/sample/certificate/create-ssl-certificate.rb +41 -0
- data/sample/certificate/delete-ssl-certificate.rb +28 -0
- data/sample/certificate/describe-ssl-certificate-attribute.rb +58 -0
- data/sample/certificate/describe-ssl-certificates.rb +49 -0
- data/sample/certificate/download-ssl-certificate.rb +31 -0
- data/sample/certificate/modify-ssl-certificate-attribute.rb +29 -0
- data/sample/certificate/register-corporate-info-for-certificate.rb +57 -0
- data/sample/certificate/upload-ssl-certificate.rb +32 -0
- data/sample/images/create-image.rb +33 -0
- data/sample/images/delete-image.rb +26 -0
- data/sample/images/describe-images.rb +70 -0
- data/sample/images/modify-image-attribute.rb +33 -0
- data/sample/instances/cancel_copy_instances.rb +26 -0
- data/sample/instances/copy-instances.rb +41 -0
- data/sample/instances/describe-instance-attribute.rb +78 -0
- data/sample/instances/describe-instances.rb +100 -0
- data/sample/instances/modify-instance-attribute.rb +30 -0
- data/sample/instances/reboot-instances.rb +29 -0
- data/sample/instances/run-instances.rb +104 -0
- data/sample/instances/start-instances.rb +36 -0
- data/sample/instances/stop-instances.rb +35 -0
- data/sample/instances/terminate-instances.rb +34 -0
- data/sample/keypairs/create-key-pair.rb +31 -0
- data/sample/keypairs/delete-key-pair.rb +28 -0
- data/sample/keypairs/describe-key-pairs.rb +31 -0
- data/sample/load_balancers/configure-health-check.rb +41 -0
- data/sample/load_balancers/create-load-balancer.rb +35 -0
- data/sample/load_balancers/delete-load-balancer.rb +28 -0
- data/sample/load_balancers/deregister-instances-from-load-balancer.rb +35 -0
- data/sample/load_balancers/describe-instance-health.rb +36 -0
- data/sample/load_balancers/describe-load-balancers.rb +89 -0
- data/sample/load_balancers/register-instances-with-load-balancer.rb +33 -0
- data/sample/load_balancers/register-port-with-load-balancer.rb +37 -0
- data/sample/load_balancers/set-filter-for-load-balancer.rb +38 -0
- data/sample/load_balancers/update-load-balancer.rb +33 -0
- data/sample/security_groups/authorize-security-group-ingress.rb +36 -0
- data/sample/security_groups/create-security-group.rb +29 -0
- data/sample/security_groups/delete-security-group.rb +28 -0
- data/sample/security_groups/deregister-instances-from-security-group.rb +31 -0
- data/sample/security_groups/describe-security-activities.rb +33 -0
- data/sample/security_groups/describe-security-groups.rb +59 -0
- data/sample/security_groups/register-instances-with-security-group.rb +31 -0
- data/sample/security_groups/revoke-security-group-ingress.rb +36 -0
- data/sample/security_groups/update-security-group.rb +30 -0
- data/sample/volumes/attach-volumes.rb +34 -0
- data/sample/volumes/create-volume.rb +38 -0
- data/sample/volumes/delete-volume.rb +28 -0
- data/sample/volumes/describe-volumes.rb +44 -0
- data/sample/volumes/detach-volume.rb +35 -0
- data/test/test_Cloud.rb +186 -0
- data/test/test_Cloud_availability_zones.rb +50 -0
- data/test/test_Cloud_certificates.rb +627 -0
- data/test/test_Cloud_images.rb +284 -0
- data/test/test_Cloud_instances.rb +941 -0
- data/test/test_Cloud_keypairs.rb +177 -0
- data/test/test_Cloud_load_balancers.rb +1183 -0
- data/test/test_Cloud_responses.rb +43 -0
- data/test/test_Cloud_security_groups.rb +699 -0
- data/test/test_Cloud_volumes.rb +325 -0
- data/test/test_helper.rb +23 -0
- metadata +275 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:instance_id => "instanceId",
|
24
|
+
#:attribute => "attribute",
|
25
|
+
#:value => "value",
|
26
|
+
}
|
27
|
+
|
28
|
+
pp response = ncs4r.modify_instance_attribute(options)
|
29
|
+
|
30
|
+
p response.return
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:instance_id => ["instanceId"],
|
24
|
+
#:force => false
|
25
|
+
}
|
26
|
+
|
27
|
+
pp response = ncs4r.reboot_instances(options)
|
28
|
+
|
29
|
+
p response.return
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:image_id => "imageId",
|
24
|
+
#:min_count => 0,
|
25
|
+
#:max_count => 0,
|
26
|
+
#:key_name => "keyName",
|
27
|
+
#:security_group => ["groupName"],
|
28
|
+
#:additional_info => "additionalInfo",
|
29
|
+
#:user_data => "userData",
|
30
|
+
#:addressing_type => "addressingType",
|
31
|
+
#:instance_type => "instanceType",
|
32
|
+
#:availability_zone => "availabilityZone",
|
33
|
+
#:kernel_id => "kernelId",
|
34
|
+
#:ramdisk_id => "ramdiskId",
|
35
|
+
#:block_device_mapping => [{ :device_name => "deviceName",
|
36
|
+
# :virtual_name => "virtualName",
|
37
|
+
# :ebs_snapshot_id => "snapshotId",
|
38
|
+
# :ebs_volume_size => 0,
|
39
|
+
# :ebs_delete_on_termination => false,
|
40
|
+
# :ebs_no_device => "noDevice"
|
41
|
+
# }],
|
42
|
+
#:monitoring_enabled => false,
|
43
|
+
#:subnet_id => "subnetId",
|
44
|
+
#:disable_api_termination => false,
|
45
|
+
#:instance_initiated_shutdown_behavior => "instanceInitiatedShutdownBehavior",
|
46
|
+
#:accounting_type => "accountingType",
|
47
|
+
#:instance_id => "instanceId",
|
48
|
+
#:admin => "admin",
|
49
|
+
#:password => "password",
|
50
|
+
#:ip_type => "static"
|
51
|
+
}
|
52
|
+
|
53
|
+
pp response = ncs4r.run_instances(options)
|
54
|
+
|
55
|
+
|
56
|
+
p response.reservationId
|
57
|
+
p response.ownerId
|
58
|
+
p response.groupSet
|
59
|
+
p response.groupId
|
60
|
+
response.instancesSet.item.each do |instance|
|
61
|
+
p instance.instanceId
|
62
|
+
p instance.imageId
|
63
|
+
p instance.instanceState.code
|
64
|
+
p instance.instanceState.name
|
65
|
+
p instance.privateDnsName
|
66
|
+
p instance.dnsName
|
67
|
+
p instance.reason
|
68
|
+
p instance.keyName
|
69
|
+
p instance.admin
|
70
|
+
p instance.amiLaunchIndex
|
71
|
+
if product_codes = instance.productCodes
|
72
|
+
product_codes.item.each do |code|
|
73
|
+
p code.productCode
|
74
|
+
end
|
75
|
+
end
|
76
|
+
p instance.instanceType
|
77
|
+
p instance.launchTime
|
78
|
+
instance.placement
|
79
|
+
p instance.kernelId
|
80
|
+
p instance.ramdiskId
|
81
|
+
p instance.platform
|
82
|
+
if monitoring = instance.monitoring
|
83
|
+
p monitoring.state
|
84
|
+
end
|
85
|
+
p instance.subnetId
|
86
|
+
p instance.vpcId
|
87
|
+
p instance.privateIpAddress
|
88
|
+
p instance.ipAddress
|
89
|
+
p instance.privateIpAddressV6
|
90
|
+
p instance.ipAddressV6
|
91
|
+
if reason = instance.stateReason
|
92
|
+
p reason.code
|
93
|
+
p reason.message
|
94
|
+
end
|
95
|
+
p instance.architecture
|
96
|
+
p instance.rootDeviceType
|
97
|
+
p instance.rootDeviceName
|
98
|
+
if instance.blockDeviceMapping
|
99
|
+
p instance.instanceLifecycle
|
100
|
+
p instance.spotInstanceRequestId
|
101
|
+
p instance.accountingType
|
102
|
+
p instance.ipType
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:instance_id => ["instanceId"],
|
24
|
+
#:instance_type => ["instanceType"],
|
25
|
+
#:accounting_type => ["accounting_type"]
|
26
|
+
}
|
27
|
+
|
28
|
+
pp response = ncs4r.start_instances(options)
|
29
|
+
|
30
|
+
response.instancesSet.item.each do |instance|
|
31
|
+
p instance.instanceId
|
32
|
+
p instance.currentState.code
|
33
|
+
p instance.currentState.name
|
34
|
+
p instance.previousState.code
|
35
|
+
p instance.previousState.name
|
36
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:instance_id => ["instanceId"],
|
24
|
+
#:force => false
|
25
|
+
}
|
26
|
+
|
27
|
+
pp response = ncs4r.stop_instances(options)
|
28
|
+
|
29
|
+
response.instancesSet.item.each do |instance|
|
30
|
+
p instance.instanceId
|
31
|
+
p instance.currentState.code
|
32
|
+
p instance.currentState.name
|
33
|
+
p instance.previousState.code
|
34
|
+
p instance.previousState.name
|
35
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:instance_id => ["instanceId"]
|
24
|
+
}
|
25
|
+
|
26
|
+
pp response = ncs4r.terminate_instances(options)
|
27
|
+
|
28
|
+
response.instancesSet.item.each do |instance|
|
29
|
+
p instance.instanceId
|
30
|
+
p instance.currentState.code
|
31
|
+
p instance.currentState.name
|
32
|
+
p instance.previousState.code
|
33
|
+
p instance.previousState.name
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:key_name => "keyName",
|
24
|
+
#:password => "password"
|
25
|
+
}
|
26
|
+
|
27
|
+
pp response = ncs4r.create_key_pair(options)
|
28
|
+
|
29
|
+
p response.keyName
|
30
|
+
p response.keyFingerprint
|
31
|
+
p response.keyMaterial
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:key_name => "keyName",
|
24
|
+
}
|
25
|
+
|
26
|
+
pp response = ncs4r.delete_key_pair(options)
|
27
|
+
|
28
|
+
p response.return
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:key_name => ["keyName"]
|
24
|
+
}
|
25
|
+
|
26
|
+
pp response = ncs4r.describe_key_pairs(options)
|
27
|
+
|
28
|
+
response.keySet.item.each do |key|
|
29
|
+
p key.keyName
|
30
|
+
p key.keyFingerprint
|
31
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:load_balancer_name => "loadBalancerName",
|
24
|
+
#:load_balancer_port => 0,
|
25
|
+
#:instance_port => 0,
|
26
|
+
#:target => "target",
|
27
|
+
#:interval => 0,
|
28
|
+
#:timeout => 30,
|
29
|
+
#:unhealthy_threshold => 30,
|
30
|
+
#:healthy_threshold => 30
|
31
|
+
}
|
32
|
+
|
33
|
+
pp response = ncs4r.configure_health_check(options)
|
34
|
+
|
35
|
+
if health = response.ConfigureHealthCheckResult.HealthCheck
|
36
|
+
p health.Target
|
37
|
+
p health.Interval
|
38
|
+
p health.Timeout
|
39
|
+
p health.UnhealthyThreshold
|
40
|
+
p health.HealthyThreshold
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# ニフティクラウドSDK for Ruby
|
4
|
+
#
|
5
|
+
# Ruby Gem Name:: nifty-cloud-sdk
|
6
|
+
# Author:: NIFTY Corporation
|
7
|
+
# Copyright:: Copyright 2011 NIFTY Corporation All Rights Reserved.
|
8
|
+
# License:: Distributes under the same terms as Ruby
|
9
|
+
# Home:: http://cloud.nifty.com/api/
|
10
|
+
#++
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require File.dirname(__FILE__) + "/../../lib/NIFTY"
|
14
|
+
require 'pp'
|
15
|
+
|
16
|
+
ACCESS_KEY = ENV["NIFTY_CLOUD_ACCESS_KEY"] || "<Your Access Key ID>"
|
17
|
+
SECRET_KEY = ENV["NIFTY_CLOUD_SECRET_KEY"] || "<Your Secret Access Key>"
|
18
|
+
|
19
|
+
|
20
|
+
ncs4r = NIFTY::Cloud::Base.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
|
21
|
+
|
22
|
+
options = {
|
23
|
+
#:load_balancer_name => "loadBalancerName",
|
24
|
+
#:listeners => [{:protocol => "protocol",
|
25
|
+
# :load_balancer_port => 0,
|
26
|
+
# :instance_port => 0,
|
27
|
+
# :balancing_type => "balancingType"}],
|
28
|
+
#:availability_zone => "availabilityZone",
|
29
|
+
#:network_volume => 0,
|
30
|
+
#:ip_version => "v6"
|
31
|
+
}
|
32
|
+
|
33
|
+
pp response = ncs4r.create_load_balancer(options)
|
34
|
+
|
35
|
+
p response.CreateLoadBalancerResult.DNSName
|