public class ReactiveVaultTemplate extends Object implements ReactiveVaultOperations
ReactiveVaultTemplate
will log
into Vault on initialization and use the token throughout the whole lifetime.SessionManager
Constructor and Description |
---|
ReactiveVaultTemplate(VaultEndpoint vaultEndpoint,
ClientHttpConnector connector,
VaultTokenSupplier vaultTokenSupplier)
Create a new
ReactiveVaultTemplate with a VaultEndpoint ,
ClientHttpConnector and VaultTokenSupplier . |
ReactiveVaultTemplate(VaultEndpointProvider endpointProvider,
ClientHttpConnector connector,
VaultTokenSupplier vaultTokenSupplier)
Create a new
ReactiveVaultTemplate with a VaultEndpointProvider ,
ClientHttpConnector and VaultTokenSupplier . |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
delete(String path)
Delete a path.
|
protected WebClient |
doCreateSessionWebClient(VaultEndpointProvider endpointProvider,
ClientHttpConnector connector)
Create a session-bound
WebClient to be used by VaultTemplate for
Vault communication given VaultEndpointProvider and
ClientHttpConnector for calls that require an authenticated context. |
protected WebClient |
doCreateWebClient(VaultEndpointProvider endpointProvider,
ClientHttpConnector connector)
Create a
WebClient to be used by ReactiveVaultTemplate for Vault
communication given VaultEndpointProvider and ClientHttpConnector . |
<V,T extends org.reactivestreams.Publisher<V>> |
doWithSession(Function<WebClient,? extends T> sessionCallback)
Executes a Vault
RestOperationsCallback . |
<V,T extends org.reactivestreams.Publisher<V>> |
doWithVault(Function<WebClient,? extends T> clientCallback)
Executes a Vault
RestOperationsCallback . |
reactor.core.publisher.Flux<String> |
list(String path)
Enumerate keys from a Vault path.
|
reactor.core.publisher.Mono<VaultResponse> |
read(String path)
Read from a Vault path.
|
<T> reactor.core.publisher.Mono<VaultResponseSupport<T>> |
read(String path,
Class<T> responseType)
Read from a Vault path.
|
reactor.core.publisher.Mono<VaultResponse> |
write(String path,
Object body)
Write to a Vault path.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write
public ReactiveVaultTemplate(VaultEndpoint vaultEndpoint, ClientHttpConnector connector, VaultTokenSupplier vaultTokenSupplier)
ReactiveVaultTemplate
with a VaultEndpoint
,
ClientHttpConnector
and VaultTokenSupplier
.vaultEndpoint
- must not be null.connector
- must not be null.vaultTokenSupplier
- must not be null.public ReactiveVaultTemplate(VaultEndpointProvider endpointProvider, ClientHttpConnector connector, VaultTokenSupplier vaultTokenSupplier)
ReactiveVaultTemplate
with a VaultEndpointProvider
,
ClientHttpConnector
and VaultTokenSupplier
.endpointProvider
- must not be null.connector
- must not be null.vaultTokenSupplier
- must not be null.protected WebClient doCreateWebClient(VaultEndpointProvider endpointProvider, ClientHttpConnector connector)
WebClient
to be used by ReactiveVaultTemplate
for Vault
communication given VaultEndpointProvider
and ClientHttpConnector
.
VaultEndpointProvider
is used to contribute host and port details for
relative URLs typically used by the Template API. Subclasses may override this
method to customize the WebClient
.endpointProvider
- must not be null.connector
- must not be null.WebClient
used for Vault communication.protected WebClient doCreateSessionWebClient(VaultEndpointProvider endpointProvider, ClientHttpConnector connector)
WebClient
to be used by VaultTemplate
for
Vault communication given VaultEndpointProvider
and
ClientHttpConnector
for calls that require an authenticated context.
VaultEndpointProvider
is used to contribute host and port details for
relative URLs typically used by the Template API. Subclasses may override this
method to customize the WebClient
.endpointProvider
- must not be null.connector
- must not be null.WebClient
used for Vault communication.public reactor.core.publisher.Mono<VaultResponse> read(String path)
ReactiveVaultOperations
read
in interface ReactiveVaultOperations
path
- must not be null.public <T> reactor.core.publisher.Mono<VaultResponseSupport<T>> read(String path, Class<T> responseType)
ReactiveVaultOperations
read
in interface ReactiveVaultOperations
path
- must not be null.responseType
- must not be null.public reactor.core.publisher.Flux<String> list(String path)
ReactiveVaultOperations
list
in interface ReactiveVaultOperations
path
- must not be null.public reactor.core.publisher.Mono<VaultResponse> write(String path, @Nullable Object body)
ReactiveVaultOperations
write
in interface ReactiveVaultOperations
path
- must not be null.body
- the body, may be null if absent.public reactor.core.publisher.Mono<Void> delete(String path)
ReactiveVaultOperations
delete
in interface ReactiveVaultOperations
path
- must not be null.public <V,T extends org.reactivestreams.Publisher<V>> T doWithVault(Function<WebClient,? extends T> clientCallback) throws VaultException, WebClientException
ReactiveVaultOperations
RestOperationsCallback
. Allows to interact with Vault
using RestOperations
without requiring a
session.doWithVault
in interface ReactiveVaultOperations
clientCallback
- the request.RestOperationsCallback
return value.VaultException
- when a
HttpStatusCodeException
occurs.WebClientException
- exceptions from
WebClient
.public <V,T extends org.reactivestreams.Publisher<V>> T doWithSession(Function<WebClient,? extends T> sessionCallback) throws VaultException, WebClientException
ReactiveVaultOperations
RestOperationsCallback
. Allows to interact with Vault in
an authenticated session.doWithSession
in interface ReactiveVaultOperations
sessionCallback
- the request.RestOperationsCallback
return value.VaultException
- when a
HttpStatusCodeException
occurs.WebClientException
- exceptions from
WebClient
.Copyright © 2016–2019 Pivotal Software, Inc.. All rights reserved.