use of com.walmartlabs.concord.server.sdk.metrics.WithTimer in project concord by walmartlabs.
the class ConsoleService method isStorageQueryExists.
@GET
@Path("/org/{orgName}/jsonstore/{storeName}/query/{queryName}/exists")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public boolean isStorageQueryExists(@PathParam("orgName") @ConcordKey String orgName, @PathParam("storeName") String storeName, @PathParam("queryName") String queryName) {
try {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
JsonStoreEntry storage = jsonStoreAccessManager.assertAccess(org.getId(), null, storeName, ResourceAccessLevel.READER, true);
return storageQueryDao.getId(storage.id(), queryName) != null;
} catch (UnauthorizedException e) {
return false;
}
}
use of com.walmartlabs.concord.server.sdk.metrics.WithTimer in project concord by walmartlabs.
the class ConsoleService method isApiTokenExists.
@GET
@Path("/apikey/{name}/exists")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public boolean isApiTokenExists(@PathParam("name") @ConcordKey String tokenName) {
UserPrincipal currentUser = UserPrincipal.getCurrent();
if (currentUser == null) {
return false;
}
UUID userId = currentUser.getId();
return apiKeyDao.getId(userId, tokenName) != null;
}
use of com.walmartlabs.concord.server.sdk.metrics.WithTimer in project concord by walmartlabs.
the class GithubTriggerV2Processor method process.
@Override
@WithTimer
public void process(String eventName, Payload payload, UriInfo uriInfo, List<Result> result) {
GithubKey githubKey = GithubKey.getCurrent();
UUID projectId = githubKey.getProjectId();
List<TriggerEntry> triggers = listTriggers(projectId, payload.getOrg(), payload.getRepo());
for (TriggerEntry t : triggers) {
// skip empty push events if the trigger's configuration says so
if (GithubUtils.ignoreEmptyPush(t) && GithubUtils.isEmptyPush(eventName, payload)) {
continue;
}
Map<String, Object> event = buildEvent(eventName, payload);
enrichEventConditions(payload, t, event);
if (DefaultEventFilter.filter(event, t)) {
result.add(Result.from(event, t));
}
}
}
use of com.walmartlabs.concord.server.sdk.metrics.WithTimer in project concord by walmartlabs.
the class ProcessLogResourceV2 method data.
/**
* Retrieves a log segment' data.
*/
@GET
@ApiOperation(value = "Retrieve the log")
@Path("/{id}/log/segment/{segmentId}/data")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@WithTimer
public Response data(@ApiParam @PathParam("id") UUID instanceId, @ApiParam @PathParam("segmentId") long segmentId, @HeaderParam("range") String rangeHeader) {
ProcessKey processKey = logAccessManager.assertLogAccess(instanceId);
HttpUtils.Range range = HttpUtils.parseRangeHeaderValue(rangeHeader);
ProcessLog l = logManager.segmentData(processKey, segmentId, range.start(), range.end());
return toResponse(instanceId, segmentId, l, range);
}
use of com.walmartlabs.concord.server.sdk.metrics.WithTimer in project concord by walmartlabs.
the class ProcessLogResourceV2 method segment.
/**
* Create a new process log segment.
*/
@POST
@ApiOperation(value = "Create process log segment")
@Path("{id}/log/segment")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public LogSegmentOperationResponse segment(@ApiParam @PathParam("id") UUID instanceId, @ApiParam LogSegmentRequest request) {
ProcessKey processKey = logAccessManager.assertLogAccess(instanceId);
long segmentId = logManager.createSegment(processKey, request.correlationId(), request.name(), request.createdAt());
return new LogSegmentOperationResponse(segmentId, OperationResult.CREATED);
}
Aggregations