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

Implement Snapshot Lifecycle Management APIs #4126

Merged
merged 3 commits into from
Oct 14, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public static class CodeConfiguration
"monitoring.bulk.json",
"snapshot.cleanup_repository.json",
"ml.estimate_memory_usage.json",

"slm.delete_lifecycle.json",
"slm.execute_lifecycle.json",
"slm.get_lifecycle.json",
"slm.put_lifecycle.json",
};


Expand Down
1 change: 1 addition & 0 deletions src/CodeGeneration/ApiGenerator/Domain/Code/CsharpNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private static string CreateCSharpNamespace(string endpointNamespace)
case "ccr": return "CrossClusterReplication";
case "ml": return "MachineLearning";
case "xpack": return "XPack";
case "slm": return "SnapshotLifecycleManagement";
default: return endpointNamespace.ToPascalCase();
}
}
Expand Down
32 changes: 17 additions & 15 deletions src/CodeGeneration/ApiGenerator/Domain/Specification/UrlPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,39 @@ public string HighLevelTypeName
case "timestamp": return "Timestamp";
case "index_metric": return "IndexMetrics";
case "metric": return "Metrics";
case "node_id" when Type == "list":

case "node_id" when Type == "list":
return "NodeIds";
case "fields" when Type == "list":

case "fields" when Type == "list":
return "Fields";

case "parent_task_id":
case "task_id":
case "task_id":
return "TaskId";

case "forecast_id":
case "action_id":
return "Ids";

case "index":
case "new_index":
case "target":
case "target":
return Type == "string" ? "IndexName" : "Indices";

case "watch_id":
case "job_id":
case "calendar_id":
case "event_id":
case "datafeed_id":
case "snapshot_id":
case "filter_id":
case "policy_id":
case "id":
case "id":
return "Id";


case "policy_id":
return Type == "string" ? "Id" : "Ids";

case "application":
case "repository":
case "snapshot":
Expand All @@ -96,8 +98,8 @@ public string HighLevelTypeName
case "thread_pool_patterns":
case "type":
return Type == "string" ? "Name" : "Names";


//This forces a compilation error post code generation as intended
default: return Type + "_";
}
Expand Down
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"
}
}
}
}
}
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;
}
}
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;
}
}
8 changes: 8 additions & 0 deletions src/Elasticsearch.Net/ElasticLowLevelClient.NoNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using Elasticsearch.Net.Specification.RollupApi;
using Elasticsearch.Net.Specification.SecurityApi;
using Elasticsearch.Net.Specification.SnapshotApi;
using Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi;
using Elasticsearch.Net.Specification.SqlApi;
using Elasticsearch.Net.Specification.TasksApi;
using Elasticsearch.Net.Specification.WatcherApi;
Expand Down Expand Up @@ -136,6 +137,12 @@ public LowLevelSnapshotNamespace Snapshot
private set;
}

public LowLevelSnapshotLifecycleManagementNamespace SnapshotLifecycleManagement
{
get;
private set;
}

public LowLevelSqlNamespace Sql
{
get;
Expand Down Expand Up @@ -176,6 +183,7 @@ partial void SetupNamespaces()
Rollup = new LowLevelRollupNamespace(this);
Security = new LowLevelSecurityNamespace(this);
Snapshot = new LowLevelSnapshotNamespace(this);
SnapshotLifecycleManagement = new LowLevelSnapshotLifecycleManagementNamespace(this);
Sql = new LowLevelSqlNamespace(this);
Tasks = new LowLevelTasksNamespace(this);
Watcher = new LowLevelWatcherNamespace(this);
Expand Down
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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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 &amp; 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));
}
}
7 changes: 7 additions & 0 deletions src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using Elasticsearch.Net.Specification.RollupApi;
using Elasticsearch.Net.Specification.SecurityApi;
using Elasticsearch.Net.Specification.SnapshotApi;
using Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi;
using Elasticsearch.Net.Specification.SqlApi;
using Elasticsearch.Net.Specification.TasksApi;
using Elasticsearch.Net.Specification.WatcherApi;
Expand Down Expand Up @@ -1069,6 +1070,12 @@ LowLevelSnapshotNamespace Snapshot
get;
}

///<summary>Snapshot Lifecycle Management APIs</summary>
LowLevelSnapshotLifecycleManagementNamespace SnapshotLifecycleManagement
{
get;
}

///<summary>Sql APIs</summary>
LowLevelSqlNamespace Sql
{
Expand Down
Loading