Skip to content

RESOURCECTL

NAME

The main command to manage your resources

SYNOPSIS

resourcectl --url [URL] [--debug|--trust-certificate] [COMMAND] [OPTIONS]

DESCRIPTION

The resourcectl command allows you to manage your resources.

The different commands are :

  • upload : to upload a resource
  • download : to download a resource
  • list : to display resources information
  • register : to push a resource information only
  • delete : to delete a resource (Warning : use this command carefully. It should not be used to update a resource. Instead, push a new resource with a new version number)

Url to Artifacts server

To use resourcectl, you must provide a url to communicate with your artifacts server, if you artifacts server use self-signed certicates, and you want to ignore warning use --trust-certificate option.

Metadata

Each resource is related to a metadata, stored inside a different kind of backend service. A metadata is basically all the information related to a resource, such as the group, name, version, description, etc ...

When a resource is uploaded, a metadata should always be attached to it. To fetch the metadata, a user can execute the list command. To push a resource metadata only, a user can execute the register command.

Resource ID

A resource is uniquely defined using three attributes : the group, the artifact and the version. When downloading a resource, you must also provide the type.

The resulting format must look like <type>:<group>:<artifact>:<version>.

Resource list file

To download multiple files at the same time, you can use a file that describe all resources to download. This file is JSON or YAML formatted and should contain a key "settings.resources" containing a list of resources' ID.

settings:
  resources:
  - <type>:<group>:<artifact>:<version>
  - <type>:<group>:<artifact>:<version>

Types

When downloading a resource, you must provide a type. It tells the resource manager what to do with this resource. Here are the different resource types :

  • file : A simple file to download
  • punch-parsers : A zip containing punch resources such as punchlets, grok patterns...
  • additional-spark-jar : A jar downloaded under the extlib/spark directory.
  • additional-punch-jar : A jar downloaded under the extlib/storm directory.
  • additional-pyspark-pex : A pex downloaded under the extlib/pyspark directory.
  • punchline : A punchline file.
  • patch : A patch file downloaded under the patch directory.

OPTIONS

Common options

Common options MUST be placed BEFORE COMMAND.

  • --url, -u
    backend server URL. with URL format like protocol://host:port[/path] .

  • --debug
    Print additional messages for debugging.

  • --trust-certificate
    Trust self-signed certificates and hostname.

Upload

  • --file, --files, -f
    Path to the source file, or directory to upload

Download

  • --resource, -r
    The ID of the resource to download.

  • --resources-file, -f
    A file containing a resources list to download.

  • --output, -o
    Optional
    Output file on the file system.

List

  • --name, -n
    Optional , default is '*'
    Filter metadata by artifact name.
    The pattern can contain wildcards.

  • --group, -g
    Optional , default is '*'
    Filter metadata by group.
    The pattern can contain wildcards.

  • --type, -t Optional
    Filter metadata by file type.

  • --all
    Optional
    List all version of each resource

Register

  • --name, -n
    Mandatory
    Name of the resource to register inside the storage

  • --path
    Mandatory
    Real location of the resource to register

  • --type Optional Type of the resource

Delete

  • --resource, -r
    The ID of the resource to download.

EXAMPLES

# upload a single file
resourcectl --url http://artifacts.namespace upload -f my_parser.zip 

# upload a directory
resourcectl --url http://artifacts.namespace upload -f my/directory 

# download single file
resourcectl --url https://artifacts.namespace:8443 download --name csv/mylogs.csv --file /data/original_file.csv --type csv

# download multiple file
resourcectl --url https://artifacts.namespace download --resources-list /tmp/resource_list.json --output /tmp/myresources/

# list
resourcectl --url https://artifacts.namespace --debug --trust-certificate list

# delete
resourcectl --url https://artifacts.namespace delete --resources punch-parsers:org.thales.punch:common-parsers:1.0.0