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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/s3/model/S3Location.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace S3
{
namespace Model
{
S3Location::S3Location() :
m_bucketNameHasBeenSet(false),
m_prefixHasBeenSet(false),
m_encryptionHasBeenSet(false),
m_cannedACL(ObjectCannedACL::NOT_SET),
m_cannedACLHasBeenSet(false),
m_accessControlListHasBeenSet(false),
m_taggingHasBeenSet(false),
m_userMetadataHasBeenSet(false),
m_storageClass(StorageClass::NOT_SET),
m_storageClassHasBeenSet(false)
{
}
S3Location::S3Location(const XmlNode& xmlNode) :
m_bucketNameHasBeenSet(false),
m_prefixHasBeenSet(false),
m_encryptionHasBeenSet(false),
m_cannedACL(ObjectCannedACL::NOT_SET),
m_cannedACLHasBeenSet(false),
m_accessControlListHasBeenSet(false),
m_taggingHasBeenSet(false),
m_userMetadataHasBeenSet(false),
m_storageClass(StorageClass::NOT_SET),
m_storageClassHasBeenSet(false)
{
*this = xmlNode;
}
S3Location& S3Location::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode bucketNameNode = resultNode.FirstChild("BucketName");
if(!bucketNameNode.IsNull())
{
m_bucketName = Aws::Utils::Xml::DecodeEscapedXmlText(bucketNameNode.GetText());
m_bucketNameHasBeenSet = true;
}
XmlNode prefixNode = resultNode.FirstChild("Prefix");
if(!prefixNode.IsNull())
{
m_prefix = Aws::Utils::Xml::DecodeEscapedXmlText(prefixNode.GetText());
m_prefixHasBeenSet = true;
}
XmlNode encryptionNode = resultNode.FirstChild("Encryption");
if(!encryptionNode.IsNull())
{
m_encryption = encryptionNode;
m_encryptionHasBeenSet = true;
}
XmlNode cannedACLNode = resultNode.FirstChild("CannedACL");
if(!cannedACLNode.IsNull())
{
m_cannedACL = ObjectCannedACLMapper::GetObjectCannedACLForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(cannedACLNode.GetText()).c_str()).c_str());
m_cannedACLHasBeenSet = true;
}
XmlNode accessControlListNode = resultNode.FirstChild("AccessControlList");
if(!accessControlListNode.IsNull())
{
XmlNode accessControlListMember = accessControlListNode.FirstChild("Grant");
while(!accessControlListMember.IsNull())
{
m_accessControlList.push_back(accessControlListMember);
accessControlListMember = accessControlListMember.NextNode("Grant");
}
m_accessControlListHasBeenSet = true;
}
XmlNode taggingNode = resultNode.FirstChild("Tagging");
if(!taggingNode.IsNull())
{
m_tagging = taggingNode;
m_taggingHasBeenSet = true;
}
XmlNode userMetadataNode = resultNode.FirstChild("UserMetadata");
if(!userMetadataNode.IsNull())
{
XmlNode userMetadataMember = userMetadataNode.FirstChild("MetadataEntry");
while(!userMetadataMember.IsNull())
{
m_userMetadata.push_back(userMetadataMember);
userMetadataMember = userMetadataMember.NextNode("MetadataEntry");
}
m_userMetadataHasBeenSet = true;
}
XmlNode storageClassNode = resultNode.FirstChild("StorageClass");
if(!storageClassNode.IsNull())
{
m_storageClass = StorageClassMapper::GetStorageClassForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(storageClassNode.GetText()).c_str()).c_str());
m_storageClassHasBeenSet = true;
}
}
return *this;
}
void S3Location::AddToNode(XmlNode& parentNode) const
{
Aws::StringStream ss;
if(m_bucketNameHasBeenSet)
{
XmlNode bucketNameNode = parentNode.CreateChildElement("BucketName");
bucketNameNode.SetText(m_bucketName);
}
if(m_prefixHasBeenSet)
{
XmlNode prefixNode = parentNode.CreateChildElement("Prefix");
prefixNode.SetText(m_prefix);
}
if(m_encryptionHasBeenSet)
{
XmlNode encryptionNode = parentNode.CreateChildElement("Encryption");
m_encryption.AddToNode(encryptionNode);
}
if(m_cannedACLHasBeenSet)
{
XmlNode cannedACLNode = parentNode.CreateChildElement("CannedACL");
cannedACLNode.SetText(ObjectCannedACLMapper::GetNameForObjectCannedACL(m_cannedACL));
}
if(m_accessControlListHasBeenSet)
{
XmlNode accessControlListParentNode = parentNode.CreateChildElement("AccessControlList");
for(const auto& item : m_accessControlList)
{
XmlNode accessControlListNode = accessControlListParentNode.CreateChildElement("Grant");
item.AddToNode(accessControlListNode);
}
}
if(m_taggingHasBeenSet)
{
XmlNode taggingNode = parentNode.CreateChildElement("Tagging");
m_tagging.AddToNode(taggingNode);
}
if(m_userMetadataHasBeenSet)
{
XmlNode userMetadataParentNode = parentNode.CreateChildElement("UserMetadata");
for(const auto& item : m_userMetadata)
{
XmlNode userMetadataNode = userMetadataParentNode.CreateChildElement("MetadataEntry");
item.AddToNode(userMetadataNode);
}
}
if(m_storageClassHasBeenSet)
{
XmlNode storageClassNode = parentNode.CreateChildElement("StorageClass");
storageClassNode.SetText(StorageClassMapper::GetNameForStorageClass(m_storageClass));
}
}
} // namespace Model
} // namespace S3
} // namespace Aws
|