SSS - S3 Toolkit 0.9.6
S3 client library and applications
Loading...
Searching...
No Matches
S3Client

S3 client interface. Functions to send S3 requests, and perform parallel uploading and downloading data from memory and files. More...

Data Structures

struct  sss::S3Credentials
 S3 Credentials in AWS format. More...
 
struct  sss::S3ClientConfig
 Parameters for SendS3Request calls. More...
 
struct  sss::S3DataTransferConfig
 Parameters for calls to upload and download functions. More...
 
struct  sss::BucketValidation
 Returned from ValidateBucket function. More...
 

Functions

S3Credentials sss::GetS3Credentials (const std::string &fileName, std::string awsProfile)
 read S3 credentials from file in AWS S3 format (Toml).
 
BucketValidation sss::ValidateBucket (const std::string name)
 Validate bucket name. Bucket name restrictions: see https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html.
 
Headers sss::ToMeta (const std::map< std::string, std::string > &metaData)
 Translate metadata (key,value) pairs to amz- format and return header map which can be merged with other headers using the std::map::merge method, since C++17.
 
void sss::Validate (const S3ClientConfig &s)
 Validate S3 client request parameters.
 
WebClient sss::SendS3Request (S3ClientConfig cfg)
 Send S3 request to endpoint.
 
ETag sss::Upload (const S3DataTransferConfig &cfg, const MetaDataMap &mm={}, bool sync=false)
 Parallel upload If cfg.data not NULL data is read from memory, from file specified in cfg.file instead.
 
void sss::Download (const S3DataTransferConfig &cfg, bool sync=false, const std::string &versionId="")
 Parallel upload If cfg.data not NULL data is written into cfg.data buffer, to file specified in cfg.file instead.
 

Detailed Description

S3 client interface. Functions to send S3 requests, and perform parallel uploading and downloading data from memory and files.

Function Documentation

◆ Download()

void sss::Download ( const S3DataTransferConfig cfg,
bool  sync = false,
const std::string &  versionId = "" 
)

Parallel upload If cfg.data not NULL data is written into cfg.data buffer, to file specified in cfg.file instead.

Parameters
[in]cfgdata transfer configuration,
See also
S3DataTransferConfig
Parameters
[in]syncif sync==true perform serial transfer
[in]versionIdversion id or blank for latest version or in case versioning not enabled

◆ GetS3Credentials()

S3Credentials sss::GetS3Credentials ( const std::string &  fileName,
std::string  awsProfile 
)

read S3 credentials from file in AWS S3 format (Toml).

Read S3 credentials from file.

Parameters
[in]fileNameinput file, if empty will try to read from $HOME/.aws/credentials
[in]awsProfileAWS profile, if empty select default profile; not a reference because could be modified internally
Returns
S3Credentials instance
See also
S3Credentials
Parameters
[in]fileNamename of configuration file in AWS TOML format
[in]awsProfileprofile

◆ ToMeta()

Map sss::ToMeta ( const std::map< std::string, std::string > &  metaData)

Translate metadata (key,value) pairs to amz- format and return header map which can be merged with other headers using the std::map::merge method, since C++17.

Adds x-amz-meta- prefix to map keys and checks that total size is less than maximum metadata header size (currently 2kB).

◆ Upload()

string sss::Upload ( const S3DataTransferConfig cfg,
const MetaDataMap mm = {},
bool  sync = false 
)

Parallel upload If cfg.data not NULL data is read from memory, from file specified in cfg.file instead.

Parameters
[in]cfgdata transfer configuration,
See also
S3DataTransferConfig
Parameters
[in]syncif sync==true perform serial transfer

References sss::S3DataTransferConfig::data, sss::S3DataTransferConfig::file, and sss::S3DataTransferConfig::size.

◆ ValidateBucket()

BucketValidation sss::ValidateBucket ( const std::string  name)

Validate bucket name. Bucket name restrictions: see https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html.

Parameters
[in]namebucket name
Returns
true if valid false + error message if invalid