50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Fill these in
|
|
ACCOUNT_ID=""
|
|
APPLICATION_KEY=""
|
|
BUCKET_ID=""
|
|
|
|
# These need to be populated by get account token
|
|
API_HOST="https://api001.backblazeb2.com"
|
|
ACCOUNT_AUTHORIZATION_TOKEN=""
|
|
|
|
# Get account token
|
|
# curl "https://api.backblazeb2.com/b2api/v1/b2_authorize_account" -u "$ACCOUNT_ID:$APPLICATION_KEY"
|
|
|
|
|
|
# Read CORS rules on bucket
|
|
# curl \
|
|
# -H "Authorization: $ACCOUNT_AUTHORIZATION_TOKEN" \
|
|
# -d "{\"accountId\": \"$ACCOUNT_ID\", \"bucketTypes\": [\"allPrivate\",\"allPublic\"]}" \
|
|
# "$API_HOST/b2api/v1/b2_list_buckets"
|
|
|
|
|
|
# Set CORS rules on bucket
|
|
# read -d "" UPDATE_BUCKET_JSON << EOF
|
|
# {
|
|
# "accountId": "$ACCOUNT_ID",
|
|
# "bucketId": "$BUCKET_ID",
|
|
# "corsRules": [
|
|
# {
|
|
# "allowedHeaders": ["*"],
|
|
# "allowedOperations": [
|
|
# "b2_download_file_by_id",
|
|
# "b2_download_file_by_name",
|
|
# "b2_upload_file"
|
|
# ],
|
|
# "allowedOrigins": [
|
|
# "*"
|
|
# ],
|
|
# "corsRuleName": "downloadFromAnyOrigin",
|
|
# "exposeHeaders": null,
|
|
# "maxAgeSeconds": 3600
|
|
# }
|
|
# ]
|
|
# }
|
|
# EOF
|
|
# curl \
|
|
# -H "Authorization: $ACCOUNT_AUTHORIZATION_TOKEN" \
|
|
# -d "$UPDATE_BUCKET_JSON" \
|
|
# "$API_HOST/b2api/v1/b2_update_bucket"
|