1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #pragma once 7 #include <aws/s3/S3_EXPORTS.h> 8 #include <aws/core/utils/memory/stl/AWSString.h> 9 #include <utility> 10 11 namespace Aws 12 { 13 namespace Utils 14 { 15 namespace Xml 16 { 17 class XmlNode; 18 } // namespace Xml 19 } // namespace Utils 20 namespace S3 21 { 22 namespace Model 23 { 24 25 /** 26 * <p>A container for describing a condition that must be met for the specified 27 * redirect to apply. For example, 1. If request is for pages in the 28 * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If 29 * request results in HTTP error 4xx, redirect request to another host where you 30 * might process the error.</p><p><h3>See Also:</h3> <a 31 * href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Condition">AWS API 32 * Reference</a></p> 33 */ 34 class AWS_S3_API Condition 35 { 36 public: 37 Condition(); 38 Condition(const Aws::Utils::Xml::XmlNode& xmlNode); 39 Condition& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); 40 41 void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; 42 43 44 /** 45 * <p>The HTTP error code when the redirect is applied. In the event of an error, 46 * if the error code equals this value, then the specified redirect is applied. 47 * Required when parent element <code>Condition</code> is specified and sibling 48 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 49 * must be true for the redirect to be applied.</p> 50 */ GetHttpErrorCodeReturnedEquals()51 inline const Aws::String& GetHttpErrorCodeReturnedEquals() const{ return m_httpErrorCodeReturnedEquals; } 52 53 /** 54 * <p>The HTTP error code when the redirect is applied. In the event of an error, 55 * if the error code equals this value, then the specified redirect is applied. 56 * Required when parent element <code>Condition</code> is specified and sibling 57 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 58 * must be true for the redirect to be applied.</p> 59 */ HttpErrorCodeReturnedEqualsHasBeenSet()60 inline bool HttpErrorCodeReturnedEqualsHasBeenSet() const { return m_httpErrorCodeReturnedEqualsHasBeenSet; } 61 62 /** 63 * <p>The HTTP error code when the redirect is applied. In the event of an error, 64 * if the error code equals this value, then the specified redirect is applied. 65 * Required when parent element <code>Condition</code> is specified and sibling 66 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 67 * must be true for the redirect to be applied.</p> 68 */ SetHttpErrorCodeReturnedEquals(const Aws::String & value)69 inline void SetHttpErrorCodeReturnedEquals(const Aws::String& value) { m_httpErrorCodeReturnedEqualsHasBeenSet = true; m_httpErrorCodeReturnedEquals = value; } 70 71 /** 72 * <p>The HTTP error code when the redirect is applied. In the event of an error, 73 * if the error code equals this value, then the specified redirect is applied. 74 * Required when parent element <code>Condition</code> is specified and sibling 75 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 76 * must be true for the redirect to be applied.</p> 77 */ SetHttpErrorCodeReturnedEquals(Aws::String && value)78 inline void SetHttpErrorCodeReturnedEquals(Aws::String&& value) { m_httpErrorCodeReturnedEqualsHasBeenSet = true; m_httpErrorCodeReturnedEquals = std::move(value); } 79 80 /** 81 * <p>The HTTP error code when the redirect is applied. In the event of an error, 82 * if the error code equals this value, then the specified redirect is applied. 83 * Required when parent element <code>Condition</code> is specified and sibling 84 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 85 * must be true for the redirect to be applied.</p> 86 */ SetHttpErrorCodeReturnedEquals(const char * value)87 inline void SetHttpErrorCodeReturnedEquals(const char* value) { m_httpErrorCodeReturnedEqualsHasBeenSet = true; m_httpErrorCodeReturnedEquals.assign(value); } 88 89 /** 90 * <p>The HTTP error code when the redirect is applied. In the event of an error, 91 * if the error code equals this value, then the specified redirect is applied. 92 * Required when parent element <code>Condition</code> is specified and sibling 93 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 94 * must be true for the redirect to be applied.</p> 95 */ WithHttpErrorCodeReturnedEquals(const Aws::String & value)96 inline Condition& WithHttpErrorCodeReturnedEquals(const Aws::String& value) { SetHttpErrorCodeReturnedEquals(value); return *this;} 97 98 /** 99 * <p>The HTTP error code when the redirect is applied. In the event of an error, 100 * if the error code equals this value, then the specified redirect is applied. 101 * Required when parent element <code>Condition</code> is specified and sibling 102 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 103 * must be true for the redirect to be applied.</p> 104 */ WithHttpErrorCodeReturnedEquals(Aws::String && value)105 inline Condition& WithHttpErrorCodeReturnedEquals(Aws::String&& value) { SetHttpErrorCodeReturnedEquals(std::move(value)); return *this;} 106 107 /** 108 * <p>The HTTP error code when the redirect is applied. In the event of an error, 109 * if the error code equals this value, then the specified redirect is applied. 110 * Required when parent element <code>Condition</code> is specified and sibling 111 * <code>KeyPrefixEquals</code> is not specified. If both are specified, then both 112 * must be true for the redirect to be applied.</p> 113 */ WithHttpErrorCodeReturnedEquals(const char * value)114 inline Condition& WithHttpErrorCodeReturnedEquals(const char* value) { SetHttpErrorCodeReturnedEquals(value); return *this;} 115 116 117 /** 118 * <p>The object key name prefix when the redirect is applied. For example, to 119 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 120 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 121 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 122 * all objects in the <code>docs/</code> folder. Required when the parent element 123 * <code>Condition</code> is specified and sibling 124 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 125 * are specified, both must be true for the redirect to be applied.</p> 126 * <p>Replacement must be made for object keys containing special characters (such 127 * as carriage returns) when using XML requests. For more information, see <a 128 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 129 * XML related object key constraints</a>.</p> 130 */ GetKeyPrefixEquals()131 inline const Aws::String& GetKeyPrefixEquals() const{ return m_keyPrefixEquals; } 132 133 /** 134 * <p>The object key name prefix when the redirect is applied. For example, to 135 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 136 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 137 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 138 * all objects in the <code>docs/</code> folder. Required when the parent element 139 * <code>Condition</code> is specified and sibling 140 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 141 * are specified, both must be true for the redirect to be applied.</p> 142 * <p>Replacement must be made for object keys containing special characters (such 143 * as carriage returns) when using XML requests. For more information, see <a 144 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 145 * XML related object key constraints</a>.</p> 146 */ KeyPrefixEqualsHasBeenSet()147 inline bool KeyPrefixEqualsHasBeenSet() const { return m_keyPrefixEqualsHasBeenSet; } 148 149 /** 150 * <p>The object key name prefix when the redirect is applied. For example, to 151 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 152 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 153 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 154 * all objects in the <code>docs/</code> folder. Required when the parent element 155 * <code>Condition</code> is specified and sibling 156 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 157 * are specified, both must be true for the redirect to be applied.</p> 158 * <p>Replacement must be made for object keys containing special characters (such 159 * as carriage returns) when using XML requests. For more information, see <a 160 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 161 * XML related object key constraints</a>.</p> 162 */ SetKeyPrefixEquals(const Aws::String & value)163 inline void SetKeyPrefixEquals(const Aws::String& value) { m_keyPrefixEqualsHasBeenSet = true; m_keyPrefixEquals = value; } 164 165 /** 166 * <p>The object key name prefix when the redirect is applied. For example, to 167 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 168 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 169 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 170 * all objects in the <code>docs/</code> folder. Required when the parent element 171 * <code>Condition</code> is specified and sibling 172 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 173 * are specified, both must be true for the redirect to be applied.</p> 174 * <p>Replacement must be made for object keys containing special characters (such 175 * as carriage returns) when using XML requests. For more information, see <a 176 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 177 * XML related object key constraints</a>.</p> 178 */ SetKeyPrefixEquals(Aws::String && value)179 inline void SetKeyPrefixEquals(Aws::String&& value) { m_keyPrefixEqualsHasBeenSet = true; m_keyPrefixEquals = std::move(value); } 180 181 /** 182 * <p>The object key name prefix when the redirect is applied. For example, to 183 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 184 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 185 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 186 * all objects in the <code>docs/</code> folder. Required when the parent element 187 * <code>Condition</code> is specified and sibling 188 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 189 * are specified, both must be true for the redirect to be applied.</p> 190 * <p>Replacement must be made for object keys containing special characters (such 191 * as carriage returns) when using XML requests. For more information, see <a 192 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 193 * XML related object key constraints</a>.</p> 194 */ SetKeyPrefixEquals(const char * value)195 inline void SetKeyPrefixEquals(const char* value) { m_keyPrefixEqualsHasBeenSet = true; m_keyPrefixEquals.assign(value); } 196 197 /** 198 * <p>The object key name prefix when the redirect is applied. For example, to 199 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 200 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 201 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 202 * all objects in the <code>docs/</code> folder. Required when the parent element 203 * <code>Condition</code> is specified and sibling 204 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 205 * are specified, both must be true for the redirect to be applied.</p> 206 * <p>Replacement must be made for object keys containing special characters (such 207 * as carriage returns) when using XML requests. For more information, see <a 208 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 209 * XML related object key constraints</a>.</p> 210 */ WithKeyPrefixEquals(const Aws::String & value)211 inline Condition& WithKeyPrefixEquals(const Aws::String& value) { SetKeyPrefixEquals(value); return *this;} 212 213 /** 214 * <p>The object key name prefix when the redirect is applied. For example, to 215 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 216 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 217 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 218 * all objects in the <code>docs/</code> folder. Required when the parent element 219 * <code>Condition</code> is specified and sibling 220 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 221 * are specified, both must be true for the redirect to be applied.</p> 222 * <p>Replacement must be made for object keys containing special characters (such 223 * as carriage returns) when using XML requests. For more information, see <a 224 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 225 * XML related object key constraints</a>.</p> 226 */ WithKeyPrefixEquals(Aws::String && value)227 inline Condition& WithKeyPrefixEquals(Aws::String&& value) { SetKeyPrefixEquals(std::move(value)); return *this;} 228 229 /** 230 * <p>The object key name prefix when the redirect is applied. For example, to 231 * redirect requests for <code>ExamplePage.html</code>, the key prefix will be 232 * <code>ExamplePage.html</code>. To redirect request for all pages with the prefix 233 * <code>docs/</code>, the key prefix will be <code>/docs</code>, which identifies 234 * all objects in the <code>docs/</code> folder. Required when the parent element 235 * <code>Condition</code> is specified and sibling 236 * <code>HttpErrorCodeReturnedEquals</code> is not specified. If both conditions 237 * are specified, both must be true for the redirect to be applied.</p> 238 * <p>Replacement must be made for object keys containing special characters (such 239 * as carriage returns) when using XML requests. For more information, see <a 240 * href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints"> 241 * XML related object key constraints</a>.</p> 242 */ WithKeyPrefixEquals(const char * value)243 inline Condition& WithKeyPrefixEquals(const char* value) { SetKeyPrefixEquals(value); return *this;} 244 245 private: 246 247 Aws::String m_httpErrorCodeReturnedEquals; 248 bool m_httpErrorCodeReturnedEqualsHasBeenSet; 249 250 Aws::String m_keyPrefixEquals; 251 bool m_keyPrefixEqualsHasBeenSet; 252 }; 253 254 } // namespace Model 255 } // namespace S3 256 } // namespace Aws 257