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
5from .unified_agent_parser import UnifiedAgentParser
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 UnifiedJSONParser(UnifiedAgentParser):
12    """
13    JSON parser.
14    """
15
16    #: A constant which can be used with the time_type property of a UnifiedJSONParser.
17    #: This constant has a value of "FLOAT"
18    TIME_TYPE_FLOAT = "FLOAT"
19
20    #: A constant which can be used with the time_type property of a UnifiedJSONParser.
21    #: This constant has a value of "UNIXTIME"
22    TIME_TYPE_UNIXTIME = "UNIXTIME"
23
24    #: A constant which can be used with the time_type property of a UnifiedJSONParser.
25    #: This constant has a value of "STRING"
26    TIME_TYPE_STRING = "STRING"
27
28    def __init__(self, **kwargs):
29        """
30        Initializes a new UnifiedJSONParser object with values from keyword arguments. The default value of the :py:attr:`~oci.logging.models.UnifiedJSONParser.parser_type` attribute
31        of this class is ``JSON`` and it should not be changed.
32        The following keyword arguments are supported (corresponding to the getters/setters of this class):
33
34        :param parser_type:
35            The value to assign to the parser_type property of this UnifiedJSONParser.
36            Allowed values for this property are: "AUDITD", "JSON", "TSV", "CSV", "NONE", "SYSLOG", "APACHE2", "APACHE_ERROR", "MSGPACK", "REGEXP", "MULTILINE", "GROK", "MULTILINE_GROK", 'UNKNOWN_ENUM_VALUE'.
37            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
38        :type parser_type: str
39
40        :param field_time_key:
41            The value to assign to the field_time_key property of this UnifiedJSONParser.
42        :type field_time_key: str
43
44        :param types:
45            The value to assign to the types property of this UnifiedJSONParser.
46        :type types: dict(str, str)
47
48        :param null_value_pattern:
49            The value to assign to the null_value_pattern property of this UnifiedJSONParser.
50        :type null_value_pattern: str
51
52        :param is_null_empty_string:
53            The value to assign to the is_null_empty_string property of this UnifiedJSONParser.
54        :type is_null_empty_string: bool
55
56        :param is_estimate_current_event:
57            The value to assign to the is_estimate_current_event property of this UnifiedJSONParser.
58        :type is_estimate_current_event: bool
59
60        :param is_keep_time_key:
61            The value to assign to the is_keep_time_key property of this UnifiedJSONParser.
62        :type is_keep_time_key: bool
63
64        :param timeout_in_milliseconds:
65            The value to assign to the timeout_in_milliseconds property of this UnifiedJSONParser.
66        :type timeout_in_milliseconds: int
67
68        :param time_type:
69            The value to assign to the time_type property of this UnifiedJSONParser.
70            Allowed values for this property are: "FLOAT", "UNIXTIME", "STRING", 'UNKNOWN_ENUM_VALUE'.
71            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
72        :type time_type: str
73
74        :param time_format:
75            The value to assign to the time_format property of this UnifiedJSONParser.
76        :type time_format: str
77
78        """
79        self.swagger_types = {
80            'parser_type': 'str',
81            'field_time_key': 'str',
82            'types': 'dict(str, str)',
83            'null_value_pattern': 'str',
84            'is_null_empty_string': 'bool',
85            'is_estimate_current_event': 'bool',
86            'is_keep_time_key': 'bool',
87            'timeout_in_milliseconds': 'int',
88            'time_type': 'str',
89            'time_format': 'str'
90        }
91
92        self.attribute_map = {
93            'parser_type': 'parserType',
94            'field_time_key': 'fieldTimeKey',
95            'types': 'types',
96            'null_value_pattern': 'nullValuePattern',
97            'is_null_empty_string': 'isNullEmptyString',
98            'is_estimate_current_event': 'isEstimateCurrentEvent',
99            'is_keep_time_key': 'isKeepTimeKey',
100            'timeout_in_milliseconds': 'timeoutInMilliseconds',
101            'time_type': 'timeType',
102            'time_format': 'timeFormat'
103        }
104
105        self._parser_type = None
106        self._field_time_key = None
107        self._types = None
108        self._null_value_pattern = None
109        self._is_null_empty_string = None
110        self._is_estimate_current_event = None
111        self._is_keep_time_key = None
112        self._timeout_in_milliseconds = None
113        self._time_type = None
114        self._time_format = None
115        self._parser_type = 'JSON'
116
117    @property
118    def time_type(self):
119        """
120        Gets the time_type of this UnifiedJSONParser.
121        Allowed values for this property are: "FLOAT", "UNIXTIME", "STRING", 'UNKNOWN_ENUM_VALUE'.
122        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
123
124
125        :return: The time_type of this UnifiedJSONParser.
126        :rtype: str
127        """
128        return self._time_type
129
130    @time_type.setter
131    def time_type(self, time_type):
132        """
133        Sets the time_type of this UnifiedJSONParser.
134
135        :param time_type: The time_type of this UnifiedJSONParser.
136        :type: str
137        """
138        allowed_values = ["FLOAT", "UNIXTIME", "STRING"]
139        if not value_allowed_none_or_none_sentinel(time_type, allowed_values):
140            time_type = 'UNKNOWN_ENUM_VALUE'
141        self._time_type = time_type
142
143    @property
144    def time_format(self):
145        """
146        Gets the time_format of this UnifiedJSONParser.
147
148        :return: The time_format of this UnifiedJSONParser.
149        :rtype: str
150        """
151        return self._time_format
152
153    @time_format.setter
154    def time_format(self, time_format):
155        """
156        Sets the time_format of this UnifiedJSONParser.
157
158        :param time_format: The time_format of this UnifiedJSONParser.
159        :type: str
160        """
161        self._time_format = time_format
162
163    def __repr__(self):
164        return formatted_flat_dict(self)
165
166    def __eq__(self, other):
167        if other is None:
168            return False
169
170        return self.__dict__ == other.__dict__
171
172    def __ne__(self, other):
173        return not self == other
174