Coder Social home page Coder Social logo

softlayer-java's People

Contributors

acamacho82 avatar allmightyspiff avatar camporter avatar cretz avatar dependabot[bot] avatar underscorephil avatar unterhol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

softlayer-java's Issues

[Question] list transcoding jobs

Hello,
I have an issue when reading transcoding jobs. The following code is what I am doing now

RestApiClient client = new RestApiClient().withCredentials("user", "key");
List<com.softlayer.api.service.network.media.transcode.Account> accounts =
    Account.service(client).getTranscodeAccounts();
List<Job> jobs = new ArrayList<Job>();
for (com.softlayer.api.service.network.media.transcode.Account account : accounts) {
  log.debug("Transcode account: " + account.getAccountId());
  log.debug("Transcode jobs count: " + account.getTranscodeJobCount());

  jobs.addAll(account.getTranscodeJobs());
}
log.debug("Jobs count: " + jobs.size());

And here is the produced output

11:00:49.500 [main] DEBUG i.wintech.wcm.cwfa.cdn.TranscodeImpl - Transcode account: 452421
11:00:49.500 [main] DEBUG i.wintech.wcm.cwfa.cdn.TranscodeImpl - Transcode jobs count: null
11:00:49.500 [main] DEBUG i.wintech.wcm.cwfa.cdn.TranscodeImpl - Jobs count: 0

Only one account is found, which I guess its right, but no jobs are shown.

On the SoftLayer portal page I can see the several jobs that I have been able to create, either through the portal itself or other API calls.

What am I doing wrong? Does the API call that I am using only returns active jobs? Eventually, how can I list completed transcoding jobs?

SoftLayer_Network_Service_Vpn_Overrides::createObjects is not exposed

It is not possible to create VPN Overrides, I tried the following code:

import com.softlayer.api.ApiClient;
import com.softlayer.api.RestApiClient;
import com.softlayer.api.service.Account;
import com.softlayer.api.service.network.Subnet;
import com.softlayer.api.service.network.service.vpn.Overrides;
import com.softlayer.api.service.user.Customer;

Overrides.Service overrideService = Overrides.service(client);
List<Overrides> overrides = new ArrayList<Overrides>();

Overrides objectOverride1 = new Overrides();    
objectOverride1.setUserId(539047l);
objectOverride1.setSubnetId(112382l);
overrides.add(objectOverride1);

boolean result = overrideService.createObjects(overrides);
System.out.println("Have been set the overrides successfully? " + result);

The following exception is displayed:

"error":"Function (\"createObject\") is not a valid method for this service.","code":"SoftLayer_Exception_Public"}

Cannot provide service-init parameters to class-extensions

The code generator only looks for "id" and "globalIdentifier" in the current set of properties, not in the base type's set, so it doesn't produce the proper static service method for subtypes. See com.softlayer.api.service.hardware.Server's lack of service method that accepts an ID.

[Question] Print price list ID is required

I want to print a list of prices to get the right ID to create a subnet. I tried to look for a way to give my account ID through the ApiClient but this didn't need the ID. When I run the code it give me following error:
Exception in thread "main" java.lang.IllegalStateException: ID is required to invoke public abstract java.util.List com.softlayer.api.service.product.item.Price$Service.getPackageReferences()
at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:282)
at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:466)
at com.sun.proxy.$Proxy8.getPackageReferences(Unknown Source)
at applicatie.getPrices(applicatie.java:430)
at applicatie.main(applicatie.java:78)

This is the code I use:

ApiClient client = new RestApiClient()
.withCredentials("OUR USERNAME",
"THE KEY");
getPrices(client,account);

public static void getPrices(ApiClient client, Account account) {
    Price.Service servicePrices = Price.service(client);

    List<Prices> p = servicePrices.getPackageReferences();

    for (Prices price : p) {
        System.out.println(price.getId() + price.getItemPriceId());
    }
}

Does anyone have the code to print a list of ID's and Names to find the subnet priceId. Or does someone have the code to create one.

NFS order container does not extend Order

The
com.softlayer.api.service.container.product.order.network.performancestorage.Nfs
and
com.softlayer.api.service.container.product.order.network.performancestorage.Iscsi
objects do not extend Order, like the other Container objects. This prevents a verifyOrder, and presumably a placeOrder from running.

When passing the Nfs container to the order service's verifyOrder() the following error is thrown:
groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy171.verifyOrder() is applicable for argument types: (com.softlayer.api.service.container.product.order.network.performancestorage.Nfs) values: [com.softlayer.api.service.container.product.order.network.performancestorage.Nfs@22e04a44]
Possible solutions: verifyOrder(com.softlayer.api.service.container.product.Order)

SL Machines being indicated as released but are not actually released in the portal

We tried to release these 4 machines which are in Active state in SL.
"chs-hosts-stdv2-mgmt-4167.prod.bluemix.net",
"chs-hosts-stdv2-data-5076.prod.bluemix.net",
"chs-hosts-stdv2-data-5077.prod.bluemix.net",
"chs-hosts-stdv2-data-5078.prod.bluemix.net"

This is the SL API which was invoked and it returned a true. Because of which our system considered machines to be accepted for release.

SoftLayer_Virtual_Guest::deleteObject(https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/deleteObject) is invoked to delete a host.
com.softlayer.api.service.virtual.Guest.Service guestService = com.softlayer.api.service.virtual.Guest.service(client, nodeId);
boolean result = guestService.deleteObject();

Once the request has been accepted, then we tried to run this API to check if the node was deleted:
Service guestService = Guest.service(client, nodeId);

But it could not fetch the node id and returned the following error :
2018-04-24T06:47:50.43+0000 [APP/PROC/WEB/0] ERR [ERROR ] Unable to find object with id of '50074231'.
2018-04-24T06:47:50.43+0000 [APP/PROC/WEB/0] ERR Unable to find object with id of '50074231'.(code: SoftLayer_Exception_ObjectNotFound, status: 404)
2018-04-24T06:47:50.62+0000 [APP/PROC/WEB/0] ERR [ERROR ] Unable to find object with id of '50098757'.
2018-04-24T06:47:50.62+0000 [APP/PROC/WEB/0] ERR Unable to find object with id of '50098757'.(code: SoftLayer_Exception_ObjectNotFound, status: 404)
2018-04-24T06:47:50.87+0000 [APP/PROC/WEB/0] ERR [ERROR ] Unable to find object with id of '50105353'.
2018-04-24T06:47:50.87+0000 [APP/PROC/WEB/0] ERR Unable to find object with id of '50105353'.(code: SoftLayer_Exception_ObjectNotFound, status: 404)

As the node could not be fetched, it was considered to be deleted. But if checked on the portal the machines still exists.

When we fired a curl with the same id to fetch details it says that the host is active :
curl --user : https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/50074231 | json_reformat
{
"accountId": 288698,
"createDate": "2018-02-25T19:45:17+05:30",
"dedicatedAccountHostOnlyFlag": false,
"domain": "prod.bluemix.net",
"fullyQualifiedDomainName": "chs-hosts-stdv2-mgmt-4167.prod.bluemix.net",
"hostname": "chs-hosts-stdv2-mgmt-4167",
"id": 50074231,
"lastPowerStateId": null,
"lastVerifiedDate": null,
"maxCpu": 4,
"maxCpuUnits": "CORE",
"maxMemory": 16384,
"metricPollDate": null,
"modifyDate": "2018-02-25T19:47:39+05:30",
"provisionDate": "2018-02-25T19:47:39+05:30",
"startCpus": 4,
"statusId": 1001,
"typeId": 1,
"uuid": "44a7859f-1662-427d-af47-d2b24f438221",
"globalIdentifier": "b1dbb648-5673-404c-8b89-9c478bbb231c",
"managedResourceFlag": false,
"primaryBackendIpAddress": "10.186.64.12",
"primaryIpAddress": "169.60.167.25",
"status": {
"keyName": "ACTIVE",
"name": "Active"
}
}

Can you please provide us a fool proof method of releasing machines. Due the above we have more than 200 machines in released state in our DB but actually those machines are still active in SL.

[Create Object] Can i specify the vlan?

When i create a new server, can i specify the "vlan"?
I'll explain.
I noticed that when i create the first machine in a datacenter are automatically create two vlans.
Eg, if i create a server in "dal05", are created:

  • bcr01a.dal05 (private vlan, max 64 ip)
  • fcr01a.dal05 (public vlan, max 16 ip)

The instance will be inserted in these vlans.
I wonder: in a datacenter, there could be two or more vlans?
Or rather, can i have in the datacenter named "dal05" two or more couple (bcr/fcr) of vlans?
If yes, how do i decide (when i create a server) in which of these i want to put it?

com.softlayer.api.service.software.component.security.SafeNet needs to inherit from OperatingSystem

When getting a list of operating systems from the API, if a safenet (HSM) type device is in the list, the following error will be present.

Expecting class com.softlayer.api.service.software.component.OperatingSystem to be super type of class com.softlayer.api.service.software.component.security.SafeNet

https://sldn.softlayer.com/reference/datatypes/SoftLayer_Software_Component_Security_SafeNet/ should inherit from the OperatingSystem, but is instead inherits from the Security Class.

SL-API issue pagination of virtual machines with masks

The issue we're facing is to retrieve the relational properties of a list of SoftLayer_Virtual_Guest using pagination. We use masks to get the relational properties like power state, os, datacenter data etc.... of a virtual machine as there are many vms in a particular account the api throws an out of memory error, the service.getObject method ignores pagination, so I used service.getVirtualGuests() which the pagination works but only brings the local properties of the vm, if I put a mask to get the relational properties in the service, service.getVirtualGuests() thows another error, one way I found to do this is use service.getVirtualGuests() to get the basic info and then use Guest.Service virtualGuestsService = Guest.service(client, guest.getId()); with a mask to get the relational properties for each vm in a loop, but this will generate thousands of api calls, so Im not sure if this is the best/correct approach, the best would be if I could use service.getVirtualGuests() with the mask to get the relational properties, attached is a sample code.
vm-pagination.txt

http Response Error Checking

Hi all, I am a IBM business partner using this library for a plugin for IBM's APM platform. Thanks for the great library! I am in need of error checking and possibly retrying certain requests depending on the response code of each request. I have tried to extend RestApiClient, but I need to override logAndHandleResponse in the ServiceProxy class. But this class is private-protected. If i try to implement my own version of this class, I cannot call mask.getMask() because it is not in the same package as Mask at this point. Thanks for considering this request for enhancement.

Network monitor query returns invalid JSON

Quering network monitors with mask results in

java.lang.RuntimeException: Expected 'complexType' as first property
	at com.softlayer.api.json.GsonJsonMarshallerFactory$EntityTypeAdapter.read(GsonJsonMarshallerFactory.java:186)
	at com.softlayer.api.json.GsonJsonMarshallerFactory$EntityTypeAdapter.read(GsonJsonMarshallerFactory.java:139)
	at com.google.gson.Gson.fromJson(Gson.java:805)
	at com.google.gson.Gson.fromJson(Gson.java:770)
	at com.softlayer.api.json.GsonJsonMarshallerFactory.fromJson(GsonJsonMarshallerFactory.java:83)
	at com.softlayer.api.RestApiClient$ServiceProxy.logAndHandleResponse(RestApiClient.java:291)
	at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:321)
	at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:487)
	at com.sun.proxy.$Proxy5.getObject(Unknown Source)
	at com.daimler.retacc.cloud.SLApiMgr.changeNetworkMonitors(SLApiMgr.java:358)
	at com.daimler.retacc.cloud.SLApiMgrTest.testSimple(SLApiMgrTest.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at com.intellij.junit4.JUnit4TestRunnerUtil$IgnoreIgnoredTestJUnit4ClassRunner.runChild(JUnit4TestRunnerUtil.java:341)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Sample code for this is

    ApiClient client = new RestApiClient(softlayerURL).withCredentials(username, password);
    Account.Service service = Account.service(client);

    service.withMask().virtualGuests().id();
    service.withMask().virtualGuests().hostname();
    service.withMask().virtualGuests().networkMonitors();
    service.withMask().virtualGuests().networkMonitors().id();
    service.withMask().virtualGuests().networkMonitors().ipAddress();
    service.withMask().virtualGuests().networkMonitors().queryType();
    service.withMask().virtualGuests().networkMonitors().responseAction();
    service.withMask().virtualGuests().networkMonitors().lastResult();
    service.withMask().virtualGuests().networkMonitors().status();
    service.withMask().virtualGuests().networkMonitors().waitCycles();

    Account account = service.getObject();

Error to get the associated hardware for an account

When I call the SoftLayer_Account::getHardware method I got the following error:

Exception in thread "main" java.lang.IllegalStateException: ID is required to invoke public abstract java.util.List com.softlayer.api.service.Account$Service.getHardware()
at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:282)
at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:459)
at com.sun.proxy.$Proxy0.getHardware(Unknown Source)
at testJava.testjavaArtifact.Main.main(Main.java:16)

this is my code:

import com.softlayer.api.*;
import com.softlayer.api.service.Account;
import com.softlayer.api.service.Hardware;

public class Main {
public static void main(String[] args) throws Exception {
String user = "set me";
String apikey = "set me";
ApiClient client = new RestApiClient().withCredentials(user, apikey);

    for (Hardware hardware : Account.service(client).getHardware()) {
        System.out.println("Hardware: " + hardware.getFullyQualifiedDomainName());
    }               
}

}

Relational property "storageType" is not visible for SoftLayer_Account::getNetworkStorage method

I am trying to get information about "storageType" relational property, but this property is not available to be used in object mask for method SoftLayer_Account::getNetworkStorage.

        Account.Service accountService = Account.service(client);
        // Declare an object mask, to get relational properties
        accountService.withMask().networkStorage().storageType();

The above code is not working, However, I can retrieve that property using a Rest request:

https://$user:[email protected]/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[storageType]

Method: Get

Support for object filters

Is there anyway to use object filters with this client? https://sldn.softlayer.com/article/object-filters

I suppose I could implement my own HttpClient. Thoughts?

If not, please add official support in the future.

setResultLimit with limit 1 throws an Exception in Gson parser

Way to reproduce:
ApiClient client = new RestApiClient().withLoggingEnabled().withCredentials( "userid", "apikey" );
Account.Service service = Account.service( client );
service.setResultLimit( new ResultLimit( 1,1 ) );
service.getHardware();

In result the JavaClient makes the following request:

https://api.softlayer.com/rest/v3.1/SoftLayer_Account/Hardware.json?resultLimit=1,1

And SL API returns a single Json object instead of array of Json objects, but Gson is expecting list of Json objects and we are facing with the following exception:

Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

I think you need a fix on SL Rest API side :)

Thanks in advance.

Use globalIdentifier when instance id is not present

When using:

hardware = service.createObject(hardware);
hardware.asService(client).getObject();

I get the following exception:

java.lang.IllegalStateException: ID is required to invoke public abstract com.softlayer.api.service.Hardware com.softlayer.api.service.Hardware$Service.getObject()

That's because the API call SoftLayer_Hardware::createObject returns a null id, but a non-null globalIdentifier (see example here).

Because the Hardware.getObject() requires an ID (instanceRequired = true), and id = null, the API call fails. The API call should use the globalIdentifier when id is not present.

Unable to submit multiple guest objects by using createObjects API

what I can see in the logs is that the client is not calling the method "createObjects" in the requests there is not any method request when the API sees this it tries to call the createObject method by default:

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"}

Allow masks of all types to be added to a service

Currently only a mask of the type that is the same as the service can be added to a service. So if Account.getObject is called, it uses Account.Mask just fine, but if Account.getVirtualGuests is called, it needs to be able to use Guest.Mask. This is explained in http://sldn.softlayer.com/article/Object-Masks.

It would probably also be wise to error if a wrong mask is about to be used on a method, but this could introduce a slight backwards incompatibility if people are not used to the error appearing and they are just using it wrong anyways, but we are still at a 0-based major version.

Caused by: java.lang.OutOfMemoryError: PermGen space

I got java.lang.OutOfMemoryError: PermGen space every time when List guests = service.getObject().getVirtualGuests() is called. Below is my code

public static List getVirtualGuests() {
String userName = ;
String passWord = ;
client = new RestApiClient().withCredentials(userName, passWord);
Account.Service service = Account.service(client);
service.withMask().virtualGuests().operatingSystem();
service.withMask().virtualGuests().datacenter();
service.withMask().virtualGuests().powerState();
List guests = service.getObject().getVirtualGuests();
return guests;
}

Anyone else has the issue? Stacktrace attached.

Caused by: java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:390)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:371)
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3217)
at java.lang.Class.getAnnotation(Class.java:3176)
at java.lang.Package.getAnnotation(Package.java:388)
at com.softlayer.api.json.GsonJsonMarshallerFactory.(GsonJsonMarshallerFactory.java:51)
at com.softlayer.api.json.JsonMarshallerFactory.getDefault(JsonMarshallerFactory.java:28)
at com.softlayer.api.json.JsonMarshallerFactory.getDefault(JsonMarshallerFactory.java:17)
at com.softlayer.api.RestApiClient.getJsonMarshallerFactory(RestApiClient.java:98)
at com.softlayer.api.RestApiClient$ServiceProxy.logAndHandleResponse(RestApiClient.java:256)
at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:300)
at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:466)
at com.sun.proxy.$Proxy5.getObject(Unknown Source)
at ....SoftLayerUtil.getVirtualGuests(SoftLayerUtil.java:57)

Code gen package name contains invalid keyword

When compiling with maven 3.3.9 and Java 1.8.0_111, the compilation fails with:

[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ softlayer-api-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1084 source files to /Users/eric/s/softlayer-java/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/eric/s/softlayer-java/src/main/java/com/softlayer/api/service/container/authentication/response/2FactorAuthenticationNeeded.java:[13,13] <identifier> expected
[ERROR] /Users/eric/s/softlayer-java/src/main/java/com/softlayer/api/service/container/authentication/response/2FactorAuthenticationNeeded.java:[13,41] <identifier> expected
[ERROR] /Users/eric/s/softlayer-java/src/main/java/com/softlayer/api/service/container/authentication/response/2FactorAuthenticationNeeded.java:[13,56] <identifier> expected
[ERROR] /Users/eric/s/softlayer-java/src/main/java/com/softlayer/api/service/container/authentication/request/native/external/Totp.java:[1,68] <identifier> expected

The package name generated from code gen process is using:

package com.softlayer.api.service.container.authentication.request.**native**.external;

Native is a keyword in Java. Java package name convention prevents usage of Java keyword. This is causing compilation to fail.

It's not possible to set init parameters for SoftLayer_Hardware_Server service

I tried the following code:

import com.softlayer.api.service.hardware.Server;
...
        // Define the hardware
        Long hardwareId = new Long(92862);

        // Create client
        ApiClient client = new RestApiClient().withCredentials(username, apiKey);

        // Define SoftLayer_Hardware_Server service
        Server.Service serverService = Server.service(client, hardwareId);

I was not able to set init parameters

Unable to get performance metrics exception

We are trying to run the function: getBandwidthData(start, end, "public" , 3600L);
and we getting the following exception:
Unable to get performance metrics for virtual guests Metric Service call failed after attempting to connect to these hosts, in order:
web-agent-proxy-bds-metrics.app.com.okd.softlayer.local:80
Any idea why? please not that this command was working in the past but something is wrong now, we trying to understand why and how to fix it
Gil

Exception: com.softlayer.api.ApiException$Unauthorized: Access Denied

I started to get com.softlayer.api.ApiException$Unauthorized: Access Denied exception even though I am using the correct credential. It was working fine until today. And I happened to notice this in SoftLayer:

Event Details
View Recent Planned Events View All Planned Events
ID: 18749729
Type: Planned Event
Subject: API Upgrade Maintenance
Start Date: 18-May-2015 18:00 UTC (May 18, 2015 02:00PM EDT)
End Date: 18-May-2015 20:00 UTC (May 18, 2015 04:00PM EDT)
Duration: 2 Hours
Event Description

On Monday, May 18, 2015 at 18:00:00 UTC Systems Engineers will be migrating Customer API to new infrastructure via DNS updates. No API downtime is expected.

Notable changes to the API endpoints include:

  • SHA-2 SSL certificates
  • Additional SSL ciphers and Forward Secrecy (FS/PFS) support.

Customers wishing to production test the new endpoints before the DNS change can access the new infrastructure here:

  • 66.228.119.120
  • 10.0.80.88

Thank you

Will the DNS service be implemented ?

Is there any plan to implement the DNS management API in the Java API.

It's currently missing and it would be useful to know the overall Java API coverage of the entire API.

Object-mask error when trying to get PublicVlans/PrivateVlans of Gateway

Following error is raised when using masks in getPublicVlan and getPrivateVlan methods of SoftLayer_Network_Gateway:

com.softlayer.api.ApiException$Internal: Property 'networkVlan' not valid for 'SoftLayer_Network_Vlan'.(code: SoftLayer_Exception_WebService_ObjectMask, status: 500)

I found this error by using following java code:

Gateway.Service gatewayService = Gateway.service(client, gatewayId);
 // Mask to get relational properties of a public vlan
gatewayService.withMask().publicVlan().networkVlan().vlanNumber();
Vlan vlan = gatewayService.getObject().getPublicVlan();

I tried by removing networkVlan() in the mask, but vlanNumber() or other properties cannot be called after publicVlan().

It is possible to get local properties without masks but it's a problem when trying to get relational properties like primaryRouter, networkSpace, etc.

This same issue happens with getPrivateVlan method.

Regards,

Account.Service does not implement toString

I was trying to use the Java API using Scala. The code works fine with one exception: when you use the REPL, Account.Service does not implement toString. So commands like the following do not work on the REPL:

  val service = Account.service(client)

Since the it will print out the value of the command that was just executed. You can work around this with the :silent options.

But it would be nice to have the ability to print out the object while you are exploring. When using the :silent option something like:

 scala> :silent
 scala> val service = Account.service(client)
 // Worked :)
 scala> service.toString
 java.lang.RuntimeException: Unrecognized method: public java.lang.String java.lang.Object.toString()

I know most of the code is created dynamically. I was wondering is some toString could be added to the generated code?

Can't access invoice details

Hi.

We are trying to retrieve an invoice's details but are having troubles getting to the items on an invoice. We've set the mask using the following:
as.setMask("mask[invoiceTopLevelItemCount,invoiceTotalAmount,amount]");

It returns the count and amount as expected. When we change the mask to retrieve the returned invoices object is null. We tried using the following masks:

as.setMask("mask[invoiceTopLevelItems]");
or
as.setMask("mask[items]");

Here is an example of the code:

	ApiClient c = new RestApiClient().withCredentials("xxxx", "xxxx");
	Account.Service as = Account.service(c);
	as.setMask("mask[items]");

	try {

		List<com.softlayer.api.service.billing.Invoice> invoices = as.getInvoices();

Unfortunately the invoices List object (in the last line) is null with either mask set. Is there something we should be doing differently? This was also part of the SL support case CS1011381.

Thanks!

[Question] Showing VLANs not working

Hi

I tried to print all the public VLANs with the code which is provided on this git. Unfortunately this didn't work for me. I checked the softlayer portal and my account has private and public VLANs. I am able to print the private VLANs/virtual machine. Can someone help me out printing the public VLANs as well.

Here is my code which is able to print the private VLANs but unable to print the public VLANs:

import com.softlayer.api.service.network.Vlan;

service.withMask().virtualGuests().networkVlans().primaryRouter().datacenter().longName();

printvm(client, account);

public static void printVm(ApiClient client, Account account) {
    System.out.format("\n%d virtual servers\n", account.getVirtualGuests()
            .size());
    for (Guest guest : account.getVirtualGuests()) {
        System.out
                .format("Host: %s, IP: %s (%s),Cores: %s,Status %s, OS: %s, vlan %s, public vlan %s\n",
                        guest.getFullyQualifiedDomainName(), guest
                                .getPrimaryIpAddress(), guest
                                .getPrimaryBackendIpAddress(), guest
                                .getStartCpus(), guest.getPowerState()
                                .getName(), guest
                                .getOperatingSystemReferenceCode(), guest
                                .getNetworkComponents().get(0)
                                .getNetworkVlan().getName(), guest.getNetworkVlans().get(0).getPrimaryRouter().getDatacenter().getLongName());
    }
}

ID is required to invoke public resource.Metadata$Service.getId()

The Metadata service returns IllegalStateException error when calling to the methods getId(), getHostname(), etc.

java.lang.IllegalStateException: ID is required to invoke public abstract java.lang.Long com.softlayer.api.service.resource.Metadata$Service.getId()

Following code can be used to reproduce the issue.

public class TestMetadata {

    public static void main(String arg[]){
        String privateEndPoint = "https://api.service.softlayer.com/rest/v3/";
        ApiClient client = new RestApiClient(privateEndPoint);

        Metadata.Service metadataService = Metadata.service(client);

        try {            
            long id = metadataService.getId();            
            System.out.println("This VSI ID is " + id);            
        } catch (Exception e) {            
            System.out.println("SoftlayerMetadata error in " + e);
        }
    }
}

The problem is because the Metadata java class has set instanceRequired = true in all methods.

        @ApiMethod(instanceRequired = true)
        public Long getId();

Workaround
I created my own Metadata java class and I set instanceRequired = false

[Question] Changing CPU, Memory, ... with the API in java

Hello

This project has been very usefull for me but now I want to edit the CPU and memory of my virtual machines. I tried to change it with editObject but this is only to change hostname. I've seen in python examples that you have to give the price for more CPU's and use something like upgrade but I can't figure it out at all. Does someone have an example of how to edit the memory/cpu of a VM through the softlayer API client for java?

Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.