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 QueryParameterValidationRequestPolicy(object):
12    """
13    Validate the URL query parameters on the incoming API requests on a specific route.
14    """
15
16    #: A constant which can be used with the validation_mode property of a QueryParameterValidationRequestPolicy.
17    #: This constant has a value of "ENFORCING"
18    VALIDATION_MODE_ENFORCING = "ENFORCING"
19
20    #: A constant which can be used with the validation_mode property of a QueryParameterValidationRequestPolicy.
21    #: This constant has a value of "PERMISSIVE"
22    VALIDATION_MODE_PERMISSIVE = "PERMISSIVE"
23
24    #: A constant which can be used with the validation_mode property of a QueryParameterValidationRequestPolicy.
25    #: This constant has a value of "DISABLED"
26    VALIDATION_MODE_DISABLED = "DISABLED"
27
28    def __init__(self, **kwargs):
29        """
30        Initializes a new QueryParameterValidationRequestPolicy object with values from keyword arguments.
31        The following keyword arguments are supported (corresponding to the getters/setters of this class):
32
33        :param parameters:
34            The value to assign to the parameters property of this QueryParameterValidationRequestPolicy.
35        :type parameters: list[oci.apigateway.models.QueryParameterValidationItem]
36
37        :param validation_mode:
38            The value to assign to the validation_mode property of this QueryParameterValidationRequestPolicy.
39            Allowed values for this property are: "ENFORCING", "PERMISSIVE", "DISABLED", 'UNKNOWN_ENUM_VALUE'.
40            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
41        :type validation_mode: str
42
43        """
44        self.swagger_types = {
45            'parameters': 'list[QueryParameterValidationItem]',
46            'validation_mode': 'str'
47        }
48
49        self.attribute_map = {
50            'parameters': 'parameters',
51            'validation_mode': 'validationMode'
52        }
53
54        self._parameters = None
55        self._validation_mode = None
56
57    @property
58    def parameters(self):
59        """
60        Gets the parameters of this QueryParameterValidationRequestPolicy.
61
62        :return: The parameters of this QueryParameterValidationRequestPolicy.
63        :rtype: list[oci.apigateway.models.QueryParameterValidationItem]
64        """
65        return self._parameters
66
67    @parameters.setter
68    def parameters(self, parameters):
69        """
70        Sets the parameters of this QueryParameterValidationRequestPolicy.
71
72        :param parameters: The parameters of this QueryParameterValidationRequestPolicy.
73        :type: list[oci.apigateway.models.QueryParameterValidationItem]
74        """
75        self._parameters = parameters
76
77    @property
78    def validation_mode(self):
79        """
80        Gets the validation_mode of this QueryParameterValidationRequestPolicy.
81        Validation behavior mode.
82
83        In `ENFORCING` mode, upon a validation failure, the request will be rejected with a 4xx response
84        and not sent to the backend.
85
86        In `PERMISSIVE` mode, the result of the validation will be exposed as metrics while the request
87        will follow the normal path.
88
89        `DISABLED` type turns the validation off.
90
91        Allowed values for this property are: "ENFORCING", "PERMISSIVE", "DISABLED", 'UNKNOWN_ENUM_VALUE'.
92        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
93
94
95        :return: The validation_mode of this QueryParameterValidationRequestPolicy.
96        :rtype: str
97        """
98        return self._validation_mode
99
100    @validation_mode.setter
101    def validation_mode(self, validation_mode):
102        """
103        Sets the validation_mode of this QueryParameterValidationRequestPolicy.
104        Validation behavior mode.
105
106        In `ENFORCING` mode, upon a validation failure, the request will be rejected with a 4xx response
107        and not sent to the backend.
108
109        In `PERMISSIVE` mode, the result of the validation will be exposed as metrics while the request
110        will follow the normal path.
111
112        `DISABLED` type turns the validation off.
113
114
115        :param validation_mode: The validation_mode of this QueryParameterValidationRequestPolicy.
116        :type: str
117        """
118        allowed_values = ["ENFORCING", "PERMISSIVE", "DISABLED"]
119        if not value_allowed_none_or_none_sentinel(validation_mode, allowed_values):
120            validation_mode = 'UNKNOWN_ENUM_VALUE'
121        self._validation_mode = validation_mode
122
123    def __repr__(self):
124        return formatted_flat_dict(self)
125
126    def __eq__(self, other):
127        if other is None:
128            return False
129
130        return self.__dict__ == other.__dict__
131
132    def __ne__(self, other):
133        return not self == other
134