Class 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.
    • Method Detail

      • withoutMetadata

        public LocalCall<R> withoutMetadata()
      • withoutTimeouts

        public LocalCall<R> withoutTimeouts()
      • 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 instance
        target - the target for the function
        auth - authentication credentials to use
        batch - 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 instance
        target - the target for the function
        auth - authentication credentials to use
        batch - 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 instance
        target - the target for the function
        auth - 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 instance
        target - the target for the function
        events - the event stream to use
        cancel - future to cancel the action
        auth - authentication credentials to use
        batch - parameter for enabling and configuring batching
        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 instance
        target - the target for the function
        auth - 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 instance
        target - the target for the function
        batch - the batch specification
        auth - 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 instance
        target - the target for the function
        auth - authentication credentials to use
        batch - 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 instance
        target - the target for the function
        cfg - Salt SSH configuration object
        auth - authentication credentials to use
        Returns:
        a map containing the results with the minion name as key