-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathAliasDescriptor.cs
50 lines (44 loc) · 1.38 KB
/
AliasDescriptor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Elasticsearch.Net;
using Newtonsoft.Json;
using System.Linq.Expressions;
using Nest.Resolvers;
using Nest.Domain;
namespace Nest
{
[DescriptorFor("IndicesUpdateAliases")]
public partial class AliasDescriptor : BasePathDescriptor<AliasDescriptor, AliasRequestParameters>
{
public AliasDescriptor()
{
this._Actions = new List<IAliasAction>();
}
[JsonProperty("actions")]
internal IList<IAliasAction> _Actions { get; set; }
public AliasDescriptor Add(Func<AliasAddDescriptor, AliasAddDescriptor> addSelector)
{
addSelector.ThrowIfNull("addSelector");
var descriptor = addSelector(new AliasAddDescriptor());
descriptor.ThrowIfNull("addAliasDescriptor");
this._Actions.Add(descriptor);
return this;
}
public AliasDescriptor Remove(Func<AliasRemoveDescriptor, AliasRemoveDescriptor> removeSelector)
{
removeSelector.ThrowIfNull("removeSelector");
var descriptor = removeSelector(new AliasRemoveDescriptor());
descriptor.ThrowIfNull("removeAliasDescriptor");
this._Actions.Add(descriptor);
return this;
}
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<AliasRequestParameters> pathInfo)
{
pathInfo.HttpMethod = PathInfoHttpMethod.POST;
}
}
}