SUSE / salt-netapi-client

Java bindings for the Salt API
MIT License
85 stars 95 forks source link

POST /minions which returns job id not implemented? #290

Closed seaguest closed 3 years ago

seaguest commented 3 years ago

Hi,

I didn't find this rest api:

POST(**kwargs)
Start an execution command and immediately return the job id

POST /minions

best regards

renner commented 3 years ago

Hello @seaguest, sorry for the delayed reply! In fact the implementation of that endpoint has been removed in 2017 (with fc16d281ef7fa4b6bc5ff5592c1f46ba18fe0143). This endpoint is from our perspective not really needed as every call to an execution module can be done by calling the root (/) endpoint of the API, which is the method we would like to promote.

This would be a minimal example to perform the call from the upstream docs based on the Calls example:

// Prepare client and authentication
SaltClient client = new SaltClient(URI.create(SALT_API_URL), new HttpAsyncClientImpl(HttpClientUtils.defaultClient()));
AuthMethod auth = new AuthMethod(new PasswordAuth("user", "password", AuthModule.AUTO));

// Setup the target and run the call
Target<String> globTarget = new Glob("*");
Status.diskusage().callAsync(client, globTarget, auth)
        .thenAccept(result ->  System.out.println("Job ID: " + result.get().getJid()));

Just let me know if you have any further question about this.

renner commented 3 years ago

Closing the issue as the original question should be answered. Please reach out or reopen if there is further questions.