Interface CredentialsManager

All Superinterfaces:
CredentialsAccessor
All Known Implementing Classes:
CredentialsManagerImpl

public interface CredentialsManager extends CredentialsAccessor
  • Method Details

    • getCredentialTypeDescriptors

      @NotNull @NotNull List<CredentialTypeModuleDescriptor> getCredentialTypeDescriptors()
      Returns:
      Provides a list of available shared credential types
    • getCredentialTypeDescriptor

      @Nullable @Nullable CredentialTypeModuleDescriptor getCredentialTypeDescriptor(@Nullable @Nullable String pluginKey)
      Returns:
      The shared credential type for the given key
    • getPaginatedSharedCredentials

      @NotNull @NotNull PaginatedProjectSharedCredentials getPaginatedSharedCredentials(@Nullable @Nullable Long projectId, int start, int limit, @Nullable @Nullable String filter)
      Get paginated shared credentials for a project. Filtering requires at least one character. If filter is null or empty then no filtering.
      Parameters:
      projectId - of the project to get shared credentials for
      start - start by index
      limit - return no more entries than limit
      filter - filter
      Returns:
      Paginated shared credentials for a project.
    • updateCredentialsName

      @Nullable @Nullable CredentialsData updateCredentialsName(long id, @NotNull @NotNull String name) throws WebValidationException
      Updates shared credentials name
      Parameters:
      id - The id of the object to update
      name - The new name to identify the credentials
      Returns:
      Returns the object updated
      Throws:
      WebValidationException
    • createOrUpdateCredentials

      @NotNull @NotNull CredentialsData createOrUpdateCredentials(@NotNull @NotNull CredentialsData credentials)
      Creates credentials based on the object representation. If the object has ID set, then an update will be executed.

      This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.

      Parameters:
      credentials - The object representation with the data to save.
      Returns:
      Returns the persisted object for the credentials
    • createCredentials

      @NotNull @NotNull CredentialsData createCredentials(@NotNull @NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig)
      Creates Credentials from the configuration map and stores them in the database.

      This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.

      Parameters:
      credentialDescriptor - The plugin module descriptor for the credential type being created.
      credentialsName - The name for the credentials.
      credentialsConfig - The configuration map containing the credential values as defined by the plugin for this credential type.
      Returns:
      Returns the CredentialsData object representation of the credentials after creation.
    • createProjectCredentials

      @NotNull @NotNull CredentialsData createProjectCredentials(@NotNull @NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig, @NotNull @NotNull Long projectId)
      Creates Credentials from the configuration map and stores them in the database.

      This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.

      Parameters:
      credentialDescriptor - The plugin module descriptor for the credential type being created.
      credentialsName - The name for the credentials.
      credentialsConfig - The configuration map containing the credential values as defined by the plugin for this credential type.
      projectId - Project id
      Returns:
      Returns the CredentialsData object representation of the credentials after creation.
    • editCredentials

      @NotNull @NotNull CredentialsData editCredentials(long credentialsId, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig)
      Updates Credentials with values in the configuration map.

      This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.

      Parameters:
      credentialsId - The ID of the credentials to update.
      credentialsName - The name for the credentials.
      credentialsConfig - The configuration map containing the credential values as defined by the plugin for this credential type.
      Returns:
      Returns the CredentialsData object representation of the credentials.
    • editProjectCredentials

      @NotNull @NotNull CredentialsData editProjectCredentials(long credentialsId, @NotNull @NotNull String credentialsName, @NotNull @NotNull Map<String,String> credentialsConfig, long projectId)
      Updates Credentials with values in the configuration map.

      This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.

      Parameters:
      credentialsId - The ID of the credentials to update.
      credentialsName - The name for the credentials.
      credentialsConfig - The configuration map containing the credential values as defined by the plugin for this credential type.
      projectId - The ID of the Project
      Returns:
      Returns the CredentialsData object representation of the credentials.
    • deleteCredentials

      void deleteCredentials(long id)
      Deletes credentials based on Id
      Parameters:
      id - id of the object to delete
    • validate

      void validate(@NotNull @NotNull CredentialsData importedEntity) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      Validate entity before saving it in database.
      Parameters:
      importedEntity - imported entity
      Throws:
      com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
    • retrieveCredentialTypeExporter

      @NotNull @NotNull CredentialTypeExporter retrieveCredentialTypeExporter(@Nullable @Nullable String pluginKey)
      Find credential type exporter for given plugin key. Returns null if couldn't find it.
    • mergeImportedEntity

      @NotNull @NotNull CredentialsData mergeImportedEntity(@NotNull @NotNull CredentialsData importedEntity)
      Merges the state of the given imported entity into the database.

      This service will attempt to merge the entity based on ImmutableEntityWithOid.getOid(), and if there's no match, based on CredentialsData.getName(). If an existing entity is found, then it will be updated. Otherwise, a new database entity will be created. It's assumed that this method is used in specs import only as it's sending analytic event.

      Parameters:
      importedEntity - imported entity
      Returns:
      an object after persisting to the database - either the newly created or updated database object
    • countAllGlobalCredentials

      @NotNull @NotNull Long countAllGlobalCredentials()
      Count all global credentials.
      Returns:
      Long count of global credentials.
    • countAllProjectsCredentials

      @NotNull @NotNull Long countAllProjectsCredentials()
      Count all project credentials.
      Returns:
      Long count of project credentials.
    • findAllProjectsIdsUsingProjectSharedCredentials

      @NotNull @NotNull List<Long> findAllProjectsIdsUsingProjectSharedCredentials()
      Returns:
      a list which contains IDs of all project which are using project shared credentials.