Package com.suse.salt.netapi.calls
Class LocalCall<R>
- java.lang.Object
-
- com.suse.salt.netapi.calls.AbstractCall<R>
-
- com.suse.salt.netapi.calls.LocalCall<R>
-
- Type Parameters:
R
- the return type of the called function
- All Implemented Interfaces:
Call<R>
public class LocalCall<R> extends AbstractCall<R>
Class representing a function call of a salt execution module.
-
-
Constructor Summary
Constructors Constructor Description LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType)
LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<?> metadata)
LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<?> metadata, Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Optional<LocalAsyncResult<R>>>
callAsync(SaltClient client, Target<?> target, AuthMethod auth)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result.CompletionStage<Optional<LocalAsyncResult<R>>>
callAsync(SaltClient client, Target<?> target, AuthMethod auth, Batch batch)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result.CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>>
callAsync(SaltClient client, Target<?> target, AuthMethod auth, EventStream events, CompletionStage<GenericError> cancel, Batch batch)
Calls this salt call via the async client and returns the results as they come in via the event stream.CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>>
callAsync(SaltClient client, Target<?> target, AuthMethod auth, EventStream events, CompletionStage<GenericError> cancel, Optional<Batch> batch)
Calls this salt call via the async client and returns the results as they come in via the event stream.CompletionStage<Optional<LocalAsyncResult<R>>>
callAsync(SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result.CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>>
callAsync(Function<LocalCall<R>,CompletionStage<Optional<LocalAsyncResult<R>>>> localAsync, Function<RunnerCall<Map<String,R>>,CompletionStage<RunnerAsyncResult<Map<String,R>>>> runnerAsync, EventStream events, CompletionStage<GenericError> cancel)
Calls this salt call via the async client and returns the results as they come in via the event stream.CompletionStage<Map<String,Result<R>>>
callSync(SaltClient client, Target<?> target, AuthMethod auth)
Calls a execution module function on the given target and synchronously waits for the result.CompletionStage<List<Map<String,Result<R>>>>
callSync(SaltClient client, Target<?> target, AuthMethod auth, Batch batch)
Calls a execution module function on the given target with batching and synchronously waits for the result.CompletionStage<List<Map<String,Result<R>>>>
callSync(SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch)
Calls a execution module function on the given target with batching and synchronously waits for the result.CompletionStage<Map<String,Result<SSHResult<R>>>>
callSyncSSH(SaltClient client, SSHTarget<?> target, SaltSSHConfig cfg, AuthMethod auth)
Call an execution module function on the given target via salt-ssh and synchronously wait for the result.Map<String,Object>
getPayload()
Return the call payload as a map of key/value pairs.LocalCall<R>
withMetadata(Object metadata)
LocalCall<R>
withoutMetadata()
LocalCall<R>
withoutTimeouts()
LocalCall<R>
withTimeouts(Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
-
Methods inherited from class com.suse.salt.netapi.calls.AbstractCall
getFunctionName, getModuleName, getReturnType
-
-
-
-
Constructor Detail
-
LocalCall
public LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<?> metadata, Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
-
LocalCall
public LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
-
LocalCall
public LocalCall(String functionName, Optional<List<?>> arg, Optional<Map<String,?>> kwarg, com.google.gson.reflect.TypeToken<R> returnType, Optional<?> metadata)
-
-
Method Detail
-
withTimeouts
public LocalCall<R> withTimeouts(Optional<Integer> timeout, Optional<Integer> gatherJobTimeout)
-
getPayload
public Map<String,Object> getPayload()
Return the call payload as a map of key/value pairs. Usually this contains the function name and arguments, but the various clients differ in the details.- Returns:
- call payload as a map of key/value pairs
-
callAsync
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(SaltClient client, Target<?> target, AuthMethod auth, Batch batch)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionauth
- authentication credentials to usebatch
- parameter for enabling and configuring batching- Returns:
- information about the scheduled job
-
callAsync
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionauth
- authentication credentials to usebatch
- parameter for enabling and configuring batching- Returns:
- information about the scheduled job
-
callAsync
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(SaltClient client, Target<?> target, AuthMethod auth)
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionauth
- authentication credentials to use- Returns:
- information about the scheduled job
-
callAsync
public CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>> callAsync(SaltClient client, Target<?> target, AuthMethod auth, EventStream events, CompletionStage<GenericError> cancel, Batch batch)
Calls this salt call via the async client and returns the results as they come in via the event stream.- Parameters:
client
- SaltClient instancetarget
- the target for the functionevents
- the event stream to usecancel
- future to cancel the actionauth
- authentication credentials to usebatch
- parameter for enabling and configuring batching- Returns:
- a map from minion id to future of the result.
-
callAsync
public CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>> callAsync(SaltClient client, Target<?> target, AuthMethod auth, EventStream events, CompletionStage<GenericError> cancel, Optional<Batch> batch)
Calls this salt call via the async client and returns the results as they come in via the event stream.- Parameters:
client
- SaltClient instancetarget
- the target for the functionevents
- the event stream to usecancel
- future to cancel the actionauth
- authentication credentials to usebatch
- parameter for enabling and configuring batching- Returns:
- a map from minion id to future of the result.
-
callAsync
public CompletionStage<Optional<Map<String,CompletionStage<Result<R>>>>> callAsync(Function<LocalCall<R>,CompletionStage<Optional<LocalAsyncResult<R>>>> localAsync, Function<RunnerCall<Map<String,R>>,CompletionStage<RunnerAsyncResult<Map<String,R>>>> runnerAsync, EventStream events, CompletionStage<GenericError> cancel)
Calls this salt call via the async client and returns the results as they come in via the event stream.- Parameters:
localAsync
- function providing callAsync for LocalCallsrunnerAsync
- function providing callAsync for RunnerCallsevents
- the event stream to usecancel
- future to cancel the action- Returns:
- a map from minion id to future of the result.
-
callSync
public CompletionStage<Map<String,Result<R>>> callSync(SaltClient client, Target<?> target, AuthMethod auth)
Calls a execution module function on the given target and synchronously waits for the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionauth
- authentication credentials to use- Returns:
- a map containing the results with the minion name as key
-
callSync
public CompletionStage<List<Map<String,Result<R>>>> callSync(SaltClient client, Target<?> target, AuthMethod auth, Batch batch)
Calls a execution module function on the given target with batching and synchronously waits for the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionbatch
- the batch specificationauth
- authentication credentials to use- Returns:
- A list of maps with each list representing each batch, and maps containing the results with the minion names as keys.
-
callSync
public CompletionStage<List<Map<String,Result<R>>>> callSync(SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch)
Calls a execution module function on the given target with batching and synchronously waits for the result. Authentication is done with the token therefore you have to login prior to using this function.- Parameters:
client
- SaltClient instancetarget
- the target for the functionauth
- authentication credentials to usebatch
- parameter for enabling and configuring batching- Returns:
- A list of maps with each list representing each batch, and maps containing the results with the minion names as keys.
-
callSyncSSH
public CompletionStage<Map<String,Result<SSHResult<R>>>> callSyncSSH(SaltClient client, SSHTarget<?> target, SaltSSHConfig cfg, AuthMethod auth)
Call an execution module function on the given target via salt-ssh and synchronously wait for the result.- Parameters:
client
- SaltClient instancetarget
- the target for the functioncfg
- Salt SSH configuration objectauth
- authentication credentials to use- Returns:
- a map containing the results with the minion name as key
-
-