public class CredentialsManagerImpl extends Object implements CredentialsManager
CredentialsAccessor.IsCredentialsOfType
Constructor and Description |
---|
CredentialsManagerImpl() |
Modifier and Type | Method and Description |
---|---|
CredentialsData |
createCredentials(CredentialTypeModuleDescriptor credentialDescriptor,
String credentialsName,
Map<String,String> credentialsConfig)
Creates Credentials from the configuration map and stores them in the database.
|
CredentialsData |
createOrUpdateCredentials(CredentialsData credentials)
Creates credentials based on the object representation.
|
void |
deleteCredentials(long id)
Deletes credentials based on Id
|
CredentialsData |
editCredentials(long credentialsId,
String credentialsName,
Map<String,String> credentialsConfig)
Updates Credentials with values in the configuration map.
|
Iterable<CredentialsData> |
getAllCredentials() |
Iterable<CredentialsData> |
getAllCredentials(String pluginKey) |
CredentialsData |
getCredentials(long id)
Gets the Shared Credentials by id
|
CredentialsData |
getCredentialsByName(String name)
Find shared credentials by name
|
CredentialsData |
getCredentialsByOid(BambooEntityOid oid)
Find shared credentials by
BambooEntityOid |
CredentialTypeModuleDescriptor |
getCredentialTypeDescriptor(String pluginKey) |
List<CredentialTypeModuleDescriptor> |
getCredentialTypeDescriptors() |
boolean |
hasAnyCredentials(String pluginKey) |
CredentialsData |
mergeImportedEntity(CredentialsData importedEntity)
Merges the state of the given imported entity into the database.
|
CredentialTypeExporter |
retrieveCredentialTypeExporter(String pluginKey)
Find credential type exporter for given plugin key.
|
CredentialsData |
updateCredentialsName(long id,
String name)
Updates shared credentials name
|
void |
validate(CredentialsData importedEntity)
Validate entity before saving it in database.
|
@NotNull public List<CredentialTypeModuleDescriptor> getCredentialTypeDescriptors()
getCredentialTypeDescriptors
in interface CredentialsManager
@Nullable public CredentialTypeModuleDescriptor getCredentialTypeDescriptor(@Nullable String pluginKey)
getCredentialTypeDescriptor
in interface CredentialsManager
@NotNull public CredentialsData updateCredentialsName(long id, @NotNull String name) throws WebValidationException
CredentialsManager
updateCredentialsName
in interface CredentialsManager
id
- The id of the object to updatename
- The new name to identify the credentialsWebValidationException
@NotNull public CredentialsData createOrUpdateCredentials(@NotNull CredentialsData credentials)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
createOrUpdateCredentials
in interface CredentialsManager
credentials
- The object representation with the data to save.@NotNull public CredentialsData createCredentials(@NotNull CredentialTypeModuleDescriptor credentialDescriptor, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
createCredentials
in interface CredentialsManager
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.@NotNull public CredentialsData editCredentials(long credentialsId, @NotNull String credentialsName, @NotNull Map<String,String> credentialsConfig)
CredentialsManager
This method encrypts the values of the credentials, for example for ssh encrypts the ssh key and ssh passphrase.
editCredentials
in interface CredentialsManager
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.public CredentialsData getCredentials(long id)
CredentialsAccessor
getCredentials
in interface CredentialsAccessor
public CredentialsData getCredentialsByOid(BambooEntityOid oid)
CredentialsAccessor
BambooEntityOid
getCredentialsByOid
in interface CredentialsAccessor
public CredentialsData getCredentialsByName(String name)
CredentialsAccessor
getCredentialsByName
in interface CredentialsAccessor
@NotNull public Iterable<CredentialsData> getAllCredentials()
getAllCredentials
in interface CredentialsAccessor
@NotNull public Iterable<CredentialsData> getAllCredentials(@NotNull String pluginKey)
getAllCredentials
in interface CredentialsAccessor
public boolean hasAnyCredentials(@NotNull String pluginKey)
hasAnyCredentials
in interface CredentialsAccessor
public void deleteCredentials(long id)
CredentialsManager
deleteCredentials
in interface CredentialsManager
id
- id of the object to deletepublic void validate(@NotNull CredentialsData importedEntity) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
CredentialsManager
validate
in interface CredentialsManager
importedEntity
- imported entitycom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
@NotNull public CredentialTypeExporter retrieveCredentialTypeExporter(@Nullable String pluginKey)
CredentialsManager
retrieveCredentialTypeExporter
in interface CredentialsManager
@NotNull public CredentialsData mergeImportedEntity(@NotNull CredentialsData importedEntity)
CredentialsManager
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.
mergeImportedEntity
in interface CredentialsManager
importedEntity
- imported entityCopyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.