2017-01-31 6 views
0

は、createObject APIを参照しています。仮想マシンを注文するリクエストの一部として、私はパブリックインターフェイスとプライベートインターフェイスの両方でマシンを構成したいと考えています。CreateObjectネットワークコンポーネント

{ 
"parameters":[{ 
     "hostname": "hostname-test", 
     "domain": "domain-test", 
     "startCpus": 8, 
     "maxMemory": 16384, 
     "hourlyBillingFlag": true, 
     "operatingSystemReferenceCode": "ubuntu_14_64", 
     "localDiskFlag": true, 
     "privateNetworkOnlyFlag": false, 
     "networkComponents": [ 
      { 
      "maxSpeed": 1000 
      } 
     ] 
    }] 
} 

を私はまた、Webインターフェイス上で提示したオプションに類似の公共の帯域幅を、設定したいと思いますが - ここで働くJSONの関連する部分があります。 network component structureと前述のcreateオブジェクト呼び出しを読むと、特定の帯域幅を選択するフィールドを解読できません。

また、getCreateObjectOptionsの帯域幅オプションについては言及していません。どんな助けも素晴らしいだろう。

答えて

0

CreateObjectメソッドのために利用可能なすべてのオプションは、この方法を使用して表示されている:ネットワーク構成の点で

https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getCreateObjectOptions

上記の方法は、このような値が返されますで

"networkComponents": [ 
     { 
      "itemPrice": { 
       "hourlyRecurringFee": "0", 
       "recurringFee": "0", 
       "item": { 
        "description": "10 Mbps Public & Private Network Uplinks" 
       } 
      }, 
      "template": { 
       "id": null, 
       "networkComponents": [ 
        { 
         "maxSpeed": 10 
        } 
       ], 
       "privateNetworkOnlyFlag": false 
      } 
     } 

を上記のJSONは、「10 Mbps Public & Private Network Uplinks」という項目を表示できます。注文時にその項目を設定するには、「テンプレート」設定に従う必要がありますこの場合、それはあなたがフォローの設定を追加する必要があると述べている:

それだ
"networkComponents": [ 
        { 
         "maxSpeed": 10 
        } 
       ], 
       "privateNetworkOnlyFlag": false 

、しかし、CreateObjectメソッドを使用すると、唯一の方法getCreateObjectOptionsで表示オプションを設定することができます欠点を持っていますが、ポータルがどの他の多くのオプションを提供していますcreateObjectメソッドでは使用できません。

https://sldn.softlayer.com/blog/bpotter/going-further-softlayer-api-python-client-part-3

よろしく

+0

私はhttps://softlayer.github.io/rest/place_order/に従ってみましたが、この全体概念は "id"ですが、まだ非常に混乱しています。ここで私が思いついたjsonですが、私はステータス400に戻ります。明らかに、必要な "id"のすべての質問にも答える何かが欠けていますか? '{ \t "パラメータ":[{ \t \t "complexTypeの": "SoftLayer_Container_Product_Order_Virtual_Guest"、 \t \t "のPackageID":46、 \t \t "場所":449494、 \t \t "量":1、 \t \t "ハードウェア":[{ \t \t \t "ホスト名": "ホスト名試験"、 \t \t \t "ドメイン":「domain.name " \t \t}]、 \t \t "価格":[ \t \t \t {" ID ":37174}#のOS \t \t] \t}] } ' – rbh

+0

私はつもりそれを確認したが、うん、そのています注文をするのは難しいですし、idsは少なくとも注文のための基本的なオプションを必要とします。もしあなたがそれらのIDを追加する必要があるより多くのオプション(ディスクなど)が必要ならば、 –

+0

あなたのjsonが必要なすべての価格を持っていない必要な項目、私はあなたが方法を呼び出すことを勧める:http://sldn.softlayer.com/reference/serv ices/SoftLayer_Virtual_Guest/generateOrderTemplateメソッドにcreateObjectメソッドと同じ値を送信する必要がありますが、generateOrderTemplateはplaceOrderメソッドに使用できるオーダーを返します。必要に応じていくつかの価格を変更したり、必要に応じて追加することができますpalceOrderメソッドの作業jsonを持つのに役立ちます –

0

後世のためにここにこれを追加する:場合は、あなたはこの記事があなたがplaceOrderメソッドをundertandするのに役立つ可能性がありplaceOrderメソッドを使用する必要が注文した瞬間に高度なオプションを必要としています。

ここでは他の構成を構築するための基礎として使用することができますJSONテンプレートです:

{ "parameters": [{ "imageTemplateId": null, "location": "449500", "packageId": 46, "prices": [{ "hourlyRecurringFee": ".131", "id": 30823, "recurringFee": "87", "item": { "description": "8 x 2.0 GHz Cores" } }, { "hourlyRecurringFee": ".153", "id": 29663, "recurringFee": "101.5", "item": { "description": "16 GB " } }, { "hourlyRecurringFee": "0", "id": 37204, "recurringFee": "0", "item": { "description": "Ubuntu Linux 14.04 LTS Trusty Tahr - Minimal Install (64 bit)" } }, { "hourlyRecurringFee": ".004", "id": 26466, "recurringFee": "2.9", "item": { "description": "100 GB (LOCAL)" } }, { "hourlyRecurringFee": "0", "id": 23070, "recurringFee": "0", "item": { "description": "Reboot/Remote Console" } }, { "hourlyRecurringFee": ".014", "id": 23777, "recurringFee": "5", "item": { "description": "1 Gbps Private Network Uplink" } }, { "hourlyRecurringFee": "0", "id": 34183, "item": { "description": "0 GB Bandwidth" } }, { "hourlyRecurringFee": "0", "id": 34807, "recurringFee": "0", "item": { "description": "1 IP Address" } }, { "hourlyRecurringFee": "0", "id": 27023, "recurringFee": "0", "item": { "description": "Host Ping" } }, { "hourlyRecurringFee": "0", "id": 32500, "recurringFee": "0", "item": { "description": "Email and Ticket" } }, { "hourlyRecurringFee": "0", "id": 32627, "recurringFee": "0", "item": { "description": "Automated Notification" } }, { "hourlyRecurringFee": "0", "id": 33483, "recurringFee": "0", "item": { "description": "Unlimited SSL VPN Users & 1 PPTP VPN User per account" } }, { "hourlyRecurringFee": "0", "id": 35310, "recurringFee": "0", "item": { "description": "Nessus Vulnerability Assessment & Reporting" } }], "quantity": 1, "sourceVirtualGuestId": null, "sshKeys": [{ "sshKeyIds": [ 12345 ] }], "useHourlyPricing": true, "virtualGuests": [{ "domain": "domain.test", "hostname": "hostname.test" }], "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest" }] }

必要なIDの:

  1. パッケージID - SoftLayer_Product_Package->getAllObjectsから得た - それはフィールド「id」

  2. 価格id - ob SoftLayer_Product_Package->getItemPricesから得られました - もう一度それはフィールドIDです(同じフィールド名が使用されるいくつかの場所があります)。これにより、仮想マシンに入る可能性のあるすべての設定が一覧表示されます。上記のJSONでは、いくつかのオプションが選択されています。

最後に、JSONテンプレートを使用して、注文を確認して配置することができます。

(PS:これは仮想マシンの注文でのみテストされています.SSHキーIDは一例であり、有効なIDで置き換える必要があります。)

関連する問題