Class: Saklient::Cloud::Resources::Iface

Inherits:
Resource
  • Object
show all
Defined in:
lib/saklient/cloud/resources/iface.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#api_deserialize, #api_serialize, create_with, #destroy, #dump, #exists, #request_retry, #set_param

Constructor Details

#initialize(client, obj, wrapped = false) ⇒ Iface

Returns a new instance of Iface.

Parameters:



124
125
126
127
128
129
130
# File 'lib/saklient/cloud/resources/iface.rb', line 124

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

Instance Attribute Details

#activityIfaceActivity (readonly)

アクティビティ

Returns:



114
115
116
# File 'lib/saklient/cloud/resources/iface.rb', line 114

def activity
  @activity
end

#idString (readonly)

ID

Returns:

  • (String)


206
207
208
# File 'lib/saklient/cloud/resources/iface.rb', line 206

def id
  @id
end

#ip_addressString (readonly)

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

Returns:

  • (String)


254
255
256
# File 'lib/saklient/cloud/resources/iface.rb', line 254

def ip_address
  @ip_address
end

#mac_addressString (readonly)

MACアドレス

Returns:

  • (String)


230
231
232
# File 'lib/saklient/cloud/resources/iface.rb', line 230

def mac_address
  @mac_address
end

#server_idString

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

Returns:

  • (String)


331
332
333
# File 'lib/saklient/cloud/resources/iface.rb', line 331

def server_id
  @server_id
end

#swytch_idString

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

Returns:

  • (String)


372
373
374
# File 'lib/saklient/cloud/resources/iface.rb', line 372

def swytch_id
  @swytch_id
end

#user_ip_addressString

ユーザ設定IPv4アドレス

Returns:

  • (String)


290
291
292
# File 'lib/saklient/cloud/resources/iface.rb', line 290

def user_ip_address
  @user_ip_address
end

Instance Method Details

#_class_nameString

Returns:

  • (String)


73
74
75
# File 'lib/saklient/cloud/resources/iface.rb', line 73

def _class_name
  return 'Iface'
end

#_idString

Returns:

  • (String)


79
80
81
# File 'lib/saklient/cloud/resources/iface.rb', line 79

def _id
  return get_id
end

#connect_to_shared_segmentIface

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

Returns:



167
168
169
170
# File 'lib/saklient/cloud/resources/iface.rb', line 167

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) ⇒ Iface

スイッチに接続します.

Parameters:

  • swytch (Swytch)

    接続先のスイッチ.

Returns:



148
149
150
151
152
# File 'lib/saklient/cloud/resources/iface.rb', line 148

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) ⇒ Iface

指定したIDのスイッチに接続します.

Parameters:

  • swytchId (String)

    接続先のスイッチID.

Returns:



158
159
160
161
162
# File 'lib/saklient/cloud/resources/iface.rb', line 158

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_swytchIface

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

Returns:



175
176
177
178
# File 'lib/saklient/cloud/resources/iface.rb', line 175

def disconnect_from_swytch
  @_client.request('DELETE', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch')
  return reload
end

#find_swytchSwytch

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

Returns:



183
184
185
186
# File 'lib/saklient/cloud/resources/iface.rb', line 183

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_activityIfaceActivity

Returns:



107
108
109
# File 'lib/saklient/cloud/resources/iface.rb', line 107

def get_activity
  return @_activity
end

#reloadIface

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

Returns:



93
94
95
# File 'lib/saklient/cloud/resources/iface.rb', line 93

def reload
  return _reload
end

#saveIface

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

Returns:



86
87
88
# File 'lib/saklient/cloud/resources/iface.rb', line 86

def save
  return _save
end