Skip to content

Commit

Permalink
Reformat some more @parameter definitions to be more readable
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Schohn <[email protected]>
  • Loading branch information
gregschohn committed Oct 8, 2024
1 parent 63216c5 commit 204dd40
Showing 1 changed file with 53 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,62 +58,84 @@ public Duration convert(String value) {
}

public static class Args {
@Parameter(names = {"--help", "-h"}, help = true, description = "Displays information about how to use this tool")
@Parameter(
names = {"--help", "-h"},
help = true,
description = "Displays information about how to use this tool")
private boolean help;

@Parameter(names = { "--snapshot-name" }, required = true, description = "The name of the snapshot to migrate")
@Parameter(required = true,
names = { "--snapshot-name" },
description = "The name of the snapshot to migrate")
public String snapshotName;

@Parameter(names = {
"--snapshot-local-dir" }, required = false, description = ("The absolute path to the directory on local disk where the snapshot exists. Use this parameter"
+ " if have a copy of the snapshot disk. Mutually exclusive with --s3-local-dir, --s3-repo-uri, and --s3-region."))
@Parameter(required = false,
names = { "--snapshot-local-dir" },
description = ("The absolute path to the directory on local disk where the snapshot exists. " +
"Use this parameter if have a copy of the snapshot disk. Mutually exclusive with " +
"--s3-local-dir, --s3-repo-uri, and --s3-region."))
public String snapshotLocalDir = null;

@Parameter(names = {
"--s3-local-dir" }, required = false, description = ("The absolute path to the directory on local disk to download S3 files to. If you supply this, you must"
+ " also supply --s3-repo-uri and --s3-region. Mutually exclusive with --snapshot-local-dir."))
@Parameter(required = false,
names = { "--s3-local-dir" },
description = ("The absolute path to the directory on local disk to download S3 files to. " +
"If you supply this, you must also supply --s3-repo-uri and --s3-region. " +
"Mutually exclusive with --snapshot-local-dir."))
public String s3LocalDir = null;

@Parameter(names = {
"--s3-repo-uri" }, required = false, description = ("The S3 URI of the snapshot repo, like: s3://my-bucket/dir1/dir2. If you supply this, you must"
+ " also supply --s3-local-dir and --s3-region. Mutually exclusive with --snapshot-local-dir."))
@Parameter(required = false,
names = {"--s3-repo-uri" },
description = ("The S3 URI of the snapshot repo, like: s3://my-bucket/dir1/dir2. " +
"If you supply this, you must also supply --s3-local-dir and --s3-region. " +
"Mutually exclusive with --snapshot-local-dir."))
public String s3RepoUri = null;

@Parameter(names = {
"--s3-region" }, required = false, description = ("The AWS Region the S3 bucket is in, like: us-east-2. If you supply this, you must"
@Parameter(required = false,
names = { "--s3-region" },
description = ("The AWS Region the S3 bucket is in, like: us-east-2. If you supply this, you must"
+ " also supply --s3-local-dir and --s3-repo-uri. Mutually exclusive with --snapshot-local-dir."))
public String s3Region = null;

@Parameter(names = {
"--lucene-dir" }, required = true, description = "The absolute path to the directory where we'll put the Lucene docs")
@Parameter(required = true,
names = { "--lucene-dir" },
description = "The absolute path to the directory where we'll put the Lucene docs")
public String luceneDir;

@ParametersDelegate
public ConnectionContext.TargetArgs targetArgs = new ConnectionContext.TargetArgs();

@Parameter(names = { "--index-allowlist" }, description = ("Optional. List of index names to migrate"
+ " (e.g. 'logs_2024_01, logs_2024_02'). Default: all non-system indices (e.g. those not starting with '.')"), required = false)
@Parameter(required = false,
names = { "--index-allowlist" },
description = ("Optional. List of index names to migrate (e.g. 'logs_2024_01, logs_2024_02'). " +
"Default: all non-system indices (e.g. those not starting with '.')"))
public List<String> indexAllowlist = List.of();

@Parameter(names = {
"--max-shard-size-bytes" }, description = ("Optional. The maximum shard size, in bytes, to allow when"
+ " performing the document migration. Useful for preventing disk overflow. Default: 80 * 1024 * 1024 * 1024 (80 GB)"), required = false)
@Parameter(required = false,
names = { "--max-shard-size-bytes" },
description = ("Optional. The maximum shard size, in bytes, to allow when " +
"performing the document migration. " +
"Useful for preventing disk overflow. Default: 80 * 1024 * 1024 * 1024 (80 GB)"))
public long maxShardSizeBytes = 80 * 1024 * 1024 * 1024L;

@Parameter(names = { "--initial-lease-duration" }, description = ("Optional. The time that the "
+ "first attempt to migrate a shard's documents should take. If a process takes longer than this "
+ "the process will terminate, allowing another process to attempt the migration, but with double the "
+ "amount of time than the last time. Default: PT10M"), required = false, converter = DurationConverter.class)
@Parameter(required = false,
names = { "--initial-lease-duration" },
converter = DurationConverter.class,
description = "Optional. The time that the first attempt to migrate a shard's documents should take. " +
"If a process takes longer than this the process will terminate, allowing another process to " +
"attempt the migration, but with double the amount of time than the last time. Default: PT10M")
public Duration initialLeaseDuration = Duration.ofMinutes(10);

@Parameter(required = false, names = {
"--otel-collector-endpoint" }, arity = 1, description = "Endpoint (host:port) for the OpenTelemetry Collector to which metrics logs should be"
@Parameter(required = false,
names = { "--otel-collector-endpoint" },
arity = 1,
description = "Endpoint (host:port) for the OpenTelemetry Collector to which metrics logs should be"
+ "forwarded. If no value is provided, metrics will not be forwarded.")
String otelCollectorEndpoint;

@Parameter(required = false,
names = "--documents-per-bulk-request",
description = "Optional. The number of documents to be included within each bulk request sent. Default no max (controlled by documents size)")
description = "Optional. The number of documents to be included within each bulk request sent. " +
"Default no max (controlled by documents size)")
int numDocsPerBulkRequest = Integer.MAX_VALUE;

@Parameter(required = false,
Expand All @@ -128,8 +150,10 @@ public static class Args {
"used to communicate to the target, default 10")
int maxConnections = 10;

@Parameter(names = { "--source-version" }, description = ("Optional. Version of the source cluster. Default: ES_7.10"), required = false,
converter = VersionConverter.class)
@Parameter(required = false,
names = { "--source-version" },
converter = VersionConverter.class,
description = ("Optional. Version of the source cluster. Default: ES_7.10"))
public Version sourceVersion = Version.fromString("ES 7.10");
}

Expand Down

0 comments on commit 204dd40

Please sign in to comment.