1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
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 
17 #pragma once
18 
19 #include <cstdint>
20 #include <vector>
21 #include <string>
22 #include <map>
23 #include <memory>
24 #include <functional>
25 #include <alibabacloud/oss/Export.h>
26 
27 namespace AlibabaCloud
28 {
29 namespace OSS
30 {
31     enum StorageClass
32     {
33         Standard,       // Standard bucket
34         IA,             // Infrequent Access bucket
35         Archive,        // Archive bucket
36         ColdArchive     // Cold Archive bucket
37     };
38 
39     enum CannedAccessControlList
40     {
41         Private = 0,
42         PublicRead,
43         PublicReadWrite,
44         Default
45     };
46 
47     enum CopyActionList
48     {
49         Copy = 0,
50         Replace
51     };
52 
53     enum EncodingType {
54         STRING_ANY,
55         URL,
56     };
57 
58     enum RequestResponseHeader {
59         ContentType,
60         ContentLanguage,
61         Expires,
62         CacheControl,
63         ContentDisposition,
64         ContentEncoding,
65     };
66 
67     enum RuleStatus
68     {
69         Enabled,
70         Disabled
71     };
72 
73     enum LogLevel
74     {
75         LogOff = 0,
76         LogFatal,
77         LogError,
78         LogWarn,
79         LogInfo,
80         LogDebug,
81         LogTrace,
82         LogAll,
83     };
84 
85     enum LiveChannelStatus
86     {
87         EnabledStatus,
88         DisabledStatus,
89         IdleStatus,
90         LiveStatus,
91         UnknownStatus=99
92     };
93 
94 
95     enum class RequestPayer
96     {
97         NotSet = 0,
98         BucketOwner,
99         Requester
100     };
101 
102     enum class SSEAlgorithm
103     {
104         NotSet = 0,
105         KMS,
106         AES256
107     };
108 
109     enum class DataRedundancyType
110     {
111         NotSet = 0,
112         LRS,
113         ZRS
114     };
115 
116     enum class VersioningStatus
117     {
118         NotSet,
119         Enabled,
120         Suspended
121     };
122 
123     enum class InventoryFormat
124     {
125         NotSet,
126         CSV
127     };
128 
129     enum class InventoryFrequency
130     {
131         NotSet,
132         Daily,
133         Weekly
134     };
135 
136     enum class InventoryOptionalField
137     {
138         NotSet,
139         Size,
140         LastModifiedDate,
141         ETag,
142         StorageClass,
143         IsMultipartUploaded,
144         EncryptionStatus
145     };
146 
147     enum class InventoryIncludedObjectVersions
148     {
149         NotSet,
150         All,
151         Current
152     };
153 
154     enum class TierType
155     {
156         Expedited,
157         Standard,
158         Bulk
159     };
160 
161     typedef void(*LogCallback)(LogLevel level, const std::string& stream);
162 
163     struct  ALIBABACLOUD_OSS_EXPORT caseSensitiveLess
164     {
operatorcaseSensitiveLess165         bool operator() (const std::string& lhs, const std::string& rhs) const
166         {
167             return lhs < rhs;
168         }
169     };
170 
171     struct  ALIBABACLOUD_OSS_EXPORT caseInsensitiveLess
172     {
operatorcaseInsensitiveLess173         bool operator() (const std::string& lhs, const std::string& rhs) const
174         {
175             auto first1 = lhs.begin(), last1 = lhs.end();
176             auto first2 = rhs.begin(), last2 = rhs.end();
177             while (first1 != last1) {
178                 if (first2 == last2)
179                     return false;
180                 auto first1_ch = ::tolower(*first1);
181                 auto first2_ch = ::tolower(*first2);
182                 if (first1_ch != first2_ch) {
183                     return (first1_ch < first2_ch);
184                 }
185                 ++first1; ++first2;
186             }
187             return (first2 != last2);
188         }
189     };
190 
191     using TransferProgressHandler = std::function<void(size_t increment, int64_t transferred, int64_t total, void *userData)>;
192     struct  ALIBABACLOUD_OSS_EXPORT TransferProgress
193     {
194         TransferProgressHandler Handler;
195         void *UserData;
196     };
197 
198     using RefererList = std::vector<std::string>;
199     using MetaData = std::map<std::string, std::string, caseInsensitiveLess>;
200     using HeaderCollection = std::map<std::string, std::string, caseInsensitiveLess>;
201     using ParameterCollection = std::map<std::string, std::string, caseSensitiveLess>;
202     using IOStreamFactory = std::function< std::shared_ptr<std::iostream>(void)>;
203     using ByteBuffer = std::vector<unsigned char>;
204 }
205 }
206