新規作成(A)

仮想マシンを新規作成します。下記2通りの作成方法があります。
1) テンプレートを指定して作成
2) 完全新規(ゲストOS未インストール)で作成

check
重要

APIを連続実行した場合、想定していない結果が生じる可能性がございます。実行したAPIの処理結果をGET /api/1.0/task で確認したうえで、次の処理を行ってください。

1) テンプレートを指定して作成

POST /api/1.0/vm
Request parameters
Name Description Type Data type Required
Authorization Bearer [APIキー] header String True
templateVmId テンプレート仮想マシンID body String True
vm 作成する仮想マシン情報 body Object True
body parameters
Name Description Example Data type Required
templateVmId テンプレート仮想マシンID String True
vm 仮想マシン情報 Object True
vmName 仮想マシン名 VM01 String True
guestName ゲスト名 Computername String True
vmgroupId 仮想マシングループID 1d10a85b0d774af6b79264717ed57416 String True
storages 仮想マシンストレージ情報配列 Array
storage 仮想マシンストレージ情報
※指定したテンプレートで保持するディスク数分記載
Object
storageId ストレージID String True
nics 仮想マシンNIC
情報配列
Array
nic 仮想マシンNIC情報
※指定したテンプレートで保持するNIC数分記載
Object
networkId ネットワークID
※未接続で作成する場合は空文字(“”)を指定
df514769956a4c7a893bbb7e3761952c String True
ipAddressKbn IPアドレス区分
01:固定IPプール
02:手動
03:DHCP
※未接続で作成する場合は空文字(“”)を指定
02 String True
ipAddress IPアドレス
※ipAddressKbnが手動(02)の場合は記載必須
192.168.1.1 String
startupOrder 仮想マシン起動順番
※未指定の場合はデフォルト 0 が設定
1 Number
startupActionKbn 仮想マシン開始アクション区分
0:なし
1:パワーオン
1 String True
startupWaitTime 仮想マシン起動待機時間(秒)
※未指定の場合はデフォルト 0 が設定
30 Number
stopActionKbn 仮想マシン停止アクション区分
0:シャットダウン
1:パワーオフ
1 String True
stopWaitTime 仮想マシン停止待機時間(秒)
※未指定の場合はデフォルト 0 が設定
15 Number
Successful Response
Response Code 200 OK
Response Headers Content-type: application/json
Response parameters
Name Description Example Data type
taskId タスクID 24714aac4703428292a03cd847c9ed62 String
実行例) テンプレートVMのDisk数1つ、NIC数1つの場合
  
# Execute request
  curl -i -X POST -H "Authorization:$token" -H Content-Type:application/json -d '{
    "templateVmId": "7777ab9268c8428586bfc95fca14bb13",
    "vm":
        {
          "vmName": "TestVM01",
          "guestName": "TestVM01",
          "vmgroupId": "e979f975a30f4c6699a5c74f9abd6b70",
          "storages": [
            {
              "storageId": "e86e407045ad401f9a3602beed1dfb54"
            }
          ],
          "nics": [
            {
              "networkId": "df514769956a4c7a893bbb7e3761952c",
              "ipAddressKbn": "02",
              "ipAddress": "192.168.1.1"
            }
          ],
          "startupOrder": 1,
          "startupActionKbn": "1",
          "startupWaitTime": 30,
          "stopActionKbn": "1",
          "stopWaitTime": 15
        }
  }' https://eastapi.aspire.gcf.whitecloud.jp/api/1.0/vm
  
レスポンス例
  
    {"taskId":"56f35c5820424fe5b31bdabc472748d3"}
  
タスク確認例
  
  # タスク確認実施
    curl -X GET -H "Authorization:$token" -H Content-Type:application/json
    https://eastapi.aspire.gcf.whitecloud.jp/api/1.0/task/56f35c5820424fe5b31bdabc472748d3
  # レスポンス例
  {
    "task":
      {
        "status":"SUCCESS",
        "progressPercentage":100,
        "targetId":"7e1a8ceed71c4204819c626203e5deab",
        "targetId":"7e1a8ceed71c4204819c626203e5deab",
        "acceptedDate":"2023-06-27T16:26:15+0900",
        "startedDate":"2023-06-27T16:26:18+0900",
        "finishedDate":"2023-06-27T16:26:30+0900",
        "result":"OK"
      }
  }
  

※ 出力された “targetId” が新規作成された仮想マシンの “vmId” となります。

2) 完全新規(ゲストOS未インストール)で作成

POST /api/1.0/vm
Request parameters
Name Description Type Data type Required
Authorization Bearer [APIキー] header String True
vm 作成する仮想マシン情報 body Object True
body parameters
Name Description Example Data type Required
vm 仮想マシン情報 Object True
vmName 仮想マシン名 VM01 String True
guestName ゲスト名 Computername String True
comment コメント コメント String
guestOsType ゲストOSコード
※ 3.パラメータ詳細:guestOsType
01001 String True
vcpu 仮想CPU数 4 Number True
cpuCorePerSocket ソケットあたりのコア数 2 Number True
memory 仮想メモリ(MB) 1024 Number True
hwVersion 仮想ハードウェアバージョン
※ 3.パラメータ詳細:hwVersion
vmx-17 String True
firmwareKbn ファームウェア区分
1:BIOS
2:EFI
1 String True
bootSecureBootFlg セキュアブートフラグ false Boolean True
vmgroupId 仮想マシングループID 1d10a85b0d774af6b79264717ed57416 String True
storages 仮想マシンストレージ情報配列 Array True
storage 仮想マシンストレージ情報 Object True
size ストレージサイズ(GB) 100 Number True
busType バスタイプ
※ 3.パラメータ詳細:busType
Lsilogocsas String True
storageId ストレージID f1af87b78705473fb7ca7e5924fa1843 String True
nics 仮想マシンNIC情報配列 Array True
nic 仮想マシンNIC情報 Object True
primaryKbn プライマリ区分
1:プライマリ
0:プライマリ以外
1 Number True
networkId ネットワークID
※未接続で作成する場合は空文字(“”)を指定
String True
networkAdapterName ネットワークアダプタ名
※ 3.パラメータ詳細:networkAdapterName
VMXNET3 String True
ipAddressKbn IPアドレス区分
01:固定IPプール
02:手動
03:DHCP
※未接続で作成する場合は空文字(“”)を指定
01 String True
ipAddress IPアドレス
※ipAddressKbnが手動(02)の場合は記載必須
String
startupOrder 仮想マシン起動順番
※未指定の場合はデフォルト 0 が設定
1 Number
startupActionKbn 仮想マシン開始アクション区分
0:なし
1:パワーオン
1 String True
startupWaitTime 仮想マシン起動待機時間(秒)
※未指定の場合はデフォルト 0 が設定
30 Number
stopActionKbn 仮想マシン停止アクション区分
0:シャットダウン
1:パワーオフ
1 String True
stopWaitTime 仮想マシン停止待機時間(秒)
※未指定の場合はデフォルト 0 が設定
15 Number
Successful Response
Response Code 200 OK
Response Headers Content-type: application/json
Response parameters
Name Description Example Data type
taskId タスクID 24714aac4703428292a03cd847c9ed62 String
実行例) Disk数1つ、NIC数1つの仮想マシンを作成する場合
  
  # Execute request
    curl -i -X POST -H "Authorization:$token" -H Content-Type:application/json -d '{
        "vm":
            {
                "vmName": "TestnewVM01",
                "guestName": "TestnewVM01",
                "comment": "コメント",
                "guestOsType": "01001",
                "vcpu": 2,
                "cpuCorePerSocket": 1,
                "memory": 1024,
                "hwVersion": "vmx-17",
                "firmwareKbn": "1",
                "bootSecureBootFlg": false,
                "vmgroupId": "g979f975a30f4c6699a5c74f9abd6b71",
                "storages": [
                    {
                        "size": 10,
                        "busType": "lsilogocsas",
                        "storageId": "f87e407045ad401f9a3602beed1dfb73"
                    }
                ],
                "nics": [
                    {
                        "primaryKbn": 1,
                    "networkId": "df514769956a4c7a893bbb7e3761952c",
                        "networkAdapterName": "VMXNET3",
                    "ipAddressKbn": "02",
                    "ipAddress": "192.168.1.1"
                    }
                ],
                "startupOrder": 1,
                "startupActionKbn": "0",
                "startupWaitTime": 0,
                "stopActionKbn": "0",
                "stopWaitTime": 0
            }
    }' https://eastapi.aspire.gcf.whitecloud.jp/api/1.0/vm
  
レスポンス例
  
    {"taskId":" b1071f224a094822aa9134479449107c"}
  
タスク確認例
  
  # タスク確認実施
  curl -X GET -H "Authorization:$token" -H Content-Type:application/json
  https://eastapi.aspire.gcf.whitecloud.jp/api/1.0/task/b1071f224a094822aa9134479449107c
  # レスポンス例
  {
    "task":
      {
        "status":"SUCCESS",
        "progressPercentage":100,
        "targetId":"7e1a8ceed71c4204819c626203e5deab",
        "acceptedDate":"2023-06-27T16:26:15+0900",
        "startedDate":"2023-06-27T16:26:18+0900",
        "finishedDate":"2023-06-27T16:26:30+0900",
        "result":"OK"
      }
  }
  

※ 出力された “targetId” が新規作成された仮想マシンの “vmId” となります。