Class ApiToken

java.lang.Object
com.atlan.model.core.AtlanObject
com.atlan.model.admin.ApiToken
All Implemented Interfaces:
Serializable

public class ApiToken extends AtlanObject
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getClientId

      public String getClientId()
    • getDisplayName

      public String getDisplayName()
    • getApiTokenUsername

      public String getApiTokenUsername()
      Retrieve the username that represents this API token. This name can be used to assign the token as a user to objects that require a user, such as policies.
      Returns:
      a username for this API token
    • create

      public static ApiToken create(String displayName) throws AtlanException
      Create a new API token that never expires and is not assigned to any personas.
      Parameters:
      displayName - readable name for the API token
      Returns:
      the API token details
      Throws:
      AtlanException - on any API communication issues
    • create

      public static ApiToken create(AtlanClient client, String displayName) throws AtlanException
      Create a new API token that never expires and is not assigned to any personas.
      Parameters:
      client - connectivity to the Atlan tenant on which to create the new API token
      displayName - readable name for the API token
      Returns:
      the API token details
      Throws:
      AtlanException - on any API communication issues
    • create

      public static ApiToken create(String displayName, String description, Set<String> personas, Long validity) throws AtlanException
      Create a new API token with the provided details.
      Parameters:
      displayName - readable name for the API token
      description - explanation of the API token
      personas - unique names (qualifiedNames) of personas that should be linked to the token
      validity - time in seconds after which the token should expire (negative numbers are treated as a token should never expire)
      Returns:
      the API token details
      Throws:
      AtlanException - on any API communication issues
    • create

      public static ApiToken create(AtlanClient client, String displayName, String description, Set<String> personas, Long validity) throws AtlanException
      Create a new API token with the provided details.
      Parameters:
      client - connectivity to the Atlan tenant on which to create the new API token
      displayName - readable name for the API token
      description - explanation of the API token
      personas - unique names (qualifiedNames) of personas that should be linked to the token
      validity - time in seconds after which the token should expire (negative numbers are treated as a token should never expire)
      Returns:
      the API token details
      Throws:
      AtlanException - on any API communication issues
    • retrieveByName

      public static ApiToken retrieveByName(String displayName) throws AtlanException
      Retrieves the API token with a name that exactly matches the provided string.
      Parameters:
      displayName - name (as it appears in the UI) by which to retrieve the API token
      Returns:
      the API token whose name (in the UI) contains the provided string, or null if there is none
      Throws:
      AtlanException - on any error during API invocation
    • retrieveByName

      public static ApiToken retrieveByName(AtlanClient client, String displayName) throws AtlanException
      Retrieves the API token with a name that exactly matches the provided string.
      Parameters:
      client - connectivity to the Atlan tenant from which to retrieve the API token
      displayName - name (as it appears in the UI) by which to retrieve the API token
      Returns:
      the API token whose name (in the UI) contains the provided string, or null if there is none
      Throws:
      AtlanException - on any error during API invocation
    • update

      public ApiToken update() throws AtlanException
      Sends this API token to Atlan to update it in Atlan.
      Returns:
      the updated API token
      Throws:
      AtlanException - on any error during API invocation
    • update

      public ApiToken update(AtlanClient client) throws AtlanException
      Sends this API token to Atlan to update it in Atlan.
      Parameters:
      client - connectivity to the Atlan tenant on which to update the API token
      Returns:
      the updated API token
      Throws:
      AtlanException - on any error during API invocation
    • delete

      public static void delete(String guid) throws AtlanException
      Delete (purge) the API token with the provided GUID.
      Parameters:
      guid - unique identifier (GUID) of the API token to hard-delete
      Throws:
      AtlanException - on any API communication issues
    • delete

      public static void delete(AtlanClient client, String guid) throws AtlanException
      Delete (purge) the API token with the provided GUID.
      Parameters:
      client - connectivity to the Atlan tenant from which to remove the API token
      guid - unique identifier (GUID) of the API token to hard-delete
      Throws:
      AtlanException - on any API communication issues
    • builder

      public static ApiToken.ApiTokenBuilder<?,?> builder()
    • toBuilder

      public ApiToken.ApiTokenBuilder<?,?> toBuilder()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class AtlanObject
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class AtlanObject
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AtlanObject
    • toString

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

      public String getId()
      Unique identifier (GUID) of the API token.
    • getAttributes

      public ApiToken.ApiTokenAttributes getAttributes()
      Detailed characteristics of the API token.