Skip to content
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
3 changes: 0 additions & 3 deletions src/ApiGenerator/Configuration/CodeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public static class CodeConfiguration

public static string[] IgnoredApisHighLevel { get; } =
{
"dangling_indices.list_dangling_indices.json", // TODO: implement
"dangling_indices.import_dangling_index.json", // TODO: implement
"dangling_indices.delete_dangling_index.json", // TODO: implement
"indices.add_block.json", // TODO: implement
"indices.resolve_index.json", // TODO: implement
"security.clear_cached_privileges.json", // TODO: implement
Expand Down
2 changes: 2 additions & 0 deletions src/ApiGenerator/Domain/Specification/UrlPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public string HighLevelTypeName
case "type":
return Type == "string" ? "Name" : "Names";

case "index_uuid":
return "IndexUuid";

//This forces a compilation error post code generation as intended
default: return Type + "_";
Expand Down
43 changes: 43 additions & 0 deletions src/Nest/CommonAbstractions/Infer/IndexUuid/IndexUuid.cs
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);
}
}
4 changes: 2 additions & 2 deletions src/Nest/CommonAbstractions/Request/RouteValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ private RouteValues Route(string name, IUrlParameter routeValue, bool required =
}

internal RouteValues Required(string route, IUrlParameter value) => Route(route, value);

internal RouteValues Optional(string route, IUrlParameter value) => Route(route, value, false);

internal RouteValues Optional(string route, Metrics value) => Route(route, value, false);

internal RouteValues Optional(string route, IndexMetrics value) => Route(route, value, false);

internal TActual Get<TActual>(string route)
internal TActual Get<TActual>(string route)
{
if (TryGetValue(route, out var actual) && actual != null)
return (TActual)actual;
Expand Down
22 changes: 22 additions & 0 deletions src/Nest/DanglingIndices/Delete/DeleteDanglingIndexRequest.cs
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 src/Nest/DanglingIndices/Delete/DeleteDanglingIndexResponse.cs
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 src/Nest/DanglingIndices/Import/ImportDanglingIndexRequest.cs
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 src/Nest/DanglingIndices/Import/ImportDanglingIndexResponse.cs
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 src/Nest/DanglingIndices/List/ListDanglingIndicesRequest.cs
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 src/Nest/DanglingIndices/List/ListDanglingIndicesResponse.cs
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; }
}
}
94 changes: 94 additions & 0 deletions src/Nest/Descriptors.DanglingIndices.cs
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
}
}
Loading