use of com.walmartlabs.concord.runtime.v2.sdk.MapBackedVariables in project concord-plugins by walmartlabs.
the class UnitTest method requiredParametersTest.
@Test
public void requiredParametersTest() {
TaskParams params = TaskParams.of(new MapBackedVariables(getMap()), null, exporter);
try {
params.baseUrl();
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("'baseUrl' is required"));
}
try {
params.apiToken();
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("'apiToken' is required"));
}
try {
params.path();
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("'path' is required"));
}
// default action
params.kvPairs();
// kvPairs required when action is writeKv
params = TaskParams.of(new MapBackedVariables(getMap("action", "writeKv")), null, exporter);
try {
params.kvPairs();
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().contains("'kvPairs' is required"));
}
// cubbyhole is a v1 engine
params = TaskParams.of(new MapBackedVariables(getMap("path", "cubbyhole/mysecret", "engineVersion", 2)), null, exporter);
assertEquals(1, params.engineVersion());
}
use of com.walmartlabs.concord.runtime.v2.sdk.MapBackedVariables in project concord-plugins by walmartlabs.
the class HashiVaultTask method createParams.
private TaskParams createParams(Context ctx, Map<String, Object> input) {
final MapBackedVariables vars = new MapBackedVariables(input);
final SecretExporterV1 exporterV1 = new SecretExporterV1(ctx, secretService);
return TaskParams.of(vars, defaults, exporterV1);
}
Aggregations