2016-08-02 2 views
0

Softlayer Java Clientを使用してAutoscaleを実装しています。スケールグループを追加する場合、ネットワークオプションを選択できます(添付のPNGを参照してください) 選択ボックスでネットワークオプションを取得するにはどうすればよいですか?サンプルやAPIを提供できますか? Auto scale networkAuthScaleネットワークの選択

答えて

0

以下のコードはすべてのVLANを一覧表示し、データをフィルタリングする必要があります。次のオブジェクトマスクに気付くでしょうmask[primaryRouter[datacenter[groups]], networkSpace] "networkSpace"は、VLANがパブリックかプライベートかを指定します。したがって、フィルタを使用してすべてのプライベートVLANを取得します。 マスクprimaryRouter[datacenter[groups]は、VLANが使用可能なデータセンターを返します。そのため、選択した地域またはデータセンターに応じて、その地域またはデータセンターで使用されているVLANを表示するためにデータをフィルタリングする必要があります。

あなたはデータセンターとそのグループhttp://sldn.softlayer.com/reference/services/SoftLayer_Location/getDatacenters

import com.softlayer.api.ApiClient; 
import com.softlayer.api.RestApiClient; 
import com.softlayer.api.service.Account; 
import com.google.gson.Gson; 

public class VlanScale { 

    private static String user = "set me"; 

    private static String apiKey = "set me"; 

    private static ApiClient client = new RestApiClient().withCredentials(user, apiKey); 

    public static void main(String[] args) { 

     // Declare the API client 
     ApiClient client = new RestApiClient().withCredentials(user, apiKey); 
     Account.Service accountService = Account.service(client); 

     accountService.setMask("mask[primaryRouter[datacenter[groups]], networkSpace]"); 

     // Send the request to get the VLANs and print the result 
     try { 
      Gson gson = new Gson(); 
      System.out.println(gson.toJson(accountService.getNetworkVlans())); 


     } catch (Exception e) { 
       System.out.println("Unable to retrieve the VLANs. " 
          + e.getMessage()); 
     } 

    } 

} 

よろしく

+0

感謝を取得するには、このメソッドを使用することができます。それはうまく動作します。 –

関連する問題