func ObjectExists(svc *s3.S3, bucket, objName string) (bool, error) { _, err := svc.HeadBucket(&s3.HeadBucketInput{ Bucket: aws.String(bucket), }) if err != nil { return false, err } return true, nil }
// BucketExists returns if a bucket exists in the S3 API compatible storage func BucketExists(svc *s3.S3, bucketName string) (bool, error) { _, err := svc.HeadBucket(&s3.HeadBucketInput{ Bucket: aws.String(bucketName), }) if err != nil { if awsErr, ok := err.(awserr.Error); ok { if awsErr.Code() == "404" { return false, nil } } return false, err } return true, nil }