From 119590e2298db63bd921c0cf878d5ccf02e025b5 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 14 Aug 2024 17:02:34 +1200 Subject: [PATCH 01/11] Implement the `cat.pit_segments` and `cat.segment_replication` operations (#527) * Implement `cat.pit_segments` and `cat.all_pit_segments` Signed-off-by: Thomas Farr Allow body on get/head Signed-off-by: Thomas Farr * Implement `cat.segment_replication` Signed-off-by: Thomas Farr * Add changelog entry Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr (cherry picked from commit c3deb7049febe671131485bd4e71aaa4597856e2) --- .github/workflows/integration.yml | 4 +- CHANGELOG.md | 1 + .../ClusterBase.cs | 7 +- .../OpenSearchNode.cs | 5 +- .../Configuration/CodeConfiguration.cs | 3 +- src/ApiGenerator/OpenSearch.openapi.json | 739 +++++++++++++++--- .../CatPitSegments/CatAllPitSegmentsRecord.cs | 13 + .../CatAllPitSegmentsRequest.cs | 15 + .../CatPitSegments/CatPitSegmentsRecord.cs | 59 ++ .../CatPitSegments/CatPitSegmentsRequest.cs | 44 ++ .../CatSegmentReplicationRecord.cs | 89 +++ .../CatSegmentReplicationRequest.cs | 15 + .../IOpenSearchClient.Generated.cs | 6 - .../OpenSearchClient.NoNamespace.cs | 7 - src/OpenSearch.Client/OpenSearchClient.cs | 2 +- .../_Generated/ApiUrlsLookup.cs | 8 + .../_Generated/Descriptors.Cat.cs | 216 +++++ .../_Generated/IOpenSearchClient.cs | 4 + .../_Generated/OpenSearchClient.Cat.cs | 221 ++++++ .../_Generated/OpenSearchClient.cs | 5 + .../_Generated/Requests.Cat.cs | 326 ++++++++ src/OpenSearch.Client/_Generated/Requests.cs | 1 + src/OpenSearch.Net/Api/Enums.Generated.cs | 59 -- .../OpenSearchLowLevelClient.NoNamespace.cs | 6 - src/OpenSearch.Net/_Generated/Api/Enums.cs | 70 ++ .../RequestParameters.Cat.cs | 289 +++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 4 + .../OpenSearchLowLevelClient.Cat.cs | 201 +++++ .../_Generated/OpenSearchLowLevelClient.cs | 3 + .../Clusters/ReadOnlyCluster.cs | 12 + .../CatPitSegments/CatPitSegmentsApiTests.cs | 123 +++ .../CatPitSegments/CatPitSegmentsUrlTests.cs | 33 + .../CatSegmentReplicationApiTests.cs | 67 ++ .../CatSegmentReplicationUrlTests.cs | 33 + 34 files changed, 2479 insertions(+), 211 deletions(-) create mode 100644 src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRecord.cs create mode 100644 src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRequest.cs create mode 100644 src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRecord.cs create mode 100644 src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRequest.cs create mode 100644 src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRecord.cs create mode 100644 src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRequest.cs create mode 100644 src/OpenSearch.Client/_Generated/Descriptors.Cat.cs create mode 100644 src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs create mode 100644 src/OpenSearch.Client/_Generated/Requests.Cat.cs create mode 100644 src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs create mode 100644 src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs create mode 100644 tests/Tests/Cat/CatPitSegments/CatPitSegmentsApiTests.cs create mode 100644 tests/Tests/Cat/CatPitSegments/CatPitSegmentsUrlTests.cs create mode 100644 tests/Tests/Cat/CatSegmentReplication/CatSegmentReplicationApiTests.cs create mode 100644 tests/Tests/Cat/CatSegmentReplication/CatSegmentReplicationUrlTests.cs diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 68cc792a48..de9ff657ce 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -48,7 +48,7 @@ jobs: restore-keys: | ${{ runner.os }}-nuget- - - run: "./build.sh integrate ${{ matrix.version }} readonly,writable random:test_only_one --report" + - run: "./build.sh integrate ${{ matrix.version }} readonly,replicatedreadonly,writable random:test_only_one --report" name: Integration Tests working-directory: client @@ -105,7 +105,7 @@ jobs: knn_plugin: true plugins_output_directory: ${{ env.OPENSEARCH_PLUGINS_DIRECTORY }} - - run: "./build.sh integrate $OPENSEARCH_VERSION readonly,writable random:test_only_one --report" + - run: "./build.sh integrate $OPENSEARCH_VERSION readonly,replicatedreadonly,writable random:test_only_one --report" name: Integration Tests working-directory: client env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 085d805508..e327a47ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] ### Added +- Added support for the `Cat.PitSegments` and `Cat.SegmentReplication` APIs ([#527](https://github.com/opensearch-project/opensearch-net/pull/527)) - Added support for `MinScore` on `ScriptScoreQuery` ([#624](https://github.com/opensearch-project/opensearch-net/pull/624)) - Added support for serializing the `DateOnly` and `TimeOnly` types ([#734](https://github.com/opensearch-project/opensearch-net/pull/734)) - Added support for the `Ext` parameter on `SearchRequest` ([#738](https://github.com/opensearch-project/opensearch-net/pull/738)) diff --git a/abstractions/src/OpenSearch.OpenSearch.Managed/ClusterBase.cs b/abstractions/src/OpenSearch.OpenSearch.Managed/ClusterBase.cs index 6b55e4aadf..3cdb74e966 100644 --- a/abstractions/src/OpenSearch.OpenSearch.Managed/ClusterBase.cs +++ b/abstractions/src/OpenSearch.OpenSearch.Managed/ClusterBase.cs @@ -131,11 +131,12 @@ public IDisposable Start(IConsoleLineHandler writer, TimeSpan waitForStarted) OnBeforeStart(); var subscriptions = new Subscriptions(); - foreach (var node in Nodes) subscriptions.Add(node.SubscribeLines(writer)); - var waitHandles = Nodes.Select(w => w.StartedHandle).ToArray(); - if (!WaitHandle.WaitAll(waitHandles, waitForStarted)) + foreach (var node in Nodes) { + subscriptions.Add(node.SubscribeLines(writer)); + if (node.WaitForStarted(waitForStarted)) continue; + var nodeExceptions = Nodes.Select(n => n.LastSeenException).Where(e => e != null).ToList(); writer?.WriteError( $"{{{GetType().Name}.{nameof(Start)}}} cluster did not start after {waitForStarted}"); diff --git a/abstractions/src/OpenSearch.OpenSearch.Managed/OpenSearchNode.cs b/abstractions/src/OpenSearch.OpenSearch.Managed/OpenSearchNode.cs index 62ad95b836..da8250901a 100644 --- a/abstractions/src/OpenSearch.OpenSearch.Managed/OpenSearchNode.cs +++ b/abstractions/src/OpenSearch.OpenSearch.Managed/OpenSearchNode.cs @@ -88,7 +88,10 @@ private static StartArguments StartArgs(NodeConfiguration config) private static Dictionary EnvVars(NodeConfiguration config) { - var environmentVariables = new Dictionary { { "OPENSEARCH_JAVA_OPTS", "-Xms1g -Xmx1g" } }; + var javaOpts = new List { "-Xms1g", "-Xmx1g" }; + + var environmentVariables = new Dictionary { { "OPENSEARCH_JAVA_OPTS", string.Join(" ", javaOpts) } }; + if (!string.IsNullOrWhiteSpace(config.FileSystem.ConfigPath)) environmentVariables.Add(config.FileSystem.ConfigEnvironmentVariableName, config.FileSystem.ConfigPath); diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 7f8d83bddd..067caec522 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -41,7 +41,8 @@ public static class CodeConfiguration { new("{create,delete}_pit"), new("{delete,get}_all_pits"), - + new("cat.{all_pit,pit}_segments"), + new("cat.segment_replication"), new("cluster.{delete,exists,get,put}_component_template"), new("indices.{delete,exists,get,put}_index_template") }; diff --git a/src/ApiGenerator/OpenSearch.openapi.json b/src/ApiGenerator/OpenSearch.openapi.json index a4ba7bf8d3..ba09d34b3e 100644 --- a/src/ApiGenerator/OpenSearch.openapi.json +++ b/src/ApiGenerator/OpenSearch.openapi.json @@ -2632,13 +2632,80 @@ } } }, + "parameters": [ + { + "name": "format", + "in": "query", + "description": "A short version of the Accept header, e.g. json, yaml.", + "schema": { + "type": "string", + "description": "A short version of the Accept header, e.g. json, yaml." + } + }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "bytes", + "in": "query", + "description": "The unit in which to display byte values.", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + ], "responses": { "200": { "description": "CatPitSegments 200 response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CatPitSegmentsResponseContent" + "$ref": "#/components/schemas/CatPitSegmentsOutputPayload" } } } @@ -2656,13 +2723,80 @@ "url": "https://opensearch.org/docs/latest/search-plugins/point-in-time-api/" }, "operationId": "CatAllPitSegments", + "parameters": [ + { + "name": "format", + "in": "query", + "description": "A short version of the Accept header, e.g. json, yaml.", + "schema": { + "type": "string", + "description": "A short version of the Accept header, e.g. json, yaml." + } + }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "bytes", + "in": "query", + "description": "The unit in which to display byte values.", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + ], "responses": { "200": { "description": "CatAllPitSegments 200 response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CatAllPitSegmentsResponseContent" + "$ref": "#/components/schemas/CatAllPitSegmentsOutputPayload" } } } @@ -3174,6 +3308,89 @@ "description": "A short version of the Accept header, e.g. json, yaml." } }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, { "name": "active_only", "in": "query", @@ -3226,30 +3443,6 @@ }, "explode": true }, - { - "name": "h", - "in": "query", - "description": "Comma-separated list of column names to display.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names to display." - }, - "explode": true - }, - { - "name": "help", - "in": "query", - "description": "Return help information.", - "schema": { - "type": "boolean", - "default": false, - "description": "Return help information." - } - }, { "name": "index", "in": "query", @@ -3264,20 +3457,6 @@ }, "explode": true }, - { - "name": "s", - "in": "query", - "description": "Comma-separated list of column names or column aliases to sort by.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names or column aliases to sort by." - }, - "explode": true - }, { "name": "time", "in": "query", @@ -3287,23 +3466,31 @@ } }, { - "name": "v", + "name": "timeout", "in": "query", - "description": "Verbose mode. Display column headers.", + "description": "Operation timeout.", "schema": { - "type": "boolean", - "default": false, - "description": "Verbose mode. Display column headers." + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" } } ], "responses": { "200": { - "description": "CatSegmentReplication 200 response" + "description": "CatSegmentReplication 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CatSegmentReplicationOutputPayload" + } + } + } } }, "x-operation-group": "cat.segment_replication", - "x-version-added": "1.0" + "x-version-added": "2.6.0" } }, "/_cat/segment_replication/{index}": { @@ -3332,6 +3519,89 @@ "description": "A short version of the Accept header, e.g. json, yaml." } }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, { "name": "active_only", "in": "query", @@ -3384,30 +3654,6 @@ }, "explode": true }, - { - "name": "h", - "in": "query", - "description": "Comma-separated list of column names to display.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names to display." - }, - "explode": true - }, - { - "name": "help", - "in": "query", - "description": "Return help information.", - "schema": { - "type": "boolean", - "default": false, - "description": "Return help information." - } - }, { "name": "index", "in": "query", @@ -3422,20 +3668,6 @@ }, "explode": true }, - { - "name": "s", - "in": "query", - "description": "Comma-separated list of column names or column aliases to sort by.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names or column aliases to sort by." - }, - "explode": true - }, { "name": "time", "in": "query", @@ -3445,23 +3677,31 @@ } }, { - "name": "v", + "name": "timeout", "in": "query", - "description": "Verbose mode. Display column headers.", + "description": "Operation timeout.", "schema": { - "type": "boolean", - "default": false, - "description": "Verbose mode. Display column headers." + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" } } ], "responses": { "200": { - "description": "CatSegmentReplication_WithIndex 200 response" + "description": "CatSegmentReplication_WithIndex 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CatSegmentReplication_WithIndexOutputPayload" + } + } + } } }, "x-operation-group": "cat.segment_replication", - "x-version-added": "1.0" + "x-version-added": "2.6.0" } }, "/_cat/segments": { @@ -8032,6 +8272,16 @@ "type": "boolean", "description": "Specify whether the operation should only expunge deleted documents." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } } ], "responses": { @@ -21175,6 +21425,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the cloned index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -21269,6 +21540,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the cloned index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -23928,6 +24220,16 @@ "type": "boolean", "description": "Specify whether the operation should only expunge deleted documents." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } } ], "responses": { @@ -25350,6 +25652,27 @@ "type": "string", "description": "Sets the number of active shards to wait for before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -27789,6 +28112,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -27893,6 +28237,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -28283,6 +28648,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -28387,6 +28773,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -30436,27 +30843,29 @@ "pb" ] }, - "CatAllPitSegmentsResponseContent": { - "type": "object", - "properties": { - "content": { - "$ref": "#/components/schemas/CatPitSegment" - } + "CatAllPitSegmentsOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatPitSegmentsRecord" + } + }, + "CatPitSegmentsOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatPitSegmentsRecord" } }, - "CatPitSegment": { + "CatPitSegmentsRecord": { "type": "object", "properties": { "index": { "type": "string" }, "shard": { - "type": "integer", - "format": "int32" + "type": "string" }, "prirep": { - "type": "boolean", - "description": "Set to true to return stats only for primary shards." + "type": "string" }, "ip": { "type": "string" @@ -30465,43 +30874,31 @@ "type": "string" }, "generation": { - "type": "integer", - "format": "int32" + "type": "string" }, - "docs_count": { - "type": "integer", - "format": "int32" + "docs.count": { + "type": "string" }, - "docs_deleted": { - "type": "integer", - "format": "int32" + "docs.deleted": { + "type": "string" }, "size": { "type": "string" }, - "size_memory": { - "type": "integer", - "format": "int32" + "size.memory": { + "type": "string" }, "committed": { - "type": "boolean" + "type": "string" }, "searchable": { - "type": "boolean" + "type": "string" }, "version": { "type": "string" }, "compound": { - "type": "boolean" - } - } - }, - "CatPitSegmentsResponseContent": { - "type": "object", - "properties": { - "content": { - "$ref": "#/components/schemas/CatPitSegment" + "type": "string" } } }, @@ -30519,6 +30916,98 @@ "pit_id" ] }, + "CatSegmentReplicationOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatSegmentReplicationRecord" + } + }, + "CatSegmentReplicationRecord": { + "type": "object", + "properties": { + "shardId": { + "type": "string" + }, + "target_node": { + "type": "string" + }, + "target_host": { + "type": "string" + }, + "checkpoints_behind": { + "type": "string" + }, + "bytes_behind": { + "type": "string" + }, + "current_lag": { + "type": "string" + }, + "last_completed_lag": { + "type": "string" + }, + "rejected_requests": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "time": { + "type": "string" + }, + "files_fetched": { + "type": "string" + }, + "files_percent": { + "type": "string" + }, + "bytes_fetched": { + "type": "string" + }, + "bytes_percent": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "stop_time": { + "type": "string" + }, + "files": { + "type": "string" + }, + "files_total": { + "type": "string" + }, + "bytes": { + "type": "string" + }, + "bytes_total": { + "type": "string" + }, + "replicating_stage_time_taken": { + "type": "string" + }, + "get_checkpoint_info_stage_time_taken": { + "type": "string" + }, + "file_diff_stage_time_taken": { + "type": "string" + }, + "get_files_stage_time_taken": { + "type": "string" + }, + "finalize_replication_stage_time_taken": { + "type": "string" + } + } + }, + "CatSegmentReplication_WithIndexOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatSegmentReplicationRecord" + } + }, "CertificatesDetail": { "type": "object", "properties": { diff --git a/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRecord.cs b/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRecord.cs new file mode 100644 index 0000000000..2591dd873e --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRecord.cs @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +using System.Runtime.Serialization; + +namespace OpenSearch.Client; + +[DataContract] +public class CatAllPitSegmentsRecord : CatPitSegmentsRecord { } diff --git a/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRequest.cs b/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRequest.cs new file mode 100644 index 0000000000..b88c25d0eb --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatPitSegments/CatAllPitSegmentsRequest.cs @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +namespace OpenSearch.Client; + +[MapsApi("cat.all_pit_segments")] +public partial interface ICatAllPitSegmentsRequest { } + +public partial class CatAllPitSegmentsRequest { } + +public partial class CatAllPitSegmentsDescriptor { } diff --git a/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRecord.cs b/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRecord.cs new file mode 100644 index 0000000000..29876ec081 --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRecord.cs @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +using System.Runtime.Serialization; + +namespace OpenSearch.Client; + +[DataContract] +public class CatPitSegmentsRecord : ICatRecord +{ + [DataMember(Name = "committed")] + public string Committed { get; set; } + + [DataMember(Name = "compound")] + public string Compound { get; set; } + + [DataMember(Name = "docs.count")] + public string DocsCount { get; set; } + + [DataMember(Name = "docs.deleted")] + public string DocsDeleted { get; set; } + + [DataMember(Name = "generation")] + public string Generation { get; set; } + + [DataMember(Name = "id")] + public string Id { get; set; } + + [DataMember(Name = "index")] + public string Index { get; set; } + + [DataMember(Name = "ip")] + public string Ip { get; set; } + + [DataMember(Name = "prirep")] + public string PrimaryOrReplica { get; set; } + + [DataMember(Name = "searchable")] + public string Searchable { get; set; } + + [DataMember(Name = "segment")] + public string Segment { get; set; } + + [DataMember(Name = "shard")] + public string Shard { get; set; } + + [DataMember(Name = "size")] + public string Size { get; set; } + + [DataMember(Name = "size.memory")] + public string SizeMemory { get; set; } + + [DataMember(Name = "version")] + public string Version { get; set; } +} diff --git a/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRequest.cs b/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRequest.cs new file mode 100644 index 0000000000..352d7cb010 --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatPitSegments/CatPitSegmentsRequest.cs @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using OpenSearch.Net.Utf8Json; + +namespace OpenSearch.Client; + +[MapsApi("cat.pit_segments")] +[ReadAs(typeof(CatPitSegmentsRequest))] +public partial interface ICatPitSegmentsRequest +{ + [DataMember(Name = "pit_id")] + IEnumerable PitId { get; set; } +} + +public partial class CatPitSegmentsRequest +{ + [SerializationConstructor] + public CatPitSegmentsRequest() { } + + public CatPitSegmentsRequest(IEnumerable pitId) : this(pitId?.ToArray()) { } + + public CatPitSegmentsRequest(params string[] pitId) => PitId = pitId; + + public IEnumerable PitId { get; set; } +} + +public partial class CatPitSegmentsDescriptor +{ + IEnumerable ICatPitSegmentsRequest.PitId { get; set; } + + public CatPitSegmentsDescriptor PitId(IEnumerable pitId) => + Assign(pitId?.ToArray(), (r, v) => r.PitId = v); + + public CatPitSegmentsDescriptor PitId(params string[] pitId) => + Assign(pitId, (r, v) => r.PitId = v); +} diff --git a/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRecord.cs b/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRecord.cs new file mode 100644 index 0000000000..065954293a --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRecord.cs @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +using System.Runtime.Serialization; + +namespace OpenSearch.Client; + +[DataContract] +public class CatSegmentReplicationRecord : ICatRecord +{ + [DataMember(Name = "shardId")] + public string ShardId { get; set; } + + [DataMember(Name = "target_node")] + public string TargetNode { get; set; } + + [DataMember(Name = "target_host")] + public string TargetHost { get; set; } + + [DataMember(Name = "checkpoints_behind")] + public string CheckpointsBehind { get; set; } + + [DataMember(Name = "bytes_behind")] + public string BytesBehind { get; set; } + + [DataMember(Name = "current_lag")] + public string CurrentLag { get; set; } + + [DataMember(Name = "last_completed_lag")] + public string LastCompletedLag { get; set; } + + [DataMember(Name = "rejected_requests")] + public string RejectedRequests { get; set; } + + [DataMember(Name = "stage")] + public string Stage { get; set; } + + [DataMember(Name = "time")] + public string Time { get; set; } + + [DataMember(Name = "files_fetched")] + public string FilesFetched { get; set; } + + [DataMember(Name = "files_percent")] + public string FilesPercent { get; set; } + + [DataMember(Name = "bytes_fetched")] + public string BytesFetched { get; set; } + + [DataMember(Name = "bytes_percent")] + public string BytesPercent { get; set; } + + [DataMember(Name = "start_time")] + public string StartTime { get; set; } + + [DataMember(Name = "stop_time")] + public string StopTime { get; set; } + + [DataMember(Name = "files")] + public string Files { get; set; } + + [DataMember(Name = "files_total")] + public string FilesTotal { get; set; } + + [DataMember(Name = "bytes")] + public string Bytes { get; set; } + + [DataMember(Name = "bytes_total")] + public string BytesTotal { get; set; } + + [DataMember(Name = "replicating_stage_time_taken")] + public string ReplicatingStageTimeTaken { get; set; } + + [DataMember(Name = "get_checkpoint_info_stage_time_taken")] + public string GetCheckpointInfoStageTimeTaken { get; set; } + + [DataMember(Name = "file_diff_stage_time_taken")] + public string FileDiffStageTimeTaken { get; set; } + + [DataMember(Name = "get_files_stage_time_taken")] + public string GetFilesStageTimeTaken { get; set; } + + [DataMember(Name = "finalize_replication_stage_time_taken")] + public string FinalizeReplicationStageTimeTaken { get; set; } +} diff --git a/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRequest.cs b/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRequest.cs new file mode 100644 index 0000000000..55bdbe6d7f --- /dev/null +++ b/src/OpenSearch.Client/Cat/CatSegmentReplication/CatSegmentReplicationRequest.cs @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +namespace OpenSearch.Client; + +[MapsApi("cat.segment_replication")] +public partial interface ICatSegmentReplicationRequest { } + +public partial class CatSegmentReplicationRequest { } + +public partial class CatSegmentReplicationDescriptor { } diff --git a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs index fcb92df9e9..0673d19af3 100644 --- a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs +++ b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs @@ -49,12 +49,6 @@ namespace OpenSearch.Client /// public partial interface IOpenSearchClient { - ///Cat APIs - CatNamespace Cat - { - get; - } - ///Dangling Indices APIs DanglingIndicesNamespace DanglingIndices { diff --git a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs index 378f5e664b..92dc198128 100644 --- a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs +++ b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs @@ -48,13 +48,6 @@ namespace OpenSearch.Client /// public partial class OpenSearchClient : IOpenSearchClient { - ///Cat APIs - public CatNamespace Cat - { - get; - private set; - } - ///Dangling Indices APIs public DanglingIndicesNamespace DanglingIndices { diff --git a/src/OpenSearch.Client/OpenSearchClient.cs b/src/OpenSearch.Client/OpenSearchClient.cs index 77ca1c7206..c81ba9d6ee 100644 --- a/src/OpenSearch.Client/OpenSearchClient.cs +++ b/src/OpenSearch.Client/OpenSearchClient.cs @@ -220,7 +220,7 @@ Action forceConfiguration var url = request.GetUrl(ConnectionSettings); var method = request.HttpMethod; - var body = method == HttpMethod.GET || method == HttpMethod.HEAD || !parameters.SupportsBody ? null : bodySelector(request); + var body = !parameters.SupportsBody ? null : bodySelector(request); return (method, url, body); } diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index 75d3196969..5b80ccb84a 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -45,6 +45,14 @@ namespace OpenSearch.Client { internal static partial class ApiUrlsLookups { + internal static readonly ApiUrls CatAllPitSegments = + new(new[] { "_cat/pit_segments/_all" }); + + internal static readonly ApiUrls CatPitSegments = new(new[] { "_cat/pit_segments" }); + + internal static readonly ApiUrls CatSegmentReplication = + new(new[] { "_cat/segment_replication", "_cat/segment_replication/{index}" }); + internal static readonly ApiUrls ClusterDeleteComponentTemplate = new(new[] { "_component_template/{name}" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs new file mode 100644 index 0000000000..912afc70a6 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -0,0 +1,216 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using OpenSearch.Net; +using OpenSearch.Net.Specification.CatApi; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + /// Descriptor for AllPitSegments https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + public partial class CatAllPitSegmentsDescriptor + : RequestDescriptorBase< + CatAllPitSegmentsDescriptor, + CatAllPitSegmentsRequestParameters, + ICatAllPitSegmentsRequest + >, + ICatAllPitSegmentsRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllPitSegments; + + // values part of the url path + // Request parameters + /// The unit in which to display byte values. + public CatAllPitSegmentsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); + + /// A short version of the Accept header, e.g. json, yaml. + public CatAllPitSegmentsDescriptor Format(string format) => Qs("format", format); + + /// Comma-separated list of column names to display. + public CatAllPitSegmentsDescriptor Headers(params string[] headers) => Qs("h", headers); + + /// Return help information. + public CatAllPitSegmentsDescriptor Help(bool? help = true) => Qs("help", help); + + /// Comma-separated list of column names or column aliases to sort by. + public CatAllPitSegmentsDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + /// Verbose mode. Display column headers. + public CatAllPitSegmentsDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } + + /// Descriptor for PitSegments https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + public partial class CatPitSegmentsDescriptor + : RequestDescriptorBase< + CatPitSegmentsDescriptor, + CatPitSegmentsRequestParameters, + ICatPitSegmentsRequest + >, + ICatPitSegmentsRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatPitSegments; + + // values part of the url path + // Request parameters + /// The unit in which to display byte values. + public CatPitSegmentsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); + + /// A short version of the Accept header, e.g. json, yaml. + public CatPitSegmentsDescriptor Format(string format) => Qs("format", format); + + /// Comma-separated list of column names to display. + public CatPitSegmentsDescriptor Headers(params string[] headers) => Qs("h", headers); + + /// Return help information. + public CatPitSegmentsDescriptor Help(bool? help = true) => Qs("help", help); + + /// Comma-separated list of column names or column aliases to sort by. + public CatPitSegmentsDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + /// Verbose mode. Display column headers. + public CatPitSegmentsDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } + + /// Descriptor for SegmentReplication https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + public partial class CatSegmentReplicationDescriptor + : RequestDescriptorBase< + CatSegmentReplicationDescriptor, + CatSegmentReplicationRequestParameters, + ICatSegmentReplicationRequest + >, + ICatSegmentReplicationRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatSegmentReplication; + + /// /_cat/segment_replication + public CatSegmentReplicationDescriptor() + : base() { } + + /// /_cat/segment_replication/{index} + /// Optional, accepts null + public CatSegmentReplicationDescriptor(Indices index) + : base(r => r.Optional("index", index)) { } + + // values part of the url path + Indices ICatSegmentReplicationRequest.Index => Self.RouteValues.Get("index"); + + /// Comma-separated list or wildcard expression of index names to limit the returned information. + public CatSegmentReplicationDescriptor Index(Indices index) => + Assign(index, (a, v) => a.RouteValues.Optional("index", v)); + + /// a shortcut into calling Index(typeof(TOther)) + public CatSegmentReplicationDescriptor Index() + where TOther : class => + Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); + + /// A shortcut into calling Index(Indices.All) + public CatSegmentReplicationDescriptor AllIndices() => Index(Indices.All); + + // Request parameters + /// If `true`, the response only includes ongoing segment replication events. + public CatSegmentReplicationDescriptor ActiveOnly(bool? activeonly = true) => + Qs("active_only", activeonly); + + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). + public CatSegmentReplicationDescriptor AllowNoIndices(bool? allownoindices = true) => + Qs("allow_no_indices", allownoindices); + + /// The unit in which to display byte values. + public CatSegmentReplicationDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); + + /// If `true`, the response only includes latest completed segment replication events. + public CatSegmentReplicationDescriptor CompletedOnly(bool? completedonly = true) => + Qs("completed_only", completedonly); + + /// If `true`, the response includes detailed information about segment replications. + public CatSegmentReplicationDescriptor Detailed(bool? detailed = true) => + Qs("detailed", detailed); + + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public CatSegmentReplicationDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => + Qs("expand_wildcards", expandwildcards); + + /// A short version of the Accept header, e.g. json, yaml. + public CatSegmentReplicationDescriptor Format(string format) => Qs("format", format); + + /// Comma-separated list of column names to display. + public CatSegmentReplicationDescriptor Headers(params string[] headers) => Qs("h", headers); + + /// Return help information. + public CatSegmentReplicationDescriptor Help(bool? help = true) => Qs("help", help); + + /// Whether specified concrete, expanded or aliased indices should be ignored when throttled. + public CatSegmentReplicationDescriptor IgnoreThrottled(bool? ignorethrottled = true) => + Qs("ignore_throttled", ignorethrottled); + + /// Whether specified concrete indices should be ignored when unavailable (missing or closed). + public CatSegmentReplicationDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => + Qs("ignore_unavailable", ignoreunavailable); + + /// Comma-separated list of shards to display. + public CatSegmentReplicationDescriptor Shards(params string[] shards) => + Qs("shards", shards); + + /// Comma-separated list of column names or column aliases to sort by. + public CatSegmentReplicationDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + /// Operation timeout. + public CatSegmentReplicationDescriptor Timeout(Time timeout) => Qs("timeout", timeout); + + /// Verbose mode. Display column headers. + public CatSegmentReplicationDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } +} diff --git a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs index 8b86532b69..b016252386 100644 --- a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs @@ -48,6 +48,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Client; +using OpenSearch.Client.Specification.CatApi; using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.HttpApi; using OpenSearch.Client.Specification.IndicesApi; @@ -59,6 +60,9 @@ namespace OpenSearch.Client /// public partial interface IOpenSearchClient { + /// Cat APIs + CatNamespace Cat { get; } + /// Cluster APIs ClusterNamespace Cluster { get; } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs new file mode 100644 index 0000000000..d64d117cd9 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -0,0 +1,221 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Threading; +using System.Threading.Tasks; +using OpenSearch.Net.Specification.CatApi; + +// ReSharper disable once CheckNamespace +// ReSharper disable RedundantTypeArgumentsOfMethod +namespace OpenSearch.Client.Specification.CatApi +{ + /// + /// Cat APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public partial class CatNamespace : NamespacedClientProxy + { + internal CatNamespace(OpenSearchClient client) + : base(client) { } + + /// + /// GET request to the cat.all_pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CatResponse AllPitSegments( + Func selector = null + ) => AllPitSegments(selector.InvokeOrDefault(new CatAllPitSegmentsDescriptor())); + + /// + /// GET request to the cat.all_pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task> AllPitSegmentsAsync( + Func selector = null, + CancellationToken ct = default + ) => AllPitSegmentsAsync(selector.InvokeOrDefault(new CatAllPitSegmentsDescriptor()), ct); + + /// + /// GET request to the cat.all_pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CatResponse AllPitSegments( + ICatAllPitSegmentsRequest request + ) => + DoCat< + ICatAllPitSegmentsRequest, + CatAllPitSegmentsRequestParameters, + CatAllPitSegmentsRecord + >(request); + + /// + /// GET request to the cat.all_pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task> AllPitSegmentsAsync( + ICatAllPitSegmentsRequest request, + CancellationToken ct = default + ) => + DoCatAsync< + ICatAllPitSegmentsRequest, + CatAllPitSegmentsRequestParameters, + CatAllPitSegmentsRecord + >(request, ct); + + /// + /// GET request to the cat.pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CatResponse PitSegments( + Func selector = null + ) => PitSegments(selector.InvokeOrDefault(new CatPitSegmentsDescriptor())); + + /// + /// GET request to the cat.pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task> PitSegmentsAsync( + Func selector = null, + CancellationToken ct = default + ) => PitSegmentsAsync(selector.InvokeOrDefault(new CatPitSegmentsDescriptor()), ct); + + /// + /// GET request to the cat.pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CatResponse PitSegments(ICatPitSegmentsRequest request) => + DoCat( + request + ); + + /// + /// GET request to the cat.pit_segments API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task> PitSegmentsAsync( + ICatPitSegmentsRequest request, + CancellationToken ct = default + ) => + DoCatAsync< + ICatPitSegmentsRequest, + CatPitSegmentsRequestParameters, + CatPitSegmentsRecord + >(request, ct); + + /// + /// GET request to the cat.segment_replication API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + /// + /// Supported by OpenSearch servers of version 2.6.0 or greater. + public CatResponse SegmentReplication( + Func selector = null + ) => SegmentReplication(selector.InvokeOrDefault(new CatSegmentReplicationDescriptor())); + + /// + /// GET request to the cat.segment_replication API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + /// + /// Supported by OpenSearch servers of version 2.6.0 or greater. + public Task> SegmentReplicationAsync( + Func selector = null, + CancellationToken ct = default + ) => + SegmentReplicationAsync( + selector.InvokeOrDefault(new CatSegmentReplicationDescriptor()), + ct + ); + + /// + /// GET request to the cat.segment_replication API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + /// + /// Supported by OpenSearch servers of version 2.6.0 or greater. + public CatResponse SegmentReplication( + ICatSegmentReplicationRequest request + ) => + DoCat< + ICatSegmentReplicationRequest, + CatSegmentReplicationRequestParameters, + CatSegmentReplicationRecord + >(request); + + /// + /// GET request to the cat.segment_replication API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + /// + /// Supported by OpenSearch servers of version 2.6.0 or greater. + public Task> SegmentReplicationAsync( + ICatSegmentReplicationRequest request, + CancellationToken ct = default + ) => + DoCatAsync< + ICatSegmentReplicationRequest, + CatSegmentReplicationRequestParameters, + CatSegmentReplicationRecord + >(request, ct); + } +} diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs index 417512fe54..161088cc76 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs @@ -46,6 +46,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Client; +using OpenSearch.Client.Specification.CatApi; using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.HttpApi; using OpenSearch.Client.Specification.IndicesApi; @@ -58,6 +59,9 @@ namespace OpenSearch.Client /// public partial class OpenSearchClient : IOpenSearchClient { + /// Cat APIs + public CatNamespace Cat { get; private set; } + /// Cluster APIs public ClusterNamespace Cluster { get; private set; } @@ -69,6 +73,7 @@ public partial class OpenSearchClient : IOpenSearchClient partial void SetupGeneratedNamespaces() { + Cat = new CatNamespace(this); Cluster = new ClusterNamespace(this); Indices = new IndicesNamespace(this); Http = new HttpNamespace(this); diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs new file mode 100644 index 0000000000..cf1820ee94 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -0,0 +1,326 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Runtime.Serialization; +using System.Text; +using OpenSearch.Net; +using OpenSearch.Net.Specification.CatApi; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + [InterfaceDataContract] + public partial interface ICatAllPitSegmentsRequest + : IRequest { } + + /// Request for AllPitSegments https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + public partial class CatAllPitSegmentsRequest + : PlainRequestBase, + ICatAllPitSegmentsRequest + { + protected ICatAllPitSegmentsRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllPitSegments; + + // values part of the url path + + // Request parameters + /// The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } + + [InterfaceDataContract] + public partial interface ICatPitSegmentsRequest : IRequest { } + + /// Request for PitSegments https://opensearch.org/docs/latest/search-plugins/point-in-time-api/ + public partial class CatPitSegmentsRequest + : PlainRequestBase, + ICatPitSegmentsRequest + { + protected ICatPitSegmentsRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatPitSegments; + + // values part of the url path + + // Request parameters + /// The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } + + [InterfaceDataContract] + public partial interface ICatSegmentReplicationRequest + : IRequest + { + [IgnoreDataMember] + Indices Index { get; } + } + + /// Request for SegmentReplication https://opensearch.org/docs/latest/api-reference/cat/cat-segment-replication/ + public partial class CatSegmentReplicationRequest + : PlainRequestBase, + ICatSegmentReplicationRequest + { + protected ICatSegmentReplicationRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatSegmentReplication; + + /// /_cat/segment_replication + public CatSegmentReplicationRequest() + : base() { } + + /// /_cat/segment_replication/{index} + /// Optional, accepts null + public CatSegmentReplicationRequest(Indices index) + : base(r => r.Optional("index", index)) { } + + // values part of the url path + [IgnoreDataMember] + Indices ICatSegmentReplicationRequest.Index => Self.RouteValues.Get("index"); + + // Request parameters + /// If `true`, the response only includes ongoing segment replication events. + public bool? ActiveOnly + { + get => Q("active_only"); + set => Q("active_only", value); + } + + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have + /// been specified). + /// + public bool? AllowNoIndices + { + get => Q("allow_no_indices"); + set => Q("allow_no_indices", value); + } + + /// The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + /// If `true`, the response only includes latest completed segment replication events. + public bool? CompletedOnly + { + get => Q("completed_only"); + set => Q("completed_only", value); + } + + /// If `true`, the response includes detailed information about segment replications. + public bool? Detailed + { + get => Q("detailed"); + set => Q("detailed", value); + } + + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public ExpandWildcards? ExpandWildcards + { + get => Q("expand_wildcards"); + set => Q("expand_wildcards", value); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Whether specified concrete, expanded or aliased indices should be ignored when throttled. + public bool? IgnoreThrottled + { + get => Q("ignore_throttled"); + set => Q("ignore_throttled", value); + } + + /// Whether specified concrete indices should be ignored when unavailable (missing or closed). + public bool? IgnoreUnavailable + { + get => Q("ignore_unavailable"); + set => Q("ignore_unavailable", value); + } + + /// Comma-separated list of shards to display. + public string[] Shards + { + get => Q("shards"); + set => Q("shards", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Operation timeout. + public Time Timeout + { + get => Q