Class RolesClient

java.lang.Object
com.dtsx.astra.sdk.AbstractApiClient
com.dtsx.astra.sdk.org.RolesClient

public class RolesClient extends AbstractApiClient
Group roles operations.
  • Field Details

    • PATH_ORGANIZATIONS

      public static final String PATH_ORGANIZATIONS
      Constants.
      See Also:
    • PATH_ROLES

      public static final String PATH_ROLES
      Path related to Roles.
      See Also:
    • TYPE_LIST_ROLES

      public static final com.fasterxml.jackson.core.type.TypeReference<List<Role>> TYPE_LIST_ROLES
      List of Roles.
  • Constructor Details

    • RolesClient

      public RolesClient(String token)
      As immutable object use builder to initiate the object.
      Parameters:
      token - authenticated token
    • RolesClient

      public RolesClient(String token, ApiLocator.AstraEnvironment env)
      As immutable object use builder to initiate the object.
      Parameters:
      env - define target environment to be used
      token - authenticated token
  • Method Details

    • findAll

      public Stream<Role> findAll()
      List roles in a Organizations.
      Returns:
      list of roles in target organization.
    • find

      public Optional<Role> find(String roleId)
      Retrieve role information from its id.
      Parameters:
      roleId - role identifier
      Returns:
      role information
    • get

      public Role get(String roleId)
      Access the role if exist or exception.
      Parameters:
      roleId - role identifier
      Returns:
      role
    • find

      public Optional<Role> find(DefaultRoles role)
      Retrieve a suer from his email.
      Parameters:
      role - role name
      Returns:
      user iif exist
    • get

      public Role get(DefaultRoles role)
      Access the role if exist or exception.
      Parameters:
      role - current role
      Returns:
      role
    • findByName

      public Optional<Role> findByName(String roleName)
      Retrieve a suer from his email.
      Parameters:
      roleName - role name
      Returns:
      user iif exist
    • getByName

      public Role getByName(String roleName)
      Access the role if exist or exception.
      Parameters:
      roleName - role name
      Returns:
      role
    • create

      public CreateRoleResponse create(RoleDefinition cr)
      Create a new role.
      Parameters:
      cr - new role request
      Returns:
      new role created
    • exist

      public boolean exist(String roleId)
      Check if a role is present
      Parameters:
      roleId - role identifier
      Returns:
      if current role with id exist
    • delete

      public void delete(String roleId)
      Delete a role from its id.
      Parameters:
      roleId - role identifier
    • update

      public void update(String roleId, RoleDefinition cr)
      Update an existing role.
      Parameters:
      roleId - role identifier
      cr - role definition