From d217041b4ef85eb4f5c0b1ce592abdfe9294c376 Mon Sep 17 00:00:00 2001 From: Greg Schohn Date: Tue, 8 Oct 2024 09:03:43 -0400 Subject: [PATCH] Reformat some more @Parameter definitions to be more readable Signed-off-by: Greg Schohn --- .../migrations/RfsMigrateDocuments.java | 82 ++++++++++++------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/DocumentsFromSnapshotMigration/src/main/java/org/opensearch/migrations/RfsMigrateDocuments.java b/DocumentsFromSnapshotMigration/src/main/java/org/opensearch/migrations/RfsMigrateDocuments.java index 592c09dd1..14039232e 100644 --- a/DocumentsFromSnapshotMigration/src/main/java/org/opensearch/migrations/RfsMigrateDocuments.java +++ b/DocumentsFromSnapshotMigration/src/main/java/org/opensearch/migrations/RfsMigrateDocuments.java @@ -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 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, @@ -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"); }