Skip to content

Commit 6bf5d51

Browse files
adjust cos scripts to set instance properly
1 parent 1c331ee commit 6bf5d51

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

beta/serverless-fleets/download

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
# get the current resource group name
44
resource_group_name=$(ibmcloud target -o JSON | jq -r '.resource_group.name')
5+
cos_instance=${resource_group_name/--rg/}--cos
6+
7+
echo "switching to COS instance $cos_instance"
58

69
# configure the COS instance
7-
crn=$(ibmcloud resource service-instances -o json | jq -r '.[] | select( .name | contains("--cos")) | .crn')
8-
ibmcloud cos config crn --crn $crn
10+
crn=$(ibmcloud resource service-instance "${cos_instance}" -o json | jq -r '.[] | .crn')
11+
12+
ibmcloud cos config crn --crn $crn --force
913

1014
# get the bucket names
1115
output_bucket=$(ibmcloud cos buckets --json | jq -r '.Buckets[] | select( .Name | contains("output")) | .Name')

beta/serverless-fleets/upload

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
# get the current resource group name
44
resource_group_name=$(ibmcloud target -o JSON | jq -r '.resource_group.name')
5+
cos_instance=${resource_group_name/--rg/}--cos
6+
7+
echo "switching to COS instance $cos_instance"
58

69
# configure the COS instance
7-
crn=$(ibmcloud resource service-instances -o json | jq -r '.[] | select( .name | contains("--cos")) | .crn')
8-
ibmcloud cos config crn --crn $crn
10+
crn=$(ibmcloud resource service-instance "${cos_instance}" -o json | jq -r '.[] | .crn')
11+
12+
ibmcloud cos config crn --crn $crn --force
913

1014
# get the bucket names
1115
output_bucket=$(ibmcloud cos buckets --json | jq -r '.Buckets[] | select( .Name | contains("output")) | .Name')
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/bin/sh
22

3-
crn=$(ibmcloud resource service-instances -o json | jq -r '.[] | select( .name | contains("--cos")) | .crn')
4-
ibmcloud cos config crn --crn $crn
3+
# get the current resource group name
4+
resource_group_name=$(ibmcloud target -o JSON | jq -r '.resource_group.name')
5+
region=$(ibmcloud target -o JSON | jq -r '.region.name')
6+
cos_instance=${resource_group_name/--rg/}--cos
7+
8+
echo "switching to COS instance $cos_instance"
9+
10+
# configure the COS instance
11+
crn=$(ibmcloud resource service-instance "${cos_instance}" -o json | jq -r '.[] | .crn')
12+
13+
ibmcloud cos config crn --crn $crn --force
14+
ibmcloud cos config endpoint-url --url s3.$region.cloud-object-storage.appdomain.cloud
15+
516
bucket=$(ibmcloud cos buckets --json | jq -r '.Buckets[] | select( .Name | contains("output")) | .Name')
617

18+
echo $bucket
19+
720
watch -n 2 ibmcloud cos list-objects-v2 --bucket "$bucket" --prefix "$1"

0 commit comments

Comments
 (0)