-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Snapshot Lifecycle Management APIs (#4126)
This commit implements the Snapshot Lifecycle APIs in both the high level and low level clients. Unit tests for URLs, integration tests for the SLM API flow. The slm.get_lifecycle JSON spec is patched so that policy_id is a list and the Ids type is used to model multiple ids.
- Loading branch information
Showing
32 changed files
with
1,239 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/CodeGeneration/ApiGenerator/RestSpecification/_Patches/slm.get_lifecycle.patch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"slm.get_lifecycle":{ | ||
"url":{ | ||
"parts":{ | ||
"policy_id":{ | ||
"type":"list", | ||
"description":"Comma-separated list of snapshot lifecycle policies to retrieve" | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Slm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ | ||
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ | ||
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ | ||
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ | ||
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ | ||
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ | ||
// ----------------------------------------------- | ||
// | ||
// 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.Text; | ||
using System.Linq.Expressions; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Elasticsearch.Net.Specification.SlmApi | ||
{ | ||
///<summary>Request options for DeleteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary> | ||
public class DeleteSnapshotLifecycleRequestParameters : RequestParameters<DeleteSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; | ||
} | ||
|
||
///<summary>Request options for ExecuteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary> | ||
public class ExecuteSnapshotLifecycleRequestParameters : RequestParameters<ExecuteSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; | ||
} | ||
|
||
///<summary>Request options for GetSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
public class GetSnapshotLifecycleRequestParameters : RequestParameters<GetSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.GET; | ||
} | ||
|
||
///<summary>Request options for PutSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary> | ||
public class PutSnapshotLifecycleRequestParameters : RequestParameters<PutSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.SnapshotLifecycleManagement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ | ||
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ | ||
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ | ||
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ | ||
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ | ||
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ | ||
// ----------------------------------------------- | ||
// | ||
// 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.Text; | ||
using System.Linq.Expressions; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi | ||
{ | ||
///<summary>Request options for DeleteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary> | ||
public class DeleteSnapshotLifecycleRequestParameters : RequestParameters<DeleteSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; | ||
} | ||
|
||
///<summary>Request options for ExecuteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary> | ||
public class ExecuteSnapshotLifecycleRequestParameters : RequestParameters<ExecuteSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; | ||
} | ||
|
||
///<summary>Request options for GetSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
public class GetSnapshotLifecycleRequestParameters : RequestParameters<GetSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.GET; | ||
} | ||
|
||
///<summary>Request options for PutSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary> | ||
public class PutSnapshotLifecycleRequestParameters : RequestParameters<PutSnapshotLifecycleRequestParameters> | ||
{ | ||
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/Elasticsearch.Net/ElasticLowLevelClient.SnapshotLifecycleManagement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ | ||
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ | ||
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ | ||
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ | ||
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ | ||
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ | ||
// ----------------------------------------------- | ||
// | ||
// 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.Collections.Specialized; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Elasticsearch.Net; | ||
using static Elasticsearch.Net.HttpMethod; | ||
|
||
// ReSharper disable InterpolatedStringExpressionIsNotIFormattable | ||
// ReSharper disable once CheckNamespace | ||
// ReSharper disable InterpolatedStringExpressionIsNotIFormattable | ||
// ReSharper disable RedundantExtendsListEntry | ||
namespace Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi | ||
{ | ||
///<summary> | ||
/// Snapshot Lifecycle Management APIs. | ||
/// <para>Not intended to be instantiated directly. Use the <see cref = "IElasticLowLevelClient.SnapshotLifecycleManagement"/> property | ||
/// on <see cref = "IElasticLowLevelClient"/>. | ||
///</para> | ||
///</summary> | ||
public class LowLevelSnapshotLifecycleManagementNamespace : NamespacedClientProxy | ||
{ | ||
internal LowLevelSnapshotLifecycleManagementNamespace(ElasticLowLevelClient client): base(client) | ||
{ | ||
} | ||
|
||
///<summary>DELETE on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy to remove</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public TResponse DeleteSnapshotLifecycle<TResponse>(string policyId, DeleteSnapshotLifecycleRequestParameters requestParameters = null) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(DELETE, Url($"_slm/policy/{policyId:policyId}"), null, RequestParams(requestParameters)); | ||
///<summary>DELETE on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy to remove</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public Task<TResponse> DeleteSnapshotLifecycleAsync<TResponse>(string policyId, DeleteSnapshotLifecycleRequestParameters requestParameters = null, CancellationToken ctx = default) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(DELETE, Url($"_slm/policy/{policyId:policyId}"), ctx, null, RequestParams(requestParameters)); | ||
///<summary>PUT on /_slm/policy/{policy_id}/_execute <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy to be executed</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public TResponse ExecuteSnapshotLifecycle<TResponse>(string policyId, ExecuteSnapshotLifecycleRequestParameters requestParameters = null) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(PUT, Url($"_slm/policy/{policyId:policyId}/_execute"), null, RequestParams(requestParameters)); | ||
///<summary>PUT on /_slm/policy/{policy_id}/_execute <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy to be executed</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public Task<TResponse> ExecuteSnapshotLifecycleAsync<TResponse>(string policyId, ExecuteSnapshotLifecycleRequestParameters requestParameters = null, CancellationToken ctx = default) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(PUT, Url($"_slm/policy/{policyId:policyId}/_execute"), ctx, null, RequestParams(requestParameters)); | ||
///<summary>GET on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
///<param name = "policyId">Comma-separated list of snapshot lifecycle policies to retrieve</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public TResponse GetSnapshotLifecycle<TResponse>(string policyId, GetSnapshotLifecycleRequestParameters requestParameters = null) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, Url($"_slm/policy/{policyId:policyId}"), null, RequestParams(requestParameters)); | ||
///<summary>GET on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
///<param name = "policyId">Comma-separated list of snapshot lifecycle policies to retrieve</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public Task<TResponse> GetSnapshotLifecycleAsync<TResponse>(string policyId, GetSnapshotLifecycleRequestParameters requestParameters = null, CancellationToken ctx = default) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, Url($"_slm/policy/{policyId:policyId}"), ctx, null, RequestParams(requestParameters)); | ||
///<summary>GET on /_slm/policy <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public TResponse GetSnapshotLifecycle<TResponse>(GetSnapshotLifecycleRequestParameters requestParameters = null) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(GET, "_slm/policy", null, RequestParams(requestParameters)); | ||
///<summary>GET on /_slm/policy <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public Task<TResponse> GetSnapshotLifecycleAsync<TResponse>(GetSnapshotLifecycleRequestParameters requestParameters = null, CancellationToken ctx = default) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, "_slm/policy", ctx, null, RequestParams(requestParameters)); | ||
///<summary>PUT on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy</param> | ||
///<param name = "body">The snapshot lifecycle policy definition to register</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public TResponse PutSnapshotLifecycle<TResponse>(string policyId, PostData body, PutSnapshotLifecycleRequestParameters requestParameters = null) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(PUT, Url($"_slm/policy/{policyId:policyId}"), body, RequestParams(requestParameters)); | ||
///<summary>PUT on /_slm/policy/{policy_id} <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary> | ||
///<param name = "policyId">The id of the snapshot lifecycle policy</param> | ||
///<param name = "body">The snapshot lifecycle policy definition to register</param> | ||
///<param name = "requestParameters">Request specific configuration such as querystring parameters & request specific connection settings.</param> | ||
public Task<TResponse> PutSnapshotLifecycleAsync<TResponse>(string policyId, PostData body, PutSnapshotLifecycleRequestParameters requestParameters = null, CancellationToken ctx = default) | ||
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(PUT, Url($"_slm/policy/{policyId:policyId}"), ctx, body, RequestParams(requestParameters)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.