MinIO C++ SDK
args.h
1 // MinIO C++ Library for Amazon S3 Compatible Cloud Storage
2 // Copyright 2022 MinIO, Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef _MINIO_S3_ARGS_H
17 #define _MINIO_S3_ARGS_H
18 
19 #include <filesystem>
20 
21 #include "http.h"
22 #include "sse.h"
23 #include "types.h"
24 
25 namespace minio {
26 namespace s3 {
27 struct BaseArgs {
28  utils::Multimap extra_headers;
29  utils::Multimap extra_query_params;
30 }; // struct BaseArgs
31 
32 struct BucketArgs : public BaseArgs {
33  std::string bucket;
34  std::string region;
35 
36  error::Error Validate();
37 }; // struct BucketArgs
38 
39 struct ObjectArgs : public BucketArgs {
40  std::string object;
41 
42  error::Error Validate();
43 }; // struct ObjectArgs
44 
45 struct ObjectWriteArgs : public ObjectArgs {
46  utils::Multimap headers;
47  utils::Multimap user_metadata;
48  Sse *sse = NULL;
49  std::map<std::string, std::string> tags;
50  Retention *retention = NULL;
51  bool legal_hold = false;
52 
53  utils::Multimap Headers();
54 }; // struct ObjectWriteArgs
55 
56 struct ObjectVersionArgs : public ObjectArgs {
57  std::string version_id;
58 }; // struct ObjectVersionArgs
59 
61  SseCustomerKey *ssec = NULL;
62 }; // struct ObjectReadArgs
63 
65  size_t *offset = NULL;
66  size_t *length = NULL;
67  std::string match_etag;
68  std::string not_match_etag;
69  utils::Time modified_since;
70  utils::Time unmodified_since;
71 
72  utils::Multimap Headers();
73  utils::Multimap CopyHeaders();
74 }; // struct ObjectConditionalReadArgs
75 
76 struct MakeBucketArgs : public BucketArgs {
77  bool object_lock = false;
78 
79  error::Error Validate();
80 }; // struct MakeBucketArgs
81 
83 
85 
87 
89  std::string upload_id;
90 
91  error::Error Validate();
92 }; // struct AbortMultipartUploadArgs
93 
95  std::string upload_id;
96  std::list<Part> parts;
97 
98  error::Error Validate();
99 }; // struct CompleteMultipartUploadArgs
100 
102  utils::Multimap headers;
103 }; // struct CreateMultipartUploadArgs
104 
106  long object_size = -1;
107  size_t part_size = 0;
108  long part_count = 0;
109  std::string content_type;
110 }; // struct PutObjectBaseArgs
111 
113  std::string_view data;
114  utils::Multimap query_params;
115 }; // struct PutObjectApiArgs
116 
118  std::string upload_id;
119  unsigned int part_number;
120  std::string_view data;
121 
122  error::Error Validate();
123 }; // struct UploadPartArgs
124 
126  std::string upload_id;
127  unsigned int part_number;
128  utils::Multimap headers;
129 
130  error::Error Validate();
131 }; // struct UploadPartCopyArgs
132 
134 
136 
138  std::string filename;
139  bool overwrite;
140 
141  error::Error Validate();
142 }; // struct DownloadObjectArgs
143 
145  http::DataCallback data_callback;
146  void *user_arg = NULL;
147 
148  error::Error Validate();
149 }; // struct GetObjectArgs
150 
151 struct ListObjectsArgs : public BucketArgs {
152  std::string delimiter;
153  bool use_url_encoding_type = true;
154  std::string marker; // only for ListObjectsV1.
155  std::string start_after; // only for ListObjectsV2.
156  std::string key_marker; // only for GetObjectVersions.
157  unsigned int max_keys = 1000;
158  std::string prefix;
159  std::string continuation_token; // only for ListObjectsV2.
160  bool fetch_owner = false; // only for ListObjectsV2.
161  std::string version_id_marker; // only for GetObjectVersions.
162  bool include_user_metadata = false; // MinIO extension for ListObjectsV2.
163  bool recursive = false;
164  bool use_api_v1 = false;
165  bool include_versions = false;
166 }; // struct ListObjectsArgs
167 
169  std::string delimiter;
170  std::string encoding_type;
171  unsigned int max_keys = 1000;
172  std::string prefix;
173 }; // struct ListObjectsCommonArgs
174 
176  std::string marker;
177 
180 }; // struct ListObjectsV1Args
181 
183  std::string start_after;
184  std::string continuation_token;
185  bool fetch_owner;
186  bool include_user_metadata;
187 
190 }; // struct ListObjectsV2Args
191 
193  std::string key_marker;
194  std::string version_id_marker;
195 
198 }; // struct ListObjectVersionsArgs
199 
201  std::istream &stream;
202 
203  PutObjectArgs(std::istream &stream, long objectsize, long partsize);
204  error::Error Validate();
205 }; // struct PutObjectArgs
206 
208 
210  CopySource source;
211  Directive *metadata_directive = NULL;
212  Directive *tagging_directive = NULL;
213 
214  error::Error Validate();
215 }; // struct CopyObjectArgs
216 
218  error::Error BuildHeaders(size_t object_size, std::string etag);
219  size_t ObjectSize();
220  utils::Multimap Headers();
221 
222  private:
223  long object_size_ = -1;
224  utils::Multimap headers_;
225 }; // struct ComposeSource
226 
228  std::list<ComposeSource> sources;
229 
230  error::Error Validate();
231 }; // struct ComposeObjectArgs
232 
234  std::string filename;
235 
236  error::Error Validate();
237 }; // struct PutObjectArgs
238 } // namespace s3
239 } // namespace minio
240 #endif // #ifndef __MINIO_S3_ARGS_H
Definition: error.h:23
Definition: sse.h:35
Definition: sse.h:23
Definition: utils.h:119
Definition: utils.h:97
Definition: args.h:27
Definition: args.h:32
Definition: args.h:227
Definition: args.h:217
Definition: args.h:209
Definition: args.h:137
Definition: args.h:144
Definition: args.h:192
Definition: args.h:151
Definition: args.h:168
Definition: args.h:175
Definition: args.h:182
Definition: args.h:76
Definition: args.h:39
Definition: args.h:60
Definition: args.h:56
Definition: args.h:45
Definition: args.h:112
Definition: args.h:200
Definition: args.h:105
Definition: types.h:118
Definition: args.h:233
Definition: args.h:117
Definition: args.h:125