#!/bin/bash
# 替换namespace
# 替换minio的实际地址和端口
# 修改rabbitmq的实际地址和端口，需要暴露出来

curl https://dl.min.io/client/mc/release/linux-amd64/mc -o mc

export tenant_name=zyyd

mc alias set ${tenant_name} http://192.168.6.4:9000 cmii B#923fC7mk
 
mc mb ${tenant_name}/jadenq ${tenant_name}/tus ${tenant_name}/thumbnail ${tenant_name}/pub-cms ${tenant_name}/live-srs-hls/ ${tenant_name}/mission/ ${tenant_name}/surveillance ${tenant_name}/playback ${tenant_name}/tower ${tenant_name}/modelprocess ${tenant_name}/srs-hls  ${tenant_name}/live-cluster-hls


# mc alias set demo  https://oss.demo.uavcmlc.com:18000 cmii B#923fC7mk
#
# mc cp -r demo/jadenq/scenariomock/xg/ ${tenant_name}/jadenq/scenariomock/xg/
# mc cp -r demo/jadenq/application/file/中移凌云使用手册.pdf ${tenant_name}/jadenq/application/file/中移凌云使用手册.pdf
# mc cp -r demo/jadenq/defimage/def.jpg ${tenant_name}/jadenq/defimage/def.jpg
# mc cp -r demo/pub-cms/application/img/ ${tenant_name}/pub-cms/application/img/


mc admin config set ${tenant_name} notify_amqp:1 delivery_mode="2" exchange_type="direct" no_wait="off" queue_dir="" queue_limit="0"  url="amqp://admin:nYcRN91r._hj@192.168.6.5:35672" auto_deleted="off" durable="on" exchange="cmii.chinamobile.minio.event" internal="off" mandatory="off" routing_key="cmii.chinamobile.material.warehouse"
 
mc admin service restart ${tenant_name}

mc event add ${tenant_name}/mission       arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/modelprocess  arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/live-srs-hls  arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/playback      arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/live-cluster-hls   arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/surveillance  arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/tus           arn:minio:sqs::1:amqp  --event delete

mc ilm add --expiry-days "1" ${tenant_name}/tus

