fog-sakuracloud 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 897104786361cfe690b7b1f2578965818d31ad6f
4
- data.tar.gz: 0541082923de0d63f41810c91082a669e0cf50ac
3
+ metadata.gz: 3713f5daf69fb6aeff433b4b744b57c8d8ca5236
4
+ data.tar.gz: 5554058a97ba7bdb41a6113b572c6edc39ddadbb
5
5
  SHA512:
6
- metadata.gz: 464144e6b2575d09c15de82220f4044780d1c19fac34e546ae297bac95efa0796d5174b0fe9334c1ca14e546701a110f70fd8f837648b173baf5767f15e9ef86
7
- data.tar.gz: ff5d5db70886fa695d67aa8fa03da6ed2b28ce1fb031e47c3c27fd82ac3993e595e776a2ca95a4a81434c756f36ea8ef6e7345b51a1cb7ffaac12fdc4d4994c0
6
+ metadata.gz: 86709dec8f30c696e647f59a118f411bef6b5fcac34db1c65aeeeecd645e76cd697d5f87a69462dbef5a6a85f50f1b22c516c760075faf2c031b95257a7cb9f1
7
+ data.tar.gz: c8dd0f52ec47ecaf8ef876c8f4e6dc14667b231e8d958e22c0a4d45cbf6c292a6fca910380c35abd5320477032db7db77fd5bc63dfdb2f89298dd1da0ce4b1cb
@@ -1,5 +1,9 @@
1
1
  # Changelog of fog-sakuracloud
2
2
 
3
+ ## v1.7.0
4
+
5
+ - Change: Rebuild router model from internet resource.
6
+
3
7
  ## v1.6.0
4
8
 
5
9
  - Miscs: Wrap request for error messages to be readable. #22
@@ -7,13 +7,9 @@ module Fog
7
7
  identity :id, :aliases => 'ID'
8
8
  attribute :name, :aliases => 'Name'
9
9
  attribute :description, :aliases => 'Description'
10
- attribute :server_count, :aliases => 'ServerCount'
11
- attribute :appliance_count, :aliases => 'ApplianceCount'
12
- attribute :subnets, :aliases => 'Subnets'
13
- attribute :ipv6nets, :aliases => 'IPv6Nets'
14
- attribute :internet, :aliases => 'Internet'
15
- attribute :bridge, :aliases => 'Bridge'
16
- attribute :networkmasklen
10
+ attribute :networkmasklen, :aliases => 'NetworkMaskLen'
11
+ attribute :bandwidthmbps, :aliases => 'BandWidthMbps'
12
+ attribute :switch, :aliases => 'Switch'
17
13
 
18
14
 
19
15
  def delete
@@ -25,10 +21,13 @@ module Fog
25
21
  def save
26
22
  requires :name, :networkmasklen
27
23
  Fog::Logger.warning("Create Router with public subnet")
28
- data = service.create_router(@attributes).body["Internet"]
24
+ attached_switch = service.create_router(@attributes).body["Internet"]
29
25
  Fog::Logger.warning("Waiting available new router...")
30
- new_data = router_available?(service, data["ID"])
31
- merge_attributes(new_data)
26
+ new_data = switch_available?(service, attached_switch["ID"])
27
+ puts ::JSON.pretty_generate new_data
28
+ id = new_data['internet']['ID']
29
+ merge_attributes(new_data['internet'])
30
+ self.reload
32
31
  true
33
32
  end
34
33
 
@@ -36,7 +35,11 @@ module Fog
36
35
  service.collect_monitor_router(identity, start_time, end_time).body["Data"]
37
36
  end
38
37
 
39
- def router_available?(network, router_id)
38
+ def change_bandwidth(bandwidth)
39
+ service.change_router_bandwidth(identity, bandwidth).body["Success"]
40
+ end
41
+
42
+ def switch_available?(network, router_id)
40
43
  until network.switches.find {|r| r.internet != nil && r.internet["ID"] == router_id}
41
44
  print '.'
42
45
  sleep 2
@@ -19,6 +19,7 @@ module Fog
19
19
  request :create_router
20
20
  request :delete_router
21
21
  request :collect_monitor_router
22
+ request :change_router_bandwidth
22
23
  request :list_switches
23
24
  request :create_switch
24
25
  request :delete_switch
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+
3
+ module Fog
4
+ module Network
5
+ class SakuraCloud
6
+ class Real
7
+ def change_router_bandwidth( id, bandwidthmbps )
8
+ body = {
9
+ "Internet" => {
10
+ "BandWidthMbps" => bandwidthmbps
11
+ }
12
+ }
13
+
14
+ request(
15
+ :headers => {
16
+ 'Authorization' => "Basic #{@auth_encode}"
17
+ },
18
+ :expects => [200],
19
+ :method => 'PUT',
20
+ :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet/#{id}/bandwidth",
21
+ :body => Fog::JSON.encode(body)
22
+ )
23
+ end
24
+ end # Real
25
+
26
+ class Mock
27
+ def change_router_bandwidth( id, bandwidthmbps )
28
+ response = Excon::Response.new
29
+ response.status = 200
30
+ response.body = {
31
+ "Internet"=>{"ID"=>"112701091977"},
32
+ "Success"=>true,
33
+ "is_ok"=>true
34
+ }
35
+ response
36
+ end
37
+ end # Mock
38
+ end # SakuraCloud
39
+ end # Network
40
+ end # Fog
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Sakuracloud
3
- VERSION = "1.6.0"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
@@ -5,9 +5,9 @@ Shindo.tests('Fog::Network[:sakuracloud] | list_routers request', ['sakuracloud'
5
5
  'Index' => Integer,
6
6
  'ID' => String,
7
7
  'Name' => String,
8
- 'ServerCount' => Integer,
9
- 'ApplianceCount' => Integer,
10
- 'Subnets' => Array
8
+ 'BandWidthMbps' => Integer,
9
+ 'NetworkMaskLen' => Integer,
10
+ 'Switch' => Hash
11
11
  }
12
12
 
13
13
  @routers_list_format = {
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.6.0
4
+ version: 1.7.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-12-20 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -251,6 +251,7 @@ files:
251
251
  - lib/fog/sakuracloud/requests/dns/delete_zone.rb
252
252
  - lib/fog/sakuracloud/requests/dns/list_zones.rb
253
253
  - lib/fog/sakuracloud/requests/dns/modify_zone.rb
254
+ - lib/fog/sakuracloud/requests/network/change_router_bandwidth.rb
254
255
  - lib/fog/sakuracloud/requests/network/collect_monitor_router.rb
255
256
  - lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb
256
257
  - lib/fog/sakuracloud/requests/network/create_router.rb