Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-generated client code using latest OpenSearch API specification #728

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- The `MasterTimeSpanout` & `ClusterManagerTimeSpanout` parameters on all actions have been corrected to `MasterTimeout` and `ClusterManagerTimeout` respectively.
- The `MasterTimeout` parameters on all actions have been marked `[Obsolete]`, please migrate to using `ClusterManagerTimeout` if your OpenSearch cluster is at least version `2.0.0` as `MasterTimeout` may be removed in future major versions.
- The `ExpandWildcards` enum is now attributed with `[Flags]` to allow combining of multiple values e.g. `ExpandWildcards.Open | ExpandWildcards.Closed` to match open and closed indexes but not hidden.
- The `Bytes` enum has been renamed to `ByteUnit`.

#### Cat.Help Action
- The `Help` and `SortByColumns` parameters have been removed as they are unsupported by OpenSearch.
Expand Down Expand Up @@ -108,6 +109,7 @@
- The `MasterTimeout` parameters on all actions have been marked `[Obsolete]`, please migrate to using `ClusterManagerTimeout` if your OpenSearch cluster is at least version `2.0.0` as `MasterTimeout` may be removed in future major versions.
- The `ExpandWildcards` enum is now attributed with `[Flags]` to allow combining of multiple values e.g. `ExpandWildcards.Open | ExpandWildcards.Closed` to match open and closed indexes but not hidden.
- The namespaced APIs exposed in `IOpenSearchClient` have each gained a corresponding interface and the types of the properties on `IOpenSearchClient` and `OpenSearchClient` have been changed from the concrete implementations to the matching interfaces. For example, `IOpenSearchClient.Cluster` was `ClusterNamespace` and now is `IClusterNamespace`.
- The `Bytes` enum has been renamed to `ByteUnit`.

#### Cat.Help Action
- The `Help` and `SortByColumns` parameters have been removed as they are unsupported by OpenSearch.
Expand Down
4,264 changes: 3,509 additions & 755 deletions src/ApiGenerator/opensearch-openapi.yaml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/OpenSearch.Client/_Generated/Descriptors.Cat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public partial class CatAllPitSegmentsDescriptor
// values part of the url path
// Request parameters
/// <summary>The unit in which to display byte values.</summary>
public CatAllPitSegmentsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatAllPitSegmentsDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>A short version of the Accept header, e.g. json, yaml.</summary>
public CatAllPitSegmentsDescriptor Format(string format) => Qs("format", format);
Expand Down Expand Up @@ -171,7 +171,7 @@ public CatAllocationDescriptor NodeId(NodeIds nodeId) =>

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatAllocationDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatAllocationDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>Operation timeout for connection to cluster-manager node.</summary>
/// <remarks>Supported by OpenSearch servers of version 2.0.0 or greater.</remarks>
Expand Down Expand Up @@ -332,7 +332,7 @@ public CatFielddataDescriptor Fields<T>(params Expression<Func<T, object>>[] fie

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatFielddataDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatFielddataDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>A short version of the Accept header, e.g. json, yaml.</summary>
public CatFielddataDescriptor Format(string format) => Qs("format", format);
Expand Down Expand Up @@ -428,7 +428,7 @@ public CatIndicesDescriptor Index<TOther>()

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatIndicesDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatIndicesDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>Operation timeout for connection to cluster-manager node.</summary>
/// <remarks>Supported by OpenSearch servers of version 2.0.0 or greater.</remarks>
Expand Down Expand Up @@ -572,7 +572,7 @@ public partial class CatNodesDescriptor
// values part of the url path
// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatNodesDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatNodesDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>Operation timeout for connection to cluster-manager node.</summary>
/// <remarks>Supported by OpenSearch servers of version 2.0.0 or greater.</remarks>
Expand Down Expand Up @@ -671,7 +671,7 @@ public partial class CatPitSegmentsDescriptor
// values part of the url path
// Request parameters
/// <summary>The unit in which to display byte values.</summary>
public CatPitSegmentsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatPitSegmentsDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>A short version of the Accept header, e.g. json, yaml.</summary>
public CatPitSegmentsDescriptor Format(string format) => Qs("format", format);
Expand Down Expand Up @@ -776,7 +776,7 @@ public CatRecoveryDescriptor ActiveOnly(bool? activeonly = true) =>
Qs("active_only", activeonly);

/// <summary>The unit used to display byte values.</summary>
public CatRecoveryDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatRecoveryDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>If `true`, the response includes detailed information about shard recoveries.</summary>
public CatRecoveryDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed);
Expand Down Expand Up @@ -888,7 +888,7 @@ public CatSegmentReplicationDescriptor AllowNoIndices(bool? allownoindices = tru
Qs("allow_no_indices", allownoindices);

/// <summary>The unit in which to display byte values.</summary>
public CatSegmentReplicationDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatSegmentReplicationDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>If `true`, the response only includes latest completed segment replication events.</summary>
public CatSegmentReplicationDescriptor CompletedOnly(bool? completedonly = true) =>
Expand Down Expand Up @@ -971,7 +971,7 @@ public CatSegmentsDescriptor Index<TOther>()

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatSegmentsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatSegmentsDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>Operation timeout for connection to cluster-manager node.</summary>
/// <remarks>Supported by OpenSearch servers of version 2.0.0 or greater.</remarks>
Expand Down Expand Up @@ -1035,7 +1035,7 @@ public CatShardsDescriptor Index<TOther>()

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public CatShardsDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes);
public CatShardsDescriptor Bytes(ByteUnit? bytes) => Qs("bytes", bytes);

/// <summary>Operation timeout for connection to cluster-manager node.</summary>
/// <remarks>Supported by OpenSearch servers of version 2.0.0 or greater.</remarks>
Expand Down
40 changes: 20 additions & 20 deletions src/OpenSearch.Client/_Generated/Requests.Cat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public partial class CatAllPitSegmentsRequest

// Request parameters
/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -233,9 +233,9 @@ public CatAllocationRequest(NodeIds nodeId)

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -483,9 +483,9 @@ public CatFielddataRequest(Fields fields)

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -635,9 +635,9 @@ public CatIndicesRequest(Indices index)

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -908,9 +908,9 @@ public partial class CatNodesRequest

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1084,9 +1084,9 @@ public partial class CatPitSegmentsRequest

// Request parameters
/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1246,9 +1246,9 @@ public bool? ActiveOnly
}

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1427,9 +1427,9 @@ public bool? AllowNoIndices
}

/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1552,9 +1552,9 @@ public CatSegmentsRequest(Indices index)

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1646,9 +1646,9 @@ public CatShardsRequest(Indices index)

// Request parameters
/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down
30 changes: 15 additions & 15 deletions src/OpenSearch.Net/_Generated/Api/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
namespace OpenSearch.Net
{
[StringEnum]
public enum Bytes
public enum ByteUnit
{
[EnumMember(Value = "b")]
B,
Expand Down Expand Up @@ -467,7 +467,7 @@ public static partial class KnownEnums
{
static partial void RegisterEnumStringResolvers()
{
AddEnumStringResolver<Bytes>(GetStringValue);
AddEnumStringResolver<ByteUnit>(GetStringValue);
AddEnumStringResolver<ClusterHealthLevel>(GetStringValue);
AddEnumStringResolver<ClusterStateMetric>(GetStringValue);
AddEnumStringResolver<ExpandWildcards>(GetStringValue);
Expand All @@ -484,22 +484,22 @@ static partial void RegisterEnumStringResolvers()
AddEnumStringResolver<WaitForEvents>(GetStringValue);
}

public static string GetStringValue(this Bytes enumValue) =>
public static string GetStringValue(this ByteUnit 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.P => "p",
Bytes.Pb => "pb",
Bytes.T => "t",
Bytes.Tb => "tb",
ByteUnit.B => "b",
ByteUnit.G => "g",
ByteUnit.Gb => "gb",
ByteUnit.K => "k",
ByteUnit.Kb => "kb",
ByteUnit.M => "m",
ByteUnit.Mb => "mb",
ByteUnit.P => "p",
ByteUnit.Pb => "pb",
ByteUnit.T => "t",
ByteUnit.Tb => "tb",
_ => throw new ArgumentException(
$"'{enumValue.ToString()}' is not a valid value for enum 'Bytes'"
$"'{enumValue.ToString()}' is not a valid value for enum 'ByteUnit'"
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public partial class CatAllPitSegmentsRequestParameters
public override bool SupportsBody => false;

/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -175,9 +175,9 @@ public partial class CatAllocationRequestParameters
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -372,9 +372,9 @@ public partial class CatFielddataRequestParameters
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -493,9 +493,9 @@ public partial class CatIndicesRequestParameters
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -742,9 +742,9 @@ public partial class CatNodesRequestParameters : RequestParameters<CatNodesReque
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -903,9 +903,9 @@ public partial class CatPitSegmentsRequestParameters
public override bool SupportsBody => true;

/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1036,9 +1036,9 @@ public bool? ActiveOnly
}

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1193,9 +1193,9 @@ public bool? AllowNoIndices
}

/// <summary>The unit in which to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1303,9 +1303,9 @@ public partial class CatSegmentsRequestParameters
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down Expand Up @@ -1374,9 +1374,9 @@ public partial class CatShardsRequestParameters : RequestParameters<CatShardsReq
public override bool SupportsBody => false;

/// <summary>The unit used to display byte values.</summary>
public Bytes? Bytes
public ByteUnit? Bytes
{
get => Q<Bytes?>("bytes");
get => Q<ByteUnit?>("bytes");
set => Q("bytes", value);
}

Expand Down
Loading
Loading