Groovy API reference

Credential

4 minute readReference

addCredentialToPluginConfiguration

[PREVIEW] This API is in preview mode, and therefore subject to change. Adds a credential to a given plugin configuration.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

pluginConfigurationName

String

Unique name of the plugin configuration within the project. (Required)

credentialName

String

The name of the credential. (Required)

credentialProviderName

String

Name of the credential provider where the credential secret is stored.

credentialProviderProjectName

String

Name of the credential provider project, if different from the credential project.

credentialType

String

Credential type. Default is LOCAL

description

String

Comment text describing this object that is not interpreted at all by CloudBees CD/RO.

newName

String

New name for an existing object that is being renamed.

password

String

The password for the credential. Can also be a certificate or any other chunk of data.

passwordRecoveryAllowed

Boolean

If true, recovering the password by invoking getFullCredential from a job step is allowed.

pluginKey

String

The plugin key.

pluginProjectName

String

The name for the plugin’s project.

secretPath

String

Name of the folder where the password is stored.

test

Boolean

Applicable if credentialProviderName is specified. Whether to test that the credential exists in the secret management system prior to saving. Defaults to true.

userName

String

The user name for the credential.

virtualUserName

String

Applicable for 'cyberark ccp' provider type. This property identifies two identically provisioned accounts in a dual accounts pair under one virtual username.

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.addCredentialToPluginConfiguration(
                projectName: 'test-projectName',
                pluginConfigurationName: 'test-pluginConfigurationName',
                credentialName: 'test-credentialName'
                /* optional arguments */)

createCredential

Creates a new credential for a project.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

credentialName

String

The name of the credential. (Required)

credentialProviderName

String

Name of the credential provider where the credential secret is stored.

credentialProviderProjectName

String

Name of the credential provider project, if different from the credential project.

credentialType

String

Credential type. Default is LOCAL

description

String

Comment text describing this object that is not interpreted at all by CloudBees CD/RO.

password

String

The password for the credential. Can also be a certificate or any other chunk of data.

passwordRecoveryAllowed

Boolean

If true, recovering the password by invoking getFullCredential from a job step is allowed.

secretPath

String

Name of the folder where the password is stored.

test

Boolean

Applicable if credentialProviderName is specified. Whether to test that the credential exists in the secret management system prior to saving. Defaults to true.

userName

String

The user name for the credential.

virtualUserName

String

Applicable for 'cyberark ccp' provider type. This property identifies two identically provisioned accounts in a dual accounts pair under one virtual username.

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.createCredential(
                projectName: 'test-projectName',
                credentialName: 'test-credentialName'
                /* optional arguments */)

deleteCredential

Deletes a credential.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

credentialName

String

The name of the credential. (Required)

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.deleteCredential(
                projectName: 'test-projectName',
                credentialName: 'test-credentialName')

getCredential

Find a credential by name.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

credentialName

String

The name of the credential. (Required)

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.getCredential(
                projectName: 'test-projectName',
                credentialName: 'test-credentialName')

getCredentials

Retrieve all credentials in a project.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

includeHidden

Boolean

If true, return only credentials explicitly created by a user (i.e. not autocreated like for plugin configurations)

usableOnly

Boolean

If true, return only those credentials which the current user has the execute privilege on

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.getCredentials(
                projectName: 'test-projectName'
                /* optional arguments */)

getFullCredential

Find a credential by name from within a running step, including the password.

When invoked in the context of a job step, COMMANDER_JOBSTEPID will be automatically set as the jobStepId argument value unless jobStepId is already specified.

Arguments

Argument NameTypeDescription

jobStepId

String

The id of the job step to use. (Required)

credentialName

String

The name of the credential. (Required)

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.getFullCredential(
                jobStepId: 'test-jobStepId',
                credentialName: 'test-credentialName')

modifyCredential

Modifies an existing credential.

Arguments

Argument NameTypeDescription

projectName

String

The name for the project that must be unique among all projects. (Required)

credentialName

String

The name of the credential. (Required)

credentialProviderName

String

Name of the credential provider where the credential secret is stored.

credentialProviderProjectName

String

Name of the credential provider project, if different from the credential project.

credentialType

String

Credential type. Default is LOCAL

description

String

Comment text describing this object that is not interpreted at all by CloudBees CD/RO.

newName

String

New name for an existing object that is being renamed.

password

String

The password for the credential. Can also be a certificate or any other chunk of data.

passwordRecoveryAllowed

Boolean

If true, recovering the password by invoking getFullCredential from a job step is allowed.

secretPath

String

Name of the folder where the password is stored.

test

Boolean

Applicable if credentialProviderName is specified. Whether to test that the credential exists in the secret management system prior to saving. Defaults to true.

userName

String

The user name for the credential.

virtualUserName

String

Applicable for 'cyberark ccp' provider type. This property identifies two identically provisioned accounts in a dual accounts pair under one virtual username.

Usage

import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.*


ElectricFlow ef = new ElectricFlow()

def result = ef.modifyCredential(
                projectName: 'test-projectName',
                credentialName: 'test-credentialName'
                /* optional arguments */)