Search in sources :

Example 6 with FlowClient

use of org.apache.nifi.toolkit.cli.impl.client.nifi.FlowClient in project nifi by apache.

the class PGStart method doExecute.

@Override
public VoidResult doExecute(final NiFiClient client, final Properties properties) throws NiFiClientException, IOException, MissingOptionException, CommandException {
    final String pgId = getRequiredArg(properties, CommandOption.PG_ID);
    final ScheduleComponentsEntity entity = new ScheduleComponentsEntity();
    entity.setId(pgId);
    entity.setState(ScheduleComponentsEntity.STATE_RUNNING);
    final FlowClient flowClient = client.getFlowClient();
    final ScheduleComponentsEntity resultEntity = flowClient.scheduleProcessGroupComponents(pgId, entity);
    return VoidResult.getInstance();
}
Also used : ScheduleComponentsEntity(org.apache.nifi.web.api.entity.ScheduleComponentsEntity) FlowClient(org.apache.nifi.toolkit.cli.impl.client.nifi.FlowClient)

Example 7 with FlowClient

use of org.apache.nifi.toolkit.cli.impl.client.nifi.FlowClient in project nifi by apache.

the class PGStop method doExecute.

@Override
public VoidResult doExecute(final NiFiClient client, final Properties properties) throws NiFiClientException, IOException, MissingOptionException {
    final String pgId = getRequiredArg(properties, CommandOption.PG_ID);
    final ScheduleComponentsEntity entity = new ScheduleComponentsEntity();
    entity.setId(pgId);
    entity.setState(ScheduleComponentsEntity.STATE_STOPPED);
    final FlowClient flowClient = client.getFlowClient();
    final ScheduleComponentsEntity resultEntity = flowClient.scheduleProcessGroupComponents(pgId, entity);
    return VoidResult.getInstance();
}
Also used : ScheduleComponentsEntity(org.apache.nifi.web.api.entity.ScheduleComponentsEntity) FlowClient(org.apache.nifi.toolkit.cli.impl.client.nifi.FlowClient)

Aggregations

FlowClient (org.apache.nifi.toolkit.cli.impl.client.nifi.FlowClient)7 NiFiClientException (org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException)4 ProcessGroupDTO (org.apache.nifi.web.api.dto.ProcessGroupDTO)2 VersionControlInformationDTO (org.apache.nifi.web.api.dto.VersionControlInformationDTO)2 ScheduleComponentsEntity (org.apache.nifi.web.api.entity.ScheduleComponentsEntity)2 VersionedFlowSnapshotMetadataSetEntity (org.apache.nifi.web.api.entity.VersionedFlowSnapshotMetadataSetEntity)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 MissingOptionException (org.apache.commons.cli.MissingOptionException)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Context (org.apache.nifi.toolkit.cli.api.Context)1 NiFiClient (org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient)1 ProcessGroupBox (org.apache.nifi.toolkit.cli.impl.client.nifi.ProcessGroupBox)1 ProcessGroupClient (org.apache.nifi.toolkit.cli.impl.client.nifi.ProcessGroupClient)1 VersionsClient (org.apache.nifi.toolkit.cli.impl.client.nifi.VersionsClient)1 CommandOption (org.apache.nifi.toolkit.cli.impl.command.CommandOption)1 AbstractNiFiCommand (org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand)1 CurrentUserEntityResult (org.apache.nifi.toolkit.cli.impl.result.CurrentUserEntityResult)1