saklient 0.0.2.7 → 0.0.2.8
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/resources/activity.rb +90 -0
- data/lib/saklient/cloud/resources/disk.rb +26 -0
- data/lib/saklient/cloud/resources/disk_activity.rb +72 -0
- data/lib/saklient/cloud/resources/disk_activity_sample.rb +129 -0
- data/lib/saklient/cloud/resources/iface.rb +37 -0
- data/lib/saklient/cloud/resources/iface_activity.rb +78 -0
- data/lib/saklient/cloud/resources/iface_activity_sample.rb +129 -0
- data/lib/saklient/cloud/resources/ipv4_range.rb +3 -3
- data/lib/saklient/cloud/resources/lb_server.rb +2 -0
- data/lib/saklient/cloud/resources/load_balancer.rb +1 -1
- data/lib/saklient/cloud/resources/router.rb +37 -0
- data/lib/saklient/cloud/resources/router_activity.rb +72 -0
- data/lib/saklient/cloud/resources/router_activity_sample.rb +129 -0
- data/lib/saklient/cloud/resources/server.rb +37 -0
- data/lib/saklient/cloud/resources/server_activity.rb +72 -0
- data/lib/saklient/cloud/resources/server_activity_sample.rb +98 -0
- data/lib/saklient/cloud/resources/swytch.rb +1 -1
- data/lib/saklient/version.rb +1 -1
- data/spec/loadbalancer_spec.rb +15 -5
- metadata +11 -4
- data/spec/ipv4net_spec.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87140bb4c6fba13d581e1ea1837dd2b48624542c
|
4
|
+
data.tar.gz: c0688e1e5079d7703bf8b9d3b04bc59f3de2bf5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bed1ad451d918a6f9f8bb2fc4817a6f7d689c48a52cc9b67d6878938ed4d23c2763890feb6f8f41e2dca1135ddd5c501085e226ba6f5d4388c8c82d80453dc95
|
7
|
+
data.tar.gz: 46e0560f5b18e870ed095eb0b77cff1a33c3fb95b223eb9707ec946f61dc6c2443406905e5299a712122564052d52ea3cc997376b83bfb7cfeed6d80d092de8f
|
@@ -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.8 rev-3b18f823b96ca9e1efbfa161fdf55b8aee1cecbf',
|
77
77
|
'X-Requested-With' => 'XMLHttpRequest',
|
78
78
|
'X-Sakura-HTTP-Method' => method,
|
79
79
|
'X-Sakura-Error-Level' => 'warning',
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../util'
|
4
|
+
require_relative '../client'
|
5
|
+
|
6
|
+
module Saklient
|
7
|
+
module Cloud
|
8
|
+
module Resources
|
9
|
+
|
10
|
+
class Activity
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [Saklient::Cloud::Client]
|
16
|
+
attr_accessor :_client
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :_source_id
|
21
|
+
|
22
|
+
# @private
|
23
|
+
# @return [String]
|
24
|
+
def _api_path_prefix
|
25
|
+
return nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# @private
|
29
|
+
# @return [String]
|
30
|
+
def _api_path_suffix
|
31
|
+
return '/monitor'
|
32
|
+
end
|
33
|
+
|
34
|
+
# @private
|
35
|
+
# @param [String] atStr
|
36
|
+
# @param [any] data
|
37
|
+
# @return [void]
|
38
|
+
def _add_sample(atStr, data)
|
39
|
+
Saklient::Util::validate_type(atStr, 'String')
|
40
|
+
end
|
41
|
+
|
42
|
+
public
|
43
|
+
|
44
|
+
# @private
|
45
|
+
# @param [Saklient::Cloud::Client] client
|
46
|
+
def initialize(client)
|
47
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
48
|
+
@_client = client
|
49
|
+
end
|
50
|
+
|
51
|
+
# @private
|
52
|
+
# @param [String] id
|
53
|
+
# @return [void]
|
54
|
+
def set_source_id(id)
|
55
|
+
Saklient::Util::validate_type(id, 'String')
|
56
|
+
@_source_id = id
|
57
|
+
end
|
58
|
+
|
59
|
+
# アクティビティを取得します.
|
60
|
+
#
|
61
|
+
# * @return アクティビティ
|
62
|
+
#
|
63
|
+
# @private
|
64
|
+
# @param [NativeDate] startDate
|
65
|
+
# @param [NativeDate] endDate
|
66
|
+
# @return [Activity]
|
67
|
+
def _fetch(startDate = nil, endDate = nil)
|
68
|
+
Saklient::Util::validate_type(startDate, 'NativeDate')
|
69
|
+
Saklient::Util::validate_type(endDate, 'NativeDate')
|
70
|
+
query = {}
|
71
|
+
query[:Start] = Saklient::Util::date2str(startDate) if !(startDate).nil?
|
72
|
+
query[:End] = Saklient::Util::date2str(endDate) if !(endDate).nil?
|
73
|
+
path = _api_path_prefix + '/' + Saklient::Util::url_encode(@_source_id) + _api_path_suffix
|
74
|
+
data = @_client.request('GET', path)
|
75
|
+
return nil if (data).nil?
|
76
|
+
data = data[:Data]
|
77
|
+
return nil if (data).nil?
|
78
|
+
dates = data.keys.map{|k| k.to_s}
|
79
|
+
dates = dates.sort()
|
80
|
+
for date in dates
|
81
|
+
_add_sample(date, data[date.to_sym])
|
82
|
+
end
|
83
|
+
return self
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -7,6 +7,7 @@ require_relative 'icon'
|
|
7
7
|
require_relative 'disk_plan'
|
8
8
|
require_relative 'server'
|
9
9
|
require_relative 'disk_config'
|
10
|
+
require_relative 'disk_activity'
|
10
11
|
require_relative '../enums/eavailability'
|
11
12
|
require_relative '../enums/edisk_connection'
|
12
13
|
require_relative '../enums/estorage_class'
|
@@ -116,6 +117,29 @@ module Saklient
|
|
116
117
|
return _reload
|
117
118
|
end
|
118
119
|
|
120
|
+
protected
|
121
|
+
|
122
|
+
# @private
|
123
|
+
# @return [DiskActivity]
|
124
|
+
attr_accessor :_activity
|
125
|
+
|
126
|
+
public
|
127
|
+
|
128
|
+
# @private
|
129
|
+
# @return [DiskActivity]
|
130
|
+
def get_activity
|
131
|
+
return @_activity
|
132
|
+
end
|
133
|
+
|
134
|
+
# アクティビティ
|
135
|
+
#
|
136
|
+
# @return [DiskActivity]
|
137
|
+
attr_reader :activity
|
138
|
+
|
139
|
+
def activity
|
140
|
+
get_activity
|
141
|
+
end
|
142
|
+
|
119
143
|
# @private
|
120
144
|
# @param [Saklient::Cloud::Client] client
|
121
145
|
# @param [any] obj
|
@@ -124,6 +148,7 @@ module Saklient
|
|
124
148
|
super(client)
|
125
149
|
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
126
150
|
Saklient::Util::validate_type(wrapped, 'bool')
|
151
|
+
@_activity = Saklient::Cloud::Resources::DiskActivity.new(client)
|
127
152
|
api_deserialize(obj, wrapped)
|
128
153
|
end
|
129
154
|
|
@@ -223,6 +248,7 @@ module Saklient
|
|
223
248
|
# @return [void]
|
224
249
|
def _on_after_api_deserialize(r, root)
|
225
250
|
if !(r).nil?
|
251
|
+
@_activity.set_source_id(_id)
|
226
252
|
if !r.nil? && r.key?(:SourceDisk)
|
227
253
|
s = r[:SourceDisk]
|
228
254
|
if !(s).nil?
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative 'activity'
|
4
|
+
require_relative 'disk_activity_sample'
|
5
|
+
|
6
|
+
module Saklient
|
7
|
+
module Cloud
|
8
|
+
module Resources
|
9
|
+
|
10
|
+
class DiskActivity < Saklient::Cloud::Resources::Activity
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [Array<DiskActivitySample>]
|
16
|
+
attr_accessor :_samples
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# @return [Array<DiskActivitySample>]
|
20
|
+
def get_samples
|
21
|
+
return @_samples
|
22
|
+
end
|
23
|
+
|
24
|
+
public
|
25
|
+
|
26
|
+
# サンプル列
|
27
|
+
#
|
28
|
+
# @return [Array<DiskActivitySample>]
|
29
|
+
attr_reader :samples
|
30
|
+
|
31
|
+
def samples
|
32
|
+
get_samples
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [String]
|
39
|
+
def _api_path_prefix
|
40
|
+
return '/disk'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @param [String] atStr
|
45
|
+
# @param [any] data
|
46
|
+
# @return [void]
|
47
|
+
def _add_sample(atStr, data)
|
48
|
+
Saklient::Util::validate_type(atStr, 'String')
|
49
|
+
@_samples << Saklient::Cloud::Resources::DiskActivitySample.new(atStr, data)
|
50
|
+
end
|
51
|
+
|
52
|
+
public
|
53
|
+
|
54
|
+
# アクティビティを取得します.
|
55
|
+
#
|
56
|
+
# * @return アクティビティ
|
57
|
+
#
|
58
|
+
# @param [NativeDate] startDate
|
59
|
+
# @param [NativeDate] endDate
|
60
|
+
# @return [DiskActivity]
|
61
|
+
def fetch(startDate = nil, endDate = nil)
|
62
|
+
Saklient::Util::validate_type(startDate, 'NativeDate')
|
63
|
+
Saklient::Util::validate_type(endDate, 'NativeDate')
|
64
|
+
@_samples = []
|
65
|
+
return _fetch(startDate, endDate)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../util'
|
4
|
+
|
5
|
+
module Saklient
|
6
|
+
module Cloud
|
7
|
+
module Resources
|
8
|
+
|
9
|
+
# @private
|
10
|
+
class DiskActivitySample
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [NativeDate]
|
16
|
+
attr_accessor :_at
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
# @private
|
21
|
+
# @return [NativeDate]
|
22
|
+
def get_at
|
23
|
+
return @_at
|
24
|
+
end
|
25
|
+
|
26
|
+
# 記録日時
|
27
|
+
#
|
28
|
+
# @return [NativeDate]
|
29
|
+
attr_reader :at
|
30
|
+
|
31
|
+
def at
|
32
|
+
get_at
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [bool]
|
39
|
+
attr_accessor :_is_available
|
40
|
+
|
41
|
+
public
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [bool]
|
45
|
+
def get_is_available
|
46
|
+
return @_is_available
|
47
|
+
end
|
48
|
+
|
49
|
+
# 有効な値のとき真
|
50
|
+
#
|
51
|
+
# @return [bool]
|
52
|
+
attr_reader :is_available
|
53
|
+
|
54
|
+
def is_available
|
55
|
+
get_is_available
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
# @private
|
61
|
+
# @return [Float]
|
62
|
+
attr_accessor :_write
|
63
|
+
|
64
|
+
public
|
65
|
+
|
66
|
+
# @private
|
67
|
+
# @return [Float]
|
68
|
+
def get_write
|
69
|
+
return @_write
|
70
|
+
end
|
71
|
+
|
72
|
+
# ライト[BPS]
|
73
|
+
#
|
74
|
+
# @return [Float]
|
75
|
+
attr_reader :write
|
76
|
+
|
77
|
+
def write
|
78
|
+
get_write
|
79
|
+
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
|
83
|
+
# @private
|
84
|
+
# @return [Float]
|
85
|
+
attr_accessor :_read
|
86
|
+
|
87
|
+
public
|
88
|
+
|
89
|
+
# @private
|
90
|
+
# @return [Float]
|
91
|
+
def get_read
|
92
|
+
return @_read
|
93
|
+
end
|
94
|
+
|
95
|
+
# リード[BPS]
|
96
|
+
#
|
97
|
+
# @return [Float]
|
98
|
+
attr_reader :read
|
99
|
+
|
100
|
+
def read
|
101
|
+
get_read
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param [String] atStr
|
105
|
+
# @param [any] data
|
106
|
+
def initialize(atStr, data)
|
107
|
+
Saklient::Util::validate_type(atStr, 'String')
|
108
|
+
@_at = Saklient::Util::str2date(atStr)
|
109
|
+
@_is_available = true
|
110
|
+
v = nil
|
111
|
+
v = data[:Write]
|
112
|
+
if (v).nil?
|
113
|
+
@_is_available = false
|
114
|
+
else
|
115
|
+
@_write = v
|
116
|
+
end
|
117
|
+
v = data[:Read]
|
118
|
+
if (v).nil?
|
119
|
+
@_is_available = false
|
120
|
+
else
|
121
|
+
@_read = v
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -4,6 +4,7 @@ require_relative '../../errors/saklient_exception'
|
|
4
4
|
require_relative '../client'
|
5
5
|
require_relative 'resource'
|
6
6
|
require_relative 'swytch'
|
7
|
+
require_relative 'iface_activity'
|
7
8
|
|
8
9
|
module Saklient
|
9
10
|
module Cloud
|
@@ -85,6 +86,29 @@ module Saklient
|
|
85
86
|
return _reload
|
86
87
|
end
|
87
88
|
|
89
|
+
protected
|
90
|
+
|
91
|
+
# @private
|
92
|
+
# @return [IfaceActivity]
|
93
|
+
attr_accessor :_activity
|
94
|
+
|
95
|
+
public
|
96
|
+
|
97
|
+
# @private
|
98
|
+
# @return [IfaceActivity]
|
99
|
+
def get_activity
|
100
|
+
return @_activity
|
101
|
+
end
|
102
|
+
|
103
|
+
# アクティビティ
|
104
|
+
#
|
105
|
+
# @return [IfaceActivity]
|
106
|
+
attr_reader :activity
|
107
|
+
|
108
|
+
def activity
|
109
|
+
get_activity
|
110
|
+
end
|
111
|
+
|
88
112
|
# @private
|
89
113
|
# @param [Saklient::Cloud::Client] client
|
90
114
|
# @param [any] obj
|
@@ -93,9 +117,22 @@ module Saklient
|
|
93
117
|
super(client)
|
94
118
|
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
95
119
|
Saklient::Util::validate_type(wrapped, 'bool')
|
120
|
+
@_activity = Saklient::Cloud::Resources::IfaceActivity.new(client)
|
96
121
|
api_deserialize(obj, wrapped)
|
97
122
|
end
|
98
123
|
|
124
|
+
protected
|
125
|
+
|
126
|
+
# @private
|
127
|
+
# @param [any] r
|
128
|
+
# @param [any] root
|
129
|
+
# @return [void]
|
130
|
+
def _on_after_api_deserialize(r, root)
|
131
|
+
@_activity.set_source_id(_id) if !(r).nil?
|
132
|
+
end
|
133
|
+
|
134
|
+
public
|
135
|
+
|
99
136
|
# スイッチに接続します.
|
100
137
|
#
|
101
138
|
# @param [Swytch] swytch 接続先のスイッチ.
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative 'activity'
|
4
|
+
require_relative 'iface_activity_sample'
|
5
|
+
|
6
|
+
module Saklient
|
7
|
+
module Cloud
|
8
|
+
module Resources
|
9
|
+
|
10
|
+
class IfaceActivity < Saklient::Cloud::Resources::Activity
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [Array<IfaceActivitySample>]
|
16
|
+
attr_accessor :_samples
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# @return [Array<IfaceActivitySample>]
|
20
|
+
def get_samples
|
21
|
+
return @_samples
|
22
|
+
end
|
23
|
+
|
24
|
+
public
|
25
|
+
|
26
|
+
# サンプル列
|
27
|
+
#
|
28
|
+
# @return [Array<IfaceActivitySample>]
|
29
|
+
attr_reader :samples
|
30
|
+
|
31
|
+
def samples
|
32
|
+
get_samples
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [String]
|
39
|
+
def _api_path_prefix
|
40
|
+
return '/interface'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [String]
|
45
|
+
def _api_path_suffix
|
46
|
+
return '/monitor'
|
47
|
+
end
|
48
|
+
|
49
|
+
# @private
|
50
|
+
# @param [String] atStr
|
51
|
+
# @param [any] data
|
52
|
+
# @return [void]
|
53
|
+
def _add_sample(atStr, data)
|
54
|
+
Saklient::Util::validate_type(atStr, 'String')
|
55
|
+
@_samples << Saklient::Cloud::Resources::IfaceActivitySample.new(atStr, data)
|
56
|
+
end
|
57
|
+
|
58
|
+
public
|
59
|
+
|
60
|
+
# アクティビティを取得します.
|
61
|
+
#
|
62
|
+
# * @return アクティビティ
|
63
|
+
#
|
64
|
+
# @param [NativeDate] startDate
|
65
|
+
# @param [NativeDate] endDate
|
66
|
+
# @return [IfaceActivity]
|
67
|
+
def fetch(startDate = nil, endDate = nil)
|
68
|
+
Saklient::Util::validate_type(startDate, 'NativeDate')
|
69
|
+
Saklient::Util::validate_type(endDate, 'NativeDate')
|
70
|
+
@_samples = []
|
71
|
+
return _fetch(startDate, endDate)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../util'
|
4
|
+
|
5
|
+
module Saklient
|
6
|
+
module Cloud
|
7
|
+
module Resources
|
8
|
+
|
9
|
+
# @private
|
10
|
+
class IfaceActivitySample
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [NativeDate]
|
16
|
+
attr_accessor :_at
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
# @private
|
21
|
+
# @return [NativeDate]
|
22
|
+
def get_at
|
23
|
+
return @_at
|
24
|
+
end
|
25
|
+
|
26
|
+
# 記録日時
|
27
|
+
#
|
28
|
+
# @return [NativeDate]
|
29
|
+
attr_reader :at
|
30
|
+
|
31
|
+
def at
|
32
|
+
get_at
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [bool]
|
39
|
+
attr_accessor :_is_available
|
40
|
+
|
41
|
+
public
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [bool]
|
45
|
+
def get_is_available
|
46
|
+
return @_is_available
|
47
|
+
end
|
48
|
+
|
49
|
+
# 有効な値のとき真
|
50
|
+
#
|
51
|
+
# @return [bool]
|
52
|
+
attr_reader :is_available
|
53
|
+
|
54
|
+
def is_available
|
55
|
+
get_is_available
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
# @private
|
61
|
+
# @return [Float]
|
62
|
+
attr_accessor :_send
|
63
|
+
|
64
|
+
public
|
65
|
+
|
66
|
+
# @private
|
67
|
+
# @return [Float]
|
68
|
+
def get_send
|
69
|
+
return @_send
|
70
|
+
end
|
71
|
+
|
72
|
+
# 送信[byte/sec]
|
73
|
+
#
|
74
|
+
# @return [Float]
|
75
|
+
attr_reader :send
|
76
|
+
|
77
|
+
def send
|
78
|
+
get_send
|
79
|
+
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
|
83
|
+
# @private
|
84
|
+
# @return [Float]
|
85
|
+
attr_accessor :_receive
|
86
|
+
|
87
|
+
public
|
88
|
+
|
89
|
+
# @private
|
90
|
+
# @return [Float]
|
91
|
+
def get_receive
|
92
|
+
return @_receive
|
93
|
+
end
|
94
|
+
|
95
|
+
# 受信[byte/sec]
|
96
|
+
#
|
97
|
+
# @return [Float]
|
98
|
+
attr_reader :receive
|
99
|
+
|
100
|
+
def receive
|
101
|
+
get_receive
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param [String] atStr
|
105
|
+
# @param [any] data
|
106
|
+
def initialize(atStr, data)
|
107
|
+
Saklient::Util::validate_type(atStr, 'String')
|
108
|
+
@_at = Saklient::Util::str2date(atStr)
|
109
|
+
@_is_available = true
|
110
|
+
v = nil
|
111
|
+
v = data[:Send]
|
112
|
+
if (v).nil?
|
113
|
+
@_is_available = false
|
114
|
+
else
|
115
|
+
@_send = v
|
116
|
+
end
|
117
|
+
v = data[:Receive]
|
118
|
+
if (v).nil?
|
119
|
+
@_is_available = false
|
120
|
+
else
|
121
|
+
@_receive = v
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -71,7 +71,7 @@ module Saklient
|
|
71
71
|
i1 = Saklient::Util::ip2long(@_last)
|
72
72
|
while i <= i1 do
|
73
73
|
ret << Saklient::Util::long2ip(i)
|
74
|
-
i
|
74
|
+
i+=1
|
75
75
|
end
|
76
76
|
return ret
|
77
77
|
end
|
@@ -92,11 +92,11 @@ module Saklient
|
|
92
92
|
first = Saklient::Util::get_by_path_any([obj], ['Min', 'min'])
|
93
93
|
@_first = nil
|
94
94
|
@_first = first if !(first).nil?
|
95
|
-
@_first = nil if @_first == ''
|
95
|
+
@_first = nil if !(@_first).nil? && @_first == ''
|
96
96
|
last = Saklient::Util::get_by_path_any([obj], ['Max', 'max'])
|
97
97
|
@_last = nil
|
98
98
|
@_last = last if !(last).nil?
|
99
|
-
@_last = nil if @_last == ''
|
99
|
+
@_last = nil if !(@_last).nil? && @_last == ''
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
@@ -271,6 +271,8 @@ module Saklient
|
|
271
271
|
@_response_expected = nil
|
272
272
|
@_response_expected = (responseExpected).to_s().to_i(10) if !(responseExpected).nil?
|
273
273
|
@_response_expected = nil if @_response_expected == 0
|
274
|
+
@_active_connections = 0
|
275
|
+
@_status = nil
|
274
276
|
end
|
275
277
|
|
276
278
|
# @return [any]
|
@@ -239,7 +239,7 @@ module Saklient
|
|
239
239
|
# @return [LoadBalancer]
|
240
240
|
def reload_status
|
241
241
|
result = request_retry('GET', _api_path + '/' + Saklient::Util::url_encode(_id) + '/status')
|
242
|
-
if !result.nil? && result.key?(:LoadBalancer)
|
242
|
+
if !(result).nil? && (!result.nil? && result.key?(:LoadBalancer))
|
243
243
|
vips = result[:LoadBalancer]
|
244
244
|
for vipDyn in vips
|
245
245
|
vipStr = vipDyn[:VirtualIPAddress]
|
@@ -7,6 +7,7 @@ require_relative 'icon'
|
|
7
7
|
require_relative 'swytch'
|
8
8
|
require_relative 'ipv4_net'
|
9
9
|
require_relative 'ipv6_net'
|
10
|
+
require_relative 'router_activity'
|
10
11
|
require_relative '../models/model_swytch'
|
11
12
|
|
12
13
|
module Saklient
|
@@ -94,6 +95,29 @@ module Saklient
|
|
94
95
|
return _reload
|
95
96
|
end
|
96
97
|
|
98
|
+
protected
|
99
|
+
|
100
|
+
# @private
|
101
|
+
# @return [RouterActivity]
|
102
|
+
attr_accessor :_activity
|
103
|
+
|
104
|
+
public
|
105
|
+
|
106
|
+
# @private
|
107
|
+
# @return [RouterActivity]
|
108
|
+
def get_activity
|
109
|
+
return @_activity
|
110
|
+
end
|
111
|
+
|
112
|
+
# アクティビティ
|
113
|
+
#
|
114
|
+
# @return [RouterActivity]
|
115
|
+
attr_reader :activity
|
116
|
+
|
117
|
+
def activity
|
118
|
+
get_activity
|
119
|
+
end
|
120
|
+
|
97
121
|
# @private
|
98
122
|
# @param [Saklient::Cloud::Client] client
|
99
123
|
# @param [any] obj
|
@@ -102,9 +126,22 @@ module Saklient
|
|
102
126
|
super(client)
|
103
127
|
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
104
128
|
Saklient::Util::validate_type(wrapped, 'bool')
|
129
|
+
@_activity = Saklient::Cloud::Resources::RouterActivity.new(client)
|
105
130
|
api_deserialize(obj, wrapped)
|
106
131
|
end
|
107
132
|
|
133
|
+
protected
|
134
|
+
|
135
|
+
# @private
|
136
|
+
# @param [any] r
|
137
|
+
# @param [any] root
|
138
|
+
# @return [void]
|
139
|
+
def _on_after_api_deserialize(r, root)
|
140
|
+
@_activity.set_source_id(_id) if !(r).nil?
|
141
|
+
end
|
142
|
+
|
143
|
+
public
|
144
|
+
|
108
145
|
# 作成中のルータが利用可能になるまで待機します.
|
109
146
|
#
|
110
147
|
# @private
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative 'activity'
|
4
|
+
require_relative 'router_activity_sample'
|
5
|
+
|
6
|
+
module Saklient
|
7
|
+
module Cloud
|
8
|
+
module Resources
|
9
|
+
|
10
|
+
class RouterActivity < Saklient::Cloud::Resources::Activity
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [Array<RouterActivitySample>]
|
16
|
+
attr_accessor :_samples
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# @return [Array<RouterActivitySample>]
|
20
|
+
def get_samples
|
21
|
+
return @_samples
|
22
|
+
end
|
23
|
+
|
24
|
+
public
|
25
|
+
|
26
|
+
# サンプル列
|
27
|
+
#
|
28
|
+
# @return [Array<RouterActivitySample>]
|
29
|
+
attr_reader :samples
|
30
|
+
|
31
|
+
def samples
|
32
|
+
get_samples
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [String]
|
39
|
+
def _api_path_prefix
|
40
|
+
return '/internet'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @param [String] atStr
|
45
|
+
# @param [any] data
|
46
|
+
# @return [void]
|
47
|
+
def _add_sample(atStr, data)
|
48
|
+
Saklient::Util::validate_type(atStr, 'String')
|
49
|
+
@_samples << Saklient::Cloud::Resources::RouterActivitySample.new(atStr, data)
|
50
|
+
end
|
51
|
+
|
52
|
+
public
|
53
|
+
|
54
|
+
# アクティビティを取得します.
|
55
|
+
#
|
56
|
+
# * @return アクティビティ
|
57
|
+
#
|
58
|
+
# @param [NativeDate] startDate
|
59
|
+
# @param [NativeDate] endDate
|
60
|
+
# @return [RouterActivity]
|
61
|
+
def fetch(startDate = nil, endDate = nil)
|
62
|
+
Saklient::Util::validate_type(startDate, 'NativeDate')
|
63
|
+
Saklient::Util::validate_type(endDate, 'NativeDate')
|
64
|
+
@_samples = []
|
65
|
+
return _fetch(startDate, endDate)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../util'
|
4
|
+
|
5
|
+
module Saklient
|
6
|
+
module Cloud
|
7
|
+
module Resources
|
8
|
+
|
9
|
+
# @private
|
10
|
+
class RouterActivitySample
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [NativeDate]
|
16
|
+
attr_accessor :_at
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
# @private
|
21
|
+
# @return [NativeDate]
|
22
|
+
def get_at
|
23
|
+
return @_at
|
24
|
+
end
|
25
|
+
|
26
|
+
# 記録日時
|
27
|
+
#
|
28
|
+
# @return [NativeDate]
|
29
|
+
attr_reader :at
|
30
|
+
|
31
|
+
def at
|
32
|
+
get_at
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [bool]
|
39
|
+
attr_accessor :_is_available
|
40
|
+
|
41
|
+
public
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [bool]
|
45
|
+
def get_is_available
|
46
|
+
return @_is_available
|
47
|
+
end
|
48
|
+
|
49
|
+
# 有効な値のとき真
|
50
|
+
#
|
51
|
+
# @return [bool]
|
52
|
+
attr_reader :is_available
|
53
|
+
|
54
|
+
def is_available
|
55
|
+
get_is_available
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
# @private
|
61
|
+
# @return [Float]
|
62
|
+
attr_accessor :_outgoing
|
63
|
+
|
64
|
+
public
|
65
|
+
|
66
|
+
# @private
|
67
|
+
# @return [Float]
|
68
|
+
def get_outgoing
|
69
|
+
return @_outgoing
|
70
|
+
end
|
71
|
+
|
72
|
+
# 送信[BPS]
|
73
|
+
#
|
74
|
+
# @return [Float]
|
75
|
+
attr_reader :outgoing
|
76
|
+
|
77
|
+
def outgoing
|
78
|
+
get_outgoing
|
79
|
+
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
|
83
|
+
# @private
|
84
|
+
# @return [Float]
|
85
|
+
attr_accessor :_incoming
|
86
|
+
|
87
|
+
public
|
88
|
+
|
89
|
+
# @private
|
90
|
+
# @return [Float]
|
91
|
+
def get_incoming
|
92
|
+
return @_incoming
|
93
|
+
end
|
94
|
+
|
95
|
+
# 受信[BPS]
|
96
|
+
#
|
97
|
+
# @return [Float]
|
98
|
+
attr_reader :incoming
|
99
|
+
|
100
|
+
def incoming
|
101
|
+
get_incoming
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param [String] atStr
|
105
|
+
# @param [any] data
|
106
|
+
def initialize(atStr, data)
|
107
|
+
Saklient::Util::validate_type(atStr, 'String')
|
108
|
+
@_at = Saklient::Util::str2date(atStr)
|
109
|
+
@_is_available = true
|
110
|
+
v = nil
|
111
|
+
v = data[:Out]
|
112
|
+
if (v).nil?
|
113
|
+
@_is_available = false
|
114
|
+
else
|
115
|
+
@_outgoing = v
|
116
|
+
end
|
117
|
+
v = data[:In]
|
118
|
+
if (v).nil?
|
119
|
+
@_is_available = false
|
120
|
+
else
|
121
|
+
@_incoming = v
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -9,6 +9,7 @@ require_relative 'iface'
|
|
9
9
|
require_relative 'server_plan'
|
10
10
|
require_relative 'server_instance'
|
11
11
|
require_relative 'iso_image'
|
12
|
+
require_relative 'server_activity'
|
12
13
|
require_relative '../enums/eserver_instance_status'
|
13
14
|
require_relative '../enums/eavailability'
|
14
15
|
require_relative '../models/model_disk'
|
@@ -114,6 +115,29 @@ module Saklient
|
|
114
115
|
return _reload
|
115
116
|
end
|
116
117
|
|
118
|
+
protected
|
119
|
+
|
120
|
+
# @private
|
121
|
+
# @return [ServerActivity]
|
122
|
+
attr_accessor :_activity
|
123
|
+
|
124
|
+
public
|
125
|
+
|
126
|
+
# @private
|
127
|
+
# @return [ServerActivity]
|
128
|
+
def get_activity
|
129
|
+
return @_activity
|
130
|
+
end
|
131
|
+
|
132
|
+
# アクティビティ
|
133
|
+
#
|
134
|
+
# @return [ServerActivity]
|
135
|
+
attr_reader :activity
|
136
|
+
|
137
|
+
def activity
|
138
|
+
get_activity
|
139
|
+
end
|
140
|
+
|
117
141
|
# @private
|
118
142
|
# @param [Saklient::Cloud::Client] client
|
119
143
|
# @param [any] obj
|
@@ -122,9 +146,22 @@ module Saklient
|
|
122
146
|
super(client)
|
123
147
|
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
124
148
|
Saklient::Util::validate_type(wrapped, 'bool')
|
149
|
+
@_activity = Saklient::Cloud::Resources::ServerActivity.new(client)
|
125
150
|
api_deserialize(obj, wrapped)
|
126
151
|
end
|
127
152
|
|
153
|
+
protected
|
154
|
+
|
155
|
+
# @private
|
156
|
+
# @param [any] r
|
157
|
+
# @param [any] root
|
158
|
+
# @return [void]
|
159
|
+
def _on_after_api_deserialize(r, root)
|
160
|
+
@_activity.set_source_id(_id) if !(r).nil?
|
161
|
+
end
|
162
|
+
|
163
|
+
public
|
164
|
+
|
128
165
|
# サーバが起動しているときtrueを返します.
|
129
166
|
#
|
130
167
|
# @return [bool]
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative 'activity'
|
4
|
+
require_relative 'server_activity_sample'
|
5
|
+
|
6
|
+
module Saklient
|
7
|
+
module Cloud
|
8
|
+
module Resources
|
9
|
+
|
10
|
+
class ServerActivity < Saklient::Cloud::Resources::Activity
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [Array<ServerActivitySample>]
|
16
|
+
attr_accessor :_samples
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# @return [Array<ServerActivitySample>]
|
20
|
+
def get_samples
|
21
|
+
return @_samples
|
22
|
+
end
|
23
|
+
|
24
|
+
public
|
25
|
+
|
26
|
+
# サンプル列
|
27
|
+
#
|
28
|
+
# @return [Array<ServerActivitySample>]
|
29
|
+
attr_reader :samples
|
30
|
+
|
31
|
+
def samples
|
32
|
+
get_samples
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [String]
|
39
|
+
def _api_path_prefix
|
40
|
+
return '/server'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @param [String] atStr
|
45
|
+
# @param [any] data
|
46
|
+
# @return [void]
|
47
|
+
def _add_sample(atStr, data)
|
48
|
+
Saklient::Util::validate_type(atStr, 'String')
|
49
|
+
@_samples << Saklient::Cloud::Resources::ServerActivitySample.new(atStr, data)
|
50
|
+
end
|
51
|
+
|
52
|
+
public
|
53
|
+
|
54
|
+
# アクティビティを取得します.
|
55
|
+
#
|
56
|
+
# * @return アクティビティ
|
57
|
+
#
|
58
|
+
# @param [NativeDate] startDate
|
59
|
+
# @param [NativeDate] endDate
|
60
|
+
# @return [ServerActivity]
|
61
|
+
def fetch(startDate = nil, endDate = nil)
|
62
|
+
Saklient::Util::validate_type(startDate, 'NativeDate')
|
63
|
+
Saklient::Util::validate_type(endDate, 'NativeDate')
|
64
|
+
@_samples = []
|
65
|
+
return _fetch(startDate, endDate)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../util'
|
4
|
+
|
5
|
+
module Saklient
|
6
|
+
module Cloud
|
7
|
+
module Resources
|
8
|
+
|
9
|
+
# @private
|
10
|
+
class ServerActivitySample
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# @return [NativeDate]
|
16
|
+
attr_accessor :_at
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
# @private
|
21
|
+
# @return [NativeDate]
|
22
|
+
def get_at
|
23
|
+
return @_at
|
24
|
+
end
|
25
|
+
|
26
|
+
# 記録日時
|
27
|
+
#
|
28
|
+
# @return [NativeDate]
|
29
|
+
attr_reader :at
|
30
|
+
|
31
|
+
def at
|
32
|
+
get_at
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [bool]
|
39
|
+
attr_accessor :_is_available
|
40
|
+
|
41
|
+
public
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [bool]
|
45
|
+
def get_is_available
|
46
|
+
return @_is_available
|
47
|
+
end
|
48
|
+
|
49
|
+
# 有効な値のとき真
|
50
|
+
#
|
51
|
+
# @return [bool]
|
52
|
+
attr_reader :is_available
|
53
|
+
|
54
|
+
def is_available
|
55
|
+
get_is_available
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
# @private
|
61
|
+
# @return [Float]
|
62
|
+
attr_accessor :_cpu_time
|
63
|
+
|
64
|
+
public
|
65
|
+
|
66
|
+
# @private
|
67
|
+
# @return [Float]
|
68
|
+
def get_cpu_time
|
69
|
+
return @_cpu_time
|
70
|
+
end
|
71
|
+
|
72
|
+
# CPU時間
|
73
|
+
#
|
74
|
+
# @return [Float]
|
75
|
+
attr_reader :cpu_time
|
76
|
+
|
77
|
+
def cpu_time
|
78
|
+
get_cpu_time
|
79
|
+
end
|
80
|
+
|
81
|
+
# @param [String] atStr
|
82
|
+
# @param [any] data
|
83
|
+
def initialize(atStr, data)
|
84
|
+
Saklient::Util::validate_type(atStr, 'String')
|
85
|
+
@_at = Saklient::Util::str2date(atStr)
|
86
|
+
@_is_available = false
|
87
|
+
v = data['CPU-TIME'.to_sym]
|
88
|
+
if !(v).nil?
|
89
|
+
@_is_available = true
|
90
|
+
@_cpu_time = v
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -250,7 +250,7 @@ module Saklient
|
|
250
250
|
return nil if nets.length < 1
|
251
251
|
used = _used_ipv4_address_hash
|
252
252
|
ret = []
|
253
|
-
for ip in nets[0].
|
253
|
+
for ip in nets[0].get_range.get_as_array
|
254
254
|
ret << ip if !(!used.nil? && used.key?(ip.to_sym))
|
255
255
|
end
|
256
256
|
return ret.sort()
|
data/lib/saklient/version.rb
CHANGED
data/spec/loadbalancer_spec.rb
CHANGED
@@ -8,8 +8,7 @@ describe 'LoadBalancer' do
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
TESTS_CONFIG_READYMADE_LB_ID = nil
|
12
|
-
TESTS_CONFIG_READYMADE_SWYTCH_ID = '112500447075' #'112600553094'
|
11
|
+
TESTS_CONFIG_READYMADE_LB_ID = nil
|
13
12
|
|
14
13
|
before do
|
15
14
|
|
@@ -56,9 +55,20 @@ describe 'LoadBalancer' do
|
|
56
55
|
|
57
56
|
# search a switch
|
58
57
|
puts 'searching a swytch...'
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
swytches = @api.swytch.with_name_like('saklient-lb-attached').limit(1).find
|
59
|
+
if 0 < swytches.length
|
60
|
+
swytch = swytches[0]
|
61
|
+
else
|
62
|
+
puts 'ルータ+スイッチを作成しています...'
|
63
|
+
router = @api.router.create
|
64
|
+
router.name = 'saklient-lb-attached'
|
65
|
+
router.band_width_mbps = 100
|
66
|
+
router.network_mask_len = 28
|
67
|
+
router.save
|
68
|
+
puts 'ルータ+スイッチの作成完了を待機しています...'
|
69
|
+
fail 'ルータが正常に作成されません' if !router.sleep_while_creating
|
70
|
+
swytch = router.get_swytch
|
71
|
+
end
|
62
72
|
expect(swytch).to be_an_instance_of Saklient::Cloud::Resources::Swytch
|
63
73
|
expect(swytch.ipv4_nets.length).to be > 0
|
64
74
|
net = swytch.ipv4_nets[0]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- townewgokgok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -188,15 +188,20 @@ files:
|
|
188
188
|
- lib/saklient/cloud/models/model_swytch.rb
|
189
189
|
- lib/saklient/cloud/models/query_params.rb
|
190
190
|
- lib/saklient/cloud/product.rb
|
191
|
+
- lib/saklient/cloud/resources/activity.rb
|
191
192
|
- lib/saklient/cloud/resources/appliance.rb
|
192
193
|
- lib/saklient/cloud/resources/archive.rb
|
193
194
|
- lib/saklient/cloud/resources/bridge.rb
|
194
195
|
- lib/saklient/cloud/resources/disk.rb
|
196
|
+
- lib/saklient/cloud/resources/disk_activity.rb
|
197
|
+
- lib/saklient/cloud/resources/disk_activity_sample.rb
|
195
198
|
- lib/saklient/cloud/resources/disk_config.rb
|
196
199
|
- lib/saklient/cloud/resources/disk_plan.rb
|
197
200
|
- lib/saklient/cloud/resources/ftp_info.rb
|
198
201
|
- lib/saklient/cloud/resources/icon.rb
|
199
202
|
- lib/saklient/cloud/resources/iface.rb
|
203
|
+
- lib/saklient/cloud/resources/iface_activity.rb
|
204
|
+
- lib/saklient/cloud/resources/iface_activity_sample.rb
|
200
205
|
- lib/saklient/cloud/resources/ipv4_net.rb
|
201
206
|
- lib/saklient/cloud/resources/ipv4_range.rb
|
202
207
|
- lib/saklient/cloud/resources/ipv6_net.rb
|
@@ -209,9 +214,13 @@ files:
|
|
209
214
|
- lib/saklient/cloud/resources/region.rb
|
210
215
|
- lib/saklient/cloud/resources/resource.rb
|
211
216
|
- lib/saklient/cloud/resources/router.rb
|
217
|
+
- lib/saklient/cloud/resources/router_activity.rb
|
218
|
+
- lib/saklient/cloud/resources/router_activity_sample.rb
|
212
219
|
- lib/saklient/cloud/resources/router_plan.rb
|
213
220
|
- lib/saklient/cloud/resources/script.rb
|
214
221
|
- lib/saklient/cloud/resources/server.rb
|
222
|
+
- lib/saklient/cloud/resources/server_activity.rb
|
223
|
+
- lib/saklient/cloud/resources/server_activity_sample.rb
|
215
224
|
- lib/saklient/cloud/resources/server_instance.rb
|
216
225
|
- lib/saklient/cloud/resources/server_plan.rb
|
217
226
|
- lib/saklient/cloud/resources/swytch.rb
|
@@ -257,7 +266,6 @@ files:
|
|
257
266
|
- spec/bridge_spec.rb
|
258
267
|
- spec/enum_spec.rb
|
259
268
|
- spec/exception_spec.rb
|
260
|
-
- spec/ipv4net_spec.rb
|
261
269
|
- spec/iso_image_spec.rb
|
262
270
|
- spec/license_spec.rb
|
263
271
|
- spec/loadbalancer_spec.rb
|
@@ -295,7 +303,6 @@ test_files:
|
|
295
303
|
- spec/bridge_spec.rb
|
296
304
|
- spec/enum_spec.rb
|
297
305
|
- spec/exception_spec.rb
|
298
|
-
- spec/ipv4net_spec.rb
|
299
306
|
- spec/iso_image_spec.rb
|
300
307
|
- spec/license_spec.rb
|
301
308
|
- spec/loadbalancer_spec.rb
|
data/spec/ipv4net_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
$: << File.dirname(__dir__) + '/lib'
|
2
|
-
require 'saklient/util'
|
3
|
-
require 'saklient/cloud/api'
|
4
|
-
|
5
|
-
describe 'Ipv4Net' do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
before do
|
10
|
-
|
11
|
-
# load config file
|
12
|
-
root = File.dirname(__dir__)
|
13
|
-
test_ok_file = root + '/testok'
|
14
|
-
expect(File).to exist(test_ok_file)
|
15
|
-
config_file = root + '/config.sh'
|
16
|
-
expect(File).to exist(config_file)
|
17
|
-
@config = {}
|
18
|
-
fh = open(config_file)
|
19
|
-
fh.each {|line|
|
20
|
-
if /^\s*export\s+(\w+)\s*=\s*(.+?)\s*$/.match(line) then
|
21
|
-
key = $1
|
22
|
-
value = $2
|
23
|
-
@config[key.to_sym] = value.gsub(/'([^']*)'|"([^"]*)"|\\(.)|(.)/) {|m|
|
24
|
-
$1 || $2 || $3 || $4
|
25
|
-
}
|
26
|
-
end
|
27
|
-
}
|
28
|
-
fh.close
|
29
|
-
expect(@config[:SACLOUD_TOKEN]).not_to be_empty #'SACLOUD_TOKEN must be defined in config.sh'
|
30
|
-
expect(@config[:SACLOUD_SECRET]).not_to be_empty #'SACLOUD_SECRET must be defined in config.sh'
|
31
|
-
#expect(@config[:SACLOUD_ZONE]).not_to be_empty #'SACLOUD_ZONE must be defined in config.sh'
|
32
|
-
|
33
|
-
# authorize
|
34
|
-
@api = Saklient::Cloud::API::authorize(@config[:SACLOUD_TOKEN], @config[:SACLOUD_SECRET])
|
35
|
-
@api = @api.in_zone(@config[:SACLOUD_ZONE]) if @config[:SACLOUD_ZONE]
|
36
|
-
expect(@api).to be_an_instance_of Saklient::Cloud::API
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
it 'should access objects by path' do
|
43
|
-
|
44
|
-
@api.router.find.each{|router|
|
45
|
-
router.get_swytch.ipv4_nets.each{|net|
|
46
|
-
if !net.range.nil?
|
47
|
-
p net.range.first
|
48
|
-
p net.range.last
|
49
|
-
# p net.range.as_array
|
50
|
-
end
|
51
|
-
}
|
52
|
-
p router.get_swytch.collect_used_ipv4_addresses
|
53
|
-
p router.get_swytch.collect_unused_ipv4_addresses
|
54
|
-
p
|
55
|
-
}
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|