Skip to content

Commit

Permalink
Re-add and deprecate replaced operations to avoid breaking changes
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Nov 29, 2023
1 parent f9cd97d commit c649794
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added support for the component template APIs ([#411](https://github.com/opensearch-project/opensearch-net/pull/411))
- Added support for the composable index template APIs ([#437](https://github.com/opensearch-project/opensearch-net/pull/437))

### Deprecated
- Deprecated the low-level `IndexTemplateV2` APIs in favour of the new `ComposableIndexTemplate` APIs ([#454](https://github.com/opensearch-project/opensearch-net/pull/454))

### Dependencies
- Bumps `FSharp.Data` from 6.2.0 to 6.3.0
- Bumps `BenchMarkDotNet` from 0.13.7 to 0.13.10
Expand Down
103 changes: 103 additions & 0 deletions src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ public bool? IncludeYesDecisions
}
}

///<summary>Request options for DeleteComponentTemplate <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
public partial class DeleteComponentTemplateRequestParameters : RequestParameters<DeleteComponentTemplateRequestParameters>
{
#pragma warning disable 618
///<summary>Specify timeout for connection to master node</summary>
///<seealso cref="MasterTimeout"/>
[Obsolete($"Replaced by {nameof(MasterTimeout)}")]
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Specify timeout for connection to cluster_manager node</summary>
///<seealso cref="ClusterManagerTimeout"/>
[Obsolete($"Replaced by {nameof(ClusterManagerTimeout)}")]
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}
#pragma warning restore 618
}

///<summary>Request options for DeleteVotingConfigExclusions <para></para></summary>
public class DeleteVotingConfigExclusionsRequestParameters : RequestParameters<DeleteVotingConfigExclusionsRequestParameters>
{
Expand All @@ -69,6 +93,61 @@ public bool? WaitForRemoval
}
}

///<summary>Request options for ExistsComponentTemplate <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
///<seealso cref="ComponentTemplateExistsRequestParameters"/>
[Obsolete($"Replaced by {nameof(ComponentTemplateExistsRequestParameters)}")]
public class ExistsComponentTemplateRequestParameters : RequestParameters<ExistsComponentTemplateRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD;
public override bool SupportsBody => false;
///<summary>Return local information, do not retrieve the state from cluster_manager node (default: false)</summary>
public bool? Local
{
get => Q<bool? >("local");
set => Q("local", value);
}

///<summary>Explicit operation timeout for connection to master node</summary>
///<remarks>Deprecated as of OpenSearch 2.0, use <see cref="ClusterManagerTimeSpanout"/> instead</remarks>
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Explicit operation timeout for connection to cluster_manager node</summary>
///<remarks>Introduced in OpenSearch 2.0 instead of <see cref="MasterTimeSpanout"/></remarks>
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}
}

///<summary>Request options for GetComponentTemplate <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
public partial class GetComponentTemplateRequestParameters : RequestParameters<GetComponentTemplateRequestParameters>
{
#pragma warning disable 618
///<summary>Specify timeout for connection to master node</summary>
///<seealso cref="MasterTimeout"/>
[Obsolete($"Replaced by {nameof(MasterTimeout)}")]
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Specify timeout for connection to cluster_manager node</summary>
///<seealso cref="ClusterManagerTimeout"/>
[Obsolete($"Replaced by {nameof(ClusterManagerTimeout)}")]
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}
#pragma warning restore 618
}

///<summary>Request options for GetSettings <para>https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/</para></summary>
public class ClusterGetSettingsRequestParameters : RequestParameters<ClusterGetSettingsRequestParameters>
{
Expand Down Expand Up @@ -266,6 +345,30 @@ public TimeSpan Timeout
}
}

///<summary>Request options for PutComponentTemplate <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
public partial class PutComponentTemplateRequestParameters : RequestParameters<PutComponentTemplateRequestParameters>
{
#pragma warning disable 618
///<summary>Specify timeout for connection to master node</summary>
///<seealso cref="MasterTimeout"/>
[Obsolete($"Replaced by {nameof(MasterTimeout)}")]
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Specify timeout for connection to cluster_manager node</summary>
///<seealso cref="ClusterManagerTimeout"/>
[Obsolete($"Replaced by {nameof(ClusterManagerTimeout)}")]
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}
#pragma warning restore 618
}

///<summary>Request options for PutSettings <para>https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/</para></summary>
public class ClusterPutSettingsRequestParameters : RequestParameters<ClusterPutSettingsRequestParameters>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,37 @@ public TimeSpan Timeout
}
}

///<summary>Request options for DeleteTemplateV2 <para>https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/</para></summary>
///<seealso cref="DeleteComposableIndexTemplateRequestParameters"/>
[Obsolete($"Replaced by {nameof(DeleteComposableIndexTemplateRequestParameters)}")]
public class DeleteIndexTemplateV2RequestParameters : RequestParameters<DeleteIndexTemplateV2RequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
public override bool SupportsBody => false;
///<summary>Specify timeout for connection to master node</summary>
///<remarks>Deprecated as of OpenSearch 2.0, use <see cref="ClusterManagerTimeSpanout"/> instead</remarks>
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Specify timeout for connection to cluster_manager node</summary>
///<remarks>Introduced in OpenSearch 2.0 instead of <see cref="MasterTimeSpanout"/></remarks>
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}

///<summary>Explicit operation timeout</summary>
public TimeSpan Timeout
{
get => Q<TimeSpan>("timeout");
set => Q("timeout", value);
}
}

///<summary>Request options for DeleteTemplate <para>https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/</para></summary>
public class DeleteIndexTemplateRequestParameters : RequestParameters<DeleteIndexTemplateRequestParameters>
{
Expand Down Expand Up @@ -504,6 +535,8 @@ public bool? Local
}

///<summary>Request options for ExistsTemplate <para>https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/</para></summary>
///<seealso cref="ComposableIndexTemplateExistsRequestParameters"/>
[Obsolete($"Replaced by {nameof(ComposableIndexTemplateExistsRequestParameters)}")]
public class ExistsIndexTemplateRequestParameters : RequestParameters<ExistsIndexTemplateRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD;
Expand Down Expand Up @@ -906,6 +939,8 @@ public bool? Local
}

///<summary>Request options for GetTemplateV2 <para>https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/</para></summary>
///<seealso cref="GetComposableIndexTemplateRequestParameters"/>
[Obsolete($"Replaced by {nameof(GetComposableIndexTemplateRequestParameters)}")]
public class GetIndexTemplateV2RequestParameters : RequestParameters<GetIndexTemplateV2RequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
Expand Down Expand Up @@ -1195,6 +1230,44 @@ public TimeSpan Timeout
}
}

///<summary>Request options for PutTemplateV2 <para>https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/</para></summary>
///<seealso cref="PutComposableIndexTemplateRequestParameters"/>
[Obsolete($"Replaced by {nameof(PutComposableIndexTemplateRequestParameters)}")]
public class PutIndexTemplateV2RequestParameters : RequestParameters<PutIndexTemplateV2RequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
public override bool SupportsBody => true;
///<summary>User defined reason for creating/updating the index template</summary>
public string Cause
{
get => Q<string>("cause");
set => Q("cause", value);
}

///<summary>Whether the index template should only be added if new or can also replace an existing one</summary>
public bool? Create
{
get => Q<bool? >("create");
set => Q("create", value);
}

///<summary>Specify timeout for connection to master node</summary>
///<remarks>Deprecated as of OpenSearch 2.0, use <see cref="ClusterManagerTimeSpanout"/> instead</remarks>
public TimeSpan MasterTimeSpanout
{
get => Q<TimeSpan>("master_timeout");
set => Q("master_timeout", value);
}

///<summary>Specify timeout for connection to cluster_manager node</summary>
///<remarks>Introduced in OpenSearch 2.0 instead of <see cref="MasterTimeSpanout"/></remarks>
public TimeSpan ClusterManagerTimeSpanout
{
get => Q<TimeSpan>("cluster_manager_timeout");
set => Q("cluster_manager_timeout", value);
}
}

///<summary>Request options for PutMapping <para>https://opensearch.org/docs/latest/opensearch/rest-api/update-mapping/</para></summary>
public class PutMappingRequestParameters : RequestParameters<PutMappingRequestParameters>
{
Expand Down
15 changes: 15 additions & 0 deletions src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ public TResponse DeleteVotingConfigExclusions<TResponse>(DeleteVotingConfigExclu
[MapsApi("cluster.delete_voting_config_exclusions", "")]
public Task<TResponse> DeleteVotingConfigExclusionsAsync<TResponse>(DeleteVotingConfigExclusionsRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync<TResponse>(DELETE, "_cluster/voting_config_exclusions", ctx, null, RequestParams(requestParameters));
///<summary>HEAD on /_component_template/{name} <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
///<param name = "name">The name of the template</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
///<seealso cref="ComponentTemplateExists{TResponse}"/>
[Obsolete($"Replaced by {nameof(ComponentTemplateExists)}")]
public TResponse ExistsComponentTemplate<TResponse>(string name, ExistsComponentTemplateRequestParameters requestParameters = null)
where TResponse : class, IOpenSearchResponse, new() => DoRequest<TResponse>(HEAD, Url($"_component_template/{name:name}"), null, RequestParams(requestParameters));
///<summary>HEAD on /_component_template/{name} <para>https://opensearch.org/docs/latest/opensearch/index-templates/</para></summary>
///<param name = "name">The name of the template</param>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
///<seealso cref="ComponentTemplateExistsAsync{TResponse}"/>
[MapsApi("cluster.exists_component_template", "name")]
[Obsolete($"Replaced by {nameof(ComponentTemplateExistsAsync)}")]
public Task<TResponse> ExistsComponentTemplateAsync<TResponse>(string name, ExistsComponentTemplateRequestParameters requestParameters = null, CancellationToken ctx = default)
where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync<TResponse>(HEAD, Url($"_component_template/{name:name}"), ctx, null, RequestParams(requestParameters));
///<summary>GET on /_cluster/settings <para>https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/</para></summary>
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
public TResponse GetSettings<TResponse>(ClusterGetSettingsRequestParameters requestParameters = null)
Expand Down
Loading

0 comments on commit c649794

Please sign in to comment.