saklient 0.0.2.3 → 0.0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/saklient/cloud/client.rb +1 -1
- data/lib/saklient/cloud/models/model_license_info.rb +1 -1
- data/lib/saklient/cloud/resources/license_info.rb +0 -1
- data/lib/saklient/cloud/resources/swytch.rb +58 -0
- data/lib/saklient/version.rb +1 -1
- data/spec/bridge_spec.rb +16 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9c0814de498b9ba0c287cf796ec4db49262344d
|
4
|
+
data.tar.gz: 38ba8a9e76602f1d7693544bde3050def0fc7072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8863f52fd5d859c29ab80eb2ab63e5e044f401f9c33fc16d0547e7c38a22d8e61e839275589c37b1f45547b080d5396e14160e116099d84484b8d85e1a82027
|
7
|
+
data.tar.gz: 069c1c54f95521e23e1a075a232ba8b1d4de1aa05d725484ef92b038d6ed53a86a5db470a2c38a34b9906685161cc2bf820c2a93ae7c6800fcaa3aad3b6e3d5c
|
@@ -73,7 +73,7 @@ module Saklient
|
|
73
73
|
|
74
74
|
extra_headers = {
|
75
75
|
'Content-Type' => 'application/x-www-form-urlencoded',
|
76
|
-
'User-Agent' => 'saklient.ruby ver-0.0.2.
|
76
|
+
'User-Agent' => 'saklient.ruby ver-0.0.2.4 rev-a581b28f8ddd2cd75cb32f710d33d3d650bba044',
|
77
77
|
'X-Requested-With' => 'XMLHttpRequest',
|
78
78
|
'X-Sakura-HTTP-Method' => method,
|
79
79
|
'X-Sakura-Error-Level' => 'warning',
|
@@ -119,7 +119,7 @@ module Saklient
|
|
119
119
|
#
|
120
120
|
# @todo Implement test case
|
121
121
|
# @param [bool] reverse
|
122
|
-
# @return [
|
122
|
+
# @return [Model_LicenseInfo]
|
123
123
|
def sort_by_name(reverse = false)
|
124
124
|
Saklient::Util::validate_type(reverse, 'bool')
|
125
125
|
return _sort_by_name(reverse)
|
@@ -7,6 +7,7 @@ require_relative 'icon'
|
|
7
7
|
require_relative 'router'
|
8
8
|
require_relative 'ipv4_net'
|
9
9
|
require_relative 'ipv6_net'
|
10
|
+
require_relative 'bridge'
|
10
11
|
|
11
12
|
module Saklient
|
12
13
|
module Cloud
|
@@ -57,6 +58,11 @@ module Saklient
|
|
57
58
|
# @return [Router]
|
58
59
|
attr_accessor :m_router
|
59
60
|
|
61
|
+
# 接続されているブリッジ
|
62
|
+
#
|
63
|
+
# @return [Bridge]
|
64
|
+
attr_accessor :m_bridge
|
65
|
+
|
60
66
|
# IPv4ネットワーク(ルータによる自動割当) {Ipv4Net} の配列
|
61
67
|
#
|
62
68
|
# @return [Array<Ipv4Net>]
|
@@ -178,6 +184,26 @@ module Saklient
|
|
178
184
|
return self
|
179
185
|
end
|
180
186
|
|
187
|
+
# このルータ+スイッチをブリッジに接続します.
|
188
|
+
#
|
189
|
+
# @param [Bridge] bridge
|
190
|
+
# @return [Swytch] this
|
191
|
+
def connect_to_bridge(bridge)
|
192
|
+
Saklient::Util::validate_type(bridge, 'Saklient::Cloud::Resources::Bridge')
|
193
|
+
result = @_client.request('PUT', _api_path + '/' + _id + '/to/bridge/' + bridge._id)
|
194
|
+
reload
|
195
|
+
return self
|
196
|
+
end
|
197
|
+
|
198
|
+
# このルータ+スイッチをブリッジから切断します.
|
199
|
+
#
|
200
|
+
# @return [Swytch] this
|
201
|
+
def disconnect_from_bridge
|
202
|
+
result = @_client.request('DELETE', _api_path + '/' + _id + '/to/bridge')
|
203
|
+
reload
|
204
|
+
return self
|
205
|
+
end
|
206
|
+
|
181
207
|
protected
|
182
208
|
|
183
209
|
# @return [bool]
|
@@ -437,6 +463,30 @@ module Saklient
|
|
437
463
|
|
438
464
|
protected
|
439
465
|
|
466
|
+
# @return [bool]
|
467
|
+
attr_accessor :n_bridge
|
468
|
+
|
469
|
+
# (This method is generated in Translator_default#buildImpl)
|
470
|
+
#
|
471
|
+
# @private
|
472
|
+
# @return [Bridge]
|
473
|
+
def get_bridge
|
474
|
+
return @m_bridge
|
475
|
+
end
|
476
|
+
|
477
|
+
public
|
478
|
+
|
479
|
+
# 接続されているブリッジ
|
480
|
+
#
|
481
|
+
# @return [Bridge]
|
482
|
+
attr_reader :bridge
|
483
|
+
|
484
|
+
def bridge
|
485
|
+
get_bridge
|
486
|
+
end
|
487
|
+
|
488
|
+
protected
|
489
|
+
|
440
490
|
# @return [bool]
|
441
491
|
attr_accessor :n_ipv4_nets
|
442
492
|
|
@@ -557,6 +607,13 @@ module Saklient
|
|
557
607
|
@is_incomplete = true
|
558
608
|
end
|
559
609
|
@n_router = false
|
610
|
+
if Saklient::Util::exists_path(r, 'Bridge')
|
611
|
+
@m_bridge = (Saklient::Util::get_by_path(r, 'Bridge')).nil? ? nil : Saklient::Cloud::Resources::Bridge.new(@_client, Saklient::Util::get_by_path(r, 'Bridge'))
|
612
|
+
else
|
613
|
+
@m_bridge = nil
|
614
|
+
@is_incomplete = true
|
615
|
+
end
|
616
|
+
@n_bridge = false
|
560
617
|
if Saklient::Util::exists_path(r, 'Subnets')
|
561
618
|
if (Saklient::Util::get_by_path(r, 'Subnets')).nil?
|
562
619
|
@m_ipv4_nets = []
|
@@ -617,6 +674,7 @@ module Saklient
|
|
617
674
|
Saklient::Util::set_by_path(ret, 'UserSubnet.DefaultRoute', @m_user_default_route) if withClean || @n_user_default_route
|
618
675
|
Saklient::Util::set_by_path(ret, 'UserSubnet.NetworkMaskLen', @m_user_mask_len) if withClean || @n_user_mask_len
|
619
676
|
Saklient::Util::set_by_path(ret, 'Internet', withClean ? ((@m_router).nil? ? nil : @m_router.api_serialize(withClean)) : ((@m_router).nil? ? { ID: '0' } : @m_router.api_serialize_id)) if withClean || @n_router
|
677
|
+
Saklient::Util::set_by_path(ret, 'Bridge', withClean ? ((@m_bridge).nil? ? nil : @m_bridge.api_serialize(withClean)) : ((@m_bridge).nil? ? { ID: '0' } : @m_bridge.api_serialize_id)) if withClean || @n_bridge
|
620
678
|
if withClean || @n_ipv4_nets
|
621
679
|
Saklient::Util::set_by_path(ret, 'Subnets', [])
|
622
680
|
for r2 in @m_ipv4_nets
|
data/lib/saklient/version.rb
CHANGED
data/spec/bridge_spec.rb
CHANGED
@@ -57,10 +57,24 @@ describe 'Bridge' do
|
|
57
57
|
bridge.description = description
|
58
58
|
bridge.region = regions[0]
|
59
59
|
bridge.save
|
60
|
-
|
61
60
|
expect(bridge).to be_an_instance_of Saklient::Cloud::Resources::Bridge
|
62
61
|
|
63
|
-
|
62
|
+
puts 'スイッチを作成しています...'
|
63
|
+
swytch = @api.swytch.create
|
64
|
+
swytch.name = name
|
65
|
+
swytch.description = description
|
66
|
+
swytch.save
|
67
|
+
expect(swytch).to be_an_instance_of Saklient::Cloud::Resources::Swytch
|
68
|
+
|
69
|
+
puts 'スイッチをブリッジに接続しています...'
|
70
|
+
swytch.connect_to_bridge(bridge)
|
71
|
+
|
72
|
+
puts 'スイッチをブリッジから切断しています...'
|
73
|
+
swytch.disconnect_from_bridge
|
74
|
+
|
75
|
+
puts 'スイッチを削除しています...'
|
76
|
+
swytch.destroy
|
77
|
+
|
64
78
|
puts 'ブリッジを削除しています...'
|
65
79
|
bridge.destroy
|
66
80
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saklient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- townewgokgok
|
@@ -298,3 +298,4 @@ test_files:
|
|
298
298
|
- spec/router_spec.rb
|
299
299
|
- spec/server_spec.rb
|
300
300
|
- spec/util_spec.rb
|
301
|
+
has_rdoc:
|