saklient 0.0.2.11 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/saklient/cloud/api.rb +25 -0
- data/lib/saklient/cloud/client.rb +1 -1
- data/lib/saklient/cloud/models/model_common_service_item.rb +157 -0
- data/lib/saklient/cloud/resources/common_service_item.rb +499 -0
- data/lib/saklient/cloud/resources/common_service_provider.rb +196 -0
- data/lib/saklient/cloud/resources/disk_activity.rb +12 -0
- data/lib/saklient/cloud/resources/gslb.rb +293 -0
- data/lib/saklient/cloud/resources/gslb_server.rb +157 -0
- data/lib/saklient/cloud/resources/iface.rb +54 -0
- data/lib/saklient/cloud/resources/iface_activity.rb +12 -0
- data/lib/saklient/cloud/resources/resource.rb +13 -2
- data/lib/saklient/cloud/resources/router.rb +4 -2
- data/lib/saklient/cloud/resources/router_activity.rb +12 -0
- data/lib/saklient/cloud/resources/server.rb +20 -0
- data/lib/saklient/cloud/resources/server_activity.rb +12 -0
- data/lib/saklient/util.rb +1 -1
- data/lib/saklient/version.rb +1 -1
- data/spec/gslb_spec.rb +99 -0
- data/spec/iso_image_spec.rb +1 -1
- data/spec/server_spec.rb +5 -0
- data/spec/swytch_spec.rb +8 -0
- metadata +9 -2
@@ -0,0 +1,196 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
# This code is automatically transpiled by Saklient Translator
|
4
|
+
|
5
|
+
require_relative '../../errors/saklient_exception'
|
6
|
+
require_relative '../client'
|
7
|
+
require_relative 'resource'
|
8
|
+
|
9
|
+
module Saklient
|
10
|
+
module Cloud
|
11
|
+
module Resources
|
12
|
+
|
13
|
+
# ライセンス種別情報.
|
14
|
+
class CommonServiceProvider < Saklient::Cloud::Resources::Resource
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# ID
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :m_id
|
22
|
+
|
23
|
+
# クラス {ECommonServiceClass}
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :m_clazz
|
27
|
+
|
28
|
+
# 名前
|
29
|
+
#
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :m_name
|
32
|
+
|
33
|
+
# @private
|
34
|
+
# @return [String]
|
35
|
+
def _api_path
|
36
|
+
return '/commonserviceprovider'
|
37
|
+
end
|
38
|
+
|
39
|
+
# @private
|
40
|
+
# @return [String]
|
41
|
+
def _root_key
|
42
|
+
return 'CommonServiceProvider'
|
43
|
+
end
|
44
|
+
|
45
|
+
# @private
|
46
|
+
# @return [String]
|
47
|
+
def _root_key_m
|
48
|
+
return 'CommonServiceProviders'
|
49
|
+
end
|
50
|
+
|
51
|
+
public
|
52
|
+
|
53
|
+
# @private
|
54
|
+
# @return [String]
|
55
|
+
def _class_name
|
56
|
+
return 'CommonServiceProvider'
|
57
|
+
end
|
58
|
+
|
59
|
+
# @private
|
60
|
+
# @return [String]
|
61
|
+
def _id
|
62
|
+
return get_id
|
63
|
+
end
|
64
|
+
|
65
|
+
# @private
|
66
|
+
# @param [Saklient::Cloud::Client] client
|
67
|
+
# @param [any] obj
|
68
|
+
# @param [bool] wrapped
|
69
|
+
def initialize(client, obj, wrapped = false)
|
70
|
+
super(client)
|
71
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
72
|
+
Saklient::Util::validate_type(wrapped, 'bool')
|
73
|
+
api_deserialize(obj, wrapped)
|
74
|
+
end
|
75
|
+
|
76
|
+
protected
|
77
|
+
|
78
|
+
# @return [bool]
|
79
|
+
attr_accessor :n_id
|
80
|
+
|
81
|
+
# (This method is generated in Translator_default#buildImpl)
|
82
|
+
#
|
83
|
+
# @private
|
84
|
+
# @return [String]
|
85
|
+
def get_id
|
86
|
+
return @m_id
|
87
|
+
end
|
88
|
+
|
89
|
+
public
|
90
|
+
|
91
|
+
# ID
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
attr_reader :id
|
95
|
+
|
96
|
+
def id
|
97
|
+
get_id
|
98
|
+
end
|
99
|
+
|
100
|
+
protected
|
101
|
+
|
102
|
+
# @return [bool]
|
103
|
+
attr_accessor :n_clazz
|
104
|
+
|
105
|
+
# (This method is generated in Translator_default#buildImpl)
|
106
|
+
#
|
107
|
+
# @private
|
108
|
+
# @return [String]
|
109
|
+
def get_clazz
|
110
|
+
return @m_clazz
|
111
|
+
end
|
112
|
+
|
113
|
+
public
|
114
|
+
|
115
|
+
# クラス {ECommonServiceClass}
|
116
|
+
#
|
117
|
+
# @return [String]
|
118
|
+
attr_reader :clazz
|
119
|
+
|
120
|
+
def clazz
|
121
|
+
get_clazz
|
122
|
+
end
|
123
|
+
|
124
|
+
protected
|
125
|
+
|
126
|
+
# @return [bool]
|
127
|
+
attr_accessor :n_name
|
128
|
+
|
129
|
+
# (This method is generated in Translator_default#buildImpl)
|
130
|
+
#
|
131
|
+
# @private
|
132
|
+
# @return [String]
|
133
|
+
def get_name
|
134
|
+
return @m_name
|
135
|
+
end
|
136
|
+
|
137
|
+
public
|
138
|
+
|
139
|
+
# 名前
|
140
|
+
#
|
141
|
+
# @return [String]
|
142
|
+
attr_reader :name
|
143
|
+
|
144
|
+
def name
|
145
|
+
get_name
|
146
|
+
end
|
147
|
+
|
148
|
+
protected
|
149
|
+
|
150
|
+
# (This method is generated in Translator_default#buildImpl)
|
151
|
+
#
|
152
|
+
# @param [any] r
|
153
|
+
def api_deserialize_impl(r)
|
154
|
+
@is_new = (r).nil?
|
155
|
+
r = {} if @is_new
|
156
|
+
@is_incomplete = false
|
157
|
+
if Saklient::Util::exists_path(r, 'ID')
|
158
|
+
@m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
|
159
|
+
else
|
160
|
+
@m_id = nil
|
161
|
+
@is_incomplete = true
|
162
|
+
end
|
163
|
+
@n_id = false
|
164
|
+
if Saklient::Util::exists_path(r, 'Class')
|
165
|
+
@m_clazz = (Saklient::Util::get_by_path(r, 'Class')).nil? ? nil : Saklient::Util::get_by_path(r, 'Class').to_s
|
166
|
+
else
|
167
|
+
@m_clazz = nil
|
168
|
+
@is_incomplete = true
|
169
|
+
end
|
170
|
+
@n_clazz = false
|
171
|
+
if Saklient::Util::exists_path(r, 'Name')
|
172
|
+
@m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s
|
173
|
+
else
|
174
|
+
@m_name = nil
|
175
|
+
@is_incomplete = true
|
176
|
+
end
|
177
|
+
@n_name = false
|
178
|
+
end
|
179
|
+
|
180
|
+
# @private
|
181
|
+
# @param [bool] withClean
|
182
|
+
# @return [any]
|
183
|
+
def api_serialize_impl(withClean = false)
|
184
|
+
Saklient::Util::validate_type(withClean, 'bool')
|
185
|
+
ret = {}
|
186
|
+
Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
|
187
|
+
Saklient::Util::set_by_path(ret, 'Class', @m_clazz) if withClean || @n_clazz
|
188
|
+
Saklient::Util::set_by_path(ret, 'Name', @m_name) if withClean || @n_name
|
189
|
+
return ret
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# This code is automatically transpiled by Saklient Translator
|
4
4
|
|
5
|
+
require_relative '../client'
|
5
6
|
require_relative 'activity'
|
6
7
|
require_relative 'disk_activity_sample'
|
7
8
|
|
@@ -42,6 +43,17 @@ module Saklient
|
|
42
43
|
return '/disk'
|
43
44
|
end
|
44
45
|
|
46
|
+
public
|
47
|
+
|
48
|
+
# @private
|
49
|
+
# @param [Saklient::Cloud::Client] client
|
50
|
+
def initialize(client)
|
51
|
+
super(client)
|
52
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
45
57
|
# @private
|
46
58
|
# @param [String] atStr
|
47
59
|
# @param [any] data
|
@@ -0,0 +1,293 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
# This code is automatically transpiled by Saklient Translator
|
4
|
+
|
5
|
+
require_relative '../../errors/saklient_exception'
|
6
|
+
require_relative '../client'
|
7
|
+
require_relative 'common_service_item'
|
8
|
+
require_relative 'gslb_server'
|
9
|
+
|
10
|
+
module Saklient
|
11
|
+
module Cloud
|
12
|
+
module Resources
|
13
|
+
|
14
|
+
# GSLBの実体1つに対応し, 属性の取得や操作を行うためのクラス.
|
15
|
+
class Gslb < Saklient::Cloud::Resources::CommonServiceItem
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
# @private
|
20
|
+
# @return [Array<GslbServer>]
|
21
|
+
attr_accessor :_servers
|
22
|
+
|
23
|
+
public
|
24
|
+
|
25
|
+
# @private
|
26
|
+
# @return [Array<GslbServer>]
|
27
|
+
def get_servers
|
28
|
+
return @_servers
|
29
|
+
end
|
30
|
+
|
31
|
+
# 仮想IPアドレス {GslbServer} の配列
|
32
|
+
#
|
33
|
+
# @return [Array<GslbServer>]
|
34
|
+
attr_reader :servers
|
35
|
+
|
36
|
+
def servers
|
37
|
+
get_servers
|
38
|
+
end
|
39
|
+
|
40
|
+
# @private
|
41
|
+
# @return [String]
|
42
|
+
def get_protocol
|
43
|
+
raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Protocol')
|
44
|
+
raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (raw).nil?
|
45
|
+
return raw
|
46
|
+
end
|
47
|
+
|
48
|
+
# @private
|
49
|
+
# @param [String] v
|
50
|
+
# @return [String]
|
51
|
+
def set_protocol(v)
|
52
|
+
Saklient::Util::validate_type(v, 'String')
|
53
|
+
_normalize
|
54
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Protocol', v)
|
55
|
+
return v
|
56
|
+
end
|
57
|
+
|
58
|
+
# 監視方法
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :protocol
|
62
|
+
|
63
|
+
def protocol
|
64
|
+
get_protocol
|
65
|
+
end
|
66
|
+
|
67
|
+
def protocol=(v)
|
68
|
+
set_protocol(v)
|
69
|
+
end
|
70
|
+
|
71
|
+
# @private
|
72
|
+
# @return [String]
|
73
|
+
def get_path_to_check
|
74
|
+
return nil if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.HealthCheck.Path')
|
75
|
+
raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Path')
|
76
|
+
return raw
|
77
|
+
end
|
78
|
+
|
79
|
+
# @private
|
80
|
+
# @param [String] v
|
81
|
+
# @return [String]
|
82
|
+
def set_path_to_check(v)
|
83
|
+
Saklient::Util::validate_type(v, 'String')
|
84
|
+
_normalize
|
85
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Path', v)
|
86
|
+
return v
|
87
|
+
end
|
88
|
+
|
89
|
+
# 監視対象パス
|
90
|
+
#
|
91
|
+
# @return [String]
|
92
|
+
attr_accessor :path_to_check
|
93
|
+
|
94
|
+
def path_to_check
|
95
|
+
get_path_to_check
|
96
|
+
end
|
97
|
+
|
98
|
+
def path_to_check=(v)
|
99
|
+
set_path_to_check(v)
|
100
|
+
end
|
101
|
+
|
102
|
+
# @private
|
103
|
+
# @return [Fixnum]
|
104
|
+
def get_response_expected
|
105
|
+
raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Status')
|
106
|
+
raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (raw).nil?
|
107
|
+
return (raw).to_s().to_i(10)
|
108
|
+
end
|
109
|
+
|
110
|
+
# @private
|
111
|
+
# @param [Fixnum] v
|
112
|
+
# @return [Fixnum]
|
113
|
+
def set_response_expected(v)
|
114
|
+
Saklient::Util::validate_type(v, 'Fixnum')
|
115
|
+
_normalize
|
116
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Status', v)
|
117
|
+
return v
|
118
|
+
end
|
119
|
+
|
120
|
+
# 監視時に期待されるレスポンスコード
|
121
|
+
#
|
122
|
+
# @return [Fixnum]
|
123
|
+
attr_accessor :response_expected
|
124
|
+
|
125
|
+
def response_expected
|
126
|
+
get_response_expected
|
127
|
+
end
|
128
|
+
|
129
|
+
def response_expected=(v)
|
130
|
+
set_response_expected(v)
|
131
|
+
end
|
132
|
+
|
133
|
+
# @private
|
134
|
+
# @return [Fixnum]
|
135
|
+
def get_delay_loop
|
136
|
+
delayLoop = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.DelayLoop')
|
137
|
+
raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (delayLoop).nil?
|
138
|
+
return (delayLoop).to_s().to_i(10)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @private
|
142
|
+
# @param [Fixnum] v
|
143
|
+
# @return [Fixnum]
|
144
|
+
def set_delay_loop(v)
|
145
|
+
Saklient::Util::validate_type(v, 'Fixnum')
|
146
|
+
_normalize
|
147
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.DelayLoop', v)
|
148
|
+
return v
|
149
|
+
end
|
150
|
+
|
151
|
+
# チェック間隔(秒)
|
152
|
+
#
|
153
|
+
# @return [Fixnum]
|
154
|
+
attr_accessor :delay_loop
|
155
|
+
|
156
|
+
def delay_loop
|
157
|
+
get_delay_loop
|
158
|
+
end
|
159
|
+
|
160
|
+
def delay_loop=(v)
|
161
|
+
set_delay_loop(v)
|
162
|
+
end
|
163
|
+
|
164
|
+
# @private
|
165
|
+
# @return [bool]
|
166
|
+
def get_weighted
|
167
|
+
weighted = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.Weighted')
|
168
|
+
raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (weighted).nil?
|
169
|
+
return weighted.downcase() == 'true'
|
170
|
+
end
|
171
|
+
|
172
|
+
# @private
|
173
|
+
# @param [bool] v
|
174
|
+
# @return [bool]
|
175
|
+
def set_weighted(v)
|
176
|
+
Saklient::Util::validate_type(v, 'bool')
|
177
|
+
_normalize
|
178
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Weighted', v ? 'True' : 'False')
|
179
|
+
return v
|
180
|
+
end
|
181
|
+
|
182
|
+
# 重み付け応答
|
183
|
+
#
|
184
|
+
# @return [bool]
|
185
|
+
attr_accessor :weighted
|
186
|
+
|
187
|
+
def weighted
|
188
|
+
get_weighted
|
189
|
+
end
|
190
|
+
|
191
|
+
def weighted=(v)
|
192
|
+
set_weighted(v)
|
193
|
+
end
|
194
|
+
|
195
|
+
# @private
|
196
|
+
# @param [Saklient::Cloud::Client] client
|
197
|
+
# @param [any] obj
|
198
|
+
# @param [bool] wrapped
|
199
|
+
def initialize(client, obj, wrapped = false)
|
200
|
+
super(client, obj, wrapped)
|
201
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
202
|
+
Saklient::Util::validate_type(wrapped, 'bool')
|
203
|
+
_normalize
|
204
|
+
end
|
205
|
+
|
206
|
+
protected
|
207
|
+
|
208
|
+
# @private
|
209
|
+
# @ignore
|
210
|
+
# @return [void]
|
211
|
+
def _normalize
|
212
|
+
@_servers = [] if (@_servers).nil?
|
213
|
+
self.raw_settings = {} if (self.raw_settings).nil?
|
214
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB', {}) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB')
|
215
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck', {}) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.HealthCheck')
|
216
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Servers', []) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.Servers')
|
217
|
+
end
|
218
|
+
|
219
|
+
# @private
|
220
|
+
# @param [any] r
|
221
|
+
# @param [any] root
|
222
|
+
# @return [void]
|
223
|
+
def _on_after_api_deserialize(r, root)
|
224
|
+
_normalize
|
225
|
+
@_servers = []
|
226
|
+
settings = self.raw_settings
|
227
|
+
if !(settings).nil?
|
228
|
+
raw = Saklient::Util::get_by_path(settings, 'GSLB.Servers')
|
229
|
+
raw = [] if (raw).nil?
|
230
|
+
servers = raw
|
231
|
+
for server in servers
|
232
|
+
@_servers << Saklient::Cloud::Resources::GslbServer.new(server)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# @private
|
238
|
+
# @param [bool] withClean
|
239
|
+
# @return [void]
|
240
|
+
def _on_before_api_serialize(withClean)
|
241
|
+
Saklient::Util::validate_type(withClean, 'bool')
|
242
|
+
_normalize
|
243
|
+
servers = []
|
244
|
+
for server in @_servers
|
245
|
+
servers << server.to_raw_settings
|
246
|
+
end
|
247
|
+
Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Servers', servers)
|
248
|
+
end
|
249
|
+
|
250
|
+
# @private
|
251
|
+
# @param [any] r
|
252
|
+
# @param [bool] withClean
|
253
|
+
# @return [void]
|
254
|
+
def _on_after_api_serialize(r, withClean)
|
255
|
+
Saklient::Util::validate_type(withClean, 'bool')
|
256
|
+
return nil if (r).nil?
|
257
|
+
Saklient::Util::set_by_path(r, 'Provider', {})
|
258
|
+
Saklient::Util::set_by_path(r, 'Provider.Class', 'gslb')
|
259
|
+
end
|
260
|
+
|
261
|
+
public
|
262
|
+
|
263
|
+
# @private
|
264
|
+
# @param [String] protocol
|
265
|
+
# @param [Fixnum] delayLoop
|
266
|
+
# @param [bool] weighted
|
267
|
+
# @return [Gslb]
|
268
|
+
def set_initial_params(protocol, delayLoop = 10, weighted = true)
|
269
|
+
Saklient::Util::validate_type(protocol, 'String')
|
270
|
+
Saklient::Util::validate_type(delayLoop, 'Fixnum')
|
271
|
+
Saklient::Util::validate_type(weighted, 'bool')
|
272
|
+
settings = self.raw_settings
|
273
|
+
self.protocol = protocol
|
274
|
+
self.delay_loop = delayLoop
|
275
|
+
self.weighted = weighted
|
276
|
+
return self
|
277
|
+
end
|
278
|
+
|
279
|
+
# 監視対象サーバ設定を追加します.
|
280
|
+
#
|
281
|
+
# @param [any] settings 設定オブジェクト
|
282
|
+
# @return [GslbServer]
|
283
|
+
def add_server(settings = nil)
|
284
|
+
ret = Saklient::Cloud::Resources::GslbServer.new(settings)
|
285
|
+
@_servers << ret
|
286
|
+
return ret
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|