/** * Construct a {@link FlowConfigClient} to communicate with http flow config server at URI serverUri * @param restClient restClient to send restli request */ public FlowConfigClient(RestClient restClient) { LOG.debug("FlowConfigClient with restClient " + restClient); _httpClientFactory = Optional.absent(); _restClient = Optional.of(restClient); _flowconfigsRequestBuilders = new FlowconfigsRequestBuilders(); }
/** * Delete a configured flow. Running flows are not affected. The schedule will be removed for scheduled flows. * * @return * builder for the resource method */ public FlowconfigsDeleteRequestBuilder delete() { return new FlowconfigsDeleteRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
/** * Create a flow configuration * @param flowConfig flow configuration attributes * @throws RemoteInvocationException */ public void createFlowConfig(FlowConfig flowConfig) throws RemoteInvocationException { LOG.debug("createFlowConfig with groupName " + flowConfig.getId().getFlowGroup() + " flowName " + flowConfig.getId().getFlowName()); CreateIdRequest<ComplexResourceKey<FlowId, EmptyRecord>, FlowConfig> request = _flowconfigsRequestBuilders.create().input(flowConfig).build(); ResponseFuture<IdResponse<ComplexResourceKey<FlowId, EmptyRecord>>> flowConfigResponseFuture = _restClient.get().sendRequest(request); flowConfigResponseFuture.getResponse(); }
/** * Delete a flow configuration * @param flowId identifier of flow configuration to delete * @throws RemoteInvocationException */ public void deleteFlowConfig(FlowId flowId) throws RemoteInvocationException { LOG.debug("deleteFlowConfig with groupName " + flowId.getFlowGroup() + " flowName " + flowId.getFlowName()); DeleteRequest<FlowConfig> deleteRequest = _flowconfigsRequestBuilders.delete() .id(new ComplexResourceKey<>(flowId, new EmptyRecord())).build(); ResponseFuture<EmptyRecord> response = _restClient.get().sendRequest(deleteRequest); response.getResponse(); }
/** * Get a flow configuration * @param flowId identifier of flow configuration to get * @return a {@link FlowConfig} with the flow configuration * @throws RemoteInvocationException */ public FlowConfig getFlowConfig(FlowId flowId) throws RemoteInvocationException { LOG.debug("getFlowConfig with groupName " + flowId.getFlowGroup() + " flowName " + flowId.getFlowName()); GetRequest<FlowConfig> getRequest = _flowconfigsRequestBuilders.get() .id(new ComplexResourceKey<>(flowId, new EmptyRecord())).build(); Response<FlowConfig> response = _restClient.get().sendRequest(getRequest).getResponse(); return response.getEntity(); }
/** * Update a flow configuration * @param flowConfig flow configuration attributes * @throws RemoteInvocationException */ public void updateFlowConfig(FlowConfig flowConfig) throws RemoteInvocationException { LOG.debug("updateFlowConfig with groupName " + flowConfig.getId().getFlowGroup() + " flowName " + flowConfig.getId().getFlowName()); FlowId flowId = new FlowId().setFlowGroup(flowConfig.getId().getFlowGroup()) .setFlowName(flowConfig.getId().getFlowName()); UpdateRequest<FlowConfig> updateRequest = _flowconfigsRequestBuilders.update().id(new ComplexResourceKey<>(flowId, new EmptyRecord())) .input(flowConfig).build(); ResponseFuture<EmptyRecord> response = _restClient.get().sendRequest(updateRequest); response.getResponse(); }
/** * Retrieve the flow configuration with the given key * * @return * builder for the resource method */ public FlowconfigsGetRequestBuilder get() { return new FlowconfigsGetRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
/** * Construct a {@link FlowConfigClient} to communicate with http flow config server at URI serverUri * @param serverUri address and port of the REST server */ public FlowConfigClient(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)); _flowconfigsRequestBuilders = new FlowconfigsRequestBuilders(); }
/** * Update the flow configuration with the specified key. Running flows are not affected. * An error is raised if the flow configuration does not exist. * * @return * builder for the resource method */ public FlowconfigsUpdateRequestBuilder update() { return new FlowconfigsUpdateRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
/** * Create a flow configuration that the service will forward to execution instances for execution * * @return * builder for the resource method */ public FlowconfigsCreateRequestBuilder create() { return new FlowconfigsCreateRequestBuilder(getBaseUriTemplate(), _resourceSpec, getRequestOptions()); }
public OptionsRequestBuilder options() { return new OptionsRequestBuilder(getBaseUriTemplate(), getRequestOptions()); }