124 lines
2.8 KiB
Bash
124 lines
2.8 KiB
Bash
#!/bin/bash
|
|
# Reset all van quota data to default values
|
|
# Usage sl_setvanquota.sh [--vanId vanId] [--s3 bucketId]
|
|
|
|
SCRIPT=$0
|
|
echo "[OK] Script: ${SCRIPT}"
|
|
# Absolute path this script is in, thus /home/user/bin
|
|
SCRIPTPATH=`dirname ${SCRIPT}`
|
|
echo "[OK] This script is located at: $SCRIPTPATH"
|
|
|
|
# get helpers
|
|
#source ${SCRIPTPATH}/sequencelogic-helpers.sh
|
|
|
|
# args
|
|
VANID="urn:sl:000000:::"
|
|
if [ "$1" = "--vanId" ]; then
|
|
shift
|
|
VANID=$1
|
|
shift
|
|
fi
|
|
S3BUCKETID=com.sequencelogic.sgdm.prod
|
|
|
|
### TODO!!! s3secretKey and s3accessKey are defaults! ###
|
|
### Parameterize per server/VAN
|
|
|
|
echo "*** Using VAN: ${VANID} and S3 bucket: ${S3BUCKETID} ***"
|
|
|
|
json=`cat <<EOF
|
|
db.van.update({_id:'${VANID}'}, {\\$set: {quotas: [
|
|
{
|
|
plan_id: "UNLIMITED",
|
|
name: "Internally Unlimited",
|
|
description:"Unlimited for internal users",
|
|
overview: "Robots!",
|
|
billing_cycle: "perpetual",
|
|
cost: 0.0,
|
|
team_support: false,
|
|
user_limit: 200,
|
|
max_file_size: 2147483648,
|
|
cardinality: 1,
|
|
sde_ios: false,
|
|
sde_android: false,
|
|
locations: [
|
|
{type:"L1",kind:"FS",bucket_id:""}
|
|
,{type:"L2",kind:"FS",bucket_id:""}
|
|
//,{type:"CS",kind:"S3",bucket_id:"${S3BUCKETID}", "s3accessKey": "AKIAIFXLIM5HXO6Z6YNA", "s3secretKey": "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"}
|
|
],
|
|
size_limits: {
|
|
enforce: "none",
|
|
storage: [
|
|
{
|
|
mount: ".",
|
|
lbl: "all",
|
|
max: 1281090684262400,
|
|
warn: 1000000000000000,
|
|
action:"none"
|
|
}
|
|
]
|
|
},
|
|
rate_limits: {
|
|
enforce: "none",
|
|
bandwidth: [
|
|
{
|
|
mount:".",
|
|
lbl:"monthly cap",
|
|
max: 107374182400,
|
|
warn:100000000000,
|
|
time_unit:"month",
|
|
action:"throttle"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
// shared by all group+network members
|
|
plan_id: "GROUP",
|
|
name: "Group Plan",
|
|
description: "User Group Product Configuration",
|
|
overview: "Group Capabilities",
|
|
billing_cycle: "perpetual",
|
|
cost: 0,
|
|
team_support: true,
|
|
max_file_size: 2147483648,
|
|
cardinality: 1,
|
|
sde_ios: false,
|
|
sde_android: false,
|
|
locations: [
|
|
{type:"L1",kind:"FS",bucket_id:""}
|
|
,{type:"L2",kind:"FS",bucket_id:""}
|
|
//,{type:"CS",kind:"S3",bucket_id:"${S3BUCKETID}", "s3accessKey": "AKIAIFXLIM5HXO6Z6YNA", "s3secretKey": "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"}
|
|
],
|
|
user_limit: 1000,
|
|
size_limits: {
|
|
enforce: "upload-download",
|
|
storage: [
|
|
{
|
|
mount: ".",
|
|
lbl: "all",
|
|
max: 0,
|
|
warn: 0,
|
|
action: "none"
|
|
}
|
|
]
|
|
},
|
|
rate_limits: {
|
|
enforce: "upload-download",
|
|
bandwidth: [
|
|
{
|
|
mount:".",
|
|
lbl:"monthly cap",
|
|
max: 0,
|
|
warn: 0,
|
|
time_unit:"month",
|
|
action:"none"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
|
|
]}})
|
|
EOF
|
|
`
|
|
mongoExec "$json"
|