Package jenkins.plugins.jclouds.internal
Class CredentialsHelper
java.lang.Object
jenkins.plugins.jclouds.internal.CredentialsHelper
Helper for dealing with credentials.
- Author:
- Fritz Elfert
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertCredentials
(String description, String identity, Secret credential) Converts old identity/credential new UsernamePassword credential-plugin record.static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
Use the ssh-slaves-plugin to retrieve a credentials object by its Id.static String
static String
getPrivateKey
(com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey supk) static ContextBuilder
setCredentials
(ContextBuilder cb, String id) Populates the credential of a JClouds ContextBuilder from a credentials record.static void
setProject
(String id, Properties overrides) Handles new OpenstackKeystoneV3 credentials and sets jclouds overrides accordingly.static String
storeCredentials
(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials u) Stores a new credentials record (Used only during migration).
-
Constructor Details
-
CredentialsHelper
public CredentialsHelper()
-
-
Method Details
-
storeCredentials
public static String storeCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials u) throws IOException Stores a new credentials record (Used only during migration).- Parameters:
u
- The new credentials to store;- Returns:
- The Id of the new record or
null
on failure. - Throws:
IOException
- on error.
-
getCredentialsById
public static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials getCredentialsById(String id) Use the ssh-slaves-plugin to retrieve a credentials object by its Id.- Parameters:
id
- The Id of the credentials object.- Returns:
- The StandardUsernameCredentials or null if not found.
-
convertCredentials
Converts old identity/credential new UsernamePassword credential-plugin record.- Parameters:
description
- The for the credentials record.identity
- The old identity (AKA username).credential
- The old credential (AKA password).- Returns:
- The Id of the newly created credential-plugin record.
-
setProject
Handles new OpenstackKeystoneV3 credentials and sets jclouds overrides accordingly. -
setCredentials
Populates the credential of a JClouds ContextBuilder from a credentials record.- Parameters:
cb
- TheContextBuilder
which should get the credential.id
- The Id of the credentials object.- Returns:
- The modified
ContextBuilder
-
getPrivateKey
public static String getPrivateKey(com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey supk) -
getPassword
-