Skip to content

Commit

Permalink
Re-generate against latest OpenAPI specification (opensearch-project#713
Browse files Browse the repository at this point in the history
)

* Re-generate against latest OpenAPI specification

Signed-off-by: Thomas Farr <[email protected]>

* Update tests

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
(cherry picked from commit 275203b)
  • Loading branch information
Xtansia committed Aug 14, 2024
1 parent b8c5bf6 commit 11c6aa8
Show file tree
Hide file tree
Showing 16 changed files with 19,222 additions and 12,046 deletions.
513 changes: 278 additions & 235 deletions src/ApiGenerator/Generator/ApiEndpointFactory.cs

Large diffs are not rendered by default.

30,626 changes: 18,880 additions & 11,746 deletions src/ApiGenerator/opensearch-openapi.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public GetComponentTemplateDescriptor MasterTimeout(Time mastertimeout) =>
Qs("master_timeout", mastertimeout);
}

/// <summary>Descriptor for PutComponentTemplate</summary>
/// <summary>Descriptor for PutComponentTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</para></summary>
public partial class PutComponentTemplateDescriptor
: RequestDescriptorBase<
PutComponentTemplateDescriptor,
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch.Client/_Generated/Descriptors.Indices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public GetComposableIndexTemplateDescriptor MasterTimeout(Time mastertimeout) =>
Qs("master_timeout", mastertimeout);
}

/// <summary>Descriptor for PutComposableTemplate</summary>
/// <summary>Descriptor for PutComposableTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/</para></summary>
public partial class PutComposableIndexTemplateDescriptor
: RequestDescriptorBase<
PutComposableIndexTemplateDescriptor,
Expand Down
8 changes: 4 additions & 4 deletions src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public Task<GetComponentTemplateResponse> GetComponentTemplateAsync(
/// <summary>
/// <c>PUT</c> request to the <c>cluster.put_component_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template">https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</a>
/// </summary>
public PutComponentTemplateResponse PutComponentTemplate(
Name name,
Expand All @@ -246,7 +246,7 @@ Func<PutComponentTemplateDescriptor, IPutComponentTemplateRequest> selector
/// <summary>
/// <c>PUT</c> request to the <c>cluster.put_component_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template">https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</a>
/// </summary>
public Task<PutComponentTemplateResponse> PutComponentTemplateAsync(
Name name,
Expand All @@ -261,7 +261,7 @@ public Task<PutComponentTemplateResponse> PutComponentTemplateAsync(
/// <summary>
/// <c>PUT</c> request to the <c>cluster.put_component_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template">https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</a>
/// </summary>
public PutComponentTemplateResponse PutComponentTemplate(
IPutComponentTemplateRequest request
Expand All @@ -274,7 +274,7 @@ IPutComponentTemplateRequest request
/// <summary>
/// <c>PUT</c> request to the <c>cluster.put_component_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template">https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</a>
/// </summary>
public Task<PutComponentTemplateResponse> PutComponentTemplateAsync(
IPutComponentTemplateRequest request,
Expand Down
8 changes: 4 additions & 4 deletions src/OpenSearch.Client/_Generated/OpenSearchClient.Indices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public Task<GetComposableIndexTemplateResponse> GetComposableTemplateAsync(
/// <summary>
/// <c>PUT</c> request to the <c>indices.put_index_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/">https://opensearch.org/docs/latest/im-plugin/index-templates/</a>
/// </summary>
public PutComposableIndexTemplateResponse PutComposableTemplate(
Name name,
Expand All @@ -267,7 +267,7 @@ Func<PutComposableIndexTemplateDescriptor, IPutComposableIndexTemplateRequest> s
/// <summary>
/// <c>PUT</c> request to the <c>indices.put_index_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/">https://opensearch.org/docs/latest/im-plugin/index-templates/</a>
/// </summary>
public Task<PutComposableIndexTemplateResponse> PutComposableTemplateAsync(
Name name,
Expand All @@ -282,7 +282,7 @@ public Task<PutComposableIndexTemplateResponse> PutComposableTemplateAsync(
/// <summary>
/// <c>PUT</c> request to the <c>indices.put_index_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/">https://opensearch.org/docs/latest/im-plugin/index-templates/</a>
/// </summary>
public PutComposableIndexTemplateResponse PutComposableTemplate(
IPutComposableIndexTemplateRequest request
Expand All @@ -295,7 +295,7 @@ IPutComposableIndexTemplateRequest request
/// <summary>
/// <c>PUT</c> request to the <c>indices.put_index_template</c> API, read more about this API online:
/// <para></para>
/// <a></a>
/// <a href="https://opensearch.org/docs/latest/im-plugin/index-templates/">https://opensearch.org/docs/latest/im-plugin/index-templates/</a>
/// </summary>
public Task<PutComposableIndexTemplateResponse> PutComposableTemplateAsync(
IPutComposableIndexTemplateRequest request,
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch.Client/_Generated/Requests.Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public partial interface IPutComponentTemplateRequest
Name Name { get; }
}

/// <summary>Request for PutComponentTemplate</summary>
/// <summary>Request for PutComponentTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</para></summary>
public partial class PutComponentTemplateRequest
: PlainRequestBase<PutComponentTemplateRequestParameters>,
IPutComponentTemplateRequest
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch.Client/_Generated/Requests.Indices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public partial interface IPutComposableIndexTemplateRequest
Name Name { get; }
}

/// <summary>Request for PutComposableTemplate</summary>
/// <summary>Request for PutComposableTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/</para></summary>
public partial class PutComposableIndexTemplateRequest
: PlainRequestBase<PutComposableIndexTemplateRequestParameters>,
IPutComposableIndexTemplateRequest
Expand Down
78 changes: 39 additions & 39 deletions src/OpenSearch.Net/_Generated/Api/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public enum Bytes
[EnumMember(Value = "b")]
B,

[EnumMember(Value = "g")]
G,

[EnumMember(Value = "gb")]
Gb,

[EnumMember(Value = "k")]
K,

Expand All @@ -70,23 +76,17 @@ public enum Bytes
[EnumMember(Value = "mb")]
Mb,

[EnumMember(Value = "g")]
G,
[EnumMember(Value = "p")]
P,

[EnumMember(Value = "gb")]
Gb,
[EnumMember(Value = "pb")]
Pb,

[EnumMember(Value = "t")]
T,

[EnumMember(Value = "tb")]
Tb,

[EnumMember(Value = "p")]
P,

[EnumMember(Value = "pb")]
Pb
Tb
}

[Flags, StringEnum]
Expand All @@ -95,42 +95,42 @@ public enum ExpandWildcards
[EnumMember(Value = "all")]
All = 1 << 0,

[EnumMember(Value = "open")]
Open = 1 << 1,

[EnumMember(Value = "closed")]
Closed = 1 << 2,
Closed = 1 << 1,

[EnumMember(Value = "hidden")]
Hidden = 1 << 3,
Hidden = 1 << 2,

[EnumMember(Value = "none")]
None = 1 << 4
None = 1 << 3,

[EnumMember(Value = "open")]
Open = 1 << 4
}

[StringEnum]
public enum TimeUnit
{
[EnumMember(Value = "nanos")]
Nanos,
[EnumMember(Value = "d")]
D,

[EnumMember(Value = "h")]
H,

[EnumMember(Value = "m")]
M,

[EnumMember(Value = "micros")]
Micros,

[EnumMember(Value = "ms")]
Ms,

[EnumMember(Value = "s")]
S,

[EnumMember(Value = "m")]
M,

[EnumMember(Value = "h")]
H,
[EnumMember(Value = "nanos")]
Nanos,

[EnumMember(Value = "d")]
D
[EnumMember(Value = "s")]
S
}

public static partial class KnownEnums
Expand All @@ -146,16 +146,16 @@ public static string GetStringValue(this Bytes enumValue) =>
enumValue switch
{
Bytes.B => "b",
Bytes.G => "g",
Bytes.Gb => "gb",
Bytes.K => "k",
Bytes.Kb => "kb",
Bytes.M => "m",
Bytes.Mb => "mb",
Bytes.G => "g",
Bytes.Gb => "gb",
Bytes.T => "t",
Bytes.Tb => "tb",
Bytes.P => "p",
Bytes.Pb => "pb",
Bytes.T => "t",
Bytes.Tb => "tb",
_
=> throw new ArgumentException(
$"'{enumValue.ToString()}' is not a valid value for enum 'Bytes'"
Expand All @@ -167,27 +167,27 @@ public static string GetStringValue(this ExpandWildcards enumValue)
var list = new List<string>();
if ((enumValue & ExpandWildcards.All) != 0)
list.Add("all");
if ((enumValue & ExpandWildcards.Open) != 0)
list.Add("open");
if ((enumValue & ExpandWildcards.Closed) != 0)
list.Add("closed");
if ((enumValue & ExpandWildcards.Hidden) != 0)
list.Add("hidden");
if ((enumValue & ExpandWildcards.None) != 0)
list.Add("none");
if ((enumValue & ExpandWildcards.Open) != 0)
list.Add("open");
return string.Join(",", list);
}

public static string GetStringValue(this TimeUnit enumValue) =>
enumValue switch
{
TimeUnit.Nanos => "nanos",
TimeUnit.D => "d",
TimeUnit.H => "h",
TimeUnit.M => "m",
TimeUnit.Micros => "micros",
TimeUnit.Ms => "ms",
TimeUnit.Nanos => "nanos",
TimeUnit.S => "s",
TimeUnit.M => "m",
TimeUnit.H => "h",
TimeUnit.D => "d",
_
=> throw new ArgumentException(
$"'{enumValue.ToString()}' is not a valid value for enum 'TimeUnit'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public TimeSpan MasterTimeout
}
}

/// <summary>Request options for PutComponentTemplate</summary>
/// <summary>Request options for PutComponentTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</para></summary>
public partial class PutComponentTemplateRequestParameters
: RequestParameters<PutComponentTemplateRequestParameters>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public TimeSpan MasterTimeout
}
}

/// <summary>Request options for PutComposableTemplate</summary>
/// <summary>Request options for PutComposableTemplate <para>https://opensearch.org/docs/latest/im-plugin/index-templates/</para></summary>
public partial class PutComposableIndexTemplateRequestParameters
: RequestParameters<PutComposableIndexTemplateRequestParameters>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ public Task<TResponse> GetComponentTemplateAsync<TResponse>(
RequestParams(requestParameters)
);

/// <summary>PUT on /_component_template/{name}</summary>
/// <param name="name">Name of the component template to create. Opensearch includes the following built-in component templates: `logs-mappings`; &#x27;logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. Opensearch Agent uses these templates to configure backing indices for its data streams. If you use Opensearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don&#x2019;t use Opensearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API.</param>
/// <summary>PUT on /_component_template/{name} <para>https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</para></summary>
/// <param name="name">Name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`; &#x27;logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. OpenSearch Agent uses these templates to configure backing indices for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don&#x27;t use OpenSearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API.</param>
/// <param name="body">The template definition.</param>
/// <param name="requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse PutComponentTemplate<TResponse>(
Expand All @@ -214,8 +214,8 @@ public TResponse PutComponentTemplate<TResponse>(
RequestParams(requestParameters)
);

/// <summary>PUT on /_component_template/{name}</summary>
/// <param name="name">Name of the component template to create. Opensearch includes the following built-in component templates: `logs-mappings`; &#x27;logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. Opensearch Agent uses these templates to configure backing indices for its data streams. If you use Opensearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don&#x2019;t use Opensearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API.</param>
/// <summary>PUT on /_component_template/{name} <para>https://opensearch.org/docs/latest/im-plugin/index-templates/#use-component-templates-to-create-an-index-template</para></summary>
/// <param name="name">Name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`; &#x27;logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. OpenSearch Agent uses these templates to configure backing indices for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. If you don&#x27;t use OpenSearch Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API.</param>
/// <param name="body">The template definition.</param>
/// <param name="requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
[MapsApi("cluster.put_component_template", "name, body")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public Task<TResponse> GetComposableTemplateForAllAsync<TResponse>(
RequestParams(requestParameters)
);

/// <summary>PUT on /_index_template/{name}</summary>
/// <summary>PUT on /_index_template/{name} <para>https://opensearch.org/docs/latest/im-plugin/index-templates/</para></summary>
/// <param name="name">Index or template name.</param>
/// <param name="body">The template definition.</param>
/// <param name="requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
Expand All @@ -209,7 +209,7 @@ public TResponse PutComposableTemplateForAll<TResponse>(
RequestParams(requestParameters)
);

/// <summary>PUT on /_index_template/{name}</summary>
/// <summary>PUT on /_index_template/{name} <para>https://opensearch.org/docs/latest/im-plugin/index-templates/</para></summary>
/// <param name="name">Index or template name.</param>
/// <param name="body">The template definition.</param>
/// <param name="requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
Expand Down
3 changes: 1 addition & 2 deletions tests/Tests/Cluster/ClusterState/ClusterStateUrlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ await GET("/_cluster/state")
.Request(c => c.Cluster.State(new ClusterStateRequest()))
.FluentAsync(c => c.Cluster.StateAsync())
.RequestAsync(c => c.Cluster.StateAsync(new ClusterStateRequest()))

;

var metrics = ClusterStateMetric.ClusterManagerNode | ClusterStateMetric.Metadata;
await GET("/_cluster/state/metadata%2Ccluster_manager_node")
await GET("/_cluster/state/cluster_manager_node%2Cmetadata")
.Fluent(c => c.Cluster.State(null, p => p.Metric(metrics)))
.Request(c => c.Cluster.State(new ClusterStateRequest(metrics)))
.FluentAsync(c => c.Cluster.StateAsync(null, p => p.Metric(metrics)))
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests/Cluster/NodesInfo/NodesInfoUrlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ await GET("/_nodes/foo")
;

var metrics = NodesInfoMetric.Http | NodesInfoMetric.Jvm;
await GET("/_nodes/jvm%2Chttp")
await GET("/_nodes/http%2Cjvm")
.Fluent(c => c.Nodes.Info(p => p.Metric(metrics)))
.Request(c => c.Nodes.Info(new NodesInfoRequest(metrics)))
.FluentAsync(c => c.Nodes.InfoAsync(p => p.Metric(metrics)))
.RequestAsync(c => c.Nodes.InfoAsync(new NodesInfoRequest(metrics)))
;

await GET("/_nodes/foo/jvm%2Chttp")
await GET("/_nodes/foo/http%2Cjvm")
.Fluent(c => c.Nodes.Info(n => n.NodeId("foo").Metric(metrics)))
.Request(c => c.Nodes.Info(new NodesInfoRequest("foo", metrics)))
.FluentAsync(c => c.Nodes.InfoAsync(n => n.NodeId("foo").Metric(metrics)))
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests/Cluster/NodesStats/NodesStatsUrlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ await GET("/_nodes/foo/stats/fs%2Cjvm")
;

var indexMetrics = NodesStatsIndexMetric.Fielddata | NodesStatsIndexMetric.Merge;
await GET("/_nodes/stats/fs%2Cjvm/merge%2Cfielddata")
await GET("/_nodes/stats/fs%2Cjvm/fielddata%2Cmerge")
.Fluent(c => c.Nodes.Stats(p => p.Metric(metrics).IndexMetric(indexMetrics)))
.Request(c => c.Nodes.Stats(new NodesStatsRequest(metrics, indexMetrics)))
.FluentAsync(c => c.Nodes.StatsAsync(p => p.Metric(metrics).IndexMetric(indexMetrics)))
.RequestAsync(c => c.Nodes.StatsAsync(new NodesStatsRequest(metrics, indexMetrics)))
;

await GET("/_nodes/foo/stats/fs%2Cjvm/merge%2Cfielddata")
await GET("/_nodes/foo/stats/fs%2Cjvm/fielddata%2Cmerge")
.Fluent(c => c.Nodes.Stats(p => p.NodeId("foo").Metric(metrics).IndexMetric(indexMetrics)))
.Request(c => c.Nodes.Stats(new NodesStatsRequest("foo", metrics, indexMetrics)))
.FluentAsync(c => c.Nodes.StatsAsync(p => p.NodeId("foo").Metric(metrics).IndexMetric(indexMetrics)))
Expand Down

0 comments on commit 11c6aa8

Please sign in to comment.