This data structure is used to represent both policies read from Vault and
written to Vault. Thus the same Policy read, can then be written back after
amending. Vault stores the rules or per path policies in an encoded json
blob, so that effectively means json within json, hence the unusual
semantics below. {
rules: json!{
path: {
‘auth/’: { capabilities: [‘create’, ‘read’, ‘update’, ‘delete’,
‘list’, ‘sudo’] }, ‘sys/auth/’: { capabilities: [‘create’, ‘read’,
‘update’, ‘delete’, ‘sudo’] }, }
}
}
Note: Vault claims rules is deprecated and policy should be used instead,
but that doesn’t seem to work and makes the reading asymmetrical from the
writing.
Processes a generic response returned by a vault request. This function
simply just checks that the response was not an error and calls
response.into_string() to clear the ureq stream.