| 1 | /* |
| 2 | * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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 | * A copy of the License is located at |
| 7 | * |
| 8 | * http://aws.amazon.com/apache2.0 |
| 9 | * |
| 10 | * or in the "license" file accompanying this file. This file is distributed |
| 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | * express or implied. See the License for the specific language governing |
| 13 | * permissions and limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #pragma once |
| 17 | #include <aws/s3/S3_EXPORTS.h> |
| 18 | #include <aws/s3/model/Condition.h> |
| 19 | #include <aws/s3/model/Redirect.h> |
| 20 | #include <utility> |
| 21 | |
| 22 | namespace Aws |
| 23 | { |
| 24 | namespace Utils |
| 25 | { |
| 26 | namespace Xml |
| 27 | { |
| 28 | class XmlNode; |
| 29 | } // namespace Xml |
| 30 | } // namespace Utils |
| 31 | namespace S3 |
| 32 | { |
| 33 | namespace Model |
| 34 | { |
| 35 | |
| 36 | /** |
| 37 | * <p>Specifies the redirect behavior and when a redirect is applied.</p><p><h3>See |
| 38 | * Also:</h3> <a |
| 39 | * href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RoutingRule">AWS API |
| 40 | * Reference</a></p> |
| 41 | */ |
| 42 | class AWS_S3_API RoutingRule |
| 43 | { |
| 44 | public: |
| 45 | RoutingRule(); |
| 46 | RoutingRule(const Aws::Utils::Xml::XmlNode& xmlNode); |
| 47 | RoutingRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); |
| 48 | |
| 49 | void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * <p>A container for describing a condition that must be met for the specified |
| 54 | * redirect to apply. For example, 1. If request is for pages in the |
| 55 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 56 | * request results in HTTP error 4xx, redirect request to another host where you |
| 57 | * might process the error.</p> |
| 58 | */ |
| 59 | inline const Condition& GetCondition() const{ return m_condition; } |
| 60 | |
| 61 | /** |
| 62 | * <p>A container for describing a condition that must be met for the specified |
| 63 | * redirect to apply. For example, 1. If request is for pages in the |
| 64 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 65 | * request results in HTTP error 4xx, redirect request to another host where you |
| 66 | * might process the error.</p> |
| 67 | */ |
| 68 | inline bool ConditionHasBeenSet() const { return m_conditionHasBeenSet; } |
| 69 | |
| 70 | /** |
| 71 | * <p>A container for describing a condition that must be met for the specified |
| 72 | * redirect to apply. For example, 1. If request is for pages in the |
| 73 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 74 | * request results in HTTP error 4xx, redirect request to another host where you |
| 75 | * might process the error.</p> |
| 76 | */ |
| 77 | inline void SetCondition(const Condition& value) { m_conditionHasBeenSet = true; m_condition = value; } |
| 78 | |
| 79 | /** |
| 80 | * <p>A container for describing a condition that must be met for the specified |
| 81 | * redirect to apply. For example, 1. If request is for pages in the |
| 82 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 83 | * request results in HTTP error 4xx, redirect request to another host where you |
| 84 | * might process the error.</p> |
| 85 | */ |
| 86 | inline void SetCondition(Condition&& value) { m_conditionHasBeenSet = true; m_condition = std::move(value); } |
| 87 | |
| 88 | /** |
| 89 | * <p>A container for describing a condition that must be met for the specified |
| 90 | * redirect to apply. For example, 1. If request is for pages in the |
| 91 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 92 | * request results in HTTP error 4xx, redirect request to another host where you |
| 93 | * might process the error.</p> |
| 94 | */ |
| 95 | inline RoutingRule& WithCondition(const Condition& value) { SetCondition(value); return *this;} |
| 96 | |
| 97 | /** |
| 98 | * <p>A container for describing a condition that must be met for the specified |
| 99 | * redirect to apply. For example, 1. If request is for pages in the |
| 100 | * <code>/docs</code> folder, redirect to the <code>/documents</code> folder. 2. If |
| 101 | * request results in HTTP error 4xx, redirect request to another host where you |
| 102 | * might process the error.</p> |
| 103 | */ |
| 104 | inline RoutingRule& WithCondition(Condition&& value) { SetCondition(std::move(value)); return *this;} |
| 105 | |
| 106 | |
| 107 | /** |
| 108 | * <p>Container for redirect information. You can redirect requests to another |
| 109 | * host, to another page, or with another protocol. In the event of an error, you |
| 110 | * can specify a different error code to return.</p> |
| 111 | */ |
| 112 | inline const Redirect& GetRedirect() const{ return m_redirect; } |
| 113 | |
| 114 | /** |
| 115 | * <p>Container for redirect information. You can redirect requests to another |
| 116 | * host, to another page, or with another protocol. In the event of an error, you |
| 117 | * can specify a different error code to return.</p> |
| 118 | */ |
| 119 | inline bool RedirectHasBeenSet() const { return m_redirectHasBeenSet; } |
| 120 | |
| 121 | /** |
| 122 | * <p>Container for redirect information. You can redirect requests to another |
| 123 | * host, to another page, or with another protocol. In the event of an error, you |
| 124 | * can specify a different error code to return.</p> |
| 125 | */ |
| 126 | inline void SetRedirect(const Redirect& value) { m_redirectHasBeenSet = true; m_redirect = value; } |
| 127 | |
| 128 | /** |
| 129 | * <p>Container for redirect information. You can redirect requests to another |
| 130 | * host, to another page, or with another protocol. In the event of an error, you |
| 131 | * can specify a different error code to return.</p> |
| 132 | */ |
| 133 | inline void SetRedirect(Redirect&& value) { m_redirectHasBeenSet = true; m_redirect = std::move(value); } |
| 134 | |
| 135 | /** |
| 136 | * <p>Container for redirect information. You can redirect requests to another |
| 137 | * host, to another page, or with another protocol. In the event of an error, you |
| 138 | * can specify a different error code to return.</p> |
| 139 | */ |
| 140 | inline RoutingRule& WithRedirect(const Redirect& value) { SetRedirect(value); return *this;} |
| 141 | |
| 142 | /** |
| 143 | * <p>Container for redirect information. You can redirect requests to another |
| 144 | * host, to another page, or with another protocol. In the event of an error, you |
| 145 | * can specify a different error code to return.</p> |
| 146 | */ |
| 147 | inline RoutingRule& WithRedirect(Redirect&& value) { SetRedirect(std::move(value)); return *this;} |
| 148 | |
| 149 | private: |
| 150 | |
| 151 | Condition m_condition; |
| 152 | bool m_conditionHasBeenSet; |
| 153 | |
| 154 | Redirect m_redirect; |
| 155 | bool m_redirectHasBeenSet; |
| 156 | }; |
| 157 | |
| 158 | } // namespace Model |
| 159 | } // namespace S3 |
| 160 | } // namespace Aws |
| 161 | |