Package com.cloudera.cdp.client
Class CdpClient
java.lang.Object
com.cloudera.cdp.client.CdpClient
- Direct Known Subclasses:
AuditClient
,CloudprivatelinksClient
,ComputeClient
,ConsumptionClient
,DatacatalogClient
,DatahubClient
,DatalakeClient
,DeClient
,DfClient
,DfworkloadClient
,DrscpClient
,DwClient
,EnvironmentsClient
,IamClient
,ImagecatalogClient
,MlClient
,OpdbClient
,ReplicationmanagerClient
Abstract base class for all API client classes. This should not be
referenced directly.
All subclasses of this class are intended to be generated code and are safe
to share across threads. Each CdpClient instance has a dedicated HTTP
connection pool used to back its requests. The properties of that pool are
configured per-CdpClient using the CdpClientConfiguration passed at
creation time.
This class is not thread-safe.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final List
<Class<? extends CdpClientMiddleware>> -
Constructor Summary
ModifierConstructorDescriptionprotected
CdpClient
(CdpCredentials credentials, String endpoint, CdpClientConfiguration config) Constructor.protected
CdpClient
(CdpRequestContext<?> context) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the request Content-Type, used by 'Conent-Type' request header.protected String
Gets the expected response Content-Type, used by 'Accept' request header.protected abstract String
Gets the service name.protected <T extends BaseResponse>
voidinvokeAPI
(CdpRequestContext<T> context, List<Class<? extends CdpClientMiddleware>> extensions) protected <T extends CdpResponse>
TinvokeAPI
(String operationName, String path, Object body, javax.ws.rs.core.GenericType<T> returnType, List<Class<? extends CdpClientMiddleware>> extensions) Invoke API by sending HTTP request with the given options.protected RestResponse
invokeAPI
(String operationName, String method, String path, List<Pair> queries, Map<String, String> headers, Object body, List<Class<? extends CdpClientMiddleware>> extensions) Invoke API by sending HTTP request with the given options.protected <T extends BaseResponse>
TinvokeAPI
(String operationName, String method, String path, List<Pair> queries, Map<String, String> headers, Object body, javax.ws.rs.core.GenericType<T> returnType, List<Class<? extends CdpClientMiddleware>> extensions) protected Pair
parameterToPair
(String name, Object value) Formats the specified parameter to aPair
object.parameterToPairs
(String collectionFormat, String name, Collection value) Formats the specified parameters to a list ofPair
objects.protected String
parameterToString
(Object param) Format the given parameter object into string.void
shutdown()
Releases resources held by this client object.
-
Field Details
-
NO_EXTENSION
-
-
Constructor Details
-
CdpClient
Constructor.- Parameters:
credentials
- the CDP credentialsendpoint
- the CDP service endpointconfig
- the client configuration
-
CdpClient
Constructor.- Parameters:
context
- the CDP client context
-
-
Method Details
-
getServiceName
Gets the service name.- Returns:
- the service name
-
getRequestContentType
Gets the request Content-Type, used by 'Conent-Type' request header.- Returns:
- the request Content-Type
-
getResponseContentType
Gets the expected response Content-Type, used by 'Accept' request header.- Returns:
- the response Content-Type
-
invokeAPI
protected <T extends CdpResponse> T invokeAPI(String operationName, String path, Object body, javax.ws.rs.core.GenericType<T> returnType, @Nullable List<Class<? extends CdpClientMiddleware>> extensions) Invoke API by sending HTTP request with the given options.- Type Parameters:
T
- The type of the response- Parameters:
operationName
- The operation namepath
- The subpath of the HTTP URLbody
- The request body objectreturnType
- The return type as a GenericTypeextensions
- The extensions for the operation- Returns:
- The response body object
-
invokeAPI
protected RestResponse invokeAPI(String operationName, String method, String path, List<Pair> queries, Map<String, String> headers, @Nullable Object body, @Nullable List<Class<? extends CdpClientMiddleware>> extensions) Invoke API by sending HTTP request with the given options.- Parameters:
operationName
- The operation namemethod
- The request method, one of "GET", "POST", "PUT", "PATCH" and "DELETE"path
- The sub-path of the HTTP URLqueries
- The query parametersheaders
- The header parametersbody
- The request body object - if it is not binary, otherwise nullextensions
- The extensions for the operation- Returns:
- The response body object
-
invokeAPI
-
invokeAPI
protected <T extends BaseResponse> void invokeAPI(CdpRequestContext<T> context, @Nullable List<Class<? extends CdpClientMiddleware>> extensions) -
parameterToString
Format the given parameter object into string.- Parameters:
param
- Object- Returns:
- Object in string format
-
parameterToPair
Formats the specified parameter to aPair
object.- Parameters:
name
- The name of the parameter.value
- The value of the parameter.- Returns:
- A
Pair
object.
-
parameterToPairs
Formats the specified parameters to a list ofPair
objects.- Parameters:
collectionFormat
- The collection format of the parameter.name
- The name of the parameter.value
- The value of the parameter.- Returns:
- A list of
Pair
objects.
-
shutdown
public void shutdown()Releases resources held by this client object. Once a client has been shutdown, it should not be used to make any more requests. This is an optional method, and callers are not expected to call it, but can if they want to explicitly release any open resources.
-