(PureBasic) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL. Note: This example requires Chilkat v11.0.0 or greater.
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Insert your access key here:
CkHttp::setCkAwsAccessKey(http, "AWS_ACCESS_KEY")
; Insert your secret key here:
CkHttp::setCkAwsSecretKey(http, "AWS_SECRET_KEY")
CkHttp::setCkAwsRegion(http, "us-west-2")
CkHttp::setCkAwsEndpoint(http, "s3-us-west-2.amazonaws.com")
bucketName.s = "chilkattest"
path.s = "starfish.jpg"
signedUrl.s = CkHttp::ckS3_GenPresignedUrl(http,"GET",1,bucketName,path,3600,"s3")
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
Debug signedUrl
CkHttp::ckDispose(http)
ProcedureReturn
EndProcedure
|