fog-sakuracloud 1.1.1 → 1.2.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/compute.rb +1 -0
- data/lib/fog/sakuracloud/models/compute/servers.rb +6 -0
- data/lib/fog/sakuracloud/models/network/interface.rb +27 -0
- data/lib/fog/sakuracloud/models/network/interfaces.rb +37 -0
- data/lib/fog/sakuracloud/network.rb +6 -0
- data/lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb +31 -0
- data/lib/fog/sakuracloud/requests/network/delete_interface.rb +30 -0
- data/lib/fog/sakuracloud/requests/network/list_interfaces.rb +39 -0
- data/lib/fog/sakuracloud/requests/network/regist_interface_to_server.rb +40 -0
- data/lib/fog/sakuracloud/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c091507bd4319e29aaec68ccec48639442edba9
|
4
|
+
data.tar.gz: ef1f332eeed7a16ceb330d8eb9510b87d5ece2bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edf9a260ef6f5990ade711a07478f3761e6cde29e9cde6a0353777f87627e9e74b994a2960c5de981ff40aaf7d22a9b7538cd30da030f15003dc2d3603ddf35
|
7
|
+
data.tar.gz: 10dcd3507057780c9959c70e5b4b250f510e3cbad3ce1f684bb7b4c17ae50fb0a1231ab3d3ec59c16c023e88679f2e8a398aaf0757369ce29e66a081dfc4f420
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Network
|
5
|
+
class SakuraCloud
|
6
|
+
class Interface < Fog::Model
|
7
|
+
identity :id, :aliases => 'ID'
|
8
|
+
attribute :macaddress, :aliases => 'MACAddress'
|
9
|
+
attribute :ipaddress, :aliases => 'IPAddress'
|
10
|
+
attribute :user_ipaddress, :aliases => 'UserIPAddress'
|
11
|
+
attribute :switch, :aliases => 'Switch'
|
12
|
+
attribute :server, :aliases => 'Server'
|
13
|
+
|
14
|
+
def delete
|
15
|
+
service.delete_interface(identity)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
alias_method :destroy, :delete
|
19
|
+
|
20
|
+
def connect_to_switch(switch_id)
|
21
|
+
service.connect_interface_to_switch(identity, switch_id)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/sakuracloud/models/network/interface'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Network
|
6
|
+
class SakuraCloud
|
7
|
+
class Interfaces < Fog::Collection
|
8
|
+
model Fog::Network::SakuraCloud::Interface
|
9
|
+
|
10
|
+
def all
|
11
|
+
load service.list_interfaces.body['Interfaces']
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
all.find { |f| f.id == id }
|
16
|
+
rescue Fog::Errors::NotFound
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def regist_onto_server(server_id)
|
21
|
+
id = service.regist_interface_to_server(server_id)
|
22
|
+
get(id)
|
23
|
+
end
|
24
|
+
|
25
|
+
def connect_to_switch(id, switch_id)
|
26
|
+
id = service.connect_interface_to_switch(id, switch_id)
|
27
|
+
get(id)
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete(id)
|
31
|
+
service.delete_interface(id)
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -11,6 +11,8 @@ module Fog
|
|
11
11
|
collection :routers
|
12
12
|
model :switch
|
13
13
|
collection :switches
|
14
|
+
model :interface
|
15
|
+
collection :interfaces
|
14
16
|
|
15
17
|
request_path 'fog/sakuracloud/requests/network'
|
16
18
|
request :list_routers
|
@@ -19,6 +21,10 @@ module Fog
|
|
19
21
|
request :list_switches
|
20
22
|
request :create_switch
|
21
23
|
request :delete_switch
|
24
|
+
request :list_interfaces
|
25
|
+
request :regist_interface_to_server
|
26
|
+
request :connect_interface_to_switch
|
27
|
+
request :delete_interface
|
22
28
|
|
23
29
|
class Real
|
24
30
|
def initialize(options = {})
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Network
|
5
|
+
class SakuraCloud
|
6
|
+
class Real
|
7
|
+
def connect_interface_to_switch( id, switch_id )
|
8
|
+
response = request(
|
9
|
+
:headers => {
|
10
|
+
'Authorization' => "Basic #{@auth_encord}"
|
11
|
+
},
|
12
|
+
:expects => [200],
|
13
|
+
:method => 'PUT',
|
14
|
+
:path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface/#{id}/to/switch/#{switch_id}"
|
15
|
+
)
|
16
|
+
response.body['Interface']['ID']
|
17
|
+
end
|
18
|
+
end # Real
|
19
|
+
|
20
|
+
class Mock
|
21
|
+
def regist_interface_to_server( id, switch_id )
|
22
|
+
response = Excon::Response.new
|
23
|
+
response.status = 20
|
24
|
+
response.body = {
|
25
|
+
}
|
26
|
+
response
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end # SakuraCloud
|
30
|
+
end # Network0
|
31
|
+
end # Fog
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Network
|
5
|
+
class SakuraCloud
|
6
|
+
class Real
|
7
|
+
def delete_interface( id )
|
8
|
+
request(
|
9
|
+
:headers => {
|
10
|
+
'Authorization' => "Basic #{@auth_encord}"
|
11
|
+
},
|
12
|
+
:expects => [200],
|
13
|
+
:method => 'DELETE',
|
14
|
+
:path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface/#{id}"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end # Real
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
def delete_interface( id )
|
21
|
+
response = Excon::Response.new
|
22
|
+
response.status = 200
|
23
|
+
response.body = {
|
24
|
+
}
|
25
|
+
response
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end # SakuraCloud
|
29
|
+
end # Network
|
30
|
+
end # Fog
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Network
|
5
|
+
class SakuraCloud
|
6
|
+
class Real
|
7
|
+
def list_interfaces(options = {})
|
8
|
+
filter = {
|
9
|
+
"Include" => [
|
10
|
+
"ID",
|
11
|
+
"MACAddress",
|
12
|
+
"IPAddress",
|
13
|
+
"UserIPAddress",
|
14
|
+
"Switch.ID",
|
15
|
+
"Server.ID"]
|
16
|
+
}
|
17
|
+
request(
|
18
|
+
:headers => {
|
19
|
+
'Authorization' => "Basic #{@auth_encord}"
|
20
|
+
},
|
21
|
+
:method => 'GET',
|
22
|
+
:path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface",
|
23
|
+
:query => URI.encode(Fog::JSON.encode(filter))
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
def list_interfaces(options = {})
|
30
|
+
response = Excon::Response.new
|
31
|
+
response.status = 200
|
32
|
+
response.body = {
|
33
|
+
}
|
34
|
+
response
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Network
|
5
|
+
class SakuraCloud
|
6
|
+
class Real
|
7
|
+
def regist_interface_to_server( server_id )
|
8
|
+
body = {
|
9
|
+
"Interface" => {
|
10
|
+
"Server" => {
|
11
|
+
"ID" => server_id
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
response = request(
|
17
|
+
:headers => {
|
18
|
+
'Authorization' => "Basic #{@auth_encord}"
|
19
|
+
},
|
20
|
+
:expects => [201],
|
21
|
+
:method => 'POST',
|
22
|
+
:path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/interface",
|
23
|
+
:body => Fog::JSON.encode(body)
|
24
|
+
)
|
25
|
+
response.body['Interface']['ID']
|
26
|
+
end
|
27
|
+
end # Real
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
def regist_interface_to_server( id )
|
31
|
+
response = Excon::Response.new
|
32
|
+
response.status = 201
|
33
|
+
response.body = {
|
34
|
+
}
|
35
|
+
response
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end # SakuraCloud
|
39
|
+
end # Network
|
40
|
+
end # Fog
|
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.2.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-09-
|
11
|
+
date: 2015-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -221,6 +221,8 @@ files:
|
|
221
221
|
- lib/fog/sakuracloud/models/compute/ssh_keys.rb
|
222
222
|
- lib/fog/sakuracloud/models/compute/zone.rb
|
223
223
|
- lib/fog/sakuracloud/models/compute/zones.rb
|
224
|
+
- lib/fog/sakuracloud/models/network/interface.rb
|
225
|
+
- lib/fog/sakuracloud/models/network/interfaces.rb
|
224
226
|
- lib/fog/sakuracloud/models/network/router.rb
|
225
227
|
- lib/fog/sakuracloud/models/network/routers.rb
|
226
228
|
- lib/fog/sakuracloud/models/network/switch.rb
|
@@ -242,12 +244,16 @@ files:
|
|
242
244
|
- lib/fog/sakuracloud/requests/compute/list_ssh_keys.rb
|
243
245
|
- lib/fog/sakuracloud/requests/compute/list_zones.rb
|
244
246
|
- lib/fog/sakuracloud/requests/compute/stop_server.rb
|
247
|
+
- lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb
|
245
248
|
- lib/fog/sakuracloud/requests/network/create_router.rb
|
246
249
|
- lib/fog/sakuracloud/requests/network/create_switch.rb
|
250
|
+
- lib/fog/sakuracloud/requests/network/delete_interface.rb
|
247
251
|
- lib/fog/sakuracloud/requests/network/delete_router.rb
|
248
252
|
- lib/fog/sakuracloud/requests/network/delete_switch.rb
|
253
|
+
- lib/fog/sakuracloud/requests/network/list_interfaces.rb
|
249
254
|
- lib/fog/sakuracloud/requests/network/list_routers.rb
|
250
255
|
- lib/fog/sakuracloud/requests/network/list_switches.rb
|
256
|
+
- lib/fog/sakuracloud/requests/network/regist_interface_to_server.rb
|
251
257
|
- lib/fog/sakuracloud/requests/script/create_note.rb
|
252
258
|
- lib/fog/sakuracloud/requests/script/delete_note.rb
|
253
259
|
- lib/fog/sakuracloud/requests/script/list_notes.rb
|