-
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.
Browse files
Browse the repository at this point in the history
This commit implements the dangling indices APIs that can be used to list, import and delete dangling indices. Co-authored-by: Russ Cam <[email protected]>
- Loading branch information
1 parent
af936de
commit 65ef88f
Showing
22 changed files
with
750 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
public class IndexUuid : IUrlParameter, IEquatable<IndexUuid> | ||
{ | ||
public string Value { get; } | ||
|
||
public IndexUuid(string value) => Value = value ?? throw new ArgumentNullException(nameof(value)); | ||
|
||
public string GetString(IConnectionConfigurationValues settings) => Value; | ||
|
||
public bool Equals(IndexUuid other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
|
||
return Value == other.Value; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != GetType()) return false; | ||
|
||
return Equals((IndexUuid)obj); | ||
} | ||
|
||
public override int GetHashCode() => (Value != null ? Value.GetHashCode() : 0); | ||
|
||
public static bool operator ==(IndexUuid left, IndexUuid right) => Equals(left, right); | ||
|
||
public static bool operator !=(IndexUuid left, IndexUuid right) => !Equals(left, right); | ||
|
||
public static implicit operator IndexUuid(string value) => string.IsNullOrEmpty(value) ? null : new IndexUuid(value); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/Nest/DanglingIndices/Delete/DeleteDanglingIndexRequest.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,22 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Nest | ||
{ | ||
[MapsApi("dangling_indices.delete_dangling_index.json")] | ||
public partial interface IDeleteDanglingIndexRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class DeleteDanglingIndexRequest : IDeleteDanglingIndexRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class DeleteDanglingIndexDescriptor : IDeleteDanglingIndexRequest | ||
{ | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Nest/DanglingIndices/Delete/DeleteDanglingIndexResponse.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,14 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System.Runtime.Serialization; | ||
|
||
namespace Nest | ||
{ | ||
[DataContract] | ||
public class DeleteDanglingIndexResponse : AcknowledgedResponseBase | ||
{ | ||
|
||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Nest/DanglingIndices/Import/ImportDanglingIndexRequest.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,22 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Nest | ||
{ | ||
[MapsApi("dangling_indices.import_dangling_index.json")] | ||
public partial interface IImportDanglingIndexRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class ImportDanglingIndexRequest : IImportDanglingIndexRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class ImportDanglingIndexDescriptor : IImportDanglingIndexRequest | ||
{ | ||
|
||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Nest/DanglingIndices/Import/ImportDanglingIndexResponse.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,13 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System.Runtime.Serialization; | ||
|
||
namespace Nest | ||
{ | ||
[DataContract] | ||
public class ImportDanglingIndexResponse : AcknowledgedResponseBase | ||
{ | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Nest/DanglingIndices/List/ListDanglingIndicesRequest.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,22 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Nest | ||
{ | ||
[MapsApi("dangling_indices.list_dangling_indices.json")] | ||
public partial interface IListDanglingIndicesRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class ListDanglingIndicesRequest : IListDanglingIndicesRequest | ||
{ | ||
|
||
} | ||
|
||
public partial class ListDanglingIndicesDescriptor : IListDanglingIndicesRequest | ||
{ | ||
|
||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/Nest/DanglingIndices/List/ListDanglingIndicesResponse.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,47 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
[DataContract] | ||
public class ListDanglingIndicesResponse : ResponseBase | ||
{ | ||
[DataMember(Name = "dangling_indices")] | ||
public IReadOnlyCollection<AggregatedDanglingIndexInfo> DanglingIndices { get; internal set; } = | ||
EmptyReadOnly<AggregatedDanglingIndexInfo>.Collection; | ||
} | ||
|
||
public class AggregatedDanglingIndexInfo | ||
{ | ||
private DateTimeOffset? _creationDate; | ||
|
||
[DataMember(Name = "index_name")] | ||
public string IndexName { get; internal set; } | ||
|
||
[DataMember(Name = "index_uuid")] | ||
public string IndexUUID { get; internal set; } | ||
|
||
[DataMember(Name = "creation_date_millis")] | ||
public long CreationDateInMilliseconds { get; internal set; } | ||
|
||
[DataMember(Name = "creation_date")] | ||
public DateTimeOffset CreationDate | ||
{ | ||
get | ||
{ | ||
_creationDate ??= DateTimeOffset.FromUnixTimeMilliseconds(CreationDateInMilliseconds); | ||
return _creationDate.Value; | ||
} | ||
internal set => _creationDate = value; | ||
} | ||
|
||
[DataMember(Name = "node_ids")] | ||
public IReadOnlyCollection<string> NodeIds { get; internal set; } | ||
} | ||
} |
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,94 @@ | ||
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ | ||
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ | ||
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ | ||
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ | ||
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ | ||
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ | ||
// ----------------------------------------------- | ||
// | ||
// 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; | ||
using Elasticsearch.Net; | ||
using Elasticsearch.Net.Utf8Json; | ||
using Elasticsearch.Net.Specification.DanglingIndicesApi; | ||
|
||
// ReSharper disable RedundantBaseConstructorCall | ||
// ReSharper disable UnusedTypeParameter | ||
// ReSharper disable PartialMethodWithSinglePart | ||
// ReSharper disable RedundantNameQualifier | ||
namespace Nest | ||
{ | ||
///<summary>Descriptor for DeleteDanglingIndex <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html</para></summary> | ||
public partial class DeleteDanglingIndexDescriptor : RequestDescriptorBase<DeleteDanglingIndexDescriptor, DeleteDanglingIndexRequestParameters, IDeleteDanglingIndexRequest>, IDeleteDanglingIndexRequest | ||
{ | ||
internal override ApiUrls ApiUrls => ApiUrlsLookups.DanglingIndicesDeleteDanglingIndex; | ||
///<summary>/_dangling/{index_uuid}</summary> | ||
///<param name = "indexUuid">this parameter is required</param> | ||
public DeleteDanglingIndexDescriptor(IndexUuid indexUuid): base(r => r.Required("index_uuid", indexUuid)) | ||
{ | ||
} | ||
|
||
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary> | ||
[SerializationConstructor] | ||
protected DeleteDanglingIndexDescriptor(): base() | ||
{ | ||
} | ||
|
||
// values part of the url path | ||
IndexUuid IDeleteDanglingIndexRequest.IndexUuid => Self.RouteValues.Get<IndexUuid>("index_uuid"); | ||
// Request parameters | ||
///<summary>Must be set to true in order to delete the dangling index</summary> | ||
public DeleteDanglingIndexDescriptor AcceptDataLoss(bool? acceptdataloss = true) => Qs("accept_data_loss", acceptdataloss); | ||
///<summary>Specify timeout for connection to master</summary> | ||
public DeleteDanglingIndexDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); | ||
///<summary>Explicit operation timeout</summary> | ||
public DeleteDanglingIndexDescriptor Timeout(Time timeout) => Qs("timeout", timeout); | ||
} | ||
|
||
///<summary>Descriptor for ImportDanglingIndex <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html</para></summary> | ||
public partial class ImportDanglingIndexDescriptor : RequestDescriptorBase<ImportDanglingIndexDescriptor, ImportDanglingIndexRequestParameters, IImportDanglingIndexRequest>, IImportDanglingIndexRequest | ||
{ | ||
internal override ApiUrls ApiUrls => ApiUrlsLookups.DanglingIndicesImportDanglingIndex; | ||
///<summary>/_dangling/{index_uuid}</summary> | ||
///<param name = "indexUuid">this parameter is required</param> | ||
public ImportDanglingIndexDescriptor(IndexUuid indexUuid): base(r => r.Required("index_uuid", indexUuid)) | ||
{ | ||
} | ||
|
||
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary> | ||
[SerializationConstructor] | ||
protected ImportDanglingIndexDescriptor(): base() | ||
{ | ||
} | ||
|
||
// values part of the url path | ||
IndexUuid IImportDanglingIndexRequest.IndexUuid => Self.RouteValues.Get<IndexUuid>("index_uuid"); | ||
// Request parameters | ||
///<summary>Must be set to true in order to import the dangling index</summary> | ||
public ImportDanglingIndexDescriptor AcceptDataLoss(bool? acceptdataloss = true) => Qs("accept_data_loss", acceptdataloss); | ||
///<summary>Specify timeout for connection to master</summary> | ||
public ImportDanglingIndexDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); | ||
///<summary>Explicit operation timeout</summary> | ||
public ImportDanglingIndexDescriptor Timeout(Time timeout) => Qs("timeout", timeout); | ||
} | ||
|
||
///<summary>Descriptor for List <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html</para></summary> | ||
public partial class ListDanglingIndicesDescriptor : RequestDescriptorBase<ListDanglingIndicesDescriptor, ListDanglingIndicesRequestParameters, IListDanglingIndicesRequest>, IListDanglingIndicesRequest | ||
{ | ||
internal override ApiUrls ApiUrls => ApiUrlsLookups.DanglingIndicesList; | ||
// values part of the url path | ||
// Request parameters | ||
} | ||
} |
Oops, something went wrong.