Minio


This integration adds interaction with Minio. Also enables to listen for bucket notifications: watch docs

To download or upload files, folders must be added to whitelist_external_dirs.

Configuration

To enable the Minio integration in your installation, add the following to your configuration.yaml file:

minio:
  host: localhost
  port: 9000
  access_key: ACCESS_KEY
  secret_key: SECRET_KEY
  secure: false

Configuration Variables

host

(string)(Required)

Minio server host

port

(integer)(Required)

Minio server port

access_key

(string)(Required)

Minio server access key

secret_key

(string)(Required)

Minio server secret key

secure

(boolean)(Required)

Whether to use http or https connection

Default value:

false

listen

(list)(Optional)

List of configurations to listen for events to

Default value:

[]

bucket

(string)(Required)

Bucket to use

prefix

(string)(Optional)

What prefix to use to filter file events

suffix

(string)(Optional)

What file suffix to use to filter file events

Default value:

.*

events

(string)(Optional)

What file

Default value:

s3:ObjectCreated:*

Automations

Automations can be triggered on new files created on the Minio server using the data_template.

#Automatically upload new local files
automation:
- alias: Upload camera snapshot
  trigger:
    platform: event
    event_type: folder_watcher
    event_data:
      event_type: created
  action:
    - delay: '00:00:01'
    - service: minio.put
      data_template:
        file_path: "{{ trigger.event.data.path }}"
        bucket: "camera-image-object-detection"
        key: "input/{{ now().year }}/{{ (now().month | string).zfill(2) }}/{{ (now().day | string).zfill(2) }}/{{ trigger.event.data.file }}"
    - delay: '00:00:01'
    - service: shell_command.remove_file
      data_template:
        file: "{{ trigger.event.data.path }}"

- alias: Download new Minio file
  trigger:
  - platform: event
    event_type: minio
    
  condition: []
  action:
  - service: minio.get
    data_template:
      bucket: "{{trigger.event.data.bucket}}"
      key: "{{trigger.event.data.key}}"
      file_path: "/tmp/{{ trigger.event.data.file_name }}"

Platform Services

These services are provided:

  • get
  • put
  • remove

Service minio.get

Download file.

Service data attribute Required Description
bucket yes Bucket to use
key yes Object key of the file
file_path yes File path on the local file system

Service minio.put

Upload file.

Service data attribute Required Description
bucket yes Bucket to use
key yes Object key of the file
file_path yes File path on the local file system

Service minio.remove

Delete file.

Service data attribute Required Description
bucket yes Bucket to use
key yes Object key of the file