Credential commands

2 minute readReference

createCredential

Creates a new credential for a project.

Arguments

Argument Name Type Description

projectName

String

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

credentialName

String

The name of the credential. (Required)

description

String

Comment text describing this object that is not interpreted at all by CloudBees Flow.

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.

userName

String

The user name for the credential.

Usage

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.apis.model.* ElectricFlow ef = new ElectricFlow() def result = ef.createCredential( projectName: 'test-projectName', credentialName: 'test-credentialName' /* optional arguments */)

deleteCredential

Deletes a credential.

Arguments

Argument Name Type Description

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.apis.model.* ElectricFlow ef = new ElectricFlow() def result = ef.deleteCredential( projectName: 'test-projectName', credentialName: 'test-credentialName')

getCredential

Find a credential by name.

Arguments

Argument Name Type Description

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.apis.model.* ElectricFlow ef = new ElectricFlow() def result = ef.getCredential( projectName: 'test-projectName', credentialName: 'test-credentialName')

getCredentials

Retrieve all credentials in a project.

Arguments

Argument Name Type Description

projectName

String

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

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.apis.model.* 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 Name Type Description

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.apis.model.* ElectricFlow ef = new ElectricFlow() def result = ef.getFullCredential( jobStepId: 'test-jobStepId', credentialName: 'test-credentialName')

modifyCredential

Modifies an existing credential.

Arguments

Argument Name Type Description

projectName

String

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

credentialName

String

The name of the credential. (Required)

description

String

Comment text describing this object that is not interpreted at all by CloudBees Flow.

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.

userName

String

The user name for the credential.

Usage

import com.electriccloud.client.groovy.ElectricFlow import com.electriccloud.client.groovy.apis.model.* ElectricFlow ef = new ElectricFlow() def result = ef.modifyCredential( projectName: 'test-projectName', credentialName: 'test-credentialName' /* optional arguments */)