File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ gcloud services enable fitness.googleapis.com
2
+ gcloud services enable storage-api.googleapis.com
3
+ cat > values.json << EOF
4
+ { "name": "$DEVSHELL_PROJECT_ID",
5
+ "location": "us",
6
+ "storageClass": "multi_regional"
7
+ }
8
+ EOF
9
+
10
+
11
+ Go to OAuth 2.0 playground
12
+ Select Cloud Storage API V1
13
+ Select https://www.googleapis.com/auth/devstorage.full_control
14
+ Click Authorize APIs
15
+ Select your Qwiklabs account and then click Continue
16
+ Click Exchange authorization code for tokens
17
+ Now copy the access token
18
+
19
+
20
+ export OAUTH2_TOKEN=
21
+
22
+
23
+ export PROJECT_ID=$(gcloud config get-value project)
24
+ curl -X POST --data-binary @values.json \
25
+ -H "Authorization: Bearer $OAUTH2_TOKEN" \
26
+ -H "Content-Type: application/json" \
27
+ "https://www.googleapis.com/storage/v1/b?project=$PROJECT_ID"
28
+ curl -O demo-image.png https://cdn.qwiklabs.com/E4%2BSx10I0HBeOFPB15BFPzf9%2F%2FOK%2Btf7S0Mbn6aQ8fw%3D
29
+ output=$(realpath demo-image.png)
30
+ export OBJECT=$output
31
+ export BUCKET_NAME=$DEVSHELL_PROJECT_ID
32
+ curl -X POST --data-binary @$OBJECT \
33
+ -H "Authorization: Bearer $OAUTH2_TOKEN" \
34
+ -H "Content-Type: image/png" \
35
+ "https://www.googleapis.com/upload/storage/v1/b/$BUCKET_NAME/o?uploadType=media&name=demo-image"
You can’t perform that action at this time.
0 commit comments