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 #include <alibabacloud/oss/model/Bucket.h>
19 #include <vector>
20 #include <memory>
21 #include <iostream>
22 #include <alibabacloud/oss/OssResult.h>
23 #include <alibabacloud/oss/model/Owner.h>
24 
25 namespace AlibabaCloud
26 {
27 namespace OSS
28 {
29     class ListObjectsResult;
30     class ALIBABACLOUD_OSS_EXPORT ObjectSummary
31     {
32     public:
33         ObjectSummary() = default;
Key()34         const std::string& Key() const { return key_; }
ETag()35         const std::string& ETag()const { return eTag_; }
Size()36         int64_t Size() const { return size_; }
LastModified()37         const std::string& LastModified() const { return lastModified_; }
StorageClass()38         const std::string& StorageClass() const { return storageClass_; }
Type()39         const std::string& Type() const { return type_; }
Owner()40         const AlibabaCloud::OSS::Owner& Owner() const { return owner_; }
41     private:
42         friend class ListObjectsResult;
43         std::string key_;
44         std::string eTag_;
45         int64_t size_;
46         std::string lastModified_;
47         std::string storageClass_;
48         std::string type_;
49         AlibabaCloud::OSS::Owner owner_;
50     };
51 
52     using ObjectSummaryList = std::vector<ObjectSummary>;
53 
54     class ALIBABACLOUD_OSS_EXPORT ListObjectsResult : public OssResult
55     {
56     public:
57         ListObjectsResult();
58         ListObjectsResult(const std::string& data);
59         ListObjectsResult(const std::shared_ptr<std::iostream>& data);
60         ListObjectsResult& operator=(const std::string& data);
Name()61         const std::string& Name() const { return name_; }
Prefix()62         const std::string& Prefix() const { return prefix_; }
Marker()63         const std::string& Marker() const { return marker_; }
NextMarker()64         const std::string& NextMarker() const { return nextMarker_; }
Delimiter()65         const std::string& Delimiter() const { return delimiter_; }
EncodingType()66         const std::string& EncodingType() const { return encodingType_; }
MaxKeys()67         int MaxKeys() const { return maxKeys_; }
IsTruncated()68         bool IsTruncated() const { return isTruncated_; }
CommonPrefixes()69         const CommonPrefixeList& CommonPrefixes() const { return commonPrefixes_; }
ObjectSummarys()70         const ObjectSummaryList& ObjectSummarys() const { return objectSummarys_; }
71     private:
72         std::string name_;
73         std::string prefix_;
74         std::string marker_;
75         std::string delimiter_;
76         std::string nextMarker_;
77         std::string encodingType_;
78         bool        isTruncated_;
79         int         maxKeys_;
80         CommonPrefixeList commonPrefixes_;
81         ObjectSummaryList objectSummarys_;
82     };
83 }
84 }
85