nexuscli.api.cleanup_policy package¶
Submodules¶
nexuscli.api.cleanup_policy.collection module¶
-
class
nexuscli.api.cleanup_policy.collection.
CleanupPolicyCollection
(client=None)¶ Bases:
object
A class to manage Nexus 3 Cleanup Policies.
- Parameters
client (nexuscli.nexus_client.NexusClient) – the client instance that will be used to perform operations against the Nexus 3 service. You must provide this at instantiation or set it before calling any methods that require connectivity to Nexus.
-
GROOVY_SCRIPT_NAME
= 'nexus3-cli-cleanup-policy'¶ Groovy script used by this class
-
create_or_update
(cleanup_policy)¶ Creates the given Cleanup Policy in the Nexus repository. If a policy with the same name already exists, it will be updated.
- Parameters
cleanup_policy (CleanupPolicy) – the policy to create or update.
- Raises
exception.NexusClientCreateCleanupPolicyError – when the Nexus API returns an error or unexpected result.
-
get_by_name
(name)¶ Get a Nexus 3 cleanup policy by its name.
- Parameters
name (str) – name of the wanted policy
- Returns
the requested object
- Return type
- Raises
exception.NexusClientInvalidRepository – when a repository with the given name isn’t found.
-
list
()¶ Return all cleanup policies.
- Returns
every policy as a list of
CleanupPolicy
instances.- Return type
nexuscli.api.cleanup_policy.model module¶
-
class
nexuscli.api.cleanup_policy.model.
CleanupPolicy
(client, **kwargs)¶ Bases:
object
Represents a Nexus Cleanup Policy.
Example structure and attributes common to all repositories:
>>> kwargs = { >>> 'name': 'my-policy', >>> 'format': 'bower', >>> 'notes': 'Some comment', >>> 'criteria': { >>> 'lastDownloaded': 172800, >>> 'lastBlobUpdated': 86400, >>> 'regex': 'matchthis' >>> } >>> }
- Parameters
client (nexuscli.nexus_client.NexusClient) – the client instance that will be used to perform operations against the Nexus 3 service. You must provide this at instantiation or set it before calling any methods that require connectivity to Nexus.
name (str) – name of the new policy.
format (str) – ‘all’ or the format of the repository this policy applies to.
lastDownloaded (int) – deletion criterion: days since artefact last downloaded
lastBlobUpdated (int) – deletion criterion: days since last update to artefact
regex (str) – deletion criterion: only delete artefacts that match this regular expression
-
property
configuration
¶ Nexus 3 Cleanup Policy representation as a python dict. The dict returned by this property can be converted to JSON for use with the
nexus3-cli-cleanup-policy
groovy script created by theCleanupPolicyCollection
methods.- Returns
cleanup policy as a dict
- Return type