nexuscli.api.script package¶
Submodules¶
nexuscli.api.script.model module¶
-
class
nexuscli.api.script.model.
ScriptCollection
(client=None)¶ Bases:
object
A class to manage Nexus 3 scripts.
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. -
client
¶ as per
client
argument ofScriptCollection
.Type: nexuscli.nexus_client.NexusClient
-
create
(script_name, script_content, script_type='groovy')¶ Create the given script in the Nexus 3 service.
Parameters: Raises: exception.NexusClientAPIError – if the script creation isn’t successful; i.e.: any HTTP code other than 204.
-
create_if_missing
(name, content, 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 withcreate()
.Parameters as per
create()
.
-
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.
-
list
()¶ List of all script names on the Nexus 3 service.
Returns: a list of names Return type: list Raises: exception.NexusClientAPIError – if the script names cannot be retrieved; i.e.: any HTTP code other than 200.
-
run
(script_name, data='')¶ Runs an existing script on the Nexus 3 service.
Parameters: - script_name – name of script to be run.
- data – parameters to be passed to the script, via HTTP POST. If the script being run requires a certain format or encoding, you need to prepare it yourself. Typically this is json.dumps(data).
Returns: the content returned by the script, if any.
Return type: Raises: exception.NexusClientAPIError – if the Nexus service fails to run the script; i.e.: any HTTP code other than 200.
-