Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.ignite.internal.cli.core.call.DefaultCallOutput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.ClusterManagementApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;
import org.apache.ignite.rest.client.model.InitCommand;
Expand Down Expand Up @@ -50,8 +49,6 @@ public DefaultCallOutput<String> execute(ClusterInitCallInput input) {
}

private ClusterManagementApi createApiClient(ClusterInitCallInput input) {
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath(input.getClusterUrl());
return new ClusterManagementApi(client);
return new ClusterManagementApi(Configuration.getDefaultApiClient().setBasePath(input.getClusterUrl()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.apache.ignite.internal.cli.core.call.UrlCallInput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.ClusterManagementApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;
import org.apache.ignite.rest.client.model.ClusterState;

/**
Expand Down Expand Up @@ -72,6 +72,6 @@ private int fetchNumberOfAllNodes(UrlCallInput input) {
}

private ClusterState fetchClusterState(String url) throws ApiException {
return new ClusterManagementApi(new ApiClient().setBasePath(url)).clusterState();
return new ClusterManagementApi(Configuration.getDefaultApiClient().setBasePath(url)).clusterState();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.ignite.internal.cli.core.call.DefaultCallOutput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.ClusterConfigurationApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;

Expand Down Expand Up @@ -51,8 +50,6 @@ private JsonString readClusterConfig(ClusterConfigurationApi api, ClusterConfigS
}

private ClusterConfigurationApi createApiClient(ClusterConfigShowCallInput input) {
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath(input.getClusterUrl());
return new ClusterConfigurationApi(client);
return new ClusterConfigurationApi(Configuration.getDefaultApiClient().setBasePath(input.getClusterUrl()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.ignite.internal.cli.core.call.DefaultCallOutput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.ClusterConfigurationApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;

Expand Down Expand Up @@ -50,8 +49,6 @@ private DefaultCallOutput<String> updateClusterConfig(ClusterConfigurationApi ap
}

private ClusterConfigurationApi createApiClient(ClusterConfigUpdateCallInput input) {
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath(input.getClusterUrl());
return new ClusterConfigurationApi(client);
return new ClusterConfigurationApi(Configuration.getDefaultApiClient().setBasePath(input.getClusterUrl()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.ignite.internal.cli.core.call.DefaultCallOutput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.NodeConfigurationApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;

Expand Down Expand Up @@ -51,8 +50,6 @@ private JsonString readNodeConfig(NodeConfigurationApi api, NodeConfigShowCallIn
}

private NodeConfigurationApi createApiClient(NodeConfigShowCallInput input) {
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath(input.getNodeUrl());
return new NodeConfigurationApi(client);
return new NodeConfigurationApi(Configuration.getDefaultApiClient().setBasePath(input.getNodeUrl()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.ignite.internal.cli.core.call.DefaultCallOutput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.NodeConfigurationApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;

Expand Down Expand Up @@ -50,8 +49,6 @@ private DefaultCallOutput<String> updateNodeConfig(NodeConfigurationApi api, Nod
}

private NodeConfigurationApi createApiClient(NodeConfigUpdateCallInput input) {
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath(input.getNodeUrl());
return new NodeConfigurationApi(client);
return new NodeConfigurationApi(Configuration.getDefaultApiClient().setBasePath(input.getNodeUrl()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.ignite.internal.cli.core.call.UrlCallInput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.NodeManagementApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;
import org.apache.ignite.rest.client.model.NodeState;

/**
Expand All @@ -51,6 +51,6 @@ public CallOutput<NodeStatus> execute(UrlCallInput input) {
}

private NodeState fetchNodeState(String url) throws ApiException {
return new NodeManagementApi(new ApiClient().setBasePath(url)).nodeState();
return new NodeManagementApi(Configuration.getDefaultApiClient().setBasePath(url)).nodeState();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.ignite.internal.cli.core.call.UrlCallInput;
import org.apache.ignite.internal.cli.core.exception.IgniteCliApiException;
import org.apache.ignite.rest.client.api.NodeManagementApi;
import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.ApiException;
import org.apache.ignite.rest.client.invoker.Configuration;

/** Call to get node version. */
@Singleton
Expand All @@ -40,6 +40,6 @@ public CallOutput<String> execute(UrlCallInput input) {
}

private String getNodeVersion(String url) throws ApiException {
return new NodeManagementApi(new ApiClient().setBasePath(url)).nodeVersion();
return new NodeManagementApi(Configuration.getDefaultApiClient().setBasePath(url)).nodeVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public abstract class BaseCommand {
@Option(names = {"-h", "--help"}, usageHelp = true, description = "Show this help message and exit.")
protected boolean usageHelpRequested;

@Option(names = {"-v", "--verbose"}, description = "Show additional information.")
protected boolean verbose;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always about errors?


@Spec
protected CommandSpec spec;
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public Integer call() {
.profileName(profileName.getProfileName())::build)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public Integer call() {
.key(key)::build)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Integer call() {
.profileName(profileName.getProfileName())::build)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public Integer call() {
.parameters(parameters)::build)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new ProfileDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new ProfileDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public Integer call() {
.inputProvider(() -> new StringCallInput(profileName))
.errOutput(spec.commandLine().getErr())
.output(spec.commandLine().getOut())
.verbose(verbose)
.build().runPipeline();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public Integer call() {
.activate(activate)::build)
.errOutput(spec.commandLine().getErr())
.output(spec.commandLine().getOut())
.verbose(verbose)
.build().runPipeline();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Integer call() throws Exception {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new ProfileListDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public Integer call() throws Exception {
.inputProvider(EmptyCallInput::new)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Integer call() {
.exceptionHandler(new ClusterNotInitializedExceptionHandler(
"Cannot show cluster config", "ignite cluster init"
))
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void run() {
.map(this::configShowCallInput)
.then(Flows.fromCall(call))
.exceptionHandler(new ClusterNotInitializedExceptionHandler("Cannot show cluster config", "cluster init"))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public Integer call() {
.exceptionHandler(new ClusterNotInitializedExceptionHandler(
"Cannot update cluster config", "ignite cluster init"
))
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void run() {
.map(this::configUpdateCallInput)
.then(Flows.fromCall(call))
.exceptionHandler(new ClusterNotInitializedExceptionHandler("Cannot update cluster config", "cluster init"))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public Integer call() {
.inputProvider(this::buildCallInput)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void run() {
question.askQuestionIfNotConnected(clusterUrl.getClusterUrl())
.map(this::buildCallInput)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new ClusterStatusDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void run() {
question.askQuestionIfNotConnected(clusterUrl.getClusterUrl())
.map(UrlCallInput::new)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void run() {
.inputProvider(() -> new ConnectCallInput(nodeUrl.toString()))
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void run() {
.inputProvider(EmptyCallInput::new)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new JsonDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void run() {
question.askQuestionIfNotConnected(nodeUrl.getNodeUrl())
.map(this::nodeConfigShowCallInput)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Integer call() {
.inputProvider(this::buildCallInput)
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void run() {
question.askQuestionIfNotConnected(nodeUrl.getNodeUrl())
.map(this::nodeConfigUpdateCallInput)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Integer call() {
.inputProvider(() -> metricSource.buildDisableCallInput(nodeUrl.getNodeUrl()))
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void run() {
question.askQuestionIfNotConnected(nodeUrl.getNodeUrl())
.map(metricSource::buildDisableCallInput)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Integer call() {
.inputProvider(() -> metricSource.buildEnableCallInput(nodeUrl.getNodeUrl()))
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void run() {
question.askQuestionIfNotConnected(nodeUrl.getNodeUrl())
.map(metricSource::buildEnableCallInput)
.then(Flows.fromCall(call))
.verbose(verbose)
.print()
.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new MetricListDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public Integer call() {
.output(spec.commandLine().getOut())
.errOutput(spec.commandLine().getErr())
.decorator(new NodeStatusDecorator())
.verbose(verbose)
.build()
.runPipeline();
}
Expand Down
Loading