class Saklient::Cloud::Resources::ServerInstance

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

Attributes

before_status[R]

前回の起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}

@return [String]

iso_image[R]

挿入されているISOイメージ

@return [IsoImage]

m_before_status[RW]

前回の起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}

@return [String]

m_iso_image[RW]

挿入されているISOイメージ

@return [IsoImage]

m_status[RW]

起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}

@return [String]

m_status_changed_at[RW]

現在の起動状態に変化した日時

@return [NativeDate]

n_before_status[RW]

@return [bool]

n_iso_image[RW]

@return [bool]

n_status[RW]

@return [bool]

n_status_changed_at[RW]

@return [bool]

status[R]

起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}

@return [String]

status_changed_at[R]

現在の起動状態に変化した日時

@return [NativeDate]

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/server_instance.rb, line 45
def initialize(client, obj, wrapped = false)
  super(client)
  Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
  Saklient::Util::validate_type(wrapped, 'bool')
  api_deserialize(obj, wrapped)
end

Public Instance Methods

is_down() click to toggle source

サーバが停止しているときtrueを返します.

@return [bool]

# File lib/saklient/cloud/resources/server_instance.rb, line 62
def is_down
  return (get_status).nil? || Saklient::Cloud::Enums::EServerInstanceStatus::compare(get_status, Saklient::Cloud::Enums::EServerInstanceStatus::down) == 0
end
is_up() click to toggle source

サーバが起動しているときtrueを返します.

@return [bool]

# File lib/saklient/cloud/resources/server_instance.rb, line 55
def is_up
  return !(get_status).nil? && Saklient::Cloud::Enums::EServerInstanceStatus::compare(get_status, Saklient::Cloud::Enums::EServerInstanceStatus::up) == 0
end

Protected Instance Methods

api_deserialize_impl(r) click to toggle source

(This method is generated in Translator_default#buildImpl)

@param [any] r

# File lib/saklient/cloud/resources/server_instance.rb, line 167
def api_deserialize_impl(r)
  @is_new = (r).nil?
  r = {} if @is_new
  @is_incomplete = false
  if Saklient::Util::exists_path(r, 'Status')
    @m_status = (Saklient::Util::get_by_path(r, 'Status')).nil? ? nil : Saklient::Util::get_by_path(r, 'Status').to_s
  else
    @m_status = nil
    @is_incomplete = true
  end
  @n_status = false
  if Saklient::Util::exists_path(r, 'BeforeStatus')
    @m_before_status = (Saklient::Util::get_by_path(r, 'BeforeStatus')).nil? ? nil : Saklient::Util::get_by_path(r, 'BeforeStatus').to_s
  else
    @m_before_status = nil
    @is_incomplete = true
  end
  @n_before_status = false
  if Saklient::Util::exists_path(r, 'StatusChangedAt')
    @m_status_changed_at = (Saklient::Util::get_by_path(r, 'StatusChangedAt')).nil? ? nil : Saklient::Util::get_by_path(r, 'StatusChangedAt').to_s
  else
    @m_status_changed_at = nil
    @is_incomplete = true
  end
  @n_status_changed_at = false
  if Saklient::Util::exists_path(r, 'CDROM')
    @m_iso_image = (Saklient::Util::get_by_path(r, 'CDROM')).nil? ? nil : Saklient::Cloud::Resources::IsoImage.new(@_client, Saklient::Util::get_by_path(r, 'CDROM'))
  else
    @m_iso_image = nil
    @is_incomplete = true
  end
  @n_iso_image = false
end
api_serialize_impl(withClean = false) click to toggle source

@private @param [bool] withClean @return [any]

# File lib/saklient/cloud/resources/server_instance.rb, line 204
def api_serialize_impl(withClean = false)
  Saklient::Util::validate_type(withClean, 'bool')
  ret = {}
  Saklient::Util::set_by_path(ret, 'Status', @m_status) if withClean || @n_status
  Saklient::Util::set_by_path(ret, 'BeforeStatus', @m_before_status) if withClean || @n_before_status
  Saklient::Util::set_by_path(ret, 'StatusChangedAt', (@m_status_changed_at).nil? ? nil : Saklient::Util::date2str(@m_status_changed_at)) if withClean || @n_status_changed_at
  Saklient::Util::set_by_path(ret, 'CDROM', withClean ? ((@m_iso_image).nil? ? nil : @m_iso_image.api_serialize(withClean)) : ((@m_iso_image).nil? ? { ID: '0' } : @m_iso_image.api_serialize_id)) if withClean || @n_iso_image
  return ret
end
get_before_status() click to toggle source

(This method is generated in Translator_default#buildImpl)

@private @return [String]

# File lib/saklient/cloud/resources/server_instance.rb, line 99
def get_before_status
  return @m_before_status
end
get_iso_image() click to toggle source

(This method is generated in Translator_default#buildImpl)

@private @return [IsoImage]

# File lib/saklient/cloud/resources/server_instance.rb, line 147
def get_iso_image
  return @m_iso_image
end
get_status() click to toggle source

(This method is generated in Translator_default#buildImpl)

@private @return [String]

# File lib/saklient/cloud/resources/server_instance.rb, line 75
def get_status
  return @m_status
end
get_status_changed_at() click to toggle source

(This method is generated in Translator_default#buildImpl)

@private @return [NativeDate]

# File lib/saklient/cloud/resources/server_instance.rb, line 123
def get_status_changed_at
  return @m_status_changed_at
end