createDataRetentionPolicy

Back to index

Summary

Creates a new DataRetentionPolicy object.
dataRetentionPolicyName
Stringrequired
Unique name of the data retention policy.
action
Stringoptional
The action to take on the data that matches the criteria for the data retention rule.
Possible values: "archiveOnly", "purgeAfterArchive", "purgeOnly"
additionalFilters
Collectionoptional
Additional filter criteria for the object type similar to search filters.
age
Integeroptional
Minimum age of the data to qualify for the data retention rule.
ageUnit
Stringoptional
Time unit for age.
Possible values: "minutes", "hours", "days", "weeks", "months", "years"
associatedTags
Collectionoptional
List of tags that the object can be associated with.
cleanupAssociatedWorkspace
Booleanoptional
Whether or not to cleanup the associated workspace directory with the job or deployment being purged.
cleanupDatabase
Booleanoptional
Whether or not to delete the jobs from the database. If set to false, then cleanupAssociatedWorkspace must be set to true for the jobs or deployments being purged.
description
Stringoptional
Comment text describing this object that is not interpreted at all by CloudBees CD/RO.
enabled
Booleanoptional
True to enable the data retention policy. Defaults to true when creating the data retention policy.
includeSubreleases
Booleanoptional
When set to true subreleases will be automatically included for releases matching the data retention rule. Defaults to false.
numberToRetain
Integeroptional
Number of objects to retain.
objectType
Stringoptional
Type of object for which the retention rule is defined.
Possible values: "ciBuild", "deployment", "job", "pipelineRun", "release"
projectNames
Collectionoptional
List of projects that the object can belong to.
statuses
Collectionoptional
List of statuses for the object such as job status, release status, pipeline run status, or deployment status.

Usage

Perl

$cmdr->createDataRetentionPolicy( "test-dataRetentionPolicyName" # dataRetentionPolicyName # optionals );

ectool

ectool createDataRetentionPolicy \ "test-dataRetentionPolicyName" `# dataRetentionPolicyName` \ # optionals

Examples

Perl

$cmdr->createDataRetentionPolicy('ArchivePolicy1', {objectType -> 'release', projectNames -> 'default', age -> '1', ageUnit -> 'months', action -> 'archiveOnly'});
$cmdr->createDataRetentionPolicy('ArchivePolicy1', {objectType -> 'job', projectNames -> 'default', age -> '1', ageUnit -> 'months', action -> 'archiveOnly'});

ectool

ectool createDataRetentionPolicy ArchivePolicy1 --objectType release --projectNames default --age 1 --ageUnit months --action archiveOnly
ectool createDataRetentionPolicy ArchivePolicy1 --objectType job --projectNames default --age 1 --ageUnit months --action archiveOnly