/** * Construct a {@link FlowStatusClient} to communicate with http flow status server at URI serverUri * @param restClient restClient to send restli request */ public FlowStatusClient(RestClient restClient) { LOG.debug("FlowConfigClient with restClient " + restClient); _httpClientFactory = Optional.absent(); _restClient = Optional.of(restClient); _flowstatusesRequestBuilders = new FlowstatusesRequestBuilders(); }
/** * Retrieve the FlowStatus with the given key * * @return * builder for the resource method */ public FlowstatusesGetRequestBuilder get() { return new FlowstatusesGetRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
/** * Get the latest flow status * @param flowId identifier of flow status to get * @return a {@link FlowStatus} with the flow status * @throws RemoteInvocationException */ public FlowStatus getLatestFlowStatus(FlowId flowId) throws RemoteInvocationException { LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + " flowName " + flowId.getFlowName()); FindRequest<FlowStatus> findRequest = _flowstatusesRequestBuilders.findByLatestFlowStatus().flowIdParam(flowId).build(); Response<CollectionResponse<FlowStatus>> response = _restClient.get().sendRequest(findRequest).getResponse(); List<FlowStatus> flowStatusList = response.getEntity().getElements(); if (flowStatusList.isEmpty()) { return null; } else { Preconditions.checkArgument(flowStatusList.size() == 1); return flowStatusList.get(0); } }
/** * Get a flow status * @param flowStatusId identifier of flow status to get * @return a {@link FlowStatus} with the flow status * @throws RemoteInvocationException */ public FlowStatus getFlowStatus(FlowStatusId flowStatusId) throws RemoteInvocationException { LOG.debug("getFlowConfig with groupName " + flowStatusId.getFlowGroup() + " flowName " + flowStatusId.getFlowName()); GetRequest<FlowStatus> getRequest = _flowstatusesRequestBuilders.get() .id(new ComplexResourceKey<>(flowStatusId, new EmptyRecord())).build(); Response<FlowStatus> response = _restClient.get().sendRequest(getRequest).getResponse(); return response.getEntity(); }
public FlowstatusesFindByLatestFlowStatusRequestBuilder findByLatestFlowStatus() { return new FlowstatusesFindByLatestFlowStatusRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
/** * Construct a {@link FlowStatusClient} to communicate with http flow status server at URI serverUri * @param serverUri address and port of the REST server */ public FlowStatusClient(String serverUri) { LOG.debug("FlowConfigClient with serverUri " + serverUri); _httpClientFactory = Optional.of(new HttpClientFactory()); Client r2Client = new TransportClientAdapter(_httpClientFactory.get().getClient(Collections.<String, String>emptyMap())); _restClient = Optional.of(new RestClient(r2Client, serverUri)); _flowstatusesRequestBuilders = new FlowstatusesRequestBuilders(); }
public OptionsRequestBuilder options() { return new OptionsRequestBuilder(getBaseUriTemplate(), getRequestOptions()); }