com.bmc.truesight.saas.meter.client.command.GetProcessInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of meter-client Show documentation
Show all versions of meter-client Show documentation
A java library for interacting with the TrueSight Meter.
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;
}
}