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

public abstract class AbstractApiClient extends Object
Super Class for the different Http Clients of the api
  • Field Details

    • token

      protected final String token
      hold a reference to the bearer token.
    • environment

      protected final ApiLocator.AstraEnvironment environment
      hold a reference to target Astra Environment.
  • Constructor Details

    • AbstractApiClient

      public AbstractApiClient(String token, ApiLocator.AstraEnvironment env)
      Default constructor.
      Parameters:
      env - astra environment
      token - token value
  • Method Details

    • getToken

      public String getToken()
      Gets token
      Returns:
      value of token
    • getHttpClient

      public HttpClientWrapper getHttpClient()
      Access Http Client.
      Returns:
      Http client
    • GET

      public ApiResponseHttp GET(String url)
      Syntax sugar http requests.
      Parameters:
      url - url
      Returns:
      response
    • HEAD

      public ApiResponseHttp HEAD(String url)
      Syntax sugar http requests.
      Parameters:
      url - url
      Returns:
      response
    • POST

      public ApiResponseHttp POST(String url)
      Syntax sugar http requests.
      Parameters:
      url - url
      Returns:
      response
    • POST

      public ApiResponseHttp POST(String url, String body)
      Syntax sugar http requests.
      Parameters:
      body - body
      url - url
      Returns:
      response
    • PUT

      public void PUT(String url, String body)
      Syntax sugar http requests.
      Parameters:
      url - url
      body - body
    • PATCH

      public void PATCH(String url, String body)
      Syntax sugar http requests.
      Parameters:
      url - url
      body - body
    • DELETE

      public void DELETE(String url)
      Syntax sugar http requests.
      Parameters:
      url - url
    • assertHttpCodeAccepted

      public void assertHttpCodeAccepted(ApiResponseHttp res, String action, String entityId)
      Response validation
      Parameters:
      res - current response
      action - action taken
      entityId - entity id