blob: 5d0b930e01afe4d6461ca3b303f9f4f787fdcc82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#pragma once
#include "clickhouse_config.h"
#if USE_AWS_S3
#include <IO/S3/URI.h>
#include <IO/S3/ProviderType.h>
// #include <aws/core/endpoint/EndpointParameter.h>
#include <aws/s3/model/HeadObjectRequest.h>
#include <aws/s3/model/ListObjectsV2Request.h>
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/s3/model/AbortMultipartUploadRequest.h>
#include <aws/s3/model/CreateMultipartUploadRequest.h>
#include <aws/s3/model/CompleteMultipartUploadRequest.h>
#include <aws/s3/model/CopyObjectRequest.h>
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/s3/model/UploadPartRequest.h>
#include <aws/s3/model/UploadPartCopyRequest.h>
#include <aws/s3/model/DeleteObjectRequest.h>
#include <aws/s3/model/DeleteObjectsRequest.h>
namespace DB::S3
{
namespace Model = Aws::S3::Model;
template <typename BaseRequest>
class ExtendedRequest : public BaseRequest
{
public:
// Aws::Endpoint::EndpointParameters GetEndpointContextParams() const override
// {
// auto params = BaseRequest::GetEndpointContextParams();
// if (!region_override.empty())
// params.emplace_back("Region", region_override);
// if (uri_override.has_value())
// {
// static const Aws::String AWS_S3_FORCE_PATH_STYLE = "ForcePathStyle";
// params.emplace_back(AWS_S3_FORCE_PATH_STYLE, !uri_override->is_virtual_hosted_style);
// params.emplace_back("Endpoint", uri_override->endpoint);
// }
// return params;
// }
void overrideRegion(std::string region) const
{
region_override = std::move(region);
}
void overrideURI(S3::URI uri) const
{
uri_override = std::move(uri);
}
const auto & getURIOverride() const
{
return uri_override;
}
void setApiMode(ApiMode api_mode_) const
{
api_mode = api_mode_;
}
protected:
mutable std::string region_override;
mutable std::optional<S3::URI> uri_override;
mutable ApiMode api_mode{ApiMode::AWS};
};
class CopyObjectRequest : public ExtendedRequest<Model::CopyObjectRequest>
{
public:
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
};
using HeadObjectRequest = ExtendedRequest<Model::HeadObjectRequest>;
using ListObjectsV2Request = ExtendedRequest<Model::ListObjectsV2Request>;
using ListObjectsRequest = ExtendedRequest<Model::ListObjectsRequest>;
using GetObjectRequest = ExtendedRequest<Model::GetObjectRequest>;
using CreateMultipartUploadRequest = ExtendedRequest<Model::CreateMultipartUploadRequest>;
using CompleteMultipartUploadRequest = ExtendedRequest<Model::CompleteMultipartUploadRequest>;
using AbortMultipartUploadRequest = ExtendedRequest<Model::AbortMultipartUploadRequest>;
using UploadPartRequest = ExtendedRequest<Model::UploadPartRequest>;
using UploadPartCopyRequest = ExtendedRequest<Model::UploadPartCopyRequest>;
using PutObjectRequest = ExtendedRequest<Model::PutObjectRequest>;
using DeleteObjectRequest = ExtendedRequest<Model::DeleteObjectRequest>;
using DeleteObjectsRequest = ExtendedRequest<Model::DeleteObjectsRequest>;
class ComposeObjectRequest : public ExtendedRequest<Aws::S3::S3Request>
{
public:
inline const char * GetServiceRequestName() const override { return "ComposeObject"; }
AWS_S3_API Aws::String SerializePayload() const override;
AWS_S3_API void AddQueryStringParameters(Aws::Http::URI & uri) const override;
AWS_S3_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
// AWS_S3_API EndpointParameters GetEndpointContextParams() const override;
const Aws::String & GetBucket() const;
bool BucketHasBeenSet() const;
void SetBucket(const Aws::String & value);
void SetBucket(Aws::String && value);
void SetBucket(const char* value);
const Aws::String & GetKey() const;
bool KeyHasBeenSet() const;
void SetKey(const Aws::String & value);
void SetKey(Aws::String && value);
void SetKey(const char * value);
void SetComponentNames(std::vector<Aws::String> component_names_);
void SetContentType(Aws::String value);
private:
Aws::String bucket;
Aws::String key;
std::vector<Aws::String> component_names;
Aws::String content_type;
};
}
#endif
|