nexuscli.api.script package

Submodules

nexuscli.api.script.model module

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

Bases: nexuscli.api.base_model.BaseModel

A Class representing a Nexus 3 script.

class nexuscli.api.script.model.ScriptCollection(nexus_http: nexuscli.nexus_http.NexusHttp = None)

Bases: nexuscli.api.base_collection.BaseCollection

A class to manage Nexus 3 scripts.

create(script_name, script_content, script_type='groovy')

Create the given script in the Nexus 3 service.

Parameters
  • script_name (str) – name of script to be created.

  • script_content (str) – script code.

  • script_type (str) – type of script to be created.

Raises

exception.NexusClientAPIError – if the script creation isn’t successful; i.e.: any HTTP code other than 204.

create_if_missing(name, content=None, script_type='groovy')

Creates a script in the Nexus 3 service IFF a script with the same name doesn’t exist. Equivalent to checking if the script exists with get() and, if not, creating it with create().

Parameters
  • name (str) – name of script to be created.

  • content (Union[str,NoneType]) – script code. If not given, the method will use nexuscli.nexus_util.groovy_script() to read the script code from a local file.

  • script_type (str) – type of script to be created.

Raises

exception.NexusClientAPIError – if the script creation isn’t successful; i.e.: any HTTP code other than 204.

delete(script_name)

Deletes a script from the Nexus 3 repository.

Parameters

script_name – name of script to be deleted.

Raises

exception.NexusClientAPIError – if the Nexus service fails to delete the script; i.e.: any HTTP code other than 204.

exists(name)

Check if a script exists.

Parameters

name – of script to verify existence.

Returns

True if it exists, false otherwise

Return type

bool

Raises

exception.NexusClientAPIError – if the response from the Nexus service isn’t recognised; i.e.: any HTTP code other than 200, 404.

get(name)

Get a Nexus 3 script by name.

Parameters

name – of script to be retrieved.

Returns

the script or None, if not found

Return type

dict, None

Raises

exception.NexusClientAPIError – if the response from the Nexus service isn’t recognised; i.e.: any HTTP code other than 200, 404.

raw_list()
run(*args, **kwargs)

See run_script()

Module contents