diff --git a/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs b/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs index d21b6511aaa..124f9df9deb 100644 --- a/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs @@ -43,8 +43,7 @@ public static class CodeConfiguration "ml.set_upgrade_mode.json", "ml.find_file_structure.json", "monitoring.bulk.json", - "snapshot.cleanup_repository.json", - "ml.estimate_memory_usage.json", + "ml.estimate_memory_usage.json" }; diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs index 8efbec03ee1..b1ede547910 100644 --- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs +++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs @@ -1,12 +1,12 @@ // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ // ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ // ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ // ----------------------------------------------- -// -// This file is automatically generated +// +// This file is automatically generated // Please do not edit these files manually // Run the following in the root of the repos: // @@ -24,18 +24,37 @@ // ReSharper disable once CheckNamespace namespace Elasticsearch.Net.Specification.SnapshotApi { - ///Request options for Snapshot https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for CleanupRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + public class CleanupRepositoryRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + ///Explicit operation timeout for connection to master node + public TimeSpan MasterTimeout + { + get => Q("master_timeout"); + set => Q("master_timeout", value); + } + + ///Explicit operation timeout + public TimeSpan Timeout + { + get => Q("timeout"); + set => Q("timeout", value); + } + } + + ///Request options for Snapshot https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class SnapshotRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Should this request wait until the operation has completed before returning + ///Should this request wait until the operation has completed before returning public bool? WaitForCompletion { get => Q("wait_for_completion"); @@ -43,25 +62,25 @@ public bool? WaitForCompletion } } - ///Request options for CreateRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for CreateRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class CreateRepositoryRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Explicit operation timeout + ///Explicit operation timeout public TimeSpan Timeout { get => Q("timeout"); set => Q("timeout", value); } - ///Whether to verify the repository after creation + ///Whether to verify the repository after creation public bool? Verify { get => Q("verify"); @@ -69,11 +88,11 @@ public bool? Verify } } - ///Request options for Delete https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for Delete https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class DeleteSnapshotRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); @@ -81,18 +100,18 @@ public TimeSpan MasterTimeout } } - ///Request options for DeleteRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for DeleteRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class DeleteRepositoryRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Explicit operation timeout + ///Explicit operation timeout public TimeSpan Timeout { get => Q("timeout"); @@ -100,25 +119,25 @@ public TimeSpan Timeout } } - ///Request options for Get https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for Get https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class GetSnapshotRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Whether to show verbose snapshot info or only show the basic info found in the repository index blob + ///Whether to show verbose snapshot info or only show the basic info found in the repository index blob public bool? Verbose { get => Q("verbose"); @@ -126,18 +145,18 @@ public bool? Verbose } } - ///Request options for GetRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for GetRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class GetRepositoryRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - ///Return local information, do not retrieve the state from master node (default: false) + ///Return local information, do not retrieve the state from master node (default: false) public bool? Local { get => Q("local"); set => Q("local", value); } - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); @@ -145,18 +164,18 @@ public TimeSpan MasterTimeout } } - ///Request options for Restore https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for Restore https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class RestoreRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.POST; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Should this request wait until the operation has completed before returning + ///Should this request wait until the operation has completed before returning public bool? WaitForCompletion { get => Q("wait_for_completion"); @@ -164,18 +183,18 @@ public bool? WaitForCompletion } } - ///Request options for Status https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for Status https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class SnapshotStatusRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); @@ -183,22 +202,22 @@ public TimeSpan MasterTimeout } } - ///Request options for VerifyRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Request options for VerifyRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public class VerifyRepositoryRequestParameters : RequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.POST; - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public TimeSpan MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - ///Explicit operation timeout + ///Explicit operation timeout public TimeSpan Timeout { get => Q("timeout"); set => Q("timeout", value); } } -} \ No newline at end of file +} diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs index 86287a8ab89..b6e5a0924df 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs @@ -43,6 +43,18 @@ internal LowLevelSnapshotNamespace(ElasticLowLevelClient client): base(client) { } + ///POST on /_snapshot/{repository}/_cleanup https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///A repository name + /// + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse CleanupRepository(string repository, PostData body, CleanupRepositoryRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => DoRequest(POST, Url($"_snapshot/{repository:repository}/_cleanup"), body, RequestParams(requestParameters)); + ///POST on /_snapshot/{repository}/_cleanup https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///A repository name + /// + ///Request specific configuration such as querystring parameters & request specific connection settings. + public Task CleanupRepositoryAsync(string repository, PostData body, CleanupRepositoryRequestParameters requestParameters = null, CancellationToken ctx = default) + where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync(POST, Url($"_snapshot/{repository:repository}/_cleanup"), ctx, body, RequestParams(requestParameters)); ///PUT on /_snapshot/{repository}/{snapshot} https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html ///A repository name ///A snapshot name diff --git a/src/Nest/Descriptors.Snapshot.cs b/src/Nest/Descriptors.Snapshot.cs index 0c6717c0b64..65e0592e3a3 100644 --- a/src/Nest/Descriptors.Snapshot.cs +++ b/src/Nest/Descriptors.Snapshot.cs @@ -1,12 +1,12 @@ // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ // ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ // ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ // ----------------------------------------------- -// -// This file is automatically generated +// +// This file is automatically generated // Please do not edit these files manually // Run the following in the root of the repos: // @@ -30,18 +30,43 @@ // ReSharper disable RedundantNameQualifier namespace Nest { - ///Descriptor for Snapshot https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for CleanupRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + public partial class CleanupRepositoryDescriptor : RequestDescriptorBase, ICleanupRepositoryRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotCleanupRepository; + ////_snapshot/{repository}/_cleanup + ///this parameter is required + public CleanupRepositoryDescriptor(Name repository): base(r => r.Required("repository", repository)) + { + } + + ///Used for serialization purposes, making sure we have a parameterless constructor + [SerializationConstructor] + protected CleanupRepositoryDescriptor(): base() + { + } + + // values part of the url path + Name ICleanupRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); + // Request parameters + ///Explicit operation timeout for connection to master node + public CleanupRepositoryDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); + ///Explicit operation timeout + public CleanupRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout); + } + + ///Descriptor for Snapshot https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class SnapshotDescriptor : RequestDescriptorBase, ISnapshotRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotSnapshot; - ////_snapshot/{repository}/{snapshot} - ///this parameter is required - ///this parameter is required + ////_snapshot/{repository}/{snapshot} + ///this parameter is required + ///this parameter is required public SnapshotDescriptor(Name repository, Name snapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected SnapshotDescriptor(): base() { @@ -51,23 +76,23 @@ protected SnapshotDescriptor(): base() Name ISnapshotRequest.RepositoryName => Self.RouteValues.Get("repository"); Name ISnapshotRequest.Snapshot => Self.RouteValues.Get("snapshot"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public SnapshotDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Should this request wait until the operation has completed before returning + ///Should this request wait until the operation has completed before returning public SnapshotDescriptor WaitForCompletion(bool? waitforcompletion = true) => Qs("wait_for_completion", waitforcompletion); } - ///Descriptor for CreateRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for CreateRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class CreateRepositoryDescriptor : RequestDescriptorBase, ICreateRepositoryRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotCreateRepository; - ////_snapshot/{repository} - ///this parameter is required + ////_snapshot/{repository} + ///this parameter is required public CreateRepositoryDescriptor(Name repository): base(r => r.Required("repository", repository)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected CreateRepositoryDescriptor(): base() { @@ -76,26 +101,26 @@ protected CreateRepositoryDescriptor(): base() // values part of the url path Name ICreateRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public CreateRepositoryDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout + ///Explicit operation timeout public CreateRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - ///Whether to verify the repository after creation + ///Whether to verify the repository after creation public CreateRepositoryDescriptor Verify(bool? verify = true) => Qs("verify", verify); } - ///Descriptor for Delete https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for Delete https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class DeleteSnapshotDescriptor : RequestDescriptorBase, IDeleteSnapshotRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotDelete; - ////_snapshot/{repository}/{snapshot} - ///this parameter is required - ///this parameter is required + ////_snapshot/{repository}/{snapshot} + ///this parameter is required + ///this parameter is required public DeleteSnapshotDescriptor(Name repository, Name snapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected DeleteSnapshotDescriptor(): base() { @@ -105,21 +130,21 @@ protected DeleteSnapshotDescriptor(): base() Name IDeleteSnapshotRequest.RepositoryName => Self.RouteValues.Get("repository"); Name IDeleteSnapshotRequest.Snapshot => Self.RouteValues.Get("snapshot"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public DeleteSnapshotDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); } - ///Descriptor for DeleteRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for DeleteRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class DeleteRepositoryDescriptor : RequestDescriptorBase, IDeleteRepositoryRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotDeleteRepository; - ////_snapshot/{repository} - ///this parameter is required + ////_snapshot/{repository} + ///this parameter is required public DeleteRepositoryDescriptor(Names repository): base(r => r.Required("repository", repository)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected DeleteRepositoryDescriptor(): base() { @@ -128,24 +153,24 @@ protected DeleteRepositoryDescriptor(): base() // values part of the url path Names IDeleteRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public DeleteRepositoryDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout + ///Explicit operation timeout public DeleteRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout); } - ///Descriptor for Get https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for Get https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class GetSnapshotDescriptor : RequestDescriptorBase, IGetSnapshotRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotGet; - ////_snapshot/{repository}/{snapshot} - ///this parameter is required - ///this parameter is required + ////_snapshot/{repository}/{snapshot} + ///this parameter is required + ///this parameter is required public GetSnapshotDescriptor(Name repository, Names snapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected GetSnapshotDescriptor(): base() { @@ -155,52 +180,52 @@ protected GetSnapshotDescriptor(): base() Name IGetSnapshotRequest.RepositoryName => Self.RouteValues.Get("repository"); Names IGetSnapshotRequest.Snapshot => Self.RouteValues.Get("snapshot"); // Request parameters - ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown public GetSnapshotDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable); - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public GetSnapshotDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Whether to show verbose snapshot info or only show the basic info found in the repository index blob + ///Whether to show verbose snapshot info or only show the basic info found in the repository index blob public GetSnapshotDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); } - ///Descriptor for GetRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for GetRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class GetRepositoryDescriptor : RequestDescriptorBase, IGetRepositoryRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotGetRepository; - ////_snapshot + ////_snapshot public GetRepositoryDescriptor(): base() { } - ////_snapshot/{repository} - ///Optional, accepts null + ////_snapshot/{repository} + ///Optional, accepts null public GetRepositoryDescriptor(Names repository): base(r => r.Optional("repository", repository)) { } // values part of the url path Names IGetRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); - ///A comma-separated list of repository names + ///A comma-separated list of repository names public GetRepositoryDescriptor RepositoryName(Names repository) => Assign(repository, (a, v) => a.RouteValues.Optional("repository", v)); // Request parameters - ///Return local information, do not retrieve the state from master node (default: false) + ///Return local information, do not retrieve the state from master node (default: false) public GetRepositoryDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public GetRepositoryDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); } - ///Descriptor for Restore https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for Restore https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class RestoreDescriptor : RequestDescriptorBase, IRestoreRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotRestore; - ////_snapshot/{repository}/{snapshot}/_restore - ///this parameter is required - ///this parameter is required + ////_snapshot/{repository}/{snapshot}/_restore + ///this parameter is required + ///this parameter is required public RestoreDescriptor(Name repository, Name snapshot): base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected RestoreDescriptor(): base() { @@ -210,30 +235,30 @@ protected RestoreDescriptor(): base() Name IRestoreRequest.RepositoryName => Self.RouteValues.Get("repository"); Name IRestoreRequest.Snapshot => Self.RouteValues.Get("snapshot"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public RestoreDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Should this request wait until the operation has completed before returning + ///Should this request wait until the operation has completed before returning public RestoreDescriptor WaitForCompletion(bool? waitforcompletion = true) => Qs("wait_for_completion", waitforcompletion); } - ///Descriptor for Status https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for Status https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class SnapshotStatusDescriptor : RequestDescriptorBase, ISnapshotStatusRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotStatus; - ////_snapshot/_status + ////_snapshot/_status public SnapshotStatusDescriptor(): base() { } - ////_snapshot/{repository}/_status - ///Optional, accepts null + ////_snapshot/{repository}/_status + ///Optional, accepts null public SnapshotStatusDescriptor(Name repository): base(r => r.Optional("repository", repository)) { } - ////_snapshot/{repository}/{snapshot}/_status - ///Optional, accepts null - ///Optional, accepts null + ////_snapshot/{repository}/{snapshot}/_status + ///Optional, accepts null + ///Optional, accepts null public SnapshotStatusDescriptor(Name repository, Names snapshot): base(r => r.Optional("repository", repository).Optional("snapshot", snapshot)) { } @@ -241,28 +266,28 @@ public SnapshotStatusDescriptor(Name repository, Names snapshot): base(r => r.Op // values part of the url path Name ISnapshotStatusRequest.RepositoryName => Self.RouteValues.Get("repository"); Names ISnapshotStatusRequest.Snapshot => Self.RouteValues.Get("snapshot"); - ///A repository name + ///A repository name public SnapshotStatusDescriptor RepositoryName(Name repository) => Assign(repository, (a, v) => a.RouteValues.Optional("repository", v)); - ///A comma-separated list of snapshot names + ///A comma-separated list of snapshot names public SnapshotStatusDescriptor Snapshot(Names snapshot) => Assign(snapshot, (a, v) => a.RouteValues.Optional("snapshot", v)); // Request parameters - ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown public SnapshotStatusDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable); - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public SnapshotStatusDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); } - ///Descriptor for VerifyRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + ///Descriptor for VerifyRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html public partial class VerifyRepositoryDescriptor : RequestDescriptorBase, IVerifyRepositoryRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotVerifyRepository; - ////_snapshot/{repository}/_verify - ///this parameter is required + ////_snapshot/{repository}/_verify + ///this parameter is required public VerifyRepositoryDescriptor(Name repository): base(r => r.Required("repository", repository)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor + ///Used for serialization purposes, making sure we have a parameterless constructor [SerializationConstructor] protected VerifyRepositoryDescriptor(): base() { @@ -271,9 +296,9 @@ protected VerifyRepositoryDescriptor(): base() // values part of the url path Name IVerifyRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); // Request parameters - ///Explicit operation timeout for connection to master node + ///Explicit operation timeout for connection to master node public VerifyRepositoryDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout + ///Explicit operation timeout public VerifyRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout); } -} \ No newline at end of file +} diff --git a/src/Nest/ElasticClient.Snapshot.cs b/src/Nest/ElasticClient.Snapshot.cs index 8a89eda18ba..e919ea2fc30 100644 --- a/src/Nest/ElasticClient.Snapshot.cs +++ b/src/Nest/ElasticClient.Snapshot.cs @@ -36,6 +36,30 @@ internal SnapshotNamespace(ElasticClient client): base(client) { } + /// + /// POST request to the snapshot.cleanup_repository API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + /// + public CleanupRepositoryResponse CleanupRepository(Name repository, Func selector = null) => CleanupRepository(selector.InvokeOrDefault(new CleanupRepositoryDescriptor(repository: repository))); + /// + /// POST request to the snapshot.cleanup_repository API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + /// + public Task CleanupRepositoryAsync(Name repository, Func selector = null, CancellationToken ct = default) => CleanupRepositoryAsync(selector.InvokeOrDefault(new CleanupRepositoryDescriptor(repository: repository)), ct); + /// + /// POST request to the snapshot.cleanup_repository API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + /// + public CleanupRepositoryResponse CleanupRepository(ICleanupRepositoryRequest request) => DoRequest(request, request.RequestParameters); + /// + /// POST request to the snapshot.cleanup_repository API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + /// + public Task CleanupRepositoryAsync(ICleanupRepositoryRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// PUT request to the snapshot.create API, read more about this API online: /// diff --git a/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryRequest.cs b/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryRequest.cs new file mode 100644 index 00000000000..2749285a2dc --- /dev/null +++ b/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + [MapsApi("snapshot.cleanup_repository.json")] + public partial interface ICleanupRepositoryRequest { } + + public partial class CleanupRepositoryRequest { } + + public partial class CleanupRepositoryDescriptor { } +} diff --git a/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryResponse.cs b/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryResponse.cs new file mode 100644 index 00000000000..4a67cda2b02 --- /dev/null +++ b/src/Nest/Modules/SnapshotAndRestore/Repositories/CleanupRepository/CleanupRepositoryResponse.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; + +namespace Nest +{ + [DataContract] + public class CleanupRepositoryResponse : ResponseBase + { + [DataMember(Name ="results")] + public CleanupRepositoryResults Results { get; internal set; } + } + + public class CleanupRepositoryResults + { + [DataMember(Name ="deleted_bytes")] + public long DeletedBytes { get; internal set; } + + [DataMember(Name ="deleted_blobs")] + public long DeletedBlobs { get; internal set; } + } +} diff --git a/src/Nest/Requests.Snapshot.cs b/src/Nest/Requests.Snapshot.cs index 6af18c343b8..3b1e6ad8985 100644 --- a/src/Nest/Requests.Snapshot.cs +++ b/src/Nest/Requests.Snapshot.cs @@ -1,12 +1,12 @@ // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ // ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ // ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ // ----------------------------------------------- -// -// This file is automatically generated +// +// This file is automatically generated // Please do not edit these files manually // Run the following in the root of the repos: // @@ -31,6 +31,52 @@ // ReSharper disable RedundantNameQualifier namespace Nest { + [InterfaceDataContract] + public partial interface ICleanupRepositoryRequest : IRequest + { + [IgnoreDataMember] + Name RepositoryName + { + get; + } + } + + ///Request for CleanupRepository https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html + public partial class CleanupRepositoryRequest : PlainRequestBase, ICleanupRepositoryRequest + { + protected ICleanupRepositoryRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.SnapshotCleanupRepository; + ////_snapshot/{repository}/_cleanup + ///this parameter is required + public CleanupRepositoryRequest(Name repository): base(r => r.Required("repository", repository)) + { + } + + ///Used for serialization purposes, making sure we have a parameterless constructor + [SerializationConstructor] + protected CleanupRepositoryRequest(): base() + { + } + + // values part of the url path + [IgnoreDataMember] + Name ICleanupRepositoryRequest.RepositoryName => Self.RouteValues.Get("repository"); + // Request parameters + ///Explicit operation timeout for connection to master node + public Time MasterTimeout + { + get => Q