nexuscli.api.cleanup_policy package

Submodules

nexuscli.api.cleanup_policy.collection module

class nexuscli.api.cleanup_policy.collection.CleanupPolicyCollection(*args, **kwargs)

Bases: nexuscli.api.base_collection.BaseCollection

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: nexuscli.api.cleanup_policy.model.CleanupPolicy)

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 – the policy to create or update.

Raises

exception.NexusClientCreateCleanupPolicyError – when the Nexus API returns an error or unexpected result.

get_by_name(name: str) → nexuscli.api.cleanup_policy.model.CleanupPolicy

Get a Nexus 3 cleanup policy by its name.

Parameters

name – name of the wanted policy

Returns

the requested object

Raises

exception.NexusClientInvalidRepository – when a repository with the given name isn’t found.

raw_list()

Return all cleanup policies.

Returns

every policy as a list of CleanupPolicy instances.

Return type

list[CleanupPolicy]

script_dependencies() → List[str]

This method returns any scripts that the collection class depends on. These will be installed by the NexusClient instance, if not already present on the server.

nexuscli.api.cleanup_policy.model module

class nexuscli.api.cleanup_policy.model.CleanupPolicy(nexus_http: Optional[nexuscli.nexus_http.NexusHttp] = None, **kwargs)

Bases: nexuscli.api.base_model.BaseModel

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

Module contents