Interface ApiRequest<T extends ApiRequest<T>>
- Type Parameters:
T
- type of the request
- All Known Implementing Classes:
ApiJsonRequest
,ApiRestRequest
,CaCertificateGet.Request
,CertificateGet.Request
,ConfigureK8s.Request
,CreateAppRole.Request
,CreateCubbyhole.Request
,CreateKey.Request
,CreateKv1.Request
,CreateKv2.Request
,CreatePolicy.Request
,CreateRole.Request
,CreateToken.Request
,CreateTokenRole.Request
,CrlGet.Request
,DbConfigure.Request
,DbCreateRole.Request
,DbDelete.Request
,DbDeleteRole.Request
,DbGet.Request
,Decrypt.Request
,DecryptBatch.Request
,DeleteAllKv2.Request
,DeleteAppRole.Request
,DeleteCubbyhole.Request
,DeleteKey.Request
,DeleteKv1.Request
,DeleteKv2.Request
,DeletePolicy.Request
,DeleteRole.Request
,DeleteTokenRole.Request
,DestroyKv2.Request
,DestroySecretId.Request
,DisableAuth.Request
,DisableEngine.Request
,EnableAuth.Request
,EnableEngine.Request
,Encrypt.Request
,EncryptBatch.Request
,GenerateSecretId.Request
,GenerateSelfSignedRoot.Request
,GetCubbyhole.Request
,GetKv1.Request
,GetKv2.Request
,Hmac.Request
,IssueCertificate.Request
,JsonRequest
,ListSecrets.Request
,Login.Request
,Login.Request
,MySqlConfigureRequest
,OracleConfigureRequest
,PkiRole.Request
,ReadRoleId.Request
,RenewToken.Request
,RestRequest
,RevokeAndOrphanToken.Request
,RevokeCertificate.Request
,RevokeToken.Request
,Sign.Request
,SignCsr.Request
,UndeleteKv2.Request
,UpdateCubbyhole.Request
,UpdateKeyConfig.Request
,UpdateKv1.Request
,UpdateKv2.Request
,VaultRequest
,Verify.Request
public interface ApiRequest<T extends ApiRequest<T>>
Common base class for REST requests.
This class acts as a mutable builder.
Path is not a part of this request.
-
Method Summary
Modifier and TypeMethodDescriptionAdd an HTTP header.addQueryParam
(String name, String... value) Add an HTTP query parameter.headers()
Returns immutable configured headers.Returns immutable configured query parameters.Configured request ID.Configure request ID for logging (and possibly to send over the network).Request media type.requestMediaType
(MediaType mediaType) The media type header, defaults toMediaTypes.APPLICATION_JSON
when JSON entity is present, toMediaTypes.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.Response media type.responseMediaType
(MediaType mediaType) The accept header, defaults toMediaTypes.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaTypes.APPLICATION_OCTET_STREAM
.default Optional
<JsonObject> toJson
(JsonBuilderFactory factory) Return the JSON object used for POST and PUT requests (and other methods if needed).
-
Method Details
-
addHeader
Add an HTTP header.- Parameters:
name
- name of the headervalue
- header value(s)- Returns:
- updated request
-
addQueryParam
Add an HTTP query parameter.- Parameters:
name
- name of the parametervalue
- parameter value(s)- Returns:
- updated request
-
requestMediaType
The media type header, defaults toMediaTypes.APPLICATION_JSON
when JSON entity is present, toMediaTypes.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.- Parameters:
mediaType
- media type of request- Returns:
- updated request
-
responseMediaType
The accept header, defaults toMediaTypes.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaTypes.APPLICATION_OCTET_STREAM
.- Parameters:
mediaType
- accepted media type- Returns:
- updated request
-
requestId
Configure request ID for logging (and possibly to send over the network).- Parameters:
requestId
- request id- Returns:
- updated request
-
headers
Returns immutable configured headers.- Returns:
- headers configured for this request
-
queryParams
Returns immutable configured query parameters.- Returns:
- query parameters configured for this request
-
toJson
Return the JSON object used for POST and PUT requests (and other methods if needed). The default implementation returns an empty optional that can be used for GET, HEAD, DELETE methods (and other methods without an entity).- Parameters:
factory
- builder factory to construct JSON object- Returns:
- JSON if available on this request
-
requestMediaType
Request media type.- Returns:
- media type if configured
- See Also:
-
responseMediaType
Response media type.- Returns:
- media type if configured
- See Also:
-
requestId
Configured request ID.- Returns:
- request ID if configured
-