1# coding: utf-8
2# Copyright (c) 2016, 2021, Oracle and/or its affiliates.  All rights reserved.
3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
4
5
6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
7from oci.decorators import init_model_state_from_kwargs
8
9
10@init_model_state_from_kwargs
11class BlockChallengeSettings(object):
12    """
13    The challenge settings if `action` is set to `BLOCK`.
14    """
15
16    #: A constant which can be used with the block_action property of a BlockChallengeSettings.
17    #: This constant has a value of "SET_RESPONSE_CODE"
18    BLOCK_ACTION_SET_RESPONSE_CODE = "SET_RESPONSE_CODE"
19
20    #: A constant which can be used with the block_action property of a BlockChallengeSettings.
21    #: This constant has a value of "SHOW_ERROR_PAGE"
22    BLOCK_ACTION_SHOW_ERROR_PAGE = "SHOW_ERROR_PAGE"
23
24    #: A constant which can be used with the block_action property of a BlockChallengeSettings.
25    #: This constant has a value of "SHOW_CAPTCHA"
26    BLOCK_ACTION_SHOW_CAPTCHA = "SHOW_CAPTCHA"
27
28    def __init__(self, **kwargs):
29        """
30        Initializes a new BlockChallengeSettings object with values from keyword arguments.
31        The following keyword arguments are supported (corresponding to the getters/setters of this class):
32
33        :param block_action:
34            The value to assign to the block_action property of this BlockChallengeSettings.
35            Allowed values for this property are: "SET_RESPONSE_CODE", "SHOW_ERROR_PAGE", "SHOW_CAPTCHA", 'UNKNOWN_ENUM_VALUE'.
36            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
37        :type block_action: str
38
39        :param block_response_code:
40            The value to assign to the block_response_code property of this BlockChallengeSettings.
41        :type block_response_code: int
42
43        :param block_error_page_message:
44            The value to assign to the block_error_page_message property of this BlockChallengeSettings.
45        :type block_error_page_message: str
46
47        :param block_error_page_description:
48            The value to assign to the block_error_page_description property of this BlockChallengeSettings.
49        :type block_error_page_description: str
50
51        :param block_error_page_code:
52            The value to assign to the block_error_page_code property of this BlockChallengeSettings.
53        :type block_error_page_code: str
54
55        :param captcha_title:
56            The value to assign to the captcha_title property of this BlockChallengeSettings.
57        :type captcha_title: str
58
59        :param captcha_header:
60            The value to assign to the captcha_header property of this BlockChallengeSettings.
61        :type captcha_header: str
62
63        :param captcha_footer:
64            The value to assign to the captcha_footer property of this BlockChallengeSettings.
65        :type captcha_footer: str
66
67        :param captcha_submit_label:
68            The value to assign to the captcha_submit_label property of this BlockChallengeSettings.
69        :type captcha_submit_label: str
70
71        """
72        self.swagger_types = {
73            'block_action': 'str',
74            'block_response_code': 'int',
75            'block_error_page_message': 'str',
76            'block_error_page_description': 'str',
77            'block_error_page_code': 'str',
78            'captcha_title': 'str',
79            'captcha_header': 'str',
80            'captcha_footer': 'str',
81            'captcha_submit_label': 'str'
82        }
83
84        self.attribute_map = {
85            'block_action': 'blockAction',
86            'block_response_code': 'blockResponseCode',
87            'block_error_page_message': 'blockErrorPageMessage',
88            'block_error_page_description': 'blockErrorPageDescription',
89            'block_error_page_code': 'blockErrorPageCode',
90            'captcha_title': 'captchaTitle',
91            'captcha_header': 'captchaHeader',
92            'captcha_footer': 'captchaFooter',
93            'captcha_submit_label': 'captchaSubmitLabel'
94        }
95
96        self._block_action = None
97        self._block_response_code = None
98        self._block_error_page_message = None
99        self._block_error_page_description = None
100        self._block_error_page_code = None
101        self._captcha_title = None
102        self._captcha_header = None
103        self._captcha_footer = None
104        self._captcha_submit_label = None
105
106    @property
107    def block_action(self):
108        """
109        Gets the block_action of this BlockChallengeSettings.
110        The method used to block requests that fail the challenge, if `action` is set to `BLOCK`. If unspecified, defaults to `SHOW_ERROR_PAGE`.
111
112        Allowed values for this property are: "SET_RESPONSE_CODE", "SHOW_ERROR_PAGE", "SHOW_CAPTCHA", 'UNKNOWN_ENUM_VALUE'.
113        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
114
115
116        :return: The block_action of this BlockChallengeSettings.
117        :rtype: str
118        """
119        return self._block_action
120
121    @block_action.setter
122    def block_action(self, block_action):
123        """
124        Sets the block_action of this BlockChallengeSettings.
125        The method used to block requests that fail the challenge, if `action` is set to `BLOCK`. If unspecified, defaults to `SHOW_ERROR_PAGE`.
126
127
128        :param block_action: The block_action of this BlockChallengeSettings.
129        :type: str
130        """
131        allowed_values = ["SET_RESPONSE_CODE", "SHOW_ERROR_PAGE", "SHOW_CAPTCHA"]
132        if not value_allowed_none_or_none_sentinel(block_action, allowed_values):
133            block_action = 'UNKNOWN_ENUM_VALUE'
134        self._block_action = block_action
135
136    @property
137    def block_response_code(self):
138        """
139        Gets the block_response_code of this BlockChallengeSettings.
140        The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE` or `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `494`, `495`, `496`, `497`, `499`, `500`, `501`, `502`, `503`, `504`, `507`.
141
142
143        :return: The block_response_code of this BlockChallengeSettings.
144        :rtype: int
145        """
146        return self._block_response_code
147
148    @block_response_code.setter
149    def block_response_code(self, block_response_code):
150        """
151        Sets the block_response_code of this BlockChallengeSettings.
152        The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE` or `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `494`, `495`, `496`, `497`, `499`, `500`, `501`, `502`, `503`, `504`, `507`.
153
154
155        :param block_response_code: The block_response_code of this BlockChallengeSettings.
156        :type: int
157        """
158        self._block_response_code = block_response_code
159
160    @property
161    def block_error_page_message(self):
162        """
163        Gets the block_error_page_message of this BlockChallengeSettings.
164        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access to the website is blocked`.
165
166
167        :return: The block_error_page_message of this BlockChallengeSettings.
168        :rtype: str
169        """
170        return self._block_error_page_message
171
172    @block_error_page_message.setter
173    def block_error_page_message(self, block_error_page_message):
174        """
175        Sets the block_error_page_message of this BlockChallengeSettings.
176        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access to the website is blocked`.
177
178
179        :param block_error_page_message: The block_error_page_message of this BlockChallengeSettings.
180        :type: str
181        """
182        self._block_error_page_message = block_error_page_message
183
184    @property
185    def block_error_page_description(self):
186        """
187        Gets the block_error_page_description of this BlockChallengeSettings.
188        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access blocked by website owner. Please contact support.`
189
190
191        :return: The block_error_page_description of this BlockChallengeSettings.
192        :rtype: str
193        """
194        return self._block_error_page_description
195
196    @block_error_page_description.setter
197    def block_error_page_description(self, block_error_page_description):
198        """
199        Sets the block_error_page_description of this BlockChallengeSettings.
200        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access blocked by website owner. Please contact support.`
201
202
203        :param block_error_page_description: The block_error_page_description of this BlockChallengeSettings.
204        :type: str
205        """
206        self._block_error_page_description = block_error_page_description
207
208    @property
209    def block_error_page_code(self):
210        """
211        Gets the block_error_page_code of this BlockChallengeSettings.
212        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE` and the request is blocked. If unspecified, defaults to `403`.
213
214
215        :return: The block_error_page_code of this BlockChallengeSettings.
216        :rtype: str
217        """
218        return self._block_error_page_code
219
220    @block_error_page_code.setter
221    def block_error_page_code(self, block_error_page_code):
222        """
223        Sets the block_error_page_code of this BlockChallengeSettings.
224        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE` and the request is blocked. If unspecified, defaults to `403`.
225
226
227        :param block_error_page_code: The block_error_page_code of this BlockChallengeSettings.
228        :type: str
229        """
230        self._block_error_page_code = block_error_page_code
231
232    @property
233    def captcha_title(self):
234        """
235        Gets the captcha_title of this BlockChallengeSettings.
236        The title used when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Are you human?`
237
238
239        :return: The captcha_title of this BlockChallengeSettings.
240        :rtype: str
241        """
242        return self._captcha_title
243
244    @captcha_title.setter
245    def captcha_title(self, captcha_title):
246        """
247        Sets the captcha_title of this BlockChallengeSettings.
248        The title used when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Are you human?`
249
250
251        :param captcha_title: The captcha_title of this BlockChallengeSettings.
252        :type: str
253        """
254        self._captcha_title = captcha_title
255
256    @property
257    def captcha_header(self):
258        """
259        Gets the captcha_header of this BlockChallengeSettings.
260        The text to show in the header when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `We have detected an increased number of attempts to access this webapp. To help us keep this webapp secure, please let us know that you are not a robot by entering the text from captcha below.`
261
262
263        :return: The captcha_header of this BlockChallengeSettings.
264        :rtype: str
265        """
266        return self._captcha_header
267
268    @captcha_header.setter
269    def captcha_header(self, captcha_header):
270        """
271        Sets the captcha_header of this BlockChallengeSettings.
272        The text to show in the header when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `We have detected an increased number of attempts to access this webapp. To help us keep this webapp secure, please let us know that you are not a robot by entering the text from captcha below.`
273
274
275        :param captcha_header: The captcha_header of this BlockChallengeSettings.
276        :type: str
277        """
278        self._captcha_header = captcha_header
279
280    @property
281    def captcha_footer(self):
282        """
283        Gets the captcha_footer of this BlockChallengeSettings.
284        The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, default to `Enter the letters and numbers as they are shown in image above`.
285
286
287        :return: The captcha_footer of this BlockChallengeSettings.
288        :rtype: str
289        """
290        return self._captcha_footer
291
292    @captcha_footer.setter
293    def captcha_footer(self, captcha_footer):
294        """
295        Sets the captcha_footer of this BlockChallengeSettings.
296        The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, default to `Enter the letters and numbers as they are shown in image above`.
297
298
299        :param captcha_footer: The captcha_footer of this BlockChallengeSettings.
300        :type: str
301        """
302        self._captcha_footer = captcha_footer
303
304    @property
305    def captcha_submit_label(self):
306        """
307        Gets the captcha_submit_label of this BlockChallengeSettings.
308        The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Yes, I am human`.
309
310
311        :return: The captcha_submit_label of this BlockChallengeSettings.
312        :rtype: str
313        """
314        return self._captcha_submit_label
315
316    @captcha_submit_label.setter
317    def captcha_submit_label(self, captcha_submit_label):
318        """
319        Sets the captcha_submit_label of this BlockChallengeSettings.
320        The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Yes, I am human`.
321
322
323        :param captcha_submit_label: The captcha_submit_label of this BlockChallengeSettings.
324        :type: str
325        """
326        self._captcha_submit_label = captcha_submit_label
327
328    def __repr__(self):
329        return formatted_flat_dict(self)
330
331    def __eq__(self, other):
332        if other is None:
333            return False
334
335        return self.__dict__ == other.__dict__
336
337    def __ne__(self, other):
338        return not self == other
339