Preview Retention Policy by Policy Model

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: Provides an estimated count and total size of archive candidates based on the provided retention policy model.

Note

This Cold Storage feature is available only for Artifactory Enterprise and Enterprise+ users.

Since: Artifactory 7.27.3

Security: Requires an admin user

Usage: POST /api/retention/archive/policies/preview

Produces: application/json

Consumes: text/plain

Sample Request:

POST /api/retention/archive/policies/preview

Sample Request:

{
    "key": "dfsdf", 
    "aqlQuery": "",
    "description": "",
    "cronExp": "",
    "enabled": true,
    "expirationTimeInMonths": 0,
    "durationInMinutes": 0,
    "nextExecutionTime": null,
    "skipTrashcan": false,
    "packageRetention": true,
    "packageSearchCriteriaForm": {
        "packageType": "generic",
        "packageRepos": [
            "example-repo-local"
        ],
        "componentName": "",
        "version": ""
    }
}

Request Parameters:

Parameters

Type

Description

Required/Optional

packageRetention

boolean

Determines whether the archive policy works on packages (true) or artifacts (false).

The default value is false.

Required

key

string

Unique policy key that identifies the policy.

Required

enabled

boolean

Enable/disable policy. If disabled, policy execution is blocked.

Optional

cronExp

string

The Cron expression for scheduling the policy.

Optional

aqlQuery

string

Search for artifacts to be archived using Artifactory Query Language (AQL). This can be used instead of searchCriteriaForm to include/exclude artifacts in the retention policy.

The AQL query can be to:

  • Include or exclude a repository, inner path, or artifact name (one or many)

  • Include or exclude associated properties (one or many)

  • Include an age

  • Last downloaded before configurable X (weeks, months, years)

  • Deployed before configurable X (weeks, months, years)

Note

You may run AQL queries only on the Item domain. Other primary domains, such as Build, Entry, Promotion, and Release are not supported.

Required if searchCriteriaForm is not provided.

Note

aqlquery cannot be used for packages.

searchCriteriaForm

object

This can be used instead of aqlQuery to include/exclude artifacts in the retention policy.

Required if aqlQuery is not provided

packageType

string

The type of package

Required

packageRepos

string

A list of repositories to which the policy applies

Required

description

string

Description for the policy.

Optional

durationInMinutes

long

The maximum duration (in minutes) for policy execution. If policy execution exceeds this period, it is stopped.

Optional

expirationTimeInMonths

long

The expiration period (in months) that it takes for archived artifacts to be cleaned up from the Cold instance.

Optional

skipTrashcan

boolean

Prevent the transfer of the artifacts to the trash can repository, and allow the artifacts to be deleted by a full GC cleanup.Browsing ArtifactsManaging Disk Space Usage

Default value is false.

Optional

Sample Response:

{
  "count" : 10, //archive candidates count 
  "totalSize" : 80  //total size in bytes
}

Status:

200: Success