公有成员函数 | 静态公有成员函数 | 所有成员列表
kvikio::S3Endpoint 类参考

使用 AWS S3 协议的远程端点。 更多...

#include <remote_handle.hpp>

kvikio::S3Endpoint 的继承图
kvikio::RemoteEndpoint

公有成员函数

 S3Endpoint (std::string url, std::optional< std::string > aws_region=std::nullopt, std::optional< std::string > aws_access_key=std::nullopt, std::optional< std::string > aws_secret_access_key=std::nullopt)
 从 URL 创建 S3 端点。 更多...
 
 S3Endpoint (std::string const &bucket_name, std::string const &object_name, std::optional< std::string > aws_region=std::nullopt, std::optional< std::string > aws_access_key=std::nullopt, std::optional< std::string > aws_secret_access_key=std::nullopt, std::optional< std::string > aws_endpoint_url=std::nullopt)
 从桶和对象名称创建 S3 端点。 更多...
 
void setopt (CurlHandle &curl) override
 在 curl 句柄上设置所需的连接选项。 更多...
 
std::string str () const override
 获取此远程点实例的描述。 更多...
 

静态公有成员函数

static std::string url_from_bucket_and_object (std::string const &bucket_name, std::string const &object_name, std::optional< std::string > const &aws_region, std::optional< std::string > aws_endpoint_url)
 从 AWS S3 桶和对象名称获取 URL。 更多...
 
static std::pair< std::string, std::string > parse_s3_url (std::string const &s3_url)
 给定像 "s3://<bucket>/<object>" 这样的 URL,返回桶和对象的名称。 更多...
 

详细描述

使用 AWS S3 协议的远程端点。

定义于文件 remote_handle.hpp 的第 90 行。

构造函数和析构函数文档

◆ S3Endpoint() [1/2]

kvikio::S3Endpoint::S3Endpoint ( std::string  url,
std::optional< std::string >  aws_region = std::nullopt,
std::optional< std::string >  aws_access_key = std::nullopt,
std::optional< std::string >  aws_secret_access_key = std::nullopt 
)

从 URL 创建 S3 端点。

参数
urlS3 文件的完整 http URL。注意:这应该是一个以 "http://" 或 "https://" 开头的 URL。如果您有一个形式为 "s3://<bucket>/<object>" 的 S3 URL,请使用 S3Endpoint::parse_s3_url() 和 `S3Endpoint::url_from_bucket_and_object()` 来转换它。
aws_region要使用的 AWS 区域,例如 "us-east-1"。如果为 nullopt,则使用 AWS_DEFAULT_REGION 环境变量的值。
aws_access_key要使用的 AWS 访问密钥。如果为 nullopt,则使用 AWS_ACCESS_KEY_ID 环境变量的值。
aws_secret_access_key要使用的 AWS 秘密访问密钥。如果为 nullopt,则使用 AWS_SECRET_ACCESS_KEY 环境变量的值。

◆ S3Endpoint() [2/2]

kvikio::S3Endpoint::S3Endpoint ( std::string const &  bucket_name,
std::string const &  object_name,
std::optional< std::string >  aws_region = std::nullopt,
std::optional< std::string >  aws_access_key = std::nullopt,
std::optional< std::string >  aws_secret_access_key = std::nullopt,
std::optional< std::string >  aws_endpoint_url = std::nullopt 
)

从桶和对象名称创建 S3 端点。

参数
bucket_nameS3 桶的名称。
object_nameS3 对象的名称。
aws_region要使用的 AWS 区域,例如 "us-east-1"。如果为 nullopt,则使用 AWS_DEFAULT_REGION 环境变量的值。
aws_access_key要使用的 AWS 访问密钥。如果为 nullopt,则使用 AWS_ACCESS_KEY_ID 环境变量的值。
aws_secret_access_key要使用的 AWS 秘密访问密钥。如果为 nullopt,则使用 AWS_SECRET_ACCESS_KEY 环境变量的值。
aws_endpoint_url通过使用以下方案覆盖端点 URL(包括协议部分):"<aws_endpoint_url>/<bucket_name>/<object_name>"。如果为 nullopt,则使用 AWS_ENDPOINT_URL 环境变量的值。如果也未设置此项,则使用常规的 AWS URL 方案:"https://<bucket_name>.s3.<region>.amazonaws.com/<object_name>"。

成员函数文档

◆ parse_s3_url()

static std::pair<std::string, std::string> kvikio::S3Endpoint::parse_s3_url ( std::string const &  s3_url)
静态

给定像 "s3://<bucket>/<object>" 这样的 URL,返回桶和对象的名称。

异常
std::invalid_argument如果 URL 格式错误或缺少桶或对象名称。
参数
s3_urlS3 URL。
返回值
字符串对:[桶名称, 对象名称]。

◆ setopt()

void kvikio::S3Endpoint::setopt ( CurlHandle curl)
overridevirtual

在 curl 句柄上设置所需的连接选项。

随后,调用 curl.perform() 应该连接到端点。

参数
curlcurl 句柄。

实现 kvikio::RemoteEndpoint

◆ str()

std::string kvikio::S3Endpoint::str ( ) const
overridevirtual

获取此远程点实例的描述。

返回值
字符串描述。

实现 kvikio::RemoteEndpoint

◆ url_from_bucket_and_object()

static std::string kvikio::S3Endpoint::url_from_bucket_and_object ( std::string const &  bucket_name,
std::string const &  object_name,
std::optional< std::string > const &  aws_region,
std::optional< std::string >  aws_endpoint_url 
)
静态

从 AWS S3 桶和对象名称获取 URL。

异常
std::invalid_argument如果未指定区域且环境中未指定默认区域。
参数
bucket_nameS3 桶的名称。
object_nameS3 对象的名称。
aws_region要使用的 AWS 区域,例如 "us-east-1"。如果为 nullopt,则使用 AWS_DEFAULT_REGION 环境变量的值。
aws_endpoint_url通过使用以下方案覆盖端点 URL(包括协议部分):"<aws_endpoint_url>/<bucket_name>/<object_name>"。如果为 nullopt,则使用 AWS_ENDPOINT_URL 环境变量的值。如果也未设置此项,则使用常规的 AWS URL 方案:"https://<bucket_name>.s3.<region>.amazonaws.com/<object_name>"。

此类的文档生成自以下文件