class Saklient::Cloud::Resources::Iface

インタフェースの実体1つに対応し, 属性の取得や操作を行うためのクラス.

Attributes

_activity[RW]

@private @return [IfaceActivity]

activity[R]

アクティビティ

@return [IfaceActivity]

id[R]

ID

@return [String]

ip_address[R]

IPv4アドレス(共有セグメントによる自動割当)

@return [String]

m_id[RW]

ID

@return [String]

m_ip_address[RW]

IPv4アドレス(共有セグメントによる自動割当)

@return [String]

m_mac_address[RW]

MACアドレス

@return [String]

m_server_id[RW]

このインタフェースが取り付けられているサーバのID

@return [String]

m_swytch_id[RW]

このインタフェースの接続先スイッチのID

@return [String]

m_user_ip_address[RW]

ユーザ設定IPv4アドレス

@return [String]

mac_address[R]

MACアドレス

@return [String]

n_id[RW]

@return [bool]

n_ip_address[RW]

@return [bool]

n_mac_address[RW]

@return [bool]

n_server_id[RW]

@return [bool]

n_swytch_id[RW]

@return [bool]

n_user_ip_address[RW]

@return [bool]

server_id[RW]

このインタフェースが取り付けられているサーバのID

@return [String]

swytch_id[RW]

このインタフェースの接続先スイッチのID

@return [String]

user_ip_address[RW]

ユーザ設定IPv4アドレス

@return [String]

Public Class Methods

new(client, obj, wrapped = false) click to toggle source

@private @param [Saklient::Cloud::Client] client @param [any] obj @param [bool] wrapped

# 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

_class_name() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/iface.rb, line 72
def _class_name
  return 'Iface'
end
_id() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/iface.rb, line 78
def _id
  return get_id
end
connect_to_shared_segment() click to toggle source

共有セグメントに接続します.

@return [Iface] this

# File lib/saklient/cloud/resources/iface.rb, line 166
def connect_to_shared_segment
  @_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch/shared')
  return reload
end
connect_to_swytch(swytch) click to toggle source

スイッチに接続します.

@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
connect_to_swytch_by_id(swytchId) click to toggle source

指定した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
disconnect_from_swytch() click to toggle source

スイッチから切断します.

@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
find_swytch() click to toggle source

接続先のスイッチを取得します.

@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
get_activity() click to toggle source

@private @return [IfaceActivity]

# File lib/saklient/cloud/resources/iface.rb, line 106
def get_activity
  return @_activity
end
reload() click to toggle source

最新のリソース情報を再取得します.

@return [Iface] this

# File lib/saklient/cloud/resources/iface.rb, line 92
def reload
  return _reload
end
save() click to toggle source

このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.

@return [Iface] this

# File lib/saklient/cloud/resources/iface.rb, line 85
def save
  return _save
end
server_id=(v) click to toggle source
# File lib/saklient/cloud/resources/iface.rb, line 336
def server_id=(v)
  set_server_id(v)
end
swytch_id=(v) click to toggle source
# File lib/saklient/cloud/resources/iface.rb, line 377
def swytch_id=(v)
  set_swytch_id(v)
end
user_ip_address=(v) click to toggle source
# File lib/saklient/cloud/resources/iface.rb, line 295
def user_ip_address=(v)
  set_user_ip_address(v)
end

Protected Instance Methods

_api_path() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/iface.rb, line 52
def _api_path
  return '/interface'
end
_on_after_api_deserialize(r, root) click to toggle source

@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
_root_key() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/iface.rb, line 58
def _root_key
  return 'Interface'
end
_root_key_m() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/iface.rb, line 64
def _root_key_m
  return 'Interfaces'
end
api_deserialize_impl(r) click to toggle source

(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
api_serialize_impl(withClean = false) click to toggle source

@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
get_id() click to toggle source

(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
get_ip_address() click to toggle source

(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
get_mac_address() click to toggle source

(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
get_server_id() click to toggle source

(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
get_swytch_id() click to toggle source

(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
get_user_ip_address() click to toggle source

(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
set_server_id(v) click to toggle source

(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
set_swytch_id(v) click to toggle source

(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
set_user_ip_address(v) click to toggle source

(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