Class: Saklient::Cloud::Resources::Router
- Inherits:
-
Resource
- Object
- Resource
- Saklient::Cloud::Resources::Router
- Defined in:
- lib/saklient/cloud/resources/router.rb
Overview
ルータの実体1つに対応し, 属性の取得や操作を行うためのクラス.
Instance Attribute Summary (collapse)
-
- (RouterActivity) activity
readonly
アクティビティ.
-
- (Fixnum) band_width_mbps
帯域幅.
-
- (String) description
説明.
-
- (String) id
readonly
ID.
-
- (String) name
名前.
-
- (Fixnum) network_mask_len
ネットワークのマスク長.
-
- (String) swytch_id
readonly
スイッチ.
Instance Method Summary (collapse)
-
- (Ipv6Net) add_ipv6_net
このルータ+スイッチでIPv6アドレスを有効にします.
-
- (Ipv4Net) add_static_route(maskLen, nextHop)
このルータ+スイッチにスタティックルートを追加します.
-
- (Router) change_plan(bandWidthMbps)
このルータ+スイッチの帯域プランを変更します.
-
- (Swytch) get_swytch
このルータが接続されているスイッチを取得します.
-
- (Router) reload
最新のリソース情報を再取得します.
-
- (Router) remove_ipv6_net(ipv6Net)
このルータ+スイッチでIPv6アドレスを無効にします.
-
- (Router) remove_static_route(ipv4Net)
このルータ+スイッチからスタティックルートを削除します.
-
- (Router) save
このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
-
- (bool) sleep_while_creating(timeoutSec = 120)
作成中のルータが利用可能になるまで待機します.
Instance Attribute Details
- (RouterActivity) activity (readonly)
アクティビティ
118 119 120 |
# File 'lib/saklient/cloud/resources/router.rb', line 118 def activity @activity end |
- (Fixnum) band_width_mbps
帯域幅
434 435 436 |
# File 'lib/saklient/cloud/resources/router.rb', line 434 def band_width_mbps @band_width_mbps end |
- (String) description
説明
352 353 354 |
# File 'lib/saklient/cloud/resources/router.rb', line 352 def description @description end |
- (String) id (readonly)
ID
276 277 278 |
# File 'lib/saklient/cloud/resources/router.rb', line 276 def id @id end |
- (String) name
名前
312 313 314 |
# File 'lib/saklient/cloud/resources/router.rb', line 312 def name @name end |
- (Fixnum) network_mask_len
ネットワークのマスク長
393 394 395 |
# File 'lib/saklient/cloud/resources/router.rb', line 393 def network_mask_len @network_mask_len end |
- (String) swytch_id (readonly)
スイッチ
462 463 464 |
# File 'lib/saklient/cloud/resources/router.rb', line 462 def swytch_id @swytch_id end |
Instance Method Details
- (Ipv6Net) add_ipv6_net
このルータ+スイッチでIPv6アドレスを有効にします.
198 199 200 201 202 |
# File 'lib/saklient/cloud/resources/router.rb', line 198 def add_ipv6_net result = @_client.request('POST', _api_path + '/' + Saklient::Util::url_encode(_id) + '/ipv6net') reload return Saklient::Cloud::Resources::Ipv6Net.new(@_client, result[:IPv6Net]) end |
- (Ipv4Net) add_static_route(maskLen, nextHop)
このルータ+スイッチにスタティックルートを追加します.
220 221 222 223 224 225 226 227 228 229 |
# File 'lib/saklient/cloud/resources/router.rb', line 220 def add_static_route(maskLen, nextHop) Saklient::Util::validate_type(maskLen, 'Fixnum') Saklient::Util::validate_type(nextHop, 'String') q = {} Saklient::Util::set_by_path(q, 'NetworkMaskLen', maskLen) Saklient::Util::set_by_path(q, 'NextHop', nextHop) result = @_client.request('POST', _api_path + '/' + Saklient::Util::url_encode(_id) + '/subnet', q) reload return Saklient::Cloud::Resources::Ipv4Net.new(@_client, result[:Subnet]) end |
- (Router) change_plan(bandWidthMbps)
このルータ+スイッチの帯域プランを変更します.
成功時はリソースIDが変わることにご注意ください.
248 249 250 251 252 253 254 255 256 |
# File 'lib/saklient/cloud/resources/router.rb', line 248 def change_plan(bandWidthMbps) Saklient::Util::validate_type(bandWidthMbps, 'Fixnum') path = _api_path + '/' + Saklient::Util::url_encode(_id) + '/bandwidth' q = {} Saklient::Util::set_by_path(q, 'Internet.BandWidthMbps', bandWidthMbps) result = @_client.request('PUT', path, q) api_deserialize(result, true) return self end |
- (Swytch) get_swytch
このルータが接続されているスイッチを取得します.
189 190 191 192 193 |
# File 'lib/saklient/cloud/resources/router.rb', line 189 def get_swytch model = Saklient::Util::create_class_instance('saklient.cloud.models.Model_Swytch', [@_client]) id = get_swytch_id return model.get_by_id(id) end |
- (Router) reload
最新のリソース情報を再取得します.
97 98 99 |
# File 'lib/saklient/cloud/resources/router.rb', line 97 def reload return _reload end |
- (Router) remove_ipv6_net(ipv6Net)
このルータ+スイッチでIPv6アドレスを無効にします.
208 209 210 211 212 213 |
# File 'lib/saklient/cloud/resources/router.rb', line 208 def remove_ipv6_net(ipv6Net) Saklient::Util::validate_type(ipv6Net, 'Saklient::Cloud::Resources::Ipv6Net') @_client.request('DELETE', _api_path + '/' + Saklient::Util::url_encode(_id) + '/ipv6net/' + ipv6Net._id) reload return self end |
- (Router) remove_static_route(ipv4Net)
このルータ+スイッチからスタティックルートを削除します.
235 236 237 238 239 240 |
# File 'lib/saklient/cloud/resources/router.rb', line 235 def remove_static_route(ipv4Net) Saklient::Util::validate_type(ipv4Net, 'Saklient::Cloud::Resources::Ipv4Net') @_client.request('DELETE', _api_path + '/' + Saklient::Util::url_encode(_id) + '/subnet/' + ipv4Net._id) reload return self end |
- (Router) save
このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
90 91 92 |
# File 'lib/saklient/cloud/resources/router.rb', line 90 def save return _save end |
- (bool) sleep_while_creating(timeoutSec = 120)
作成中のルータが利用可能になるまで待機します.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/saklient/cloud/resources/router.rb', line 166 def sleep_while_creating(timeoutSec = 120) Saklient::Util::validate_type(timeoutSec, 'Fixnum') step = 3 isOk = false while 0 < timeoutSec do begin if exists reload isOk = true end rescue Saklient::Errors::HttpException {} end timeoutSec -= step timeoutSec = 0 if isOk sleep(step) if 0 < timeoutSec end return isOk end |