1 /***********************************************************************************************************************************
2 S3 Storage Internal
3 ***********************************************************************************************************************************/
4 #ifndef STORAGE_S3_STORAGE_INTERN_H
5 #define STORAGE_S3_STORAGE_INTERN_H
6 
7 /***********************************************************************************************************************************
8 Object type
9 ***********************************************************************************************************************************/
10 typedef struct StorageS3 StorageS3;
11 
12 #include "common/io/http/request.h"
13 #include "storage/s3/storage.h"
14 
15 /***********************************************************************************************************************************
16 Functions
17 ***********************************************************************************************************************************/
18 // Perform async request
19 typedef struct StorageS3RequestAsyncParam
20 {
21     VAR_PARAM_HEADER;
22     const HttpQuery *query;                                         // Query parameters
23     const Buffer *content;                                          // Request content
24 } StorageS3RequestAsyncParam;
25 
26 #define storageS3RequestAsyncP(this, verb, path, ...)                                                                              \
27     storageS3RequestAsync(this, verb, path, (StorageS3RequestAsyncParam){VAR_PARAM_INIT, __VA_ARGS__})
28 
29 HttpRequest *storageS3RequestAsync(StorageS3 *this, const String *verb, const String *path, StorageS3RequestAsyncParam param);
30 
31 // Get async response
32 typedef struct StorageS3ResponseParam
33 {
34     VAR_PARAM_HEADER;
35     bool allowMissing;                                              // Allow missing files (caller can check response code)
36     bool contentIo;                                                 // Is IoRead interface required to read content?
37 } StorageS3ResponseParam;
38 
39 #define storageS3ResponseP(request, ...)                                                                                           \
40     storageS3Response(request, (StorageS3ResponseParam){VAR_PARAM_INIT, __VA_ARGS__})
41 
42 HttpResponse *storageS3Response(HttpRequest *request, StorageS3ResponseParam param);
43 
44 // Perform sync request
45 typedef struct StorageS3RequestParam
46 {
47     VAR_PARAM_HEADER;
48     const HttpQuery *query;                                         // Query parameters
49     const Buffer *content;                                          // Request content
50     bool allowMissing;                                              // Allow missing files (caller can check response code)
51     bool contentIo;                                                 // Is IoRead interface required to read content?
52 } StorageS3RequestParam;
53 
54 #define storageS3RequestP(this, verb, path, ...)                                                                                   \
55     storageS3Request(this, verb, path, (StorageS3RequestParam){VAR_PARAM_INIT, __VA_ARGS__})
56 
57 HttpResponse *storageS3Request(StorageS3 *this, const String *verb, const String *path, StorageS3RequestParam param);
58 
59 /***********************************************************************************************************************************
60 Macros for function logging
61 ***********************************************************************************************************************************/
62 #define FUNCTION_LOG_STORAGE_S3_TYPE                                                                                               \
63     StorageS3 *
64 #define FUNCTION_LOG_STORAGE_S3_FORMAT(value, buffer, bufferSize)                                                                  \
65     objToLog(value, "StorageS3", buffer, bufferSize)
66 
67 #endif
68