2017-10-27 11 views
0

createObjects APIメソッドを使用してゲストオブジェクトを作成できません。 、上記の要求を提出しながら、私は以下のエラーメッセージを取得していますcreateObjects APIを使用して複数のゲストオブジェクトをサブミットできません

Image image = new Image(); 
    image.setCapacity(50L); 

    Guest guest = new Guest(); 
    guest.setHostname("malya-vm-4"); 
    guest.setDomain("test.com"); 
    guest.setStartCpus(1l); 
    guest.setMaxMemory(1024l); 
    guest.setDatacenter(new Location()); 
    guest.getDatacenter().setName("che01"); 

    guest.setLocalDiskFlag(false); 
    guest.setHourlyBillingFlag(true); 

    guest.setOperatingSystemReferenceCode("UBUNTU_LATEST"); 

    Component privateComponent = new Component(); 
    Component publicComponent = new Component(); 

    Vlan networkVlan1 = new Vlan(); 
    networkVlan1.setVlanNumber(1365L); 
    networkVlan1.setId(2117919L); 

    Subnet privateSubnet = new Subnet(); 
    privateSubnet.setId(1059121L); 

    privateComponent.setNetworkVlan(networkVlan1); 
    privateComponent.setPrimarySubnet(privateSubnet); 
    guest.setPrimaryBackendNetworkComponent(privateComponent); 

    Vlan networkVlan2 = new Vlan(); 
    networkVlan2.setId(2117917L); 
    networkVlan2.setVlanNumber(1290L); 

    Subnet primarySubnetVersion4 = new Subnet(); 
    primarySubnetVersion4.setVersion(4L); 
    primarySubnetVersion4.setId(1547547L); 

    Subnet ipv6 = Subnet.service(client, 1512739L).getObject(); 
    Subnet primarySubnetVersion6 = new Subnet(); 
    primarySubnetVersion6.setVersion(6L); 
    primarySubnetVersion6.setId(1512739L); 
    primarySubnetVersion6.setSubnetType("PRIMARY_6"); 

    networkVlan2.setPrimarySubnet(primarySubnetVersion4); 
    networkVlan2.setPrimarySubnetVersion6(ipv6); 
    networkVlan2.setPrimarySubnetCount(2L); 

    publicComponent.setNetworkVlan(networkVlan2); 
    guest.setPrimaryNetworkComponent(publicComponent); 

    List<Guest> list = new ArrayList<>(); 
    list.add(guest); 
    Guest.service(client).createObjects(list); 

、以下のサンプルコードを参照してくださいスレッド「メイン」com.softlayer.api.ApiException $内部で

例外:プロパティcom.softlayer.api.ApiException.fromError(ApiException.java:16) at com.softlayer.api at 'SoftLayer_Virtual_Guest'(コード:SoftLayer_Exception_MissingCreationProperty、ステータス:500)のインスタンスを作成するには、 'hostname'を設定する必要があります。 RestApiClient $ ServiceProxy.logAndHandleResponse(RestApiClient.java:258) at com.softlayer.api.RestApiC com.sun.proxyでcom.softlayer.api.RestApiClient $ ServiceProxy.invoke(RestApiClient.java:466) でlient $ ServiceProxy.invokeService(RestApiClient.java:300) 。$ Proxy7.createObjects(不明なソース)

答えて

0

これはSoftlayerのJavaクライアントの問題です。ここに報告する必要がありますhttps://github.com/softlayer/softlayer-java/issues、ログに表示されているのは、クライアントがメソッド内でメソッド "createObjects"を呼び出していないということです。 APIがこれを見ると、デフォルトでcreateObjectメソッドを呼び出そうとします:

Running POST on https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest.json with body: {"parameters":[[{"complexType":"SoftLayer_Virtual_Guest","maxMemory":1024,"hostname":"rcaberodeleteme","domain":"test.com","hourlyBillingFlag":true,"startCpus":1,"operatingSystemReferenceCode":"UBUNTU_LATEST","localDiskFlag":false,"datacenter":{"complexType":"SoftLayer_Location","name":"che01"}}]]} 
Got 500 on https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest.json with body: {"error":"The property 'hostname' must be set to create an instance of 'SoftLayer_Virtual_Guest'.","code":"SoftLayer_Exception_MissingCreationProperty"} 
関連する問題