Sign inSign up

grycap/onetrigger

By grycap

•Updated over 7 years ago

Image
0

9.5K

grycap/onetrigger repository overview

⁠OneTrigger

Docker Build Status Build Status PyPi version License

A command-line tool to detect Onedata file events in order to trigger a webhook.

⁠Installation

OneTrigger requires python3 and the python3-pip tool. A package is available at the Python Package Index (PyPI) under the name onetrigger, so you can easily install it executing:

pip3 install onetrigger

You can also download a binary in the releases⁠ section.

⁠Usage

Parameters can be passed via arguments or environment variables. All available commands and his parameters are described below:

⁠Command run

Subscribe to file events.

ArgumentEnvironment variableDescription
-H HOST, --oneprovider-host HOSTONEPROVIDER_HOSTOneprovider hostname or IP.
-t TOKEN, --token TOKENONEDATA_ACCESS_TOKENOnedata access token.
-s SPACE, --space SPACEONEDATA_SPACEOnedata space.
-w WEBHOOK, --webhook WEBHOOKONETRIGGER_WEBHOOKWebhook to send events.
-f FOLDER, --folder FOLDERONEDATA_SPACE_FOLDERFolder to listen events (Optional).
-i, --insecureONEPROVIDER_INSECUREConnect to a provider without a trusted certificate (Optional). Default: False.
⁠Command list-spaces

List your available spaces in Oneprovider.

ArgumentEnvironment variableDescription
-H HOST, --oneprovider-host HOSTONEPROVIDER_HOSTOneprovider hostname or IP.
-t TOKEN, --token TOKENONEDATA_ACCESS_TOKENOnedata access token.
-i, --insecureONEPROVIDER_INSECUREConnect to a provider without a trusted certificate (Optional). Default: False.
⁠Examples
⁠Subscribing to file events
onetrigger run -H example.com -t xxxxx -s my-onedata-space -w http://example.com/webhook -f my-folder
⁠Deploy on Kubernetes

OneTrigger can be deployed on Kubernetes using our public Docker Hub image grycap/onetrigger⁠ by applying a YAML file like this:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: onetrigger
spec:
  replicas: 1
    spec:
      containers:
      - name:  onetrigger
        image: grycap/onetrigger:latest
        imagePullPolicy: Always
        env:
        - name: ONEPROVIDER_HOST
          value: "example.com"
        - name: ONEDATA_ACCESS_TOKEN
          value: "xxxxx"
        - name: ONEDATA_SPACE
          value: "my-onedata-space"
        - name: ONETRIGGER_WEBHOOK
          value: "http://example.com/webhook"
        - name: ONEDATA_SPACE_FOLDER
          value: "my-folder"

⁠Event format

When a new file is created inside the space (or the specified folder) a JSON formatted event is sent to the webhook following the structure of the example shown below:

{
    "Key": "/my-onedata-space/files/file.txt",
    "Records": [
        {
            "objectKey": "file.txt",
            "objectId": "0000034500046EE9C67756964233836666330363031303664303964623739666562393165336632306232613736236664323861626330656664643566313938313333336633356232333838623137",
            "eventTime": "2019-02-07T09:51:04.347823",
            "eventSource": "OneTrigger"
        }
    ]
}

Tag summary

Content type

Image

Digest

Size

35 MB

Last updated

over 7 years ago

docker pull grycap/onetrigger