LoginSignup
1
1

More than 5 years have passed since last update.

Bluemix Infrastructure API(Location_Datacenterサービス)

Posted at

Location_Datacenter(SoftLayer_Location_Datacenter)サービス(Location系)

Location_Datacenterデータ型(dict型)
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Location_Datacenter

概要
SoftLayer_Location_Datacenter型はデータセンター特有の属性を含むようにSoftLayer_Locationデータ型を拡張したものです。

Overview
SoftLayer_Location_Datacenter extends the SoftLayer_Location data type to include datacenter-specific properties.

Location_Datacenterサービス
https://sldn.softlayer.com/reference/services/SoftLayer_Location_Datacenter

概要
SoftLayer_Location_Datacenter型はSoftLayerバックエンドネットワークのデータセンター固有の部分にアクセスするための機能を提供します。
SoftLayerでは施設・建物内スペース・装置間に階層関係を定めデータセンターを管理しており、都市毎にデータセンターは配置され、サーバルーム、ラック、スロット(SoftLayerのハードウェアを収容)と各々前者の一部として敷設されます。

Overview
SoftLayer_Location_Datacenter exposes functionality
to access datacenter-specific portions of SoftLayer's backend network.
SoftLayer maintains datacenters within it's location hierarchy.
Datacenters are located in city locations and each contain server room locations, racks, then slots.
Each slot location houses a piece of SoftLayer hardware.

(1)データセンターの立地情報を取得(getDatacentersメゾッド)
https://sldn.softlayer.com/reference/services/SoftLayer_Location_Datacenter/getDatacenters

概要
全データセンターの立地情報を取得します(SoftLayerのデータセンターは様々な都市に存在し、
各データセンターはネットワークやサバインフラストラクチャーを備えるサーバルームを含みます。

Overview
Retrieve all datacenter locations.
SoftLayer's datacenters exist in various cities
and each contain one or more server rooms which house network and server infrastructure.

ヘッダー
Optional Headers: SoftLayer_ObjectMask
Required Headers: authenticate

戻り値
Return Values: SoftLayer_Location an array of SoftLayer_Location
https://sldn.softlayer.com/reference/datatypes/softlayer_location


import SoftLayer

from pprint import pprint

username = 'xxxxxxxx'
key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

client = SoftLayer.Client(username=username, api_key=key)

results = client['Location_Datacenter'].getDatacenters()
pprint(results)   

実行結果(2017/11/03)


[{'id': 265592, 'longName': 'Amsterdam 1', 'name': 'ams01', 'statusId': 2},
 {'id': 814994, 'longName': 'Amsterdam 3', 'name': 'ams03', 'statusId': 2},
 {'id': 1004997, 'longName': 'Chennai 1', 'name': 'che01', 'statusId': 2},
 {'id': 3, 'longName': 'Dallas 1', 'name': 'dal01', 'statusId': 2},
 {'id': 1441195, 'longName': 'Dallas 10', 'name': 'dal10', 'statusId': 2},
 {'id': 1854795, 'longName': 'Dallas 12', 'name': 'dal12', 'statusId': 2},
 {'id': 1854895, 'longName': 'Dallas 13', 'name': 'dal13', 'statusId': 2},
 {'id': 154770, 'longName': 'Dallas 2', 'name': 'dal02', 'statusId': 2},
 {'id': 138124, 'longName': 'Dallas 5', 'name': 'dal05', 'statusId': 2},
 {'id': 154820, 'longName': 'Dallas 6', 'name': 'dal06', 'statusId': 2},
 {'id': 142776, 'longName': 'Dallas 7', 'name': 'dal07', 'statusId': 2},
 {'id': 449494, 'longName': 'Dallas 9', 'name': 'dal09', 'statusId': 2},
 {'id': 449506, 'longName': 'Frankfurt 2', 'name': 'fra02', 'statusId': 2},
 {'id': 352494, 'longName': 'Hong Kong 2', 'name': 'hkg02', 'statusId': 2},
 {'id': 142775, 'longName': 'Houston 2', 'name': 'hou02', 'statusId': 2},
 {'id': 358694, 'longName': 'London 2', 'name': 'lon02', 'statusId': 2},
 {'id': 2017395, 'longName': 'London 4', 'name': 'lon04', 'statusId': 2},
 {'id': 2124095, 'longName': 'London 6', 'name': 'lon06', 'statusId': 2},
 {'id': 449596, 'longName': 'Melbourne 1', 'name': 'mel01', 'statusId': 2},
 {'id': 449600, 'longName': 'Mexico 1', 'name': 'mex01', 'statusId': 2},
 {'id': 815394, 'longName': 'Milan 1', 'name': 'mil01', 'statusId': 2},
 {'id': 449610, 'longName': 'Montreal 1', 'name': 'mon01', 'statusId': 2},
 {'id': 1541257, 'longName': 'Oslo 1', 'name': 'osl01', 'statusId': 2},
 {'id': 449500, 'longName': 'Paris 1', 'name': 'par01', 'statusId': 2},
 {'id': 168642, 'longName': 'San Jose 1', 'name': 'sjc01', 'statusId': 2},
 {'id': 1004995, 'longName': 'San Jose 3', 'name': 'sjc03', 'statusId': 2},
 {'id': 2178495, 'longName': 'San Jose 4', 'name': 'sjc04', 'statusId': 2},
 {'id': 983497, 'longName': 'Sao Paulo 1', 'name': 'sao01', 'statusId': 2},
 {'id': 18171, 'longName': 'Seattle 1', 'name': 'sea01', 'statusId': 2},
 {'id': 1555995, 'longName': 'Seoul 1', 'name': 'seo01', 'statusId': 2},
 {'id': 224092, 'longName': 'Singapore 1', 'name': 'sng01', 'statusId': 2},
 {'id': 449612, 'longName': 'Sydney 1', 'name': 'syd01', 'statusId': 2},
 {'id': 2013295, 'longName': 'Sydney 4', 'name': 'syd04', 'statusId': 2},
 {'id': 449604, 'longName': 'Tokyo 2', 'name': 'tok02', 'statusId': 2},
 {'id': 448994, 'longName': 'Toronto 1', 'name': 'tor01', 'statusId': 2},
 {'id': 37473, 'longName': 'Washington 1', 'name': 'wdc01', 'statusId': 2},
 {'id': 957095, 'longName': 'Washington 4', 'name': 'wdc04', 'statusId': 2},
 {'id': 2017695, 'longName': 'Washington 6', 'name': 'wdc06', 'statusId': 2},
 {'id': 2017603, 'longName': 'Washington 7', 'name': 'wdc07', 'statusId': 2}]

コメント版


# 前提 sudo pip install softlayerなどでsoftlayerモジュールをインストール済み

# SoftLayer API Overview 
# https://sldn.softlayer.com/article/SoftLayer-API-Overview

# SoftLayer API Python Client Documentation 
# https://media.readthedocs.org/pdf/softlayer-python/v3.0.1/softlayer-python.pdf

import SoftLayer

# list型データを整列して表示するために使用
from pprint import pprint

# ポータルにて「アカウント > ユーザ > ユーザー・プロファイルの編集」でAPIアクセス情報を確認し入力
username = 'xxxxxxxx'
key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# 認証情報を渡すことで他のメゾッドで要求されるauthenticate引数を省略可能
client = SoftLayer.Client(username=username, api_key=key)

results = client['Location_Datacenter'].getDatacenters()
pprint(results)

(2)データセンターのタイムゾーン情報を取得(getTimezoneメゾッド) http://sldn.softlayer.com/reference/services/softlayer_location_datacenter/gettimezone

概要

引数
Optional Headers: SoftLayer_ObjectMask
Required Headers: authenticate

戻り値
Return Values: SoftLayer_Locale_Timezone
http://sldn.softlayer.com/reference/datatypes/softlayer_locale_timezone


import SoftLayer

from pprint import pprint

username = 'xxxxxxxx'
key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

client = SoftLayer.Client(username=username, api_key=key)

results = client['Location_Datacenter'].getTimezone(id=xxxxxx)
pprint(results)

実行結果(2017/11/02)


{'id': 158,
 'longName': '(GMT+09:00) Asia/Tokyo - JST',
 'name': 'Asia/Tokyo',
 'offset': '+0900',
 'shortName': 'JST'}

コメント版


# 前提 sudo pip install softlayerなどでsoftlayerモジュールをインストール済み

# SoftLayer API Overview 
# https://sldn.softlayer.com/article/SoftLayer-API-Overview

# SoftLayer API Python Client Documentation 
# https://media.readthedocs.org/pdf/softlayer-python/v3.0.1/softlayer-python.pdf

import SoftLayer

# list型データを整列して表示するために使用
from pprint import pprint

# ポータルにて「アカウント > ユーザ > ユーザー・プロファイルの編集」でAPIアクセス情報を確認し入力
username = 'xxxxxxxx'
key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# 認証情報を渡すことで他のメゾッドで要求されるauthenticate引数を省略可能
client = SoftLayer.Client(username=username, api_key=key)

# 施設idを与えてその場所のタイムゾーン情報を取得し表示
results = client['Location_Datacenter'].getTimezone(id=xxxxxx)
pprint(results)

アカウント登録(1ヶ月間無料トライアル付き: 要クレジット登録)
https://ibm.biz/Bdji5q

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1