class Saklient::Cloud::API

さくらのクラウドAPIクライアントを利用する際, 最初にアクセスすべきルートとなるクラス.

@see API.authorize

Attributes

_appliance[RW]

@private @return [Saklient::Cloud::Models::Model_Appliance]

_archive[RW]

@private @return [Saklient::Cloud::Models::Model_Archive]

_bridge[RW]

@private @return [Saklient::Cloud::Models::Model_Bridge]

_client[RW]

@private @return [Client]

_common_service_item[RW]

@private @return [Saklient::Cloud::Models::Model_CommonServiceItem]

_disk[RW]

@private @return [Saklient::Cloud::Models::Model_Disk]

_facility[RW]

@private @return [Facility]

_icon[RW]

@private @return [Saklient::Cloud::Models::Model_Icon]

_iface[RW]

@private @return [Saklient::Cloud::Models::Model_Iface]

_ipv6_net[RW]

@private @return [Saklient::Cloud::Models::Model_Ipv6Net]

_iso_image[RW]

@private @return [Saklient::Cloud::Models::Model_IsoImage]

_license[RW]

@private @return [Saklient::Cloud::Models::Model_License]

_product[RW]

@private @return [Product]

_router[RW]

@private @return [Saklient::Cloud::Models::Model_Router]

_script[RW]

@private @return [Saklient::Cloud::Models::Model_Script]

_server[RW]

@private @return [Saklient::Cloud::Models::Model_Server]

_swytch[RW]

@private @return [Saklient::Cloud::Models::Model_Swytch]

appliance[R]

アプライアンスにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Appliance]

archive[R]

アーカイブにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Archive]

bridge[R]

ブリッジにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Bridge]

client[R]

@private @return [Client]

common_service_item[R]

共通サービス契約にアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_CommonServiceItem]

disk[R]

ディスクにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Disk]

facility[R]

設備情報にアクセスするためのモデルを集めたオブジェクト.

@return [Facility]

icon[R]

アイコンにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Icon]

iface[R]

インタフェースにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Iface]

ipv6_net[R]

IPv6ネットワークにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Ipv6Net]

iso_image[R]

ISOイメージにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_IsoImage]

license[R]

ライセンスにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_License]

product[R]

商品情報にアクセスするためのモデルを集めたオブジェクト.

@return [Product]

router[R]

ルータにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Router]

script[R]

スクリプトにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Script]

server[R]

サーバにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Server]

swytch[R]

スイッチにアクセスするためのモデル.

@return [Saklient::Cloud::Models::Model_Swytch]

Public Class Methods

authorize(token, secret, zone = nil) click to toggle source

指定した認証情報を用いてアクセスを行うAPIクライアントを作成します.

必要な認証情報は, コントロールパネル右上にあるアカウントのプルダウンから 「設定」を選択し, 「APIキー」のページにて作成できます.

@param [String] token ACCESS TOKEN @param [String] secret ACCESS TOKEN SECRET @param [String] zone ゾーン名 @return [API] APIクライアント

# File lib/saklient/cloud/api.rb, line 457
def self.authorize(token, secret, zone = nil)
  Saklient::Util::validate_type(token, 'String')
  Saklient::Util::validate_type(secret, 'String')
  Saklient::Util::validate_type(zone, 'String')
  c = Saklient::Cloud::Client.new(token, secret)
  ret = Saklient::Cloud::API.new(c)
  return !(zone).nil? ? ret.in_zone(zone) : ret
end
new(client) click to toggle source

@private @param [Client] client

# File lib/saklient/cloud/api.rb, line 425
def initialize(client)
  Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
  @_client = client
  @_product = Saklient::Cloud::Product.new(client)
  @_facility = Saklient::Cloud::Facility.new(client)
  @_icon = Saklient::Cloud::Models::Model_Icon.new(client)
  @_server = Saklient::Cloud::Models::Model_Server.new(client)
  @_disk = Saklient::Cloud::Models::Model_Disk.new(client)
  @_appliance = Saklient::Cloud::Models::Model_Appliance.new(client)
  @_archive = Saklient::Cloud::Models::Model_Archive.new(client)
  @_iso_image = Saklient::Cloud::Models::Model_IsoImage.new(client)
  @_iface = Saklient::Cloud::Models::Model_Iface.new(client)
  @_swytch = Saklient::Cloud::Models::Model_Swytch.new(client)
  @_router = Saklient::Cloud::Models::Model_Router.new(client)
  @_bridge = Saklient::Cloud::Models::Model_Bridge.new(client)
  @_ipv6_net = Saklient::Cloud::Models::Model_Ipv6Net.new(client)
  @_script = Saklient::Cloud::Models::Model_Script.new(client)
  @_common_service_item = Saklient::Cloud::Models::Model_CommonServiceItem.new(client)
  @_license = Saklient::Cloud::Models::Model_License.new(client)
end

Public Instance Methods

in_zone(name) click to toggle source

認証情報を引き継ぎ, 指定したゾーンへのアクセスを行うAPIクライアントを作成します.

@param [String] name ゾーン名 @return [API] APIクライアント

# File lib/saklient/cloud/api.rb, line 470
def in_zone(name)
  Saklient::Util::validate_type(name, 'String')
  ret = Saklient::Cloud::API.new(@_client.clone_instance)
  suffix = ''
  suffix = '-test' if name == 'is1x' || name == 'is1y' || name == 'is1z' || name == 'tk1s'
  ret._client.set_api_root('https://secure.sakura.ad.jp/cloud' + suffix + '/')
  ret._client.set_api_root_suffix('zone/' + name)
  return ret
end

Protected Instance Methods

get_appliance() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Appliance]

# File lib/saklient/cloud/api.rb, line 176
def get_appliance
  return @_appliance
end
get_archive() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Archive]

# File lib/saklient/cloud/api.rb, line 199
def get_archive
  return @_archive
end
get_bridge() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Bridge]

# File lib/saklient/cloud/api.rb, line 314
def get_bridge
  return @_bridge
end
get_client() click to toggle source

@private @return [Client]

# File lib/saklient/cloud/api.rb, line 39
def get_client
  return @_client
end
get_common_service_item() click to toggle source

@private @return [Saklient::Cloud::Models::Model_CommonServiceItem]

# File lib/saklient/cloud/api.rb, line 383
def get_common_service_item
  return @_common_service_item
end
get_disk() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Disk]

# File lib/saklient/cloud/api.rb, line 153
def get_disk
  return @_disk
end
get_facility() click to toggle source

@private @return [Facility]

# File lib/saklient/cloud/api.rb, line 84
def get_facility
  return @_facility
end
get_icon() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Icon]

# File lib/saklient/cloud/api.rb, line 107
def get_icon
  return @_icon
end
get_iface() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Iface]

# File lib/saklient/cloud/api.rb, line 245
def get_iface
  return @_iface
end
get_ipv6_net() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Ipv6Net]

# File lib/saklient/cloud/api.rb, line 337
def get_ipv6_net
  return @_ipv6_net
end
get_iso_image() click to toggle source

@private @return [Saklient::Cloud::Models::Model_IsoImage]

# File lib/saklient/cloud/api.rb, line 222
def get_iso_image
  return @_iso_image
end
get_license() click to toggle source

@private @return [Saklient::Cloud::Models::Model_License]

# File lib/saklient/cloud/api.rb, line 406
def get_license
  return @_license
end
get_product() click to toggle source

@private @return [Product]

# File lib/saklient/cloud/api.rb, line 61
def get_product
  return @_product
end
get_router() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Router]

# File lib/saklient/cloud/api.rb, line 291
def get_router
  return @_router
end
get_script() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Script]

# File lib/saklient/cloud/api.rb, line 360
def get_script
  return @_script
end
get_server() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Server]

# File lib/saklient/cloud/api.rb, line 130
def get_server
  return @_server
end
get_swytch() click to toggle source

@private @return [Saklient::Cloud::Models::Model_Swytch]

# File lib/saklient/cloud/api.rb, line 268
def get_swytch
  return @_swytch
end