Skip to content

Commit ba59741

Browse files
committed
[Add] - add the function aws_s3_get_location and aws_s3_get_presign_url
1 parent 2fe6807 commit ba59741

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

services/s3.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ aws_s3_rm_with_hint() {
9494
aws_s3_rm_instruction $(peco_create_menu 'peco_aws_s3_list')
9595
}
9696

97+
#
98+
# TODO aws_s3_get_location for getting bucket location.
99+
# @param TODO The first parameter is the bucket name.
100+
# @return Buckets in Region us-east-1 have a LocationConstraint of null .
101+
#
102+
aws_s3_get_location() {
103+
aws_run_commandline "\
104+
aws s3api get-bucket-location --bucket ${1}
105+
"
106+
}
107+
108+
aws_s3_get_location_with_hint() {
109+
#
110+
aws_s3_get_location $(peco_create_menu 'peco_aws_s3_list')
111+
}
112+
97113
aws_s3_get_bucket_policy() {
98114
aws_s3_bucket_name=$1
99115
aws_run_commandline \
@@ -107,3 +123,19 @@ aws_s3_get_bucket_policy() {
107123
aws_s3_get_bucket_policy_with_hint() {
108124
aws_s3_get_bucket_policy $(peco_create_menu 'peco_aws_s3_list')
109125
}
126+
127+
#
128+
# TODO to get presign url for s3 object.
129+
# @param The first parameter is the full path of object including s3 bucket name
130+
# For ex: s3://DOC-EXAMPLE-BUCKET/test2.txt
131+
# The second parameter is the expires-in (integer) Number of seconds until the pre-signed URL expires.
132+
# Default is 3600 seconds.
133+
# @return
134+
#
135+
136+
aws_s3_get_presigned_url() {
137+
aws_run_commandline "\
138+
aws s3 presign $1 --expires-in ${2:-3600}
139+
"
140+
141+
}

0 commit comments

Comments
 (0)