use of com.walmartlabs.concord.runtime.v2.sdk.Variables in project concord-plugins by walmartlabs.
the class UnitTest method stringDataTest.
@Test
public void stringDataTest() {
Variables vars = new MapBackedVariables(getMap("path", "secret/mysecret", "key", "top_secret"));
TaskParams params = TaskParams.of(vars, null, exporter);
HashiVaultTaskResult result = HashiVaultTaskResult.of(true, getMap("top_secret", "value"), null, params);
try {
Map<String, Object> m = result.data();
fail("data should be String when key param is given");
} catch (ClassCastException e) {
// that's expected
}
// this should work
String s = result.data();
assertEquals("value", s);
}
use of com.walmartlabs.concord.runtime.v2.sdk.Variables in project concord-plugins by walmartlabs.
the class TeamsTaskParams method of.
public static TeamsTaskParams of(Variables input, Map<String, Object> defaults) {
Variables variables = Utils.merge(input, defaults);
Action action = new TeamsTaskParams(variables).action();
switch(action) {
case SENDMESSAGE:
{
return new SendMessageParams(variables);
}
default:
throw new IllegalArgumentException("Unsupported action type: " + action);
}
}
use of com.walmartlabs.concord.runtime.v2.sdk.Variables in project concord-plugins by walmartlabs.
the class TaskParams method of.
public static TaskParams of(Variables input, Map<String, Object> defaults) {
Variables variables = merge(input, defaults);
Action action = new TaskParams(variables).action();
switch(action) {
case SEARCHBYDN:
{
return new SearchByDnParams(variables);
}
case GETUSER:
{
return new GetUserParams(variables);
}
case GETGROUP:
{
return new GetGroupParams(variables);
}
case ISMEMBEROF:
{
return new MemberOfParams(variables);
}
default:
throw new IllegalArgumentException("Unsupported action type: " + action);
}
}
use of com.walmartlabs.concord.runtime.v2.sdk.Variables in project concord-plugins by walmartlabs.
the class S3TaskV2 method execute.
@Override
@SuppressWarnings("unchecked")
public TaskResult execute(Variables input) throws Exception {
Result result = delegate.execute(TaskParams.of(input, context.defaultVariables().toMap()));
ObjectMapper om = new ObjectMapper();
Map<String, Object> r = om.convertValue(result, Map.class);
return TaskResult.of(MapUtils.getBoolean(r, "ok", false), MapUtils.getString(r, "error")).values(r);
}
use of com.walmartlabs.concord.runtime.v2.sdk.Variables in project concord-plugins by walmartlabs.
the class TaskParams method of.
public static TaskParams of(Variables input, Map<String, Object> defaults) {
Variables variables = merge(input, defaults);
Action action = new TaskParams(variables).action();
switch(action) {
case RUN:
{
return new RunParams(variables);
}
default:
throw new IllegalArgumentException("Unsupported action type: " + action);
}
}
Aggregations