|
| 1 | +// Licensed to Elasticsearch B.V under one or more agreements. |
| 2 | +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. |
| 3 | +// See the LICENSE file in the project root for more information |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.Runtime.Serialization; |
| 7 | + |
| 8 | +namespace Nest |
| 9 | +{ |
| 10 | + [MapsApi("security.grant_api_key.json")] |
| 11 | + [ReadAs(typeof(GrantApiKeyRequest))] |
| 12 | + public partial interface IGrantApiKeyRequest |
| 13 | + { |
| 14 | + /// <summary> |
| 15 | + /// The user’s access token. If you specify the access_token grant type, |
| 16 | + /// this parameter is required. It is not valid with other grant types. |
| 17 | + /// </summary> |
| 18 | + [DataMember(Name = "access_token")] |
| 19 | + string AccessToken { get; set; } |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// The type of grant. Supported grant types are: access_token,password. |
| 23 | + /// </summary> |
| 24 | + [DataMember(Name = "grant_type")] |
| 25 | + GrantType? GrantType { get; set; } |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// The user’s password. If you specify the password grant type, |
| 29 | + /// this parameter is required. It is not valid with other grant types. |
| 30 | + /// </summary> |
| 31 | + [DataMember(Name = "password")] |
| 32 | + string Password { get; set; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// The user name that identifies the user. If you specify the password grant type, |
| 36 | + /// this parameter is required. It is not valid with other grant types. |
| 37 | + /// </summary> |
| 38 | + [DataMember(Name = "username")] |
| 39 | + string Username { get; set; } |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Defines the API key. |
| 43 | + /// </summary> |
| 44 | + [DataMember(Name = "api_key")] |
| 45 | + IApiKey ApiKey { get; set; } |
| 46 | + } |
| 47 | + |
| 48 | + public partial class GrantApiKeyRequest |
| 49 | + { |
| 50 | + /// <inheritdoc cref="IGrantApiKeyRequest.AccessToken" /> |
| 51 | + public string AccessToken { get; set; } |
| 52 | + |
| 53 | + /// <inheritdoc cref="IGrantApiKeyRequest.GrantType" /> |
| 54 | + public GrantType? GrantType { get; set; } |
| 55 | + |
| 56 | + /// <inheritdoc cref="IGrantApiKeyRequest.Password" /> |
| 57 | + public string Password { get; set; } |
| 58 | + |
| 59 | + /// <inheritdoc cref="IGrantApiKeyRequest.Username" /> |
| 60 | + public string Username { get; set; } |
| 61 | + |
| 62 | + /// <inheritdoc cref="IGrantApiKeyRequest.ApiKey" /> |
| 63 | + public IApiKey ApiKey { get; set; } |
| 64 | + } |
| 65 | + |
| 66 | + public partial class GrantApiKeyDescriptor |
| 67 | + { |
| 68 | + /// <inheritdoc cref="IGrantApiKeyRequest.AccessToken" /> |
| 69 | + string IGrantApiKeyRequest.AccessToken { get; set; } |
| 70 | + |
| 71 | + /// <inheritdoc cref="IGrantApiKeyRequest.GrantType" /> |
| 72 | + GrantType? IGrantApiKeyRequest.GrantType { get; set; } = Nest.GrantType.AccessToken; |
| 73 | + |
| 74 | + /// <inheritdoc cref="IGrantApiKeyRequest.Password" /> |
| 75 | + string IGrantApiKeyRequest.Password { get; set; } |
| 76 | + |
| 77 | + /// <inheritdoc cref="IGrantApiKeyRequest.Username" /> |
| 78 | + string IGrantApiKeyRequest.Username { get; set; } |
| 79 | + |
| 80 | + /// <inheritdoc cref="IGrantApiKeyRequest.ApiKey" /> |
| 81 | + IApiKey IGrantApiKeyRequest.ApiKey { get; set; } |
| 82 | + |
| 83 | + /// <inheritdoc cref="IGrantApiKeyRequest.AccessToken" /> |
| 84 | + public GrantApiKeyDescriptor AccessToken(string accessToken) => Assign(accessToken, (a, v) => a.AccessToken = v); |
| 85 | + |
| 86 | + /// <inheritdoc cref="IGrantApiKeyRequest.GrantType" /> |
| 87 | + public GrantApiKeyDescriptor GrantType(GrantType? type) => Assign(type, (a, v) => a.GrantType = v); |
| 88 | + |
| 89 | + /// <inheritdoc cref="IGrantApiKeyRequest.Password" /> |
| 90 | + public GrantApiKeyDescriptor Password(string password) => Assign(password, (a, v) => a.Password = v); |
| 91 | + |
| 92 | + /// <inheritdoc cref="IGrantApiKeyRequest.Username" /> |
| 93 | + public GrantApiKeyDescriptor Username(string username) => Assign(username, (a, v) => a.Username = v); |
| 94 | + |
| 95 | + /// <inheritdoc cref="IGrantApiKeyRequest.ApiKey" /> |
| 96 | + public GrantApiKeyDescriptor ApiKey(Func<ApiKeyDescriptor, IApiKey> selector) => |
| 97 | + Assign(selector, (a, v) => a.ApiKey = v?.Invoke(new ApiKeyDescriptor())); |
| 98 | + } |
| 99 | +} |
0 commit comments