Skip to main content

Trigger webhooks by Onedata events

Project description

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.

Argument Environment variable Description
-H HOST, --oneprovider-host HOST ONEPROVIDER_HOST Oneprovider hostname or IP.
-t TOKEN, --token TOKEN ONEDATA_ACCESS_TOKEN Onedata access token.
-s SPACE, --space SPACE ONEDATA_SPACE Onedata space.
-w WEBHOOK, --webhook WEBHOOK ONETRIGGER_WEBHOOK Webhook to send events.
-f FOLDER, --folder FOLDER ONEDATA_SPACE_FOLDER Folder to listen events (Optional).
-i, --insecure ONEPROVIDER_INSECURE Connect to a provider without a trusted certificate (Optional). Default: False.

Command list-spaces

List your available spaces in Oneprovider.

Argument Environment variable Description
-H HOST, --oneprovider-host HOST ONEPROVIDER_HOST Oneprovider hostname or IP.
-t TOKEN, --token TOKEN ONEDATA_ACCESS_TOKEN Onedata access token.
-i, --insecure ONEPROVIDER_INSECURE Connect 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"
        }
    ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onetrigger-1.0.4.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file onetrigger-1.0.4.tar.gz.

File metadata

  • Download URL: onetrigger-1.0.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for onetrigger-1.0.4.tar.gz
Algorithm Hash digest
SHA256 8337cecbec6ba8c946bf4398b897dcc49a48c92e4410b73e8814fa4ce7b0df21
MD5 bab527d37a95b24a3b5fc1ec9208e382
BLAKE2b-256 301d065cd2b960e0e4edfd7c7a34a50dd19fc4db13006b2fa8f46dd9beaf13d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page