Example #1
0
 /**
  * Creates (or replaces) the named role.
  *
  * Roles enforce specific behavior when creating tokens that allow token functionality that is otherwise not
  * available or would require sudo/root privileges to access.
  *
  * Role parameters, when set, override any provided options to the create endpoints.
  *
  * The role name is also included in the token path, allowing all tokens created against a role to be revoked
  * using the sys/revoke-prefix endpoint.
  *
  * @see    https://www.vaultproject.io/docs/auth/token.html
  * @return mixed
  */
 public function createRole(string $role, array $body = [])
 {
     $body = OptionsResolver::resolve($body, ['allowed_policies', 'orphan', 'period', 'renewable', 'path_suffix', 'explicit_max_ttl']);
     $params = ['body' => json_encode($body)];
     return $this->client->post('/v1/auth/token/roles/' . $role, $params);
 }
Example #2
0
 /**
  * Returns the health status of Vault.
  *
  * This matches the semantics of a Consul HTTP health check and provides a simple way to monitor the health of a Vault instance
  *
  * @return mixed
  */
 public function health(array $arguments = [])
 {
     $url = '/v1/sys/health?' . http_build_query($arguments);
     return $this->client->get($url);
 }
Example #3
0
 public function delete($path)
 {
     return $this->client->delete('/v1/' . $path);
 }