(Tcl) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL.
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Insert your access key here:
CkHttp_put_AwsAccessKey $http "AWS_ACCESS_KEY"
# Insert your secret key here:
CkHttp_put_AwsSecretKey $http "AWS_SECRET_KEY"
set bucketName "chilkattest"
set path "starfish.jpg"
set expireTime [new_CkDateTime]
CkDateTime_SetFromCurrentSystemTime $expireTime
CkDateTime_AddSeconds $expireTime 3600
set signedUrl [CkHttp_s3_GenerateUrl $http $bucketName $path $expireTime]
if {[CkHttp_get_LastMethodSuccess $http] != 1} then {
puts [CkHttp_lastErrorText $http]
} else {
puts "$signedUrl"
}
delete_CkHttp $http
delete_CkDateTime $expireTime
|