private static IEnumerable<string> IndicesPointingToAlias(IConnectionConfigurationValues settings, Names alias, IGetAliasResponse aliasesResponse) { if (!aliasesResponse.IsValid || !aliasesResponse.Indices.HasAny()) return new string[] { }; var aliases = alias.GetString(settings).Split(','); var indices = from i in aliasesResponse.Indices where i.Value.Any(a => aliases.Contains(a.Name)) select i.Key; return indices.ToList(); }
/// <summary> /// Returns a collection of indices that have the specified alias(es) applied to them. Simplified version of GetAlias. /// </summary> /// <param name="client">The client</param> /// <param name="alias">The alias name(s)</param> public static async Task<IEnumerable<string>> GetIndicesPointingToAliasAsync(this IElasticClient client, Names alias) { var response = await client.GetAliasAsync(a => a.Name(alias)).ConfigureAwait(false); return IndicesPointingToAlias(client.ConnectionSettings, alias, response); }
/// <inheritdoc /> public GetSnapshotResponse GetSnapshot(Name repository, Names snapshots, Func <GetSnapshotDescriptor, IGetSnapshotRequest> selector = null) => GetSnapshot(selector.InvokeOrDefault(new GetSnapshotDescriptor(repository, snapshots)));
/// <inheritdoc/> public Task<IDeleteRepositoryResponse> DeleteRepositoryAsync(Names repositories, Func<DeleteRepositoryDescriptor, IDeleteRepositoryRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) => this.DeleteRepositoryAsync(selector.InvokeOrDefault(new DeleteRepositoryDescriptor(repositories)), cancellationToken);
/// <inheritdoc/> public IAcknowledgedResponse DeleteRepository(Names repositories, Func<DeleteRepositoryDescriptor, IDeleteRepositoryRequest> selector = null) => this.DeleteRepository(selector.InvokeOrDefault(new DeleteRepositoryDescriptor(repositories)));
/// <inheritdoc/> public Task<IGetSnapshotResponse> GetSnapshotAsync(Name repository, Names snapshots, Func<GetSnapshotDescriptor, IGetSnapshotRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) => this.GetSnapshotAsync(selector.InvokeOrDefault(new GetSnapshotDescriptor(repository, snapshots)), cancellationToken);
/// <inheritdoc/> public IAcknowledgedResponse DeleteWarmer(Indices indices, Names names, Func<DeleteWarmerDescriptor, IDeleteWarmerRequest> selector = null) => this.DeleteWarmer(selector.InvokeOrDefault(new DeleteWarmerDescriptor(indices, names)));
/// <inheritdoc/> public Task<IClearCachedRolesResponse> ClearCachedRolesAsync(Names roles, Func<ClearCachedRolesDescriptor, IClearCachedRolesRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) => this.ClearCachedRolesAsync(selector.InvokeOrDefault(new ClearCachedRolesDescriptor(roles)), cancellationToken);
///<summary>/_security/role/{name}/_clear_cache</summary> ///<param name = "name">this parameter is required</param> public ClearCachedRolesDescriptor(Names name) : base(r => r.Required("name", name)) { }
///<summary>/_security/realm/{realms}/_clear_cache</summary> ///<param name = "realms">this parameter is required</param> public ClearCachedRealmsDescriptor(Names realms) : base(r => r.Required("realms", realms)) { }
///<summary>A comma-separated list of usernames</summary> public GetUserDescriptor Username(Names username) => Assign(username, (a, v) => a.RouteValues.Optional("username", v));
///<summary>/_security/user/{username}</summary> ///<param name = "username">Optional, accepts null</param> public GetUserDescriptor(Names username) : base(r => r.Optional("username", username)) { }
/// <inheritdoc /> public Task <IDeleteRepositoryResponse> DeleteRepositoryAsync(Names repositories, Func <DeleteRepositoryDescriptor, IDeleteRepositoryRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken) ) => DeleteRepositoryAsync(selector.InvokeOrDefault(new DeleteRepositoryDescriptor(repositories)), cancellationToken);
/// <inheritdoc /> public IDeleteRepositoryResponse DeleteRepository(Names repositories, Func <DeleteRepositoryDescriptor, IDeleteRepositoryRequest> selector = null ) => DeleteRepository(selector.InvokeOrDefault(new DeleteRepositoryDescriptor(repositories)));
/// <inheritdoc/> public Task <IAcknowledgedResponse> DeleteWarmerAsync(Indices indices, Names names, Func <DeleteWarmerDescriptor, IDeleteWarmerRequest> selector = null) => this.DeleteWarmerAsync(selector.InvokeOrDefault(new DeleteWarmerDescriptor(indices, names)));
/// <inheritdoc/> public IDeleteAliasResponse DeleteAlias(Indices indices, Names names, Func<DeleteAliasDescriptor, IDeleteAliasRequest> selector = null) => this.DeleteAlias(selector.InvokeOrDefault(new DeleteAliasDescriptor(indices, names)));
/// <inheritdoc/> public IClearCachedRolesResponse ClearCachedRoles(Names roles, Func<ClearCachedRolesDescriptor, IClearCachedRolesRequest> selector = null) => this.ClearCachedRoles(selector.InvokeOrDefault(new ClearCachedRolesDescriptor(roles)));
/// <inheritdoc/> public Task<IDeleteAliasResponse> DeleteAliasAsync( Indices indices, Names names, Func<DeleteAliasDescriptor, IDeleteAliasRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken) ) => this.DeleteAliasAsync(selector.InvokeOrDefault(new DeleteAliasDescriptor(indices, names)), cancellationToken);
/// <inheritdoc/> public Task<ICatResponse<CatSnapshotsRecord>> CatSnapshotsAsync( Names repositories, Func<CatSnapshotsDescriptor, ICatSnapshotsRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken) ) => this.CatSnapshotsAsync(selector.InvokeOrDefault(new CatSnapshotsDescriptor(repositories)), cancellationToken);
/// <summary> /// Returns a collection of indices that have the specified alias(es) applied to them. Simplified version of GetAlias. /// </summary> /// <param name="client">The client</param> /// <param name="alias">The alias name(s)</param> public static async Task <IReadOnlyCollection <string> > GetIndicesPointingToAliasAsync(this IElasticClient client, Names alias) { var response = await client.Indices.GetAliasAsync(Indices.All, a => a.Name(alias).RequestConfiguration(r => r.ThrowExceptions())).ConfigureAwait(false); return(IndicesPointingToAlias(client.ConnectionSettings, alias, response)); }
/// <inheritdoc/> public IGetSnapshotResponse GetSnapshot(Name repository, Names snapshots, Func<GetSnapshotDescriptor, IGetSnapshotRequest> selector = null) => this.GetSnapshot(selector.InvokeOrDefault(new GetSnapshotDescriptor(repository, snapshots)));
/// <inheritdoc /> public ClearCachedRealmsResponse ClearCachedRealms(Names realms, Func <ClearCachedRealmsDescriptor, IClearCachedRealmsRequest> selector = null ) => ClearCachedRealms(selector.InvokeOrDefault(new ClearCachedRealmsDescriptor(realms)));
/// <inheritdoc/> public Task<IDeleteWarmerResponse> DeleteWarmerAsync(Indices indices, Names names, Func<DeleteWarmerDescriptor, IDeleteWarmerRequest> selector = null) => this.DeleteWarmerAsync(selector.InvokeOrDefault(new DeleteWarmerDescriptor(indices, names)));
/// <inheritdoc /> public Task <ClearCachedRealmsResponse> ClearCachedRealmsAsync( Names realms, Func <ClearCachedRealmsDescriptor, IClearCachedRealmsRequest> selector = null, CancellationToken cancellationToken = default ) => ClearCachedRealmsAsync(selector.InvokeOrDefault(new ClearCachedRealmsDescriptor(realms)), cancellationToken);
/// <inheritdoc/> public Task<ICatResponse<CatSnapshotsRecord>> CatSnapshotsAsync(Names repositories, Func<CatSnapshotsDescriptor, ICatSnapshotsRequest> selector = null) => this.CatSnapshotsAsync(selector.InvokeOrDefault(new CatSnapshotsDescriptor(repositories)));
/// <summary> /// Returns a collection of indices that have the specified alias(es) applied to them. Simplified version of GetAlias. /// </summary> /// <param name="client">The client</param> /// <param name="alias">The alias name(s)</param> public static IEnumerable<string> GetIndicesPointingToAlias(this IElasticClient client, Names alias) { var response = client.GetAlias(a => a.Name(alias)); return IndicesPointingToAlias(client.ConnectionSettings, alias, response); }
/// <inheritdoc/> public Task<IDeleteRepositoryResponse> DeleteRepositoryAsync(Names repositories, Func<DeleteRepositoryDescriptor, IDeleteRepositoryRequest> selector = null) => this.DeleteRepositoryAsync(selector.InvokeOrDefault(new DeleteRepositoryDescriptor(repositories)));
///<summary>/_cat/aliases/{name}</summary> ///<param name = "name">Optional, accepts null</param> public CatAliasesRequest(Names name) : base(r => r.Optional("name", name)) { }