Package com.atlan.net

Class ApiResource

All Implemented Interfaces:
AtlanResponseInterface, Serializable
Direct Known Subclasses:
AbstractEndpoint.RawResponse, AdminEventResponse, ApiTokenResponse, AssetMutationResponse, AssetResponse, AtlanFile, AtlanImage, AtlanRequestResponse, AuditSearchResponse, CreateGroupResponse, CredentialResponse, CredentialTestResponse, GroupResponse, IndexSearchResponse, KeycloakEventResponse, LineageListResponse, ParsedQuery, RoleResponse, SearchLogResponse, SessionResponse, SSOMapping, SuggestionResponse, TaskSearchResponse, TypeDefResponse, UserMinimalResponse, UserResponse, WorkflowResponse, WorkflowSearchResponse

public abstract class ApiResource extends AtlanObject implements AtlanResponseInterface
Base class for all response objects.
See Also:
  • Field Details

    • CHARSET

      public static final Charset CHARSET
  • Constructor Details

    • ApiResource

      public ApiResource()
  • Method Details

    • getLastResponse

      public AtlanResponse getLastResponse()
      Specified by:
      getLastResponse in interface AtlanResponseInterface
    • setLastResponse

      public void setLastResponse(AtlanResponse response)
      Specified by:
      setLastResponse in interface AtlanResponseInterface
    • getRawJsonObject

      public com.fasterxml.jackson.databind.JsonNode getRawJsonObject()
      Returns the raw JsonNode exposed by the Jackson library. This can be used to access properties that are not directly exposed by Atlan's Java library.

      Note: You should always prefer using the standard property accessors whenever possible. Because this method exposes Jackson's underlying API, it is not considered fully stable. Atlan's Java library might move off Jackson in the future and this method would be removed or change significantly.

      Overrides:
      getRawJsonObject in class AtlanObject
      Returns:
      The raw JsonNode.
    • urlEncode

      public static String urlEncode(String str)
      URL-encodes a string.
    • urlEncodeId

      public static String urlEncodeId(String id) throws InvalidRequestException
      URL-encode a string ID in url path formatting.
      Throws:
      InvalidRequestException
    • createQueryString

      public static String createQueryString(Map<String,Object> params)
      Creates the HTTP query string for a given map of parameters.
      Parameters:
      params - The map of parameters.
      Returns:
      The query string.
    • createQueryString

      public static String createQueryString(Collection<KeyValuePair<String,String>> nameValueCollection)
      Creates the HTTP query string for a collection of name/value tuples.
      Parameters:
      nameValueCollection - The collection of name/value tuples.
      Returns:
      The query string.
    • request

      public static void request(AtlanClient client, ApiResource.RequestMethod method, String url, AtlanObject payload, RequestOptions options) throws AtlanException
      Pass-through to the request-handling method after confirming that the provided payload is non-null, for calls that do not expect a response.
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      payload - to send in the request
      options - for sending the request (or null to use global defaults)
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static void request(AtlanClient client, ApiResource.RequestMethod method, String url, String body, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method. This method wraps debug-level logging lines around the request to show precisely what was constructed and sent to Atlan. Since this method is used when no response is expected, no response will be logged.
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      body - to send in the request, if any (to not send any use an empty string)
      options - for sending the request (or null to use global defaults)
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static <T extends ApiResource> T request(AtlanClient client, ApiResource.RequestMethod method, String url, AtlanObject payload, Class<T> clazz, RequestOptions options) throws AtlanException
      Pass-through to the request-handling method after confirming that the provided payload is non-null.
      Type Parameters:
      T - the type of the response
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      payload - to send in the request
      clazz - defining the expected response type
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • requestPlainText

      public static String requestPlainText(AtlanClient client, ApiResource.RequestMethod method, String url, AtlanObject payload, RequestOptions options) throws AtlanException
      Pass-through to the request-handling method after confirming that the provided payload is non-null. This uses special handling of the response, where the response is plain text rather than JSON.
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      payload - to send in the request
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static <T extends ApiResource> T request(AtlanClient client, ApiResource.RequestMethod method, String url, String body, Class<T> clazz, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method. This method wraps debug-level logging lines around the request to show precisely what was constructed and sent to Atlan and precisely what was returned (prior to deserialization).
      Type Parameters:
      T - the type of the response
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      body - to send in the request, if any (to not send any use an empty string)
      clazz - defining the expected response type
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • requestPlainText

      public static String requestPlainText(AtlanClient client, ApiResource.RequestMethod method, String url, String body, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method. This method wraps debug-level logging lines around the request to show precisely what was constructed and sent to Atlan and precisely what was returned (prior to deserialization). This handles the response as plain text rather than JSON.
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      body - to send in the request, if any (to not send any use an empty string)
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static <T extends ApiResource> T request(AtlanClient client, ApiResource.RequestMethod method, String url, InputStream payload, String filename, Class<T> clazz, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method, for file uploads. This method wraps debug-level logging lines around the request to show precisely what was constructed and sent to Atlan and precisely what was returned (prior to deserialization).
      Type Parameters:
      T - the type of the response
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      payload - binary input stream of the file contents
      filename - name of the file being streamed
      clazz - defining the expected response type
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static <T extends ApiResource> T request(AtlanClient client, ApiResource.RequestMethod method, String url, InputStream payload, String filename, Class<T> clazz, Map<String,String> extras, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method, for file uploads. This method wraps debug-level logging lines around the request to show precisely what was constructed and sent to Atlan and precisely what was returned (prior to deserialization).
      Type Parameters:
      T - the type of the response
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      payload - binary input stream of the file contents
      filename - name of the file being streamed
      clazz - defining the expected response type
      extras - additional form-encoded fields to send in the request
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • request

      public static <T extends ApiResource> T request(AtlanClient client, ApiResource.RequestMethod method, String url, Map<String,Object> map, Class<T> clazz, RequestOptions options) throws AtlanException
      Pass-through the request to the request-handling method, for form-urlencoded endpoints.
      Type Parameters:
      T - the type of the response
      Parameters:
      client - connectivity to Atlan
      method - for the request
      url - of the request
      map - of key-value pairs to be form-urlencoded
      clazz - defining the expected response type
      options - for sending the request (or null to use global defaults)
      Returns:
      the response
      Throws:
      AtlanException - on any API interaction problem
    • checkNullTypedParams

      public static void checkNullTypedParams(String url, AtlanObject params)
      Invalidate null typed parameters.
      Parameters:
      url - request url associated with the given parameters.
      params - typed parameters to check for null value.
    • toString

      public String toString()
      Description copied from class: AtlanObject
      Overrides:
      toString in class AtlanObject