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 CreateMonitorDetails(object):
12    """
13    Details of the request body used to create a new monitor.
14    """
15
16    #: A constant which can be used with the monitor_type property of a CreateMonitorDetails.
17    #: This constant has a value of "SCRIPTED_BROWSER"
18    MONITOR_TYPE_SCRIPTED_BROWSER = "SCRIPTED_BROWSER"
19
20    #: A constant which can be used with the monitor_type property of a CreateMonitorDetails.
21    #: This constant has a value of "BROWSER"
22    MONITOR_TYPE_BROWSER = "BROWSER"
23
24    #: A constant which can be used with the monitor_type property of a CreateMonitorDetails.
25    #: This constant has a value of "SCRIPTED_REST"
26    MONITOR_TYPE_SCRIPTED_REST = "SCRIPTED_REST"
27
28    #: A constant which can be used with the monitor_type property of a CreateMonitorDetails.
29    #: This constant has a value of "REST"
30    MONITOR_TYPE_REST = "REST"
31
32    #: A constant which can be used with the status property of a CreateMonitorDetails.
33    #: This constant has a value of "ENABLED"
34    STATUS_ENABLED = "ENABLED"
35
36    #: A constant which can be used with the status property of a CreateMonitorDetails.
37    #: This constant has a value of "DISABLED"
38    STATUS_DISABLED = "DISABLED"
39
40    #: A constant which can be used with the status property of a CreateMonitorDetails.
41    #: This constant has a value of "INVALID"
42    STATUS_INVALID = "INVALID"
43
44    def __init__(self, **kwargs):
45        """
46        Initializes a new CreateMonitorDetails object with values from keyword arguments.
47        The following keyword arguments are supported (corresponding to the getters/setters of this class):
48
49        :param display_name:
50            The value to assign to the display_name property of this CreateMonitorDetails.
51        :type display_name: str
52
53        :param monitor_type:
54            The value to assign to the monitor_type property of this CreateMonitorDetails.
55            Allowed values for this property are: "SCRIPTED_BROWSER", "BROWSER", "SCRIPTED_REST", "REST"
56        :type monitor_type: str
57
58        :param vantage_points:
59            The value to assign to the vantage_points property of this CreateMonitorDetails.
60        :type vantage_points: list[str]
61
62        :param script_id:
63            The value to assign to the script_id property of this CreateMonitorDetails.
64        :type script_id: str
65
66        :param status:
67            The value to assign to the status property of this CreateMonitorDetails.
68            Allowed values for this property are: "ENABLED", "DISABLED", "INVALID"
69        :type status: str
70
71        :param repeat_interval_in_seconds:
72            The value to assign to the repeat_interval_in_seconds property of this CreateMonitorDetails.
73        :type repeat_interval_in_seconds: int
74
75        :param is_run_once:
76            The value to assign to the is_run_once property of this CreateMonitorDetails.
77        :type is_run_once: bool
78
79        :param timeout_in_seconds:
80            The value to assign to the timeout_in_seconds property of this CreateMonitorDetails.
81        :type timeout_in_seconds: int
82
83        :param target:
84            The value to assign to the target property of this CreateMonitorDetails.
85        :type target: str
86
87        :param script_parameters:
88            The value to assign to the script_parameters property of this CreateMonitorDetails.
89        :type script_parameters: list[oci.apm_synthetics.models.MonitorScriptParameter]
90
91        :param configuration:
92            The value to assign to the configuration property of this CreateMonitorDetails.
93        :type configuration: oci.apm_synthetics.models.MonitorConfiguration
94
95        :param freeform_tags:
96            The value to assign to the freeform_tags property of this CreateMonitorDetails.
97        :type freeform_tags: dict(str, str)
98
99        :param defined_tags:
100            The value to assign to the defined_tags property of this CreateMonitorDetails.
101        :type defined_tags: dict(str, dict(str, object))
102
103        """
104        self.swagger_types = {
105            'display_name': 'str',
106            'monitor_type': 'str',
107            'vantage_points': 'list[str]',
108            'script_id': 'str',
109            'status': 'str',
110            'repeat_interval_in_seconds': 'int',
111            'is_run_once': 'bool',
112            'timeout_in_seconds': 'int',
113            'target': 'str',
114            'script_parameters': 'list[MonitorScriptParameter]',
115            'configuration': 'MonitorConfiguration',
116            'freeform_tags': 'dict(str, str)',
117            'defined_tags': 'dict(str, dict(str, object))'
118        }
119
120        self.attribute_map = {
121            'display_name': 'displayName',
122            'monitor_type': 'monitorType',
123            'vantage_points': 'vantagePoints',
124            'script_id': 'scriptId',
125            'status': 'status',
126            'repeat_interval_in_seconds': 'repeatIntervalInSeconds',
127            'is_run_once': 'isRunOnce',
128            'timeout_in_seconds': 'timeoutInSeconds',
129            'target': 'target',
130            'script_parameters': 'scriptParameters',
131            'configuration': 'configuration',
132            'freeform_tags': 'freeformTags',
133            'defined_tags': 'definedTags'
134        }
135
136        self._display_name = None
137        self._monitor_type = None
138        self._vantage_points = None
139        self._script_id = None
140        self._status = None
141        self._repeat_interval_in_seconds = None
142        self._is_run_once = None
143        self._timeout_in_seconds = None
144        self._target = None
145        self._script_parameters = None
146        self._configuration = None
147        self._freeform_tags = None
148        self._defined_tags = None
149
150    @property
151    def display_name(self):
152        """
153        **[Required]** Gets the display_name of this CreateMonitorDetails.
154        Unique name that can be edited. The name should not contain any confidential information.
155
156
157        :return: The display_name of this CreateMonitorDetails.
158        :rtype: str
159        """
160        return self._display_name
161
162    @display_name.setter
163    def display_name(self, display_name):
164        """
165        Sets the display_name of this CreateMonitorDetails.
166        Unique name that can be edited. The name should not contain any confidential information.
167
168
169        :param display_name: The display_name of this CreateMonitorDetails.
170        :type: str
171        """
172        self._display_name = display_name
173
174    @property
175    def monitor_type(self):
176        """
177        **[Required]** Gets the monitor_type of this CreateMonitorDetails.
178        Type of monitor.
179
180        Allowed values for this property are: "SCRIPTED_BROWSER", "BROWSER", "SCRIPTED_REST", "REST"
181
182
183        :return: The monitor_type of this CreateMonitorDetails.
184        :rtype: str
185        """
186        return self._monitor_type
187
188    @monitor_type.setter
189    def monitor_type(self, monitor_type):
190        """
191        Sets the monitor_type of this CreateMonitorDetails.
192        Type of monitor.
193
194
195        :param monitor_type: The monitor_type of this CreateMonitorDetails.
196        :type: str
197        """
198        allowed_values = ["SCRIPTED_BROWSER", "BROWSER", "SCRIPTED_REST", "REST"]
199        if not value_allowed_none_or_none_sentinel(monitor_type, allowed_values):
200            raise ValueError(
201                "Invalid value for `monitor_type`, must be None or one of {0}"
202                .format(allowed_values)
203            )
204        self._monitor_type = monitor_type
205
206    @property
207    def vantage_points(self):
208        """
209        **[Required]** Gets the vantage_points of this CreateMonitorDetails.
210        A list of vantage points from which to execute the monitor.
211        Use /publicVantagePoints to fetch public vantage points.
212
213
214        :return: The vantage_points of this CreateMonitorDetails.
215        :rtype: list[str]
216        """
217        return self._vantage_points
218
219    @vantage_points.setter
220    def vantage_points(self, vantage_points):
221        """
222        Sets the vantage_points of this CreateMonitorDetails.
223        A list of vantage points from which to execute the monitor.
224        Use /publicVantagePoints to fetch public vantage points.
225
226
227        :param vantage_points: The vantage_points of this CreateMonitorDetails.
228        :type: list[str]
229        """
230        self._vantage_points = vantage_points
231
232    @property
233    def script_id(self):
234        """
235        Gets the script_id of this CreateMonitorDetails.
236        The `OCID`__ of the script.
237        scriptId is mandatory for creation of SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null.
238
239        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
240
241
242        :return: The script_id of this CreateMonitorDetails.
243        :rtype: str
244        """
245        return self._script_id
246
247    @script_id.setter
248    def script_id(self, script_id):
249        """
250        Sets the script_id of this CreateMonitorDetails.
251        The `OCID`__ of the script.
252        scriptId is mandatory for creation of SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null.
253
254        __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
255
256
257        :param script_id: The script_id of this CreateMonitorDetails.
258        :type: str
259        """
260        self._script_id = script_id
261
262    @property
263    def status(self):
264        """
265        Gets the status of this CreateMonitorDetails.
266        Enables or disables the monitor.
267
268        Allowed values for this property are: "ENABLED", "DISABLED", "INVALID"
269
270
271        :return: The status of this CreateMonitorDetails.
272        :rtype: str
273        """
274        return self._status
275
276    @status.setter
277    def status(self, status):
278        """
279        Sets the status of this CreateMonitorDetails.
280        Enables or disables the monitor.
281
282
283        :param status: The status of this CreateMonitorDetails.
284        :type: str
285        """
286        allowed_values = ["ENABLED", "DISABLED", "INVALID"]
287        if not value_allowed_none_or_none_sentinel(status, allowed_values):
288            raise ValueError(
289                "Invalid value for `status`, must be None or one of {0}"
290                .format(allowed_values)
291            )
292        self._status = status
293
294    @property
295    def repeat_interval_in_seconds(self):
296        """
297        **[Required]** Gets the repeat_interval_in_seconds of this CreateMonitorDetails.
298        Interval in seconds after the start time when the job should be repeated.
299        Minimum repeatIntervalInSeconds should be 300 seconds.
300
301
302        :return: The repeat_interval_in_seconds of this CreateMonitorDetails.
303        :rtype: int
304        """
305        return self._repeat_interval_in_seconds
306
307    @repeat_interval_in_seconds.setter
308    def repeat_interval_in_seconds(self, repeat_interval_in_seconds):
309        """
310        Sets the repeat_interval_in_seconds of this CreateMonitorDetails.
311        Interval in seconds after the start time when the job should be repeated.
312        Minimum repeatIntervalInSeconds should be 300 seconds.
313
314
315        :param repeat_interval_in_seconds: The repeat_interval_in_seconds of this CreateMonitorDetails.
316        :type: int
317        """
318        self._repeat_interval_in_seconds = repeat_interval_in_seconds
319
320    @property
321    def is_run_once(self):
322        """
323        Gets the is_run_once of this CreateMonitorDetails.
324        If runOnce is enabled, then the monitor will run once.
325
326
327        :return: The is_run_once of this CreateMonitorDetails.
328        :rtype: bool
329        """
330        return self._is_run_once
331
332    @is_run_once.setter
333    def is_run_once(self, is_run_once):
334        """
335        Sets the is_run_once of this CreateMonitorDetails.
336        If runOnce is enabled, then the monitor will run once.
337
338
339        :param is_run_once: The is_run_once of this CreateMonitorDetails.
340        :type: bool
341        """
342        self._is_run_once = is_run_once
343
344    @property
345    def timeout_in_seconds(self):
346        """
347        Gets the timeout_in_seconds of this CreateMonitorDetails.
348        Timeout in seconds. Timeout cannot be more than 30% of repeatIntervalInSeconds time for monitors.
349        Also, timeoutInSeconds should be a multiple of 60. Monitor will be allowed to run only for timeoutInSeconds time. It would be terminated after that.
350
351
352        :return: The timeout_in_seconds of this CreateMonitorDetails.
353        :rtype: int
354        """
355        return self._timeout_in_seconds
356
357    @timeout_in_seconds.setter
358    def timeout_in_seconds(self, timeout_in_seconds):
359        """
360        Sets the timeout_in_seconds of this CreateMonitorDetails.
361        Timeout in seconds. Timeout cannot be more than 30% of repeatIntervalInSeconds time for monitors.
362        Also, timeoutInSeconds should be a multiple of 60. Monitor will be allowed to run only for timeoutInSeconds time. It would be terminated after that.
363
364
365        :param timeout_in_seconds: The timeout_in_seconds of this CreateMonitorDetails.
366        :type: int
367        """
368        self._timeout_in_seconds = timeout_in_seconds
369
370    @property
371    def target(self):
372        """
373        Gets the target of this CreateMonitorDetails.
374        Specify the endpoint on which to run the monitor.
375        For BROWSER and REST monitor types, target is mandatory.
376        If target is specified in the SCRIPTED_BROWSER monitor type, then the monitor will run the selected script (specified by scriptId in monitor) against the specified target endpoint.
377        If target is not specified in the SCRIPTED_BROWSER monitor type, then the monitor will run the selected script as it is.
378
379
380        :return: The target of this CreateMonitorDetails.
381        :rtype: str
382        """
383        return self._target
384
385    @target.setter
386    def target(self, target):
387        """
388        Sets the target of this CreateMonitorDetails.
389        Specify the endpoint on which to run the monitor.
390        For BROWSER and REST monitor types, target is mandatory.
391        If target is specified in the SCRIPTED_BROWSER monitor type, then the monitor will run the selected script (specified by scriptId in monitor) against the specified target endpoint.
392        If target is not specified in the SCRIPTED_BROWSER monitor type, then the monitor will run the selected script as it is.
393
394
395        :param target: The target of this CreateMonitorDetails.
396        :type: str
397        """
398        self._target = target
399
400    @property
401    def script_parameters(self):
402        """
403        Gets the script_parameters of this CreateMonitorDetails.
404        List of script parameters in the monitor.
405        This is valid only for SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null.
406        Example: `[{\"paramName\": \"userid\", \"paramValue\":\"testuser\"}]`
407
408
409        :return: The script_parameters of this CreateMonitorDetails.
410        :rtype: list[oci.apm_synthetics.models.MonitorScriptParameter]
411        """
412        return self._script_parameters
413
414    @script_parameters.setter
415    def script_parameters(self, script_parameters):
416        """
417        Sets the script_parameters of this CreateMonitorDetails.
418        List of script parameters in the monitor.
419        This is valid only for SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null.
420        Example: `[{\"paramName\": \"userid\", \"paramValue\":\"testuser\"}]`
421
422
423        :param script_parameters: The script_parameters of this CreateMonitorDetails.
424        :type: list[oci.apm_synthetics.models.MonitorScriptParameter]
425        """
426        self._script_parameters = script_parameters
427
428    @property
429    def configuration(self):
430        """
431        Gets the configuration of this CreateMonitorDetails.
432
433        :return: The configuration of this CreateMonitorDetails.
434        :rtype: oci.apm_synthetics.models.MonitorConfiguration
435        """
436        return self._configuration
437
438    @configuration.setter
439    def configuration(self, configuration):
440        """
441        Sets the configuration of this CreateMonitorDetails.
442
443        :param configuration: The configuration of this CreateMonitorDetails.
444        :type: oci.apm_synthetics.models.MonitorConfiguration
445        """
446        self._configuration = configuration
447
448    @property
449    def freeform_tags(self):
450        """
451        Gets the freeform_tags of this CreateMonitorDetails.
452        Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
453        Example: `{\"bar-key\": \"value\"}`
454
455
456        :return: The freeform_tags of this CreateMonitorDetails.
457        :rtype: dict(str, str)
458        """
459        return self._freeform_tags
460
461    @freeform_tags.setter
462    def freeform_tags(self, freeform_tags):
463        """
464        Sets the freeform_tags of this CreateMonitorDetails.
465        Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
466        Example: `{\"bar-key\": \"value\"}`
467
468
469        :param freeform_tags: The freeform_tags of this CreateMonitorDetails.
470        :type: dict(str, str)
471        """
472        self._freeform_tags = freeform_tags
473
474    @property
475    def defined_tags(self):
476        """
477        Gets the defined_tags of this CreateMonitorDetails.
478        Defined tags for this resource. Each key is predefined and scoped to a namespace.
479        Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`
480
481
482        :return: The defined_tags of this CreateMonitorDetails.
483        :rtype: dict(str, dict(str, object))
484        """
485        return self._defined_tags
486
487    @defined_tags.setter
488    def defined_tags(self, defined_tags):
489        """
490        Sets the defined_tags of this CreateMonitorDetails.
491        Defined tags for this resource. Each key is predefined and scoped to a namespace.
492        Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`
493
494
495        :param defined_tags: The defined_tags of this CreateMonitorDetails.
496        :type: dict(str, dict(str, object))
497        """
498        self._defined_tags = defined_tags
499
500    def __repr__(self):
501        return formatted_flat_dict(self)
502
503    def __eq__(self, other):
504        if other is None:
505            return False
506
507        return self.__dict__ == other.__dict__
508
509    def __ne__(self, other):
510        return not self == other
511