use of com.formkiq.lambda.apigateway.AwsServiceCache in project formkiq-core by formkiq.
the class WebhooksRequestHandler method saveWebhook.
private String saveWebhook(final ApiGatewayRequestEvent event, final AwsServiceCache awsservice, final String siteId, final DynamicObject o) {
Date ttlDate = getTtlDate(awsservice, siteId, o);
String name = o.getString("name");
String userId = getCallingCognitoUsername(event);
String enabled = o.containsKey("enabled") ? o.getString("enabled") : "true";
String id = awsservice.webhookService().saveWebhook(siteId, name, userId, ttlDate, enabled);
if (o.containsKey("tags")) {
List<DynamicObject> dtags = o.getList("tags");
Date date = new Date();
Collection<DocumentTag> tags = dtags.stream().map(d -> new DocumentTag(null, d.getString("key"), d.getString("value"), date, userId)).collect(Collectors.toList());
awsservice.webhookService().addTags(siteId, id, tags, ttlDate);
}
return id;
}
use of com.formkiq.lambda.apigateway.AwsServiceCache in project formkiq-core by formkiq.
the class DocumentsRestrictionsMaxContentLengthTest method before.
/**
* Before Tests.
* @throws URISyntaxException URISyntaxException
* @throws IOException IOException
*/
@BeforeEach
public void before() throws URISyntaxException, IOException {
DynamoDbConnectionBuilder adb = DynamoDbTestServices.getDynamoDbConnection(null);
DynamoDbHelper dbhelper = new DynamoDbHelper(adb);
this.awsservice = new AwsServiceCache().dbConnection(adb, dbhelper.getDocumentTable(), "").appEnvironment("unittest");
}
use of com.formkiq.lambda.apigateway.AwsServiceCache in project formkiq-core by formkiq.
the class WebhooksTagsRequestHandler method get.
@Override
public ApiRequestHandlerResponse get(final LambdaLogger logger, final ApiGatewayRequestEvent event, final ApiAuthorizer authorizer, final AwsServiceCache awsServices) throws Exception {
String siteId = authorizer.getSiteId();
String id = getPathParameter(event, "webhookId");
PaginationResults<DynamicObject> list = awsServices.webhookService().findTags(siteId, id, null);
List<Map<String, Object>> tags = list.getResults().stream().map(m -> {
Map<String, Object> map = new HashMap<>();
map.put("insertedDate", m.getString("inserteddate"));
map.put("webhookId", id);
map.put("type", m.getString("type"));
map.put("userId", m.getString("userId"));
map.put("value", m.getString("tagValue"));
map.put("key", m.getString("tagKey"));
return map;
}).collect(Collectors.toList());
return new ApiRequestHandlerResponse(SC_OK, new ApiMapResponse(Map.of("tags", tags)));
}
Aggregations