Beispiel #1
0
 /**
  * List or change the given mount's configuration.
  *
  * if `$body` is not empty, a POST to update a mount tune is assumed.
  *
  * Unlike the mounts endpoint, this will return the current time in seconds for each TTL,
  * which may be the system default or a mount-specific value.
  *
  * @param  string $name
  * @param  array  $body
  * @return mixed
  */
 public function tuneMount($name, array $body = [])
 {
     if (empty($body)) {
         return $this->client->get('/v1/sys/mounts/' . $name . '/tune');
     }
     $params = ['body' => json_encode(OptionsResolver::resolve($body, ['default_lease_ttl', 'max_lease_ttl']))];
     return $this->client->post('/v1/sys/mounts/' . $name . '/tune', $params);
 }
Beispiel #2
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);
 }