Skip to content

Commit

Permalink
add new sys/step-down api
Browse files Browse the repository at this point in the history
  • Loading branch information
rajanadar committed Aug 30, 2016
1 parent 450aeef commit 49f0bc7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/VaultSharp/IVaultClient.cs
Expand Up @@ -371,6 +371,17 @@ public interface IVaultClient
/// </returns>
Task<Leader> GetLeaderAsync();

/// <summary>
/// Forces the node to give up active status.
/// If the node does not have active status, this endpoint does nothing.
/// Note that the node will sleep for ten seconds before attempting to grab the active lock again,
/// but if no standby nodes grab the active lock in the interim,
/// the same node may become the active node again.
/// This API is a root protected call.
/// </summary>
/// <returns>The task.</returns>
Task StepDownActiveNodeAsync();

/// <summary>
/// Gets information about the current encryption key used by Vault
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions src/VaultSharp/VaultClient.cs
Expand Up @@ -366,6 +366,13 @@ public async Task<Leader> GetLeaderAsync()
return leader;
}

public async Task StepDownActiveNodeAsync()
{
await
MakeVaultApiRequest("sys/step-down", HttpMethod.Put)
.ConfigureAwait(_continueAsyncTasksOnCapturedContext);
}

public async Task<EncryptionKeyStatus> GetEncryptionKeyStatusAsync()
{
var keyStatus = await MakeVaultApiRequest<EncryptionKeyStatus>("sys/key-status", HttpMethod.Get).ConfigureAwait(continueOnCapturedContext: _continueAsyncTasksOnCapturedContext);
Expand Down
2 changes: 2 additions & 0 deletions test/VaultSharp.UnitTests/End2End/VaultClientEnd2EndTests.cs
Expand Up @@ -41,6 +41,8 @@ public async Task AllTests()
// await GithubAuthenticationProviderTests();
}

await _authenticatedClient.StepDownActiveNodeAsync();

await EncryptStrongTests();
await MountedSecretBackendTests();
await MountedAuthenticationBackendTests();
Expand Down

1 comment on commit 49f0bc7

@v6
Copy link

@v6 v6 commented on 49f0bc7 May 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// , For anyone coming to this from Google, here is the documentation for this API call:

https://www.vaultproject.io/api/system/step-down.html#step-down-leader

Please sign in to comment.