All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bmc.truesight.saas.meter.client.command.GetProcessInfo Maven / Gradle / Ivy

There is a newer version: 0.12
Show newest version
package com.bmc.truesight.saas.meter.client.command;

import com.bmc.truesight.saas.meter.client.response.GetProcessInfoResponse;
import com.google.common.collect.ImmutableMap;
import org.immutables.value.Value;

/**
 * JSON RPC call to retrieve and parse Running Process Information
 */

public class GetProcessInfo implements Command {

    @Value.Immutable
    public static abstract class TypedExpression {
        public enum Type {
            process, args_expr, cwd_expr
        }

        @Value.Default
        public Type type() {
            return Type.process;
        }
        public abstract String expression();
    }

    private ImmutableMap params;

    public GetProcessInfo(ImmutableMap params) {
        this.params = params;
    }

    public static GetProcessInfo of(TypedExpression expression1, TypedExpression ... optional) {
        ImmutableMap.Builder paramsBuilder = ImmutableMap.builder();

        paramsBuilder.put(expression1.type().name(), expression1.expression());

        for (TypedExpression expression: optional) {
            paramsBuilder.put(expression.type().name(), expression.expression());
        }
        return new GetProcessInfo(paramsBuilder.build());
    }


    @Override
    public Class getResponseType() {
        return GetProcessInfoResponse.class;
    }

    @Override
    public String getMethod() {
        return "get_process_info";
    }

    @Override
    public ImmutableMap getParams() {
        return this.params;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy