Interface CredentialsManager
-
- All Superinterfaces:
CredentialsAccessor
- All Known Implementing Classes:
CredentialsManagerImpl
public interface CredentialsManager extends CredentialsAccessor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.credentials.CredentialsAccessor
CredentialsAccessor.IsCredentialsOfType
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Long
countAllGlobalCredentials()
Count all global credentials.@NotNull Long
countAllProjectsCredentials()
Count all project credentials.@NotNull CredentialsData
createCredentials(@NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig)
Creates Credentials from the configuration map and stores them in the database.@NotNull CredentialsData
createOrUpdateCredentials(@NotNull CredentialsData credentials)
Creates credentials based on the object representation.@NotNull CredentialsData
createProjectCredentials(@NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig, @NotNull Long projectId)
Creates Credentials from the configuration map and stores them in the database.void
deleteCredentials(long id)
Deletes credentials based on Id@NotNull CredentialsData
editCredentials(long credentialsId, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig)
Updates Credentials with values in the configuration map.@NotNull CredentialsData
editProjectCredentials(long credentialsId, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig, long projectId)
Updates Credentials with values in the configuration map.@NotNull List<Long>
findAllProjectsIdsUsingProjectSharedCredentials()
@Nullable CredentialTypeModuleDescriptor
getCredentialTypeDescriptor(@Nullable String pluginKey)
@NotNull List<CredentialTypeModuleDescriptor>
getCredentialTypeDescriptors()
@NotNull PaginatedProjectSharedCredentials
getPaginatedSharedCredentials(@Nullable Long projectId, int start, int limit, @Nullable String filter)
Get paginated shared credentials for a project.@NotNull CredentialsData
mergeImportedEntity(@NotNull CredentialsData importedEntity)
Merges the state of the given imported entity into the database.@NotNull CredentialTypeExporter
retrieveCredentialTypeExporter(@Nullable String pluginKey)
Find credential type exporter for given plugin key.@Nullable CredentialsData
updateCredentialsName(long id, @NotNull String name)
Updates shared credentials namevoid
validate(@NotNull CredentialsData importedEntity)
Validate entity before saving it in database.-
Methods inherited from interface com.atlassian.bamboo.credentials.CredentialsAccessor
getAllCredentials, getAllCredentials, getAllCredentialsByPluginKey, getCredentials, getCredentialsByName, getCredentialsByNameAndProjectId, getCredentialsByOid, getGlobalCredentials, getGlobalCredentials, getProjectCredentials, getProjectCredentials, getProjectCredentialsByPluginKey, hasAnyCredentials
-
-
-
-
Method Detail
-
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 forstart
- start by indexlimit
- return no more entries than limitfilter
- 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 updatename
- 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 onCredentialsData.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.
-
-