class Saklient::Cloud::Resources::Iface
インタフェースの実体1つに対応し, 属性の取得や操作を行うためのクラス.
Attributes
@private @return [IfaceActivity]
アクティビティ
@return [IfaceActivity]
ID
@return [String]
IPv4アドレス(共有セグメントによる自動割当)
@return [String]
ID
@return [String]
IPv4アドレス(共有セグメントによる自動割当)
@return [String]
MACアドレス
@return [String]
このインタフェースが取り付けられているサーバのID
@return [String]
このインタフェースの接続先スイッチのID
@return [String]
ユーザ設定IPv4アドレス
@return [String]
MACアドレス
@return [String]
@return [bool]
@return [bool]
@return [bool]
@return [bool]
@return [bool]
@return [bool]
このインタフェースが取り付けられているサーバのID
@return [String]
このインタフェースの接続先スイッチのID
@return [String]
ユーザ設定IPv4アドレス
@return [String]
Public Class Methods
@private @param [Saklient::Cloud::Client] client @param [any] obj @param [bool] wrapped
Saklient::Cloud::Resources::Resource::new
# File lib/saklient/cloud/resources/iface.rb, line 123 def initialize(client, obj, wrapped = false) super(client) Saklient::Util::validate_type(client, 'Saklient::Cloud::Client') Saklient::Util::validate_type(wrapped, 'bool') @_activity = Saklient::Cloud::Resources::IfaceActivity.new(client) api_deserialize(obj, wrapped) end
Public Instance Methods
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 72 def _class_name return 'Iface' end
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 78 def _id return get_id end
スイッチに接続します.
@param [Swytch] swytch 接続先のスイッチ. @return [Iface] this
# File lib/saklient/cloud/resources/iface.rb, line 147 def connect_to_swytch(swytch) Saklient::Util::validate_type(swytch, 'Saklient::Cloud::Resources::Swytch') @_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch/' + Saklient::Util::url_encode(swytch._id)) return reload end
指定したIDのスイッチに接続します.
@param [String] swytchId 接続先のスイッチID. @return [Iface] this
# File lib/saklient/cloud/resources/iface.rb, line 157 def connect_to_swytch_by_id(swytchId) Saklient::Util::validate_type(swytchId, 'String') @_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch/' + swytchId) return reload end
スイッチから切断します.
@return [Iface] this
# File lib/saklient/cloud/resources/iface.rb, line 174 def disconnect_from_swytch @_client.request('DELETE', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch') return reload end
接続先のスイッチを取得します.
@return [Swytch]
# File lib/saklient/cloud/resources/iface.rb, line 182 def find_swytch model = Saklient::Util::create_class_instance('saklient.cloud.models.Model_Swytch', [@_client]) return model.get_by_id(self.swytch_id) end
@private @return [IfaceActivity]
# File lib/saklient/cloud/resources/iface.rb, line 106 def get_activity return @_activity end
最新のリソース情報を再取得します.
@return [Iface] this
# File lib/saklient/cloud/resources/iface.rb, line 92 def reload return _reload end
このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
@return [Iface] this
# File lib/saklient/cloud/resources/iface.rb, line 85 def save return _save end
# File lib/saklient/cloud/resources/iface.rb, line 336 def server_id=(v) set_server_id(v) end
# File lib/saklient/cloud/resources/iface.rb, line 377 def swytch_id=(v) set_swytch_id(v) end
# File lib/saklient/cloud/resources/iface.rb, line 295 def user_ip_address=(v) set_user_ip_address(v) end
Protected Instance Methods
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 52 def _api_path return '/interface' end
@private @param [any] r @param [any] root @return [void]
# File lib/saklient/cloud/resources/iface.rb, line 137 def _on_after_api_deserialize(r, root) @_activity.set_source_id(_id) if !(r).nil? end
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 58 def _root_key return 'Interface' end
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 64 def _root_key_m return 'Interfaces' end
(This method is generated in Translator_default#buildImpl)
@param [any] r
# File lib/saklient/cloud/resources/iface.rb, line 386 def api_deserialize_impl(r) @is_new = (r).nil? r = {} if @is_new @is_incomplete = false if Saklient::Util::exists_path(r, 'ID') @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s else @m_id = nil @is_incomplete = true end @n_id = false if Saklient::Util::exists_path(r, 'MACAddress') @m_mac_address = (Saklient::Util::get_by_path(r, 'MACAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'MACAddress').to_s else @m_mac_address = nil @is_incomplete = true end @n_mac_address = false if Saklient::Util::exists_path(r, 'IPAddress') @m_ip_address = (Saklient::Util::get_by_path(r, 'IPAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'IPAddress').to_s else @m_ip_address = nil @is_incomplete = true end @n_ip_address = false if Saklient::Util::exists_path(r, 'UserIPAddress') @m_user_ip_address = (Saklient::Util::get_by_path(r, 'UserIPAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'UserIPAddress').to_s else @m_user_ip_address = nil @is_incomplete = true end @n_user_ip_address = false if Saklient::Util::exists_path(r, 'Server.ID') @m_server_id = (Saklient::Util::get_by_path(r, 'Server.ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'Server.ID').to_s else @m_server_id = nil @is_incomplete = true end @n_server_id = false if Saklient::Util::exists_path(r, 'Switch.ID') @m_swytch_id = (Saklient::Util::get_by_path(r, 'Switch.ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'Switch.ID').to_s else @m_swytch_id = nil @is_incomplete = true end @n_swytch_id = false end
@private @param [bool] withClean @return [any]
# File lib/saklient/cloud/resources/iface.rb, line 437 def api_serialize_impl(withClean = false) Saklient::Util::validate_type(withClean, 'bool') missing = [] ret = {} Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id Saklient::Util::set_by_path(ret, 'MACAddress', @m_mac_address) if withClean || @n_mac_address Saklient::Util::set_by_path(ret, 'IPAddress', @m_ip_address) if withClean || @n_ip_address Saklient::Util::set_by_path(ret, 'UserIPAddress', @m_user_ip_address) if withClean || @n_user_ip_address if withClean || @n_server_id Saklient::Util::set_by_path(ret, 'Server.ID', @m_server_id) else missing << 'server_id' if @is_new end Saklient::Util::set_by_path(ret, 'Switch.ID', @m_swytch_id) if withClean || @n_swytch_id raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the Iface creation: ' + missing.join(', ')) if missing.length > 0 return ret end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 196 def get_id return @m_id end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 244 def get_ip_address return @m_ip_address end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 220 def get_mac_address return @m_mac_address end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 308 def get_server_id return @m_server_id end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 349 def get_swytch_id return @m_swytch_id end
(This method is generated in Translator_default#buildImpl)
@private @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 268 def get_user_ip_address return @m_user_ip_address end
(This method is generated in Translator_default#buildImpl)
@private @param [String] v @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 317 def set_server_id(v) Saklient::Util::validate_type(v, 'String') raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Iface#server_id') if !@is_new @m_server_id = v @n_server_id = true return @m_server_id end
(This method is generated in Translator_default#buildImpl)
@private @param [String] v @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 358 def set_swytch_id(v) Saklient::Util::validate_type(v, 'String') raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Iface#swytch_id') if !@is_new @m_swytch_id = v @n_swytch_id = true return @m_swytch_id end
(This method is generated in Translator_default#buildImpl)
@private @param [String] v @return [String]
# File lib/saklient/cloud/resources/iface.rb, line 277 def set_user_ip_address(v) Saklient::Util::validate_type(v, 'String') @m_user_ip_address = v @n_user_ip_address = true return @m_user_ip_address end