(C) Example: Http.S3_FileExists method
Demonstrates the S3_FileExists method.
#include <C_CkHttp.h>
void ChilkatSample(void)
{
HCkHttp http;
const char *bucketName;
const char *objectName;
int retval;
http = CkHttp_Create();
// Insert your AWS keys here:
CkHttp_putAwsAccessKey(http,"AWS_ACCESS_KEY");
CkHttp_putAwsSecretKey(http,"AWS_SECRET_KEY");
bucketName = "chilkat.ocean";
objectName = "seahorse.jpg";
CkHttp_putAwsRegion(http,"us-west-2");
CkHttp_putAwsEndpoint(http,"s3-us-west-2.amazonaws.com");
retval = CkHttp_S3_FileExists(http,bucketName,objectName);
if (retval < 0) {
printf("Failed to check for the S3 object existence\n");
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
return;
}
if (retval == 0) {
printf("The S3 object does not exist.\n");
CkHttp_Dispose(http);
return;
}
printf("The S3 object exists.\n");
CkHttp_Dispose(http);
}
|