Enum CredentialsScope
- java.lang.Object
-
- java.lang.Enum<CredentialsScope>
-
- com.cloudbees.plugins.credentials.CredentialsScope
-
- All Implemented Interfaces:
Serializable
,Comparable<CredentialsScope>
public enum CredentialsScope extends Enum<CredentialsScope> implements Serializable
The scope of credentials.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description GLOBAL
This credential is available to the object on which the credential is associated and all objects that are children of that object.SYSTEM
This credential is only available to the object on which the credential is associated.USER
This credential is available to the user which which the credential is associated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
getDisplayName()
Gets the display name for the credentials.abstract boolean
isVisible(ModelObject context)
Tests if credentials with this scope are visible in the supplied context.static CredentialsScope
valueOf(String name)
Returns the enum constant of this type with the specified name.static CredentialsScope[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SYSTEM
public static final CredentialsScope SYSTEM
This credential is only available to the object on which the credential is associated. Typically you would use SYSTEM scoped credentials for things like email auth, agent connection, etc, i.e. where the Jenkins instance itself is using the credential.
-
GLOBAL
public static final CredentialsScope GLOBAL
This credential is available to the object on which the credential is associated and all objects that are children of that object. Typically you would use GLOBAL scoped credentials for things that are needed byJob
s.
-
USER
public static final CredentialsScope USER
This credential is available to the user which which the credential is associated. Typically you would use USER scoped credentials where credentials are required for immediate actions. Some examples could include:- Tag this build
- Deploy artifacts to some container NOW
- etc
Another way of looking at this is, if the action is one that is configured from the
Job
's Configure page, then don't use USER scope, as that prevents another user from modifying the job configuration (because they will only be able to see their own credentials)
-
-
Method Detail
-
values
public static CredentialsScope[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CredentialsScope c : CredentialsScope.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CredentialsScope valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getDisplayName
public abstract String getDisplayName()
Gets the display name for the credentials.- Returns:
- The display name for the credentials.
-
isVisible
public abstract boolean isVisible(ModelObject context)
Tests if credentials with this scope are visible in the supplied context.- Parameters:
context
- the context.- Returns:
true
if credentials with this scope are visible in the supplied context.- Since:
- 2.1.5
-
-