forked from lix-project/lix
9ff9c3f2f8
This adds support for s3:// URIs in all places where Nix allows URIs, e.g. in builtins.fetchurl, builtins.fetchTarball, <nix/fetchurl.nix> and NIX_PATH. It allows fetching resources from private S3 buckets, using credentials obtained from the standard places (i.e. AWS_* environment variables, ~/.aws/credentials and the EC2 metadata server). This may not be super-useful in general, but since we already depend on aws-sdk-cpp, it's a cheap feature to add.
34 lines
587 B
C++
34 lines
587 B
C++
#pragma once
|
|
|
|
#if ENABLE_S3
|
|
|
|
#include "ref.hh"
|
|
|
|
namespace Aws { namespace Client { class ClientConfiguration; } }
|
|
namespace Aws { namespace S3 { class S3Client; } }
|
|
|
|
namespace nix {
|
|
|
|
struct S3Helper
|
|
{
|
|
ref<Aws::Client::ClientConfiguration> config;
|
|
ref<Aws::S3::S3Client> client;
|
|
|
|
S3Helper();
|
|
|
|
ref<Aws::Client::ClientConfiguration> makeConfig();
|
|
|
|
struct DownloadResult
|
|
{
|
|
std::shared_ptr<std::string> data;
|
|
unsigned int durationMs;
|
|
};
|
|
|
|
DownloadResult getObject(
|
|
const std::string & bucketName, const std::string & key);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|