fog-sakuracloud 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/fog/sakuracloud.rb +15 -2
  4. data/lib/fog/sakuracloud/compute.rb +3 -1
  5. data/lib/fog/sakuracloud/dns.rb +3 -1
  6. data/lib/fog/sakuracloud/models/volume/plan.rb +1 -0
  7. data/lib/fog/sakuracloud/network.rb +3 -1
  8. data/lib/fog/sakuracloud/requests/compute/boot_server.rb +1 -1
  9. data/lib/fog/sakuracloud/requests/compute/create_server.rb +1 -1
  10. data/lib/fog/sakuracloud/requests/compute/delete_server.rb +1 -1
  11. data/lib/fog/sakuracloud/requests/compute/list_plans.rb +1 -1
  12. data/lib/fog/sakuracloud/requests/compute/list_servers.rb +1 -1
  13. data/lib/fog/sakuracloud/requests/compute/list_ssh_keys.rb +1 -1
  14. data/lib/fog/sakuracloud/requests/compute/list_zones.rb +1 -1
  15. data/lib/fog/sakuracloud/requests/compute/stop_server.rb +1 -1
  16. data/lib/fog/sakuracloud/requests/dns/create_zone.rb +1 -1
  17. data/lib/fog/sakuracloud/requests/dns/delete_zone.rb +1 -1
  18. data/lib/fog/sakuracloud/requests/dns/list_zones.rb +1 -1
  19. data/lib/fog/sakuracloud/requests/dns/modify_zone.rb +1 -1
  20. data/lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb +1 -1
  21. data/lib/fog/sakuracloud/requests/network/create_router.rb +1 -1
  22. data/lib/fog/sakuracloud/requests/network/create_switch.rb +1 -1
  23. data/lib/fog/sakuracloud/requests/network/delete_interface.rb +1 -1
  24. data/lib/fog/sakuracloud/requests/network/delete_router.rb +1 -1
  25. data/lib/fog/sakuracloud/requests/network/delete_switch.rb +1 -1
  26. data/lib/fog/sakuracloud/requests/network/list_interfaces.rb +1 -1
  27. data/lib/fog/sakuracloud/requests/network/list_routers.rb +1 -1
  28. data/lib/fog/sakuracloud/requests/network/list_switches.rb +1 -1
  29. data/lib/fog/sakuracloud/requests/network/regist_interface_to_server.rb +1 -1
  30. data/lib/fog/sakuracloud/requests/script/create_note.rb +1 -1
  31. data/lib/fog/sakuracloud/requests/script/delete_note.rb +1 -1
  32. data/lib/fog/sakuracloud/requests/script/list_notes.rb +1 -1
  33. data/lib/fog/sakuracloud/requests/script/modify_note.rb +1 -1
  34. data/lib/fog/sakuracloud/requests/volume/associate_ip_to_disk.rb +1 -1
  35. data/lib/fog/sakuracloud/requests/volume/attach_disk.rb +1 -1
  36. data/lib/fog/sakuracloud/requests/volume/carve_hostname_on_disk.rb +1 -1
  37. data/lib/fog/sakuracloud/requests/volume/configure_disk.rb +1 -1
  38. data/lib/fog/sakuracloud/requests/volume/create_disk.rb +1 -1
  39. data/lib/fog/sakuracloud/requests/volume/delete_disk.rb +1 -1
  40. data/lib/fog/sakuracloud/requests/volume/list_archives.rb +1 -1
  41. data/lib/fog/sakuracloud/requests/volume/list_disks.rb +1 -1
  42. data/lib/fog/sakuracloud/requests/volume/list_plans.rb +26 -10
  43. data/lib/fog/sakuracloud/requests/volume/register_note_to_disk.rb +1 -1
  44. data/lib/fog/sakuracloud/script.rb +3 -1
  45. data/lib/fog/sakuracloud/version.rb +1 -1
  46. data/lib/fog/sakuracloud/volume.rb +3 -1
  47. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f179bb5fe911c507374a15fd4244bcc3a3a8cb5
4
- data.tar.gz: ee254916549f9391ef89bf8e87cdd0c40381dba4
3
+ metadata.gz: 44007b32b6e17b0fe4a28c84c57bc4e8848b4da6
4
+ data.tar.gz: f091a5cfcd6e290c829dc31502dd3a146bb8c31c
5
5
  SHA512:
6
- metadata.gz: 9c4d0e4e4bab316d496b91939dea5f1e54032ef83f3aac68262063633d9fa84f0fad382bb7d5c43a7d476644a5a90ca74df0af65034b0729ae1cadb28943a4ef
7
- data.tar.gz: 3ce680b80b8855ecf9d192f88978bebcd36e4c545f1f18c910b487f68ab2f8a14eb8bc54ba3a1baab123fa743f2d0b6b085717520e1d57226a7ad175a10a6138
6
+ metadata.gz: fa9b69bdb76aabcec1945c580ec77bd267562473309101a5920978dc1177df88a032f455dff0fad173918cec77f854efb079cbc1247177f69ce4a91db9c0baf7
7
+ data.tar.gz: 386799b76c599ba970b03c7d91f3449beaa943775bb798827f0469792d8fa53a6a7cc907f69893ecd56e3f773fd08ac4923862cf829931a9d00604362b93412a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog of fog-sakuracloud
2
2
 
3
+ ## v1.5.0
4
+
5
+ - Feature: # Add new option api_zone to Provider to select zone easily.
6
+
3
7
  ## v1.4.0
4
8
 
5
9
  - Feature: #17 Support Standard Disk Plan for Disk creation HT: @noralife
@@ -22,8 +22,6 @@ module Fog
22
22
  extend Fog::Provider
23
23
 
24
24
  SAKURACLOUD_API_VERSION = '1.1' unless defined? SAKURACLOUD_API_VERSION
25
- SAKURACLOUD_API_ZONE = "is1b" unless defined? SAKURACLOUD_API_ZONE
26
- SAKURACLOUD_API_ENDPOINT = "/cloud/zone/#{SAKURACLOUD_API_ZONE}/api/cloud/#{SAKURACLOUD_API_VERSION}/"
27
25
 
28
26
  # Miscs
29
27
  ## Startup Script
@@ -34,5 +32,20 @@ module Fog
34
32
  service(:network, 'Network')
35
33
  service(:script, 'Script')
36
34
  service(:dns, 'DNS')
35
+
36
+
37
+ def self.api_zones
38
+ @api_zones ||= ['tk1a','is1b', 'is1b', 'tk1v']
39
+ end
40
+
41
+ def self.validate_api_zone!(api_zone, host=nil)
42
+ if !api_zones.include?(api_zone)
43
+ raise ArgumentError, "Unknown api_zone: #{api_zone.inspect}"
44
+ end
45
+ end
46
+
47
+ def self.build_endpoint(api_zone)
48
+ "/cloud/zone/#{api_zone}/api/cloud/#{SAKURACLOUD_API_VERSION}/"
49
+ end
37
50
  end
38
51
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  requires :sakuracloud_api_token
5
5
  requires :sakuracloud_api_token_secret
6
6
 
7
- recognizes :sakuracloud_api_url
7
+ recognizes :sakuracloud_api_url, :api_zone
8
8
 
9
9
  model_path 'fog/sakuracloud/models/compute'
10
10
  model :server
@@ -36,6 +36,8 @@ module Fog
36
36
  Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret]
37
37
 
38
38
  @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp'
39
+ @api_zone = options[:api_zone] || 'is1b'
40
+ Fog::SakuraCloud.validate_api_zone!(@api_zone)
39
41
 
40
42
  @connection = Fog::Core::Connection.new(@sakuracloud_api_url)
41
43
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  requires :sakuracloud_api_token
5
5
  requires :sakuracloud_api_token_secret
6
6
 
7
- recognizes :sakuracloud_api_url
7
+ recognizes :sakuracloud_api_url, :api_zone
8
8
 
9
9
  model_path 'fog/sakuracloud/models/dns'
10
10
  model :zone
@@ -26,6 +26,8 @@ module Fog
26
26
  Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret]
27
27
 
28
28
  @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp'
29
+ @api_zone = options[:api_zone] || 'is1b'
30
+ Fog::SakuraCloud.validate_api_zone!(@api_zone)
29
31
 
30
32
  @connection = Fog::Core::Connection.new(@sakuracloud_api_url)
31
33
  end
@@ -6,6 +6,7 @@ module Fog
6
6
  class Plan < Fog::Model
7
7
  identity :id, :aliases => 'ID'
8
8
  attribute :name, :aliases => 'Name'
9
+ attribute :size, :aliases => 'Size'
9
10
  end
10
11
  end
11
12
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  requires :sakuracloud_api_token
5
5
  requires :sakuracloud_api_token_secret
6
6
 
7
- recognizes :sakuracloud_api_url
7
+ recognizes :sakuracloud_api_url, :api_zone
8
8
 
9
9
  model_path 'fog/sakuracloud/models/network'
10
10
  model :router
@@ -36,6 +36,8 @@ module Fog
36
36
  Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret]
37
37
 
38
38
  @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp'
39
+ @api_zone = options[:api_zone] || 'is1b'
40
+ Fog::SakuraCloud.validate_api_zone!(@api_zone)
39
41
 
40
42
  @connection = Fog::Core::Connection.new(@sakuracloud_api_url)
41
43
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'PUT',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/server/#{id}/power"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}/power"
15
15
  )
16
16
  true
17
17
  end
@@ -32,7 +32,7 @@ module Fog
32
32
  },
33
33
  :expects => [201],
34
34
  :method => 'POST',
35
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/server",
35
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server",
36
36
  :body => Fog::JSON.encode(body)
37
37
  )
38
38
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  },
14
14
  :expects => [200],
15
15
  :method => 'DELETE',
16
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/server/#{id}",
16
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}",
17
17
  :body => Fog::JSON.encode(body)
18
18
  )
19
19
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/product/server"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/product/server"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/server"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/sshkey"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/sshkey"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/zone"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/zone"
14
14
  )
15
15
  end
16
16
  end
@@ -16,7 +16,7 @@ module Fog
16
16
  },
17
17
  :expects => [200,202],
18
18
  :method => 'DELETE',
19
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/server/#{id}/power",
19
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}/power",
20
20
  :body => Fog::JSON.encode(body)
21
21
  )
22
22
  true
@@ -26,7 +26,7 @@ module Fog
26
26
  },
27
27
  :expects => 201,
28
28
  :method => 'POST',
29
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/commonserviceitem",
29
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem",
30
30
  :body => Fog::JSON.encode(body)
31
31
  )
32
32
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/commonserviceitem/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -15,7 +15,7 @@ module Fog
15
15
  'Authorization' => "Basic #{@auth_encode}"
16
16
  },
17
17
  :method => 'GET',
18
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/commonserviceitem",
18
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem",
19
19
  :query => URI.encode(Fog::JSON.encode(filter))
20
20
  )
21
21
  end
@@ -17,7 +17,7 @@ module Fog
17
17
  },
18
18
  :expects => 200,
19
19
  :method => 'PUT',
20
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/commonserviceitem/#{options[:id]}",
20
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem/#{options[:id]}",
21
21
  :body => Fog::JSON.encode(body)
22
22
  )
23
23
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'PUT',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface/#{id}/to/switch/#{switch_id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface/#{id}/to/switch/#{switch_id}"
15
15
  )
16
16
  response.body['Interface']['ID']
17
17
  end
@@ -21,7 +21,7 @@ module Fog
21
21
  },
22
22
  :expects => 202,
23
23
  :method => 'POST',
24
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/internet",
24
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet",
25
25
  :body => Fog::JSON.encode(body)
26
26
  )
27
27
  end
@@ -17,7 +17,7 @@ module Fog
17
17
  },
18
18
  :expects => 201,
19
19
  :method => 'POST',
20
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/switch",
20
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch",
21
21
  :body => Fog::JSON.encode(body)
22
22
  )
23
23
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/internet/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/switch/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -19,7 +19,7 @@ module Fog
19
19
  'Authorization' => "Basic #{@auth_encode}"
20
20
  },
21
21
  :method => 'GET',
22
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface",
22
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface",
23
23
  :query => URI.encode(Fog::JSON.encode(filter))
24
24
  )
25
25
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/internet"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/switch"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch"
14
14
  )
15
15
  end
16
16
  end
@@ -19,7 +19,7 @@ module Fog
19
19
  },
20
20
  :expects => [201],
21
21
  :method => 'POST',
22
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface",
22
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface",
23
23
  :body => Fog::JSON.encode(body)
24
24
  )
25
25
  response.body['Interface']['ID']
@@ -18,7 +18,7 @@ module Fog
18
18
  },
19
19
  :expects => 201,
20
20
  :method => 'POST',
21
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/note",
21
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note",
22
22
  :body => Fog::JSON.encode(body)
23
23
  )
24
24
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/note/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/note"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note"
14
14
  )
15
15
  end
16
16
  end
@@ -18,7 +18,7 @@ module Fog
18
18
  },
19
19
  :expects => [200],
20
20
  :method => 'PUT',
21
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/note/#{options[:id]}",
21
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note/#{options[:id]}",
22
22
  :body => Fog::JSON.encode(body)
23
23
  )
24
24
  end
@@ -19,7 +19,7 @@ module Fog
19
19
  },
20
20
  :expects => [200],
21
21
  :method => 'PUT',
22
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{disk_id.to_s}/config",
22
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config",
23
23
  :body => Fog::JSON.encode(body)
24
24
  )
25
25
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'PUT',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{disk_id.to_s}/to/server/#{server_id.to_s}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/to/server/#{server_id.to_s}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -15,7 +15,7 @@ module Fog
15
15
  },
16
16
  :expects => [200],
17
17
  :method => 'PUT',
18
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{disk_id.to_s}/config",
18
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config",
19
19
  :body => Fog::JSON.encode(body)
20
20
  )
21
21
  end
@@ -15,7 +15,7 @@ module Fog
15
15
  },
16
16
  :expects => [200],
17
17
  :method => 'PUT',
18
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{disk_id.to_s}/config",
18
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config",
19
19
  :body => Fog::JSON.encode(body)
20
20
  )
21
21
  end
@@ -21,7 +21,7 @@ module Fog
21
21
  },
22
22
  :expects => [201, 202],
23
23
  :method => 'POST',
24
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk",
24
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk",
25
25
  :body => Fog::JSON.encode(body)
26
26
  )
27
27
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  },
12
12
  :expects => [200],
13
13
  :method => 'DELETE',
14
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{id}"
14
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{id}"
15
15
  )
16
16
  end
17
17
  end # Real
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/archive"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/archive"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk"
14
14
  )
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Fog
10
10
  'Authorization' => "Basic #{@auth_encode}"
11
11
  },
12
12
  :method => 'GET',
13
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/product/disk"
13
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/product/disk"
14
14
  )
15
15
  end
16
16
  end
@@ -20,16 +20,32 @@ module Fog
20
20
  response = Excon::Response.new
21
21
  response.status = 200
22
22
  response.body = {
23
- "DiskPlans" =>
23
+ "DiskPlans" =>
24
24
  [
25
- {"Index"=>0,
26
- "ID"=>4,
27
- "Name"=>"SSDプラン",
28
- "Availability"=>"available"},
29
- {"Index"=>1,
30
- "ID"=>2,
31
- "Name"=>"標準プラン",
32
- "Availability"=>"available"}
25
+ {"Index"=>0,
26
+ "ID"=>4,
27
+ "Name"=>"SSDプラン",
28
+ "Availability"=>"available",
29
+ "Size"=>
30
+ [{"SizeMB"=>20480, "DisplaySize"=>20, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/20g"},
31
+ {"SizeMB"=>102400, "DisplaySize"=>100, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/100g"},
32
+ {"SizeMB"=>256000, "DisplaySize"=>250, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/250g"},
33
+ {"SizeMB"=>512000, "DisplaySize"=>500, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/500g"}]},
34
+ {"Index"=>1,
35
+ "ID"=>2,
36
+ "Name"=>"標準プラン",
37
+ "Availability"=>"available",
38
+ "Size"=>
39
+ [{"SizeMB"=>40960, "DisplaySize"=>40, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/40g"},
40
+ {"SizeMB"=>61440, "DisplaySize"=>60, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/60g"},
41
+ {"SizeMB"=>81920, "DisplaySize"=>80, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/80g"},
42
+ {"SizeMB"=>102400, "DisplaySize"=>100, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/100g"},
43
+ {"SizeMB"=>256000, "DisplaySize"=>250, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/250g"},
44
+ {"SizeMB"=>512000, "DisplaySize"=>500, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/500g"},
45
+ {"SizeMB"=>768000, "DisplaySize"=>750, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/750g"},
46
+ {"SizeMB"=>1048576, "DisplaySize"=>1, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/1t"},
47
+ {"SizeMB"=>2097152, "DisplaySize"=>2, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/2t"},
48
+ {"SizeMB"=>4194304, "DisplaySize"=>4, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/4t"}]}
33
49
  ]
34
50
  }
35
51
  response
@@ -15,7 +15,7 @@ module Fog
15
15
  },
16
16
  :expects => [200],
17
17
  :method => 'PUT',
18
- :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/disk/#{disk_id.to_s}/config",
18
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config",
19
19
  :body => Fog::JSON.encode(body)
20
20
  )
21
21
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  requires :sakuracloud_api_token
5
5
  requires :sakuracloud_api_token_secret
6
6
 
7
- recognizes :sakuracloud_api_url
7
+ recognizes :sakuracloud_api_url, :api_zone
8
8
 
9
9
  model_path 'fog/sakuracloud/models/script'
10
10
  model :note
@@ -26,6 +26,8 @@ module Fog
26
26
  Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret]
27
27
 
28
28
  @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp'
29
+ @api_zone = options[:api_zone] || 'is1b'
30
+ Fog::SakuraCloud.validate_api_zone!(@api_zone)
29
31
 
30
32
  @connection = Fog::Core::Connection.new(@sakuracloud_api_url)
31
33
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Sakuracloud
3
- VERSION = "1.4.0"
3
+ VERSION = "1.5.0"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  requires :sakuracloud_api_token
5
5
  requires :sakuracloud_api_token_secret
6
6
 
7
- recognizes :sakuracloud_api_url
7
+ recognizes :sakuracloud_api_url, :api_zone
8
8
 
9
9
  model_path 'fog/sakuracloud/models/volume'
10
10
  model :archive
@@ -36,6 +36,8 @@ module Fog
36
36
  Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret]
37
37
 
38
38
  @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp'
39
+ @api_zone = options[:api_zone] || 'is1b'
40
+ Fog::SakuraCloud.validate_api_zone!(@api_zone)
39
41
 
40
42
  @connection = Fog::Core::Connection.new(@sakuracloud_api_url)
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-sakuracloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core