saklient 0.0.2.2 → 0.0.2.3

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/saklient/cloud/api.rb +75 -0
  3. data/lib/saklient/cloud/client.rb +1 -1
  4. data/lib/saklient/cloud/facility.rb +45 -0
  5. data/lib/saklient/cloud/models/model.rb +7 -12
  6. data/lib/saklient/cloud/models/model_appliance.rb +17 -2
  7. data/lib/saklient/cloud/models/model_archive.rb +10 -0
  8. data/lib/saklient/cloud/models/model_bridge.rb +148 -0
  9. data/lib/saklient/cloud/models/model_disk.rb +10 -0
  10. data/lib/saklient/cloud/models/model_disk_plan.rb +10 -0
  11. data/lib/saklient/cloud/models/model_icon.rb +10 -0
  12. data/lib/saklient/cloud/models/model_iface.rb +10 -0
  13. data/lib/saklient/cloud/models/model_ipv6_net.rb +10 -0
  14. data/lib/saklient/cloud/models/model_iso_image.rb +10 -0
  15. data/lib/saklient/cloud/models/model_license.rb +148 -0
  16. data/lib/saklient/cloud/models/model_license_info.rb +139 -0
  17. data/lib/saklient/cloud/models/model_region.rb +139 -0
  18. data/lib/saklient/cloud/models/model_router.rb +10 -0
  19. data/lib/saklient/cloud/models/model_router_plan.rb +10 -0
  20. data/lib/saklient/cloud/models/model_script.rb +10 -0
  21. data/lib/saklient/cloud/models/model_server.rb +10 -0
  22. data/lib/saklient/cloud/models/model_server_plan.rb +10 -0
  23. data/lib/saklient/cloud/models/model_swytch.rb +10 -0
  24. data/lib/saklient/cloud/product.rb +25 -0
  25. data/lib/saklient/cloud/resources/appliance.rb +5 -17
  26. data/lib/saklient/cloud/resources/archive.rb +2 -2
  27. data/lib/saklient/cloud/resources/bridge.rb +305 -0
  28. data/lib/saklient/cloud/resources/disk.rb +2 -2
  29. data/lib/saklient/cloud/resources/disk_config.rb +1 -1
  30. data/lib/saklient/cloud/resources/iso_image.rb +2 -2
  31. data/lib/saklient/cloud/resources/lb_server.rb +2 -2
  32. data/lib/saklient/cloud/resources/lb_virtual_ip.rb +1 -1
  33. data/lib/saklient/cloud/resources/license.rb +252 -0
  34. data/lib/saklient/cloud/resources/license_info.rb +180 -0
  35. data/lib/saklient/cloud/resources/load_balancer.rb +1 -1
  36. data/lib/saklient/cloud/resources/region.rb +233 -0
  37. data/lib/saklient/cloud/resources/resource.rb +1 -10
  38. data/lib/saklient/cloud/resources/script.rb +2 -2
  39. data/lib/saklient/cloud/resources/server.rb +2 -2
  40. data/lib/saklient/cloud/resources/swytch.rb +137 -14
  41. data/lib/saklient/version.rb +1 -1
  42. data/spec/archive_spec.rb +1 -0
  43. data/spec/bridge_spec.rb +78 -0
  44. data/spec/exception_spec.rb +1 -1
  45. data/spec/iso_image_spec.rb +1 -1
  46. data/spec/license_spec.rb +73 -0
  47. data/spec/loadbalancer_spec.rb +8 -5
  48. data/spec/server_spec.rb +3 -1
  49. metadata +16 -4
@@ -0,0 +1,305 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../../errors/saklient_exception'
4
+ require_relative '../client'
5
+ require_relative 'resource'
6
+ require_relative 'region'
7
+
8
+ module Saklient
9
+ module Cloud
10
+ module Resources
11
+
12
+ # ブリッジの実体1つに対応し, 属性の取得や操作を行うためのクラス.
13
+ class Bridge < Saklient::Cloud::Resources::Resource
14
+
15
+ protected
16
+
17
+ # ID
18
+ #
19
+ # @return [String]
20
+ attr_accessor :m_id
21
+
22
+ # 名前
23
+ #
24
+ # @return [String]
25
+ attr_accessor :m_name
26
+
27
+ # 説明
28
+ #
29
+ # @return [String]
30
+ attr_accessor :m_description
31
+
32
+ # リージョン
33
+ #
34
+ # @return [Region]
35
+ attr_accessor :m_region
36
+
37
+ # @private
38
+ # @return [String]
39
+ def _api_path
40
+ return '/bridge'
41
+ end
42
+
43
+ # @private
44
+ # @return [String]
45
+ def _root_key
46
+ return 'Bridge'
47
+ end
48
+
49
+ # @private
50
+ # @return [String]
51
+ def _root_key_m
52
+ return 'Bridges'
53
+ end
54
+
55
+ public
56
+
57
+ # @private
58
+ # @return [String]
59
+ def _class_name
60
+ return 'Bridge'
61
+ end
62
+
63
+ # @private
64
+ # @return [String]
65
+ def _id
66
+ return get_id
67
+ end
68
+
69
+ # このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
70
+ #
71
+ # @return [Bridge] this
72
+ def save
73
+ return _save
74
+ end
75
+
76
+ # 最新のリソース情報を再取得します.
77
+ #
78
+ # @return [Bridge] this
79
+ def reload
80
+ return _reload
81
+ end
82
+
83
+ # @private
84
+ # @param [Saklient::Cloud::Client] client
85
+ # @param [any] obj
86
+ # @param [bool] wrapped
87
+ def initialize(client, obj, wrapped = false)
88
+ super(client)
89
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
90
+ Saklient::Util::validate_type(wrapped, 'bool')
91
+ api_deserialize(obj, wrapped)
92
+ end
93
+
94
+ protected
95
+
96
+ # @return [bool]
97
+ attr_accessor :n_id
98
+
99
+ # (This method is generated in Translator_default#buildImpl)
100
+ #
101
+ # @private
102
+ # @return [String]
103
+ def get_id
104
+ return @m_id
105
+ end
106
+
107
+ public
108
+
109
+ # ID
110
+ #
111
+ # @return [String]
112
+ attr_reader :id
113
+
114
+ def id
115
+ get_id
116
+ end
117
+
118
+ protected
119
+
120
+ # @return [bool]
121
+ attr_accessor :n_name
122
+
123
+ # (This method is generated in Translator_default#buildImpl)
124
+ #
125
+ # @private
126
+ # @return [String]
127
+ def get_name
128
+ return @m_name
129
+ end
130
+
131
+ # (This method is generated in Translator_default#buildImpl)
132
+ #
133
+ # @private
134
+ # @param [String] v
135
+ # @return [String]
136
+ def set_name(v)
137
+ Saklient::Util::validate_type(v, 'String')
138
+ @m_name = v
139
+ @n_name = true
140
+ return @m_name
141
+ end
142
+
143
+ public
144
+
145
+ # 名前
146
+ #
147
+ # @return [String]
148
+ attr_accessor :name
149
+
150
+ def name
151
+ get_name
152
+ end
153
+
154
+ def name=(v)
155
+ set_name(v)
156
+ end
157
+
158
+ protected
159
+
160
+ # @return [bool]
161
+ attr_accessor :n_description
162
+
163
+ # (This method is generated in Translator_default#buildImpl)
164
+ #
165
+ # @private
166
+ # @return [String]
167
+ def get_description
168
+ return @m_description
169
+ end
170
+
171
+ # (This method is generated in Translator_default#buildImpl)
172
+ #
173
+ # @private
174
+ # @param [String] v
175
+ # @return [String]
176
+ def set_description(v)
177
+ Saklient::Util::validate_type(v, 'String')
178
+ @m_description = v
179
+ @n_description = true
180
+ return @m_description
181
+ end
182
+
183
+ public
184
+
185
+ # 説明
186
+ #
187
+ # @return [String]
188
+ attr_accessor :description
189
+
190
+ def description
191
+ get_description
192
+ end
193
+
194
+ def description=(v)
195
+ set_description(v)
196
+ end
197
+
198
+ protected
199
+
200
+ # @return [bool]
201
+ attr_accessor :n_region
202
+
203
+ # (This method is generated in Translator_default#buildImpl)
204
+ #
205
+ # @private
206
+ # @return [Region]
207
+ def get_region
208
+ return @m_region
209
+ end
210
+
211
+ # (This method is generated in Translator_default#buildImpl)
212
+ #
213
+ # @private
214
+ # @param [Region] v
215
+ # @return [Region]
216
+ def set_region(v)
217
+ Saklient::Util::validate_type(v, 'Saklient::Cloud::Resources::Region')
218
+ raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Bridge#region') if !@is_new
219
+ @m_region = v
220
+ @n_region = true
221
+ return @m_region
222
+ end
223
+
224
+ public
225
+
226
+ # リージョン
227
+ #
228
+ # @return [Region]
229
+ attr_accessor :region
230
+
231
+ def region
232
+ get_region
233
+ end
234
+
235
+ def region=(v)
236
+ set_region(v)
237
+ end
238
+
239
+ protected
240
+
241
+ # (This method is generated in Translator_default#buildImpl)
242
+ #
243
+ # @param [any] r
244
+ def api_deserialize_impl(r)
245
+ @is_new = (r).nil?
246
+ r = {} if @is_new
247
+ @is_incomplete = false
248
+ if Saklient::Util::exists_path(r, 'ID')
249
+ @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
250
+ else
251
+ @m_id = nil
252
+ @is_incomplete = true
253
+ end
254
+ @n_id = false
255
+ if Saklient::Util::exists_path(r, 'Name')
256
+ @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s
257
+ else
258
+ @m_name = nil
259
+ @is_incomplete = true
260
+ end
261
+ @n_name = false
262
+ if Saklient::Util::exists_path(r, 'Description')
263
+ @m_description = (Saklient::Util::get_by_path(r, 'Description')).nil? ? nil : Saklient::Util::get_by_path(r, 'Description').to_s
264
+ else
265
+ @m_description = nil
266
+ @is_incomplete = true
267
+ end
268
+ @n_description = false
269
+ if Saklient::Util::exists_path(r, 'Region')
270
+ @m_region = (Saklient::Util::get_by_path(r, 'Region')).nil? ? nil : Saklient::Cloud::Resources::Region.new(@_client, Saklient::Util::get_by_path(r, 'Region'))
271
+ else
272
+ @m_region = nil
273
+ @is_incomplete = true
274
+ end
275
+ @n_region = false
276
+ end
277
+
278
+ # @private
279
+ # @param [bool] withClean
280
+ # @return [any]
281
+ def api_serialize_impl(withClean = false)
282
+ Saklient::Util::validate_type(withClean, 'bool')
283
+ missing = []
284
+ ret = {}
285
+ Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
286
+ if withClean || @n_name
287
+ Saklient::Util::set_by_path(ret, 'Name', @m_name)
288
+ else
289
+ missing << 'name' if @is_new
290
+ end
291
+ Saklient::Util::set_by_path(ret, 'Description', @m_description) if withClean || @n_description
292
+ if withClean || @n_region
293
+ Saklient::Util::set_by_path(ret, 'Region', withClean ? ((@m_region).nil? ? nil : @m_region.api_serialize(withClean)) : ((@m_region).nil? ? { ID: '0' } : @m_region.api_serialize_id))
294
+ else
295
+ missing << 'region' if @is_new
296
+ end
297
+ raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the Bridge creation: ' + missing.join(', ')) if missing.length > 0
298
+ return ret
299
+ end
300
+
301
+ end
302
+
303
+ end
304
+ end
305
+ end
@@ -35,7 +35,7 @@ module Saklient
35
35
  # @return [String]
36
36
  attr_accessor :m_description
37
37
 
38
- # タグ
38
+ # タグ文字列の配列
39
39
  #
40
40
  # @return [Array<String>]
41
41
  attr_accessor :m_tags
@@ -442,7 +442,7 @@ module Saklient
442
442
 
443
443
  public
444
444
 
445
- # タグ
445
+ # タグ文字列の配列
446
446
  #
447
447
  # @return [Array<String>]
448
448
  attr_accessor :tags
@@ -285,7 +285,7 @@ module Saklient
285
285
 
286
286
  public
287
287
 
288
- # スタートアップスクリプト(pushによりスクリプトを追加できます)
288
+ # スタートアップスクリプト {Script} の配列(pushによりスクリプトを追加できます)
289
289
  #
290
290
  # @return [Array<Script>]
291
291
  attr_reader :scripts
@@ -36,7 +36,7 @@ module Saklient
36
36
  # @return [String]
37
37
  attr_accessor :m_description
38
38
 
39
- # タグ
39
+ # タグ文字列の配列
40
40
  #
41
41
  # @return [Array<String>]
42
42
  attr_accessor :m_tags
@@ -384,7 +384,7 @@ module Saklient
384
384
 
385
385
  public
386
386
 
387
- # タグ
387
+ # タグ文字列の配列
388
388
  #
389
389
  # @return [Array<String>]
390
390
  attr_accessor :tags
@@ -203,7 +203,7 @@ module Saklient
203
203
  return @_active_connections
204
204
  end
205
205
 
206
- # レスポンスコード
206
+ # 現在の接続数
207
207
  #
208
208
  # @return [Fixnum]
209
209
  attr_reader :active_connections
@@ -226,7 +226,7 @@ module Saklient
226
226
  return @_status
227
227
  end
228
228
 
229
- # レスポンスコード
229
+ # 現在の状態
230
230
  #
231
231
  # @return [String]
232
232
  attr_reader :status
@@ -132,7 +132,7 @@ module Saklient
132
132
  return @_servers
133
133
  end
134
134
 
135
- # 実サーバ
135
+ # 実サーバ {LbServer} の配列
136
136
  #
137
137
  # @return [Array<LbServer>]
138
138
  attr_reader :servers
@@ -0,0 +1,252 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../../errors/saklient_exception'
4
+ require_relative '../client'
5
+ require_relative 'resource'
6
+ require_relative 'license_info'
7
+
8
+ module Saklient
9
+ module Cloud
10
+ module Resources
11
+
12
+ # ライセンスの実体1つに対応し, 属性の取得や操作を行うためのクラス.
13
+ class License < Saklient::Cloud::Resources::Resource
14
+
15
+ protected
16
+
17
+ # ID
18
+ #
19
+ # @return [String]
20
+ attr_accessor :m_id
21
+
22
+ # 名前
23
+ #
24
+ # @return [String]
25
+ attr_accessor :m_name
26
+
27
+ # ライセンス種別情報
28
+ #
29
+ # @return [LicenseInfo]
30
+ attr_accessor :m_info
31
+
32
+ # @private
33
+ # @return [String]
34
+ def _api_path
35
+ return '/license'
36
+ end
37
+
38
+ # @private
39
+ # @return [String]
40
+ def _root_key
41
+ return 'License'
42
+ end
43
+
44
+ # @private
45
+ # @return [String]
46
+ def _root_key_m
47
+ return 'Licenses'
48
+ end
49
+
50
+ public
51
+
52
+ # @private
53
+ # @return [String]
54
+ def _class_name
55
+ return 'License'
56
+ end
57
+
58
+ # @private
59
+ # @return [String]
60
+ def _id
61
+ return get_id
62
+ end
63
+
64
+ # このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
65
+ #
66
+ # @return [License] this
67
+ def save
68
+ return _save
69
+ end
70
+
71
+ # 最新のリソース情報を再取得します.
72
+ #
73
+ # @return [License] this
74
+ def reload
75
+ return _reload
76
+ end
77
+
78
+ # @private
79
+ # @param [Saklient::Cloud::Client] client
80
+ # @param [any] obj
81
+ # @param [bool] wrapped
82
+ def initialize(client, obj, wrapped = false)
83
+ super(client)
84
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
85
+ Saklient::Util::validate_type(wrapped, 'bool')
86
+ api_deserialize(obj, wrapped)
87
+ end
88
+
89
+ protected
90
+
91
+ # @return [bool]
92
+ attr_accessor :n_id
93
+
94
+ # (This method is generated in Translator_default#buildImpl)
95
+ #
96
+ # @private
97
+ # @return [String]
98
+ def get_id
99
+ return @m_id
100
+ end
101
+
102
+ public
103
+
104
+ # ID
105
+ #
106
+ # @return [String]
107
+ attr_reader :id
108
+
109
+ def id
110
+ get_id
111
+ end
112
+
113
+ protected
114
+
115
+ # @return [bool]
116
+ attr_accessor :n_name
117
+
118
+ # (This method is generated in Translator_default#buildImpl)
119
+ #
120
+ # @private
121
+ # @return [String]
122
+ def get_name
123
+ return @m_name
124
+ end
125
+
126
+ # (This method is generated in Translator_default#buildImpl)
127
+ #
128
+ # @private
129
+ # @param [String] v
130
+ # @return [String]
131
+ def set_name(v)
132
+ Saklient::Util::validate_type(v, 'String')
133
+ @m_name = v
134
+ @n_name = true
135
+ return @m_name
136
+ end
137
+
138
+ public
139
+
140
+ # 名前
141
+ #
142
+ # @return [String]
143
+ attr_accessor :name
144
+
145
+ def name
146
+ get_name
147
+ end
148
+
149
+ def name=(v)
150
+ set_name(v)
151
+ end
152
+
153
+ protected
154
+
155
+ # @return [bool]
156
+ attr_accessor :n_info
157
+
158
+ # (This method is generated in Translator_default#buildImpl)
159
+ #
160
+ # @private
161
+ # @return [LicenseInfo]
162
+ def get_info
163
+ return @m_info
164
+ end
165
+
166
+ # (This method is generated in Translator_default#buildImpl)
167
+ #
168
+ # @private
169
+ # @param [LicenseInfo] v
170
+ # @return [LicenseInfo]
171
+ def set_info(v)
172
+ Saklient::Util::validate_type(v, 'Saklient::Cloud::Resources::LicenseInfo')
173
+ raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::License#info') if !@is_new
174
+ @m_info = v
175
+ @n_info = true
176
+ return @m_info
177
+ end
178
+
179
+ public
180
+
181
+ # ライセンス種別情報
182
+ #
183
+ # @return [LicenseInfo]
184
+ attr_accessor :info
185
+
186
+ def info
187
+ get_info
188
+ end
189
+
190
+ def info=(v)
191
+ set_info(v)
192
+ end
193
+
194
+ protected
195
+
196
+ # (This method is generated in Translator_default#buildImpl)
197
+ #
198
+ # @param [any] r
199
+ def api_deserialize_impl(r)
200
+ @is_new = (r).nil?
201
+ r = {} if @is_new
202
+ @is_incomplete = false
203
+ if Saklient::Util::exists_path(r, 'ID')
204
+ @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
205
+ else
206
+ @m_id = nil
207
+ @is_incomplete = true
208
+ end
209
+ @n_id = false
210
+ if Saklient::Util::exists_path(r, 'Name')
211
+ @m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s
212
+ else
213
+ @m_name = nil
214
+ @is_incomplete = true
215
+ end
216
+ @n_name = false
217
+ if Saklient::Util::exists_path(r, 'LicenseInfo')
218
+ @m_info = (Saklient::Util::get_by_path(r, 'LicenseInfo')).nil? ? nil : Saklient::Cloud::Resources::LicenseInfo.new(@_client, Saklient::Util::get_by_path(r, 'LicenseInfo'))
219
+ else
220
+ @m_info = nil
221
+ @is_incomplete = true
222
+ end
223
+ @n_info = false
224
+ end
225
+
226
+ # @private
227
+ # @param [bool] withClean
228
+ # @return [any]
229
+ def api_serialize_impl(withClean = false)
230
+ Saklient::Util::validate_type(withClean, 'bool')
231
+ missing = []
232
+ ret = {}
233
+ Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
234
+ if withClean || @n_name
235
+ Saklient::Util::set_by_path(ret, 'Name', @m_name)
236
+ else
237
+ missing << 'name' if @is_new
238
+ end
239
+ if withClean || @n_info
240
+ Saklient::Util::set_by_path(ret, 'LicenseInfo', withClean ? ((@m_info).nil? ? nil : @m_info.api_serialize(withClean)) : ((@m_info).nil? ? { ID: '0' } : @m_info.api_serialize_id))
241
+ else
242
+ missing << 'info' if @is_new
243
+ end
244
+ raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the License creation: ' + missing.join(', ')) if missing.length > 0
245
+ return ret
246
+ end
247
+
248
+ end
249
+
250
+ end
251
+ end
252
+ end