Created
May 31, 2023 03:08
-
-
Save drewgillson/fe9a7f582d507021e33f03b80a4d6f53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOKEN=$(gcloud auth application-default print-access-token) | |
PROJECT_ID="663188713804" | |
DOCUMENT_ID="29oiqkhlqm5o8" | |
ENDPOINT="https://contentwarehouse.googleapis.com/v1/projects/$PROJECT_ID/locations/us/documents/$DOCUMENT_ID:setAcl" | |
# Set the policy | |
POLICY='{ | |
"policy": { | |
"bindings": [ | |
{ | |
"role": "roles/contentwarehouse.documentViewer", | |
"members": [ | |
"user:[email protected]" | |
] | |
} | |
] | |
}, | |
"requestMetadata": { | |
"userInfo": { | |
"id": "user:[email protected]", | |
"groupIds": [] | |
} | |
} | |
}' | |
# Make an API request to grant [email protected] contentwarehouse.documentViewer privileges | |
echo $ENDPOINT | |
curl -s -X POST \ | |
-H "Authorization: Bearer $TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-d "$POLICY" \ | |
$ENDPOINT | jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment