export tenant_name=outside
export inner_master_ip=
export minio_host_ip=192.168.1.128

mc alias set ${tenant_name} http://${minio_host_ip}:39000 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 ${tenant_name}/geodata ${tenant_name}/ilm-detect ${tenant_name}/ilm-geodata
echo ""

echo "set rabbit mq"
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@helm-rabbitmq:5672" auto_deleted="off" durable="on" exchange="cmii.chinamobile.minio.event" internal="off" mandatory="off" routing_key="cmii.chinamobile.material.warehouse"
echo ""

echo "sleep 5 s!"
sleep 5

mc admin service restart ${tenant_name}

echo "sleep 5 s!"
sleep 5
echo ""


echo "start to add event notification !"

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}/geodata   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}/ilm-detect  arn:minio:sqs::1:amqp  --event put

mc event add ${tenant_name}/ilm-geodata  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

echo ""
echo "done of init !"