Package com.dtsx.astra.sdk
Class AbstractApiClient
java.lang.Object
com.dtsx.astra.sdk.AbstractApiClient
- Direct Known Subclasses:
AstraDbClient
,AstraDevopsApiClient
,AstraStreamingClient
,ClustersClient
,DatabaseClient
,DbAccessListsClient
,DbCdcsClient
,DbDatacentersClient
,DbKeyspacesClient
,DbPrivateLinksClient
,DbRegionsClient
,DbTelemetryClient
,KeysClient
,ProvidersClient
,RegionsClient
,RolesClient
,TenantCdcClient
,TenantClient
,TenantLimitsClient
,TenantStatsClient
,TokensClient
,UsersClient
Super Class for the different Http Clients of the api
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ApiLocator.AstraEnvironment
hold a reference to target Astra Environment.protected final String
hold a reference to the bearer token. -
Constructor Summary
ConstructorDescriptionAbstractApiClient
(String token, ApiLocator.AstraEnvironment env) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertHttpCodeAccepted
(ApiResponseHttp res, String action, String entityId) Response validationvoid
Syntax sugar http requests.Syntax sugar http requests.Access Http Client.getToken()
Gets tokenSyntax sugar http requests.void
Syntax sugar http requests.Syntax sugar http requests.Syntax sugar http requests.void
Syntax sugar http requests.
-
Field Details
-
token
hold a reference to the bearer token. -
environment
hold a reference to target Astra Environment.
-
-
Constructor Details
-
AbstractApiClient
Default constructor.- Parameters:
env
- astra environmenttoken
- token value
-
-
Method Details
-
getToken
Gets token- Returns:
- value of token
-
getHttpClient
Access Http Client.- Returns:
- Http client
-
GET
Syntax sugar http requests.- Parameters:
url
- url- Returns:
- response
-
HEAD
Syntax sugar http requests.- Parameters:
url
- url- Returns:
- response
-
POST
Syntax sugar http requests.- Parameters:
url
- url- Returns:
- response
-
POST
Syntax sugar http requests.- Parameters:
body
- bodyurl
- url- Returns:
- response
-
PUT
Syntax sugar http requests.- Parameters:
url
- urlbody
- body
-
PATCH
Syntax sugar http requests.- Parameters:
url
- urlbody
- body
-
DELETE
Syntax sugar http requests.- Parameters:
url
- url
-
assertHttpCodeAccepted
Response validation- Parameters:
res
- current responseaction
- action takenentityId
- entity id
-