public abstract class SecretUtils extends Object
V1Secrets.
Note: API may be subject to change.| 限定符和类型 | 字段和说明 |
|---|---|
static String |
JENKINS_IO_CREDENTIALS_TYPE_LABEL |
| 构造器和说明 |
|---|
SecretUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
base64Decode(String s)
Convert a String representation of the base64 encoded bytes back to a byte[].
|
static String |
base64DecodeToString(String s)
Convert a String representation of the base64 encoded bytes of a UTF-8 String back to a String.
|
static String |
getCredentialDescription(io.kubernetes.client.models.V1ObjectMeta meta) |
static String |
getCredentialDescription(io.kubernetes.client.models.V1Secret s)
Obtain the credential description from a given
Secret. |
static String |
getCredentialId(io.kubernetes.client.models.V1ObjectMeta meta) |
static String |
getCredentialId(io.kubernetes.client.models.V1Secret s)
Obtain the credential ID from a given
Secret. |
static String |
getKeyName(io.kubernetes.client.models.V1Secret s,
String key)
Get the mapping for the specified key name.
|
static String |
getNonNullSecretData(io.kubernetes.client.models.V1Secret s,
String key,
String exceptionMessage)
Get the data for the specified key (or the mapped key if key is mapped), or throw a
CredentialsConversionException if the data for the given key was not present..
|
static Optional<String> |
getOptionalSecretData(io.kubernetes.client.models.V1Secret s,
String key,
String exceptionMessage)
Get optional data for the specified key (or the mapped key if key is mapped)
|
static <T> T |
requireNonNull(T obj,
String exceptionMessage)
Checks that
obj is not null. |
static <T> T |
requireNonNull(T obj,
String exceptionMessage,
String mapped)
Checks that
obj is not null. |
@CheckForNull @Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String base64DecodeToString(String s)
s - the base64 encoded String representation of the bytes.null if the string could not be converted.@CheckForNull @Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static byte[] base64Decode(String s)
s - the base64 encoded representation of the bytes.null if the string could not be converted.public static String getCredentialId(io.kubernetes.client.models.V1Secret s)
Secret.s - the secret whose id we want to obtain.public static String getCredentialId(io.kubernetes.client.models.V1ObjectMeta meta)
@CheckForNull public static String getCredentialDescription(io.kubernetes.client.models.V1Secret s)
Secret.s - the secret whose description we want to obtain.public static String getCredentialDescription(io.kubernetes.client.models.V1ObjectMeta meta)
public static <T> T requireNonNull(@Nullable
T obj,
String exceptionMessage)
throws CredentialsConversionException
obj is not null.T - the type of the obj.obj - the Object to check for null.exceptionMessage - detail message to be used in the event that a CredentialsConversionException is thrown.obj if not null.CredentialsConversionException - iff obj is null.public static <T> T requireNonNull(@Nullable
T obj,
String exceptionMessage,
@Nullable
String mapped)
throws CredentialsConversionException
obj is not null.T - the type of the obj.obj - the Object to check for null.exceptionMessage - detail message to be used in the event that a CredentialsConversionException is thrown.mapped - an optional mapping (adds a "mapped to " + mapped to the exception message if this is non null.obj if not null.CredentialsConversionException - iff obj is null.public static String getNonNullSecretData(io.kubernetes.client.models.V1Secret s, String key, String exceptionMessage) throws CredentialsConversionException
s - the Secretkey - the key to get the data for (which may be mapped to another key).exceptionMessage - the detailMessage of the exception if the data for the key (or mapped key) was not
present.CredentialsConversionException - if the data was not present.public static Optional<String> getOptionalSecretData(io.kubernetes.client.models.V1Secret s, String key, String exceptionMessage) throws CredentialsConversionException
s - the Secretkey - the key to get the data for (which may be mapped to another key).exceptionMessage - the detailMessage of the exception if the data for the key (or mapped key) was not
present.CredentialsConversionException - if the data was not present.public static String getKeyName(io.kubernetes.client.models.V1Secret s, String key)
jenkins.io/credentials-keybinding-name containing the custom name - for example
jenkins.io/credentials-keybinding-foo=wibble.s - the secret to inspect for a custom name.key - the name of the key we are looking for.key (identical object) if there is no custom mapping.Copyright © 2016–2019. All rights reserved.