package com.suse.salt.netapi.results;

import com.google.gson.annotations.SerializedName;

import java.util.List;
import java.util.Optional;

/**
 * Wrapper class for salt-ssh results.
 *
 * @param <T> The type of the value this result holds.
 */
public class SSHResult<T> {

    private String fun;
    @SerializedName("fun_args")
    private List<String> funArgs;
    private String id;
    private String jid;
    private int retcode;
    @SerializedName("return")
    private Optional<T> returnAttribute = Optional.empty();
    private Optional<String> stderr = Optional.empty();
    private Optional<String> stdout = Optional.empty();

    public String getFun() {
        return fun;
    }

    public List<String> getFunArgs() {
        return funArgs;
    }

    public String getId() {
        return id;
    }

    public String getJid() {
        return jid;
    }

    public int getRetcode() {
        return retcode;
    }

    public Optional<T> getReturn() {
        return returnAttribute;
    }

    public Optional<String> getStderr() {
        return stderr;
    }

    public Optional<String> getStdout() {
        return stdout;
    }
}

@@ -1149,11 +1149,450 @@
 t;%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        return %22SSHResult%7B%22 +%0A                %22fun='%22 + fun + '%5C'' +%0A                %22, funArgs=%22 + funArgs +%0A                %22, id='%22 + id + '%5C'' +%0A                %22, jid='%22 + jid + '%5C'' +%0A                %22, retcode=%22 + retcode +%0A                %22, returnAttribute=%22 + returnAttribute +%0A                %22, stderr=%22 + stderr +%0A                %22, stdout=%22 + stdout +%0A                '%7D';%0A    %7D
 %0A%7D%0A

Add SSHResult.toString