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 QueryDetails(object):
12    """
13    Input arguments for running a log anlaytics query. If the request is set to run in asynchronous mode
14    then shouldIncludeColumns and shouldIncludeFields can be overwritten when retrieving the results.
15    """
16
17    #: A constant which can be used with the sub_system property of a QueryDetails.
18    #: This constant has a value of "LOG"
19    SUB_SYSTEM_LOG = "LOG"
20
21    #: A constant which can be used with the async_mode property of a QueryDetails.
22    #: This constant has a value of "FOREGROUND"
23    ASYNC_MODE_FOREGROUND = "FOREGROUND"
24
25    #: A constant which can be used with the async_mode property of a QueryDetails.
26    #: This constant has a value of "BACKGROUND"
27    ASYNC_MODE_BACKGROUND = "BACKGROUND"
28
29    def __init__(self, **kwargs):
30        """
31        Initializes a new QueryDetails object with values from keyword arguments.
32        The following keyword arguments are supported (corresponding to the getters/setters of this class):
33
34        :param compartment_id:
35            The value to assign to the compartment_id property of this QueryDetails.
36        :type compartment_id: str
37
38        :param compartment_id_in_subtree:
39            The value to assign to the compartment_id_in_subtree property of this QueryDetails.
40        :type compartment_id_in_subtree: bool
41
42        :param saved_search_id:
43            The value to assign to the saved_search_id property of this QueryDetails.
44        :type saved_search_id: str
45
46        :param query_string:
47            The value to assign to the query_string property of this QueryDetails.
48        :type query_string: str
49
50        :param sub_system:
51            The value to assign to the sub_system property of this QueryDetails.
52            Allowed values for this property are: "LOG"
53        :type sub_system: str
54
55        :param max_total_count:
56            The value to assign to the max_total_count property of this QueryDetails.
57        :type max_total_count: int
58
59        :param time_filter:
60            The value to assign to the time_filter property of this QueryDetails.
61        :type time_filter: oci.log_analytics.models.TimeRange
62
63        :param scope_filters:
64            The value to assign to the scope_filters property of this QueryDetails.
65        :type scope_filters: list[oci.log_analytics.models.ScopeFilter]
66
67        :param query_timeout_in_seconds:
68            The value to assign to the query_timeout_in_seconds property of this QueryDetails.
69        :type query_timeout_in_seconds: int
70
71        :param should_run_async:
72            The value to assign to the should_run_async property of this QueryDetails.
73        :type should_run_async: bool
74
75        :param async_mode:
76            The value to assign to the async_mode property of this QueryDetails.
77            Allowed values for this property are: "FOREGROUND", "BACKGROUND"
78        :type async_mode: str
79
80        :param should_include_total_count:
81            The value to assign to the should_include_total_count property of this QueryDetails.
82        :type should_include_total_count: bool
83
84        :param should_include_columns:
85            The value to assign to the should_include_columns property of this QueryDetails.
86        :type should_include_columns: bool
87
88        :param should_include_fields:
89            The value to assign to the should_include_fields property of this QueryDetails.
90        :type should_include_fields: bool
91
92        :param should_use_acceleration:
93            The value to assign to the should_use_acceleration property of this QueryDetails.
94        :type should_use_acceleration: bool
95
96        """
97        self.swagger_types = {
98            'compartment_id': 'str',
99            'compartment_id_in_subtree': 'bool',
100            'saved_search_id': 'str',
101            'query_string': 'str',
102            'sub_system': 'str',
103            'max_total_count': 'int',
104            'time_filter': 'TimeRange',
105            'scope_filters': 'list[ScopeFilter]',
106            'query_timeout_in_seconds': 'int',
107            'should_run_async': 'bool',
108            'async_mode': 'str',
109            'should_include_total_count': 'bool',
110            'should_include_columns': 'bool',
111            'should_include_fields': 'bool',
112            'should_use_acceleration': 'bool'
113        }
114
115        self.attribute_map = {
116            'compartment_id': 'compartmentId',
117            'compartment_id_in_subtree': 'compartmentIdInSubtree',
118            'saved_search_id': 'savedSearchId',
119            'query_string': 'queryString',
120            'sub_system': 'subSystem',
121            'max_total_count': 'maxTotalCount',
122            'time_filter': 'timeFilter',
123            'scope_filters': 'scopeFilters',
124            'query_timeout_in_seconds': 'queryTimeoutInSeconds',
125            'should_run_async': 'shouldRunAsync',
126            'async_mode': 'asyncMode',
127            'should_include_total_count': 'shouldIncludeTotalCount',
128            'should_include_columns': 'shouldIncludeColumns',
129            'should_include_fields': 'shouldIncludeFields',
130            'should_use_acceleration': 'shouldUseAcceleration'
131        }
132
133        self._compartment_id = None
134        self._compartment_id_in_subtree = None
135        self._saved_search_id = None
136        self._query_string = None
137        self._sub_system = None
138        self._max_total_count = None
139        self._time_filter = None
140        self._scope_filters = None
141        self._query_timeout_in_seconds = None
142        self._should_run_async = None
143        self._async_mode = None
144        self._should_include_total_count = None
145        self._should_include_columns = None
146        self._should_include_fields = None
147        self._should_use_acceleration = None
148
149    @property
150    def compartment_id(self):
151        """
152        **[Required]** Gets the compartment_id of this QueryDetails.
153        Compartment Identifier `OCID]`__.
154
155        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
156
157
158        :return: The compartment_id of this QueryDetails.
159        :rtype: str
160        """
161        return self._compartment_id
162
163    @compartment_id.setter
164    def compartment_id(self, compartment_id):
165        """
166        Sets the compartment_id of this QueryDetails.
167        Compartment Identifier `OCID]`__.
168
169        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
170
171
172        :param compartment_id: The compartment_id of this QueryDetails.
173        :type: str
174        """
175        self._compartment_id = compartment_id
176
177    @property
178    def compartment_id_in_subtree(self):
179        """
180        Gets the compartment_id_in_subtree of this QueryDetails.
181        Flag to search all child compartments of the compartment Id specified in the compartmentId query parameter.
182
183
184        :return: The compartment_id_in_subtree of this QueryDetails.
185        :rtype: bool
186        """
187        return self._compartment_id_in_subtree
188
189    @compartment_id_in_subtree.setter
190    def compartment_id_in_subtree(self, compartment_id_in_subtree):
191        """
192        Sets the compartment_id_in_subtree of this QueryDetails.
193        Flag to search all child compartments of the compartment Id specified in the compartmentId query parameter.
194
195
196        :param compartment_id_in_subtree: The compartment_id_in_subtree of this QueryDetails.
197        :type: bool
198        """
199        self._compartment_id_in_subtree = compartment_id_in_subtree
200
201    @property
202    def saved_search_id(self):
203        """
204        Gets the saved_search_id of this QueryDetails.
205        Saved search OCID for this query if known.
206
207
208        :return: The saved_search_id of this QueryDetails.
209        :rtype: str
210        """
211        return self._saved_search_id
212
213    @saved_search_id.setter
214    def saved_search_id(self, saved_search_id):
215        """
216        Sets the saved_search_id of this QueryDetails.
217        Saved search OCID for this query if known.
218
219
220        :param saved_search_id: The saved_search_id of this QueryDetails.
221        :type: str
222        """
223        self._saved_search_id = saved_search_id
224
225    @property
226    def query_string(self):
227        """
228        **[Required]** Gets the query_string of this QueryDetails.
229        Query to perform. Must conform to logging analytic querylanguage syntax. Syntax errors will be returned if present.
230
231
232        :return: The query_string of this QueryDetails.
233        :rtype: str
234        """
235        return self._query_string
236
237    @query_string.setter
238    def query_string(self, query_string):
239        """
240        Sets the query_string of this QueryDetails.
241        Query to perform. Must conform to logging analytic querylanguage syntax. Syntax errors will be returned if present.
242
243
244        :param query_string: The query_string of this QueryDetails.
245        :type: str
246        """
247        self._query_string = query_string
248
249    @property
250    def sub_system(self):
251        """
252        **[Required]** Gets the sub_system of this QueryDetails.
253        Default subsystem to qualify fields with in the queryString if not specified.
254
255        Allowed values for this property are: "LOG"
256
257
258        :return: The sub_system of this QueryDetails.
259        :rtype: str
260        """
261        return self._sub_system
262
263    @sub_system.setter
264    def sub_system(self, sub_system):
265        """
266        Sets the sub_system of this QueryDetails.
267        Default subsystem to qualify fields with in the queryString if not specified.
268
269
270        :param sub_system: The sub_system of this QueryDetails.
271        :type: str
272        """
273        allowed_values = ["LOG"]
274        if not value_allowed_none_or_none_sentinel(sub_system, allowed_values):
275            raise ValueError(
276                "Invalid value for `sub_system`, must be None or one of {0}"
277                .format(allowed_values)
278            )
279        self._sub_system = sub_system
280
281    @property
282    def max_total_count(self):
283        """
284        Gets the max_total_count of this QueryDetails.
285        Maximum number of results to count.  Note a maximum of 2001 will be enforced; that is, actualMaxTotalCountUsed = Math.min(maxTotalCount, 2001).
286
287
288        :return: The max_total_count of this QueryDetails.
289        :rtype: int
290        """
291        return self._max_total_count
292
293    @max_total_count.setter
294    def max_total_count(self, max_total_count):
295        """
296        Sets the max_total_count of this QueryDetails.
297        Maximum number of results to count.  Note a maximum of 2001 will be enforced; that is, actualMaxTotalCountUsed = Math.min(maxTotalCount, 2001).
298
299
300        :param max_total_count: The max_total_count of this QueryDetails.
301        :type: int
302        """
303        self._max_total_count = max_total_count
304
305    @property
306    def time_filter(self):
307        """
308        Gets the time_filter of this QueryDetails.
309
310        :return: The time_filter of this QueryDetails.
311        :rtype: oci.log_analytics.models.TimeRange
312        """
313        return self._time_filter
314
315    @time_filter.setter
316    def time_filter(self, time_filter):
317        """
318        Sets the time_filter of this QueryDetails.
319
320        :param time_filter: The time_filter of this QueryDetails.
321        :type: oci.log_analytics.models.TimeRange
322        """
323        self._time_filter = time_filter
324
325    @property
326    def scope_filters(self):
327        """
328        Gets the scope_filters of this QueryDetails.
329        List of filters to be applied when the query executes. More than one filter per field is not permitted.
330
331
332        :return: The scope_filters of this QueryDetails.
333        :rtype: list[oci.log_analytics.models.ScopeFilter]
334        """
335        return self._scope_filters
336
337    @scope_filters.setter
338    def scope_filters(self, scope_filters):
339        """
340        Sets the scope_filters of this QueryDetails.
341        List of filters to be applied when the query executes. More than one filter per field is not permitted.
342
343
344        :param scope_filters: The scope_filters of this QueryDetails.
345        :type: list[oci.log_analytics.models.ScopeFilter]
346        """
347        self._scope_filters = scope_filters
348
349    @property
350    def query_timeout_in_seconds(self):
351        """
352        Gets the query_timeout_in_seconds of this QueryDetails.
353        Amount of time, in seconds, allowed for a query to execute. If this time expires before the query is complete, any partial results will be returned.
354
355
356        :return: The query_timeout_in_seconds of this QueryDetails.
357        :rtype: int
358        """
359        return self._query_timeout_in_seconds
360
361    @query_timeout_in_seconds.setter
362    def query_timeout_in_seconds(self, query_timeout_in_seconds):
363        """
364        Sets the query_timeout_in_seconds of this QueryDetails.
365        Amount of time, in seconds, allowed for a query to execute. If this time expires before the query is complete, any partial results will be returned.
366
367
368        :param query_timeout_in_seconds: The query_timeout_in_seconds of this QueryDetails.
369        :type: int
370        """
371        self._query_timeout_in_seconds = query_timeout_in_seconds
372
373    @property
374    def should_run_async(self):
375        """
376        Gets the should_run_async of this QueryDetails.
377        Option to run the query asynchronously. This will lead to a LogAnalyticsQueryJobWorkRequest being submitted and the {workRequestId} will be returned to use for fetching the results.
378
379
380        :return: The should_run_async of this QueryDetails.
381        :rtype: bool
382        """
383        return self._should_run_async
384
385    @should_run_async.setter
386    def should_run_async(self, should_run_async):
387        """
388        Sets the should_run_async of this QueryDetails.
389        Option to run the query asynchronously. This will lead to a LogAnalyticsQueryJobWorkRequest being submitted and the {workRequestId} will be returned to use for fetching the results.
390
391
392        :param should_run_async: The should_run_async of this QueryDetails.
393        :type: bool
394        """
395        self._should_run_async = should_run_async
396
397    @property
398    def async_mode(self):
399        """
400        Gets the async_mode of this QueryDetails.
401        Execution mode for the query if running asynchronously i.e (shouldRunAsync is set to true).
402
403        Allowed values for this property are: "FOREGROUND", "BACKGROUND"
404
405
406        :return: The async_mode of this QueryDetails.
407        :rtype: str
408        """
409        return self._async_mode
410
411    @async_mode.setter
412    def async_mode(self, async_mode):
413        """
414        Sets the async_mode of this QueryDetails.
415        Execution mode for the query if running asynchronously i.e (shouldRunAsync is set to true).
416
417
418        :param async_mode: The async_mode of this QueryDetails.
419        :type: str
420        """
421        allowed_values = ["FOREGROUND", "BACKGROUND"]
422        if not value_allowed_none_or_none_sentinel(async_mode, allowed_values):
423            raise ValueError(
424                "Invalid value for `async_mode`, must be None or one of {0}"
425                .format(allowed_values)
426            )
427        self._async_mode = async_mode
428
429    @property
430    def should_include_total_count(self):
431        """
432        Gets the should_include_total_count of this QueryDetails.
433        Include the total number of results from the query. Note, this value will always be equal to or less than maxTotalCount.
434
435
436        :return: The should_include_total_count of this QueryDetails.
437        :rtype: bool
438        """
439        return self._should_include_total_count
440
441    @should_include_total_count.setter
442    def should_include_total_count(self, should_include_total_count):
443        """
444        Sets the should_include_total_count of this QueryDetails.
445        Include the total number of results from the query. Note, this value will always be equal to or less than maxTotalCount.
446
447
448        :param should_include_total_count: The should_include_total_count of this QueryDetails.
449        :type: bool
450        """
451        self._should_include_total_count = should_include_total_count
452
453    @property
454    def should_include_columns(self):
455        """
456        Gets the should_include_columns of this QueryDetails.
457        Include columns in response
458
459
460        :return: The should_include_columns of this QueryDetails.
461        :rtype: bool
462        """
463        return self._should_include_columns
464
465    @should_include_columns.setter
466    def should_include_columns(self, should_include_columns):
467        """
468        Sets the should_include_columns of this QueryDetails.
469        Include columns in response
470
471
472        :param should_include_columns: The should_include_columns of this QueryDetails.
473        :type: bool
474        """
475        self._should_include_columns = should_include_columns
476
477    @property
478    def should_include_fields(self):
479        """
480        Gets the should_include_fields of this QueryDetails.
481        Include fields in response
482
483
484        :return: The should_include_fields of this QueryDetails.
485        :rtype: bool
486        """
487        return self._should_include_fields
488
489    @should_include_fields.setter
490    def should_include_fields(self, should_include_fields):
491        """
492        Sets the should_include_fields of this QueryDetails.
493        Include fields in response
494
495
496        :param should_include_fields: The should_include_fields of this QueryDetails.
497        :type: bool
498        """
499        self._should_include_fields = should_include_fields
500
501    @property
502    def should_use_acceleration(self):
503        """
504        Gets the should_use_acceleration of this QueryDetails.
505        Controls if query should ignore pre-calculated results if available and only use raw data. If set and no acceleration data is found it will fallback to raw data.
506
507
508        :return: The should_use_acceleration of this QueryDetails.
509        :rtype: bool
510        """
511        return self._should_use_acceleration
512
513    @should_use_acceleration.setter
514    def should_use_acceleration(self, should_use_acceleration):
515        """
516        Sets the should_use_acceleration of this QueryDetails.
517        Controls if query should ignore pre-calculated results if available and only use raw data. If set and no acceleration data is found it will fallback to raw data.
518
519
520        :param should_use_acceleration: The should_use_acceleration of this QueryDetails.
521        :type: bool
522        """
523        self._should_use_acceleration = should_use_acceleration
524
525    def __repr__(self):
526        return formatted_flat_dict(self)
527
528    def __eq__(self, other):
529        if other is None:
530            return False
531
532        return self.__dict__ == other.__dict__
533
534    def __ne__(self, other):
535        return not self == other
536