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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/fog/sakuracloud/models/network/router.rb +14 -11
- data/lib/fog/sakuracloud/network.rb +1 -0
- data/lib/fog/sakuracloud/requests/network/change_router_bandwidth.rb +40 -0
- data/lib/fog/sakuracloud/version.rb +1 -1
- data/tests/sakuracloud/requests/network/routers_tests.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3713f5daf69fb6aeff433b4b744b57c8d8ca5236
|
4
|
+
data.tar.gz: 5554058a97ba7bdb41a6113b572c6edc39ddadbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86709dec8f30c696e647f59a118f411bef6b5fcac34db1c65aeeeecd645e76cd697d5f87a69462dbef5a6a85f50f1b22c516c760075faf2c031b95257a7cb9f1
|
7
|
+
data.tar.gz: c8dd0f52ec47ecaf8ef876c8f4e6dc14667b231e8d958e22c0a4d45cbf6c292a6fca910380c35abd5320477032db7db77fd5bc63dfdb2f89298dd1da0ce4b1cb
|
data/CHANGELOG.md
CHANGED
@@ -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 :
|
11
|
-
attribute :
|
12
|
-
attribute :
|
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
|
-
|
24
|
+
attached_switch = service.create_router(@attributes).body["Internet"]
|
29
25
|
Fog::Logger.warning("Waiting available new router...")
|
30
|
-
new_data =
|
31
|
-
|
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
|
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
|
@@ -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
|
@@ -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
|
-
'
|
9
|
-
'
|
10
|
-
'
|
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.
|
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-
|
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
|