Create a new storage helper instance
my $s3 = publiccloud::s3->new(provider => 'EC2', region => 'us-east-1');
Supported providers: 'EC2' (AWS S3), 'AZURE' (Azure Blob Storage)
Generate bucket URI for the provider
my $uri = $s3->get_bucket_uri($bucket_name); # Returns: s3://bucket or gs://bucket
my $uri = $s3->get_bucket_uri($bucket_name, $key); # Returns: s3://bucket/key or gs://bucket/key
Returns the provider-specific URI format. For Azure, returns just the bucket name.
Create a storage bucket/container
$s3->create_bucket($bucket_name);
Upload a file to a storage bucket
$s3->upload_file(bucket => $bucket_name, file => $local_file, [key => $remote_key]);
If key is not specified, the basename of the file is used.
List contents of a storage bucket
my $contents = $s3->list_bucket($bucket_name);
Returns the output of the list command
Download a file from a storage bucket
$s3->download_file(bucket => $bucket_name, key => $remote_key, file => $local_file);
Delete a file from a storage bucket and verify deletion
$s3->delete_file(bucket => $bucket_name, key => $file_key);
Delete a storage bucket (bucket must be empty)
$s3->delete_bucket($bucket_name);
Delete a storage bucket along with any contents it still holds.
$s3->force_delete_bucket($bucket_name);
Intended for cleanup paths where the bucket may not be empty (e.g. mid-test failure).
Verify that a file exists in an S3 bucket
$s3->verify_file_exists(bucket => $bucket_name, key => $file_key);
Dies if the file is not found in the bucket listing.
Verify that two files have the same SHA256 checksum
$s3->verify_checksum(file1 => $path1, file2 => $path2);
Dies if checksums don't match.
Generate a unique S3 bucket name
my $bucket_name = $s3->generate_unique_bucket_name([$prefix]);
Generates a globally unique bucket name using a prefix (default: 'openqa-s3-test') and timestamp. S3 bucket names must be globally unique and DNS-compliant.