Class: OCI::ApmSynthetics::Models::CreateMonitorDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/apm_synthetics/models/create_monitor_details.rb

Overview

Details of the request body used to create a new monitor.

Constant Summary collapse

MONITOR_TYPE_ENUM =
[
  MONITOR_TYPE_SCRIPTED_BROWSER = 'SCRIPTED_BROWSER'.freeze,
  MONITOR_TYPE_BROWSER = 'BROWSER'.freeze,
  MONITOR_TYPE_SCRIPTED_REST = 'SCRIPTED_REST'.freeze,
  MONITOR_TYPE_REST = 'REST'.freeze,
  MONITOR_TYPE_NETWORK = 'NETWORK'.freeze,
  MONITOR_TYPE_DNS = 'DNS'.freeze
].freeze
STATUS_ENUM =
[
  STATUS_ENABLED = 'ENABLED'.freeze,
  STATUS_DISABLED = 'DISABLED'.freeze,
  STATUS_INVALID = 'INVALID'.freeze
].freeze
SCHEDULING_POLICY_ENUM =
[
  SCHEDULING_POLICY_ALL = 'ALL'.freeze,
  SCHEDULING_POLICY_ROUND_ROBIN = 'ROUND_ROBIN'.freeze,
  SCHEDULING_POLICY_BATCHED_ROUND_ROBIN = 'BATCHED_ROUND_ROBIN'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateMonitorDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 199

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')

  self.display_name = attributes[:'display_name'] if attributes[:'display_name']

  self.monitor_type = attributes[:'monitorType'] if attributes[:'monitorType']
  self.monitor_type = "SCRIPTED_BROWSER" if monitor_type.nil? && !attributes.key?(:'monitorType') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :monitorType and :monitor_type' if attributes.key?(:'monitorType') && attributes.key?(:'monitor_type')

  self.monitor_type = attributes[:'monitor_type'] if attributes[:'monitor_type']
  self.monitor_type = "SCRIPTED_BROWSER" if monitor_type.nil? && !attributes.key?(:'monitorType') && !attributes.key?(:'monitor_type') # rubocop:disable Style/StringLiterals

  self.vantage_points = attributes[:'vantagePoints'] if attributes[:'vantagePoints']

  raise 'You cannot provide both :vantagePoints and :vantage_points' if attributes.key?(:'vantagePoints') && attributes.key?(:'vantage_points')

  self.vantage_points = attributes[:'vantage_points'] if attributes[:'vantage_points']

  self.script_id = attributes[:'scriptId'] if attributes[:'scriptId']

  raise 'You cannot provide both :scriptId and :script_id' if attributes.key?(:'scriptId') && attributes.key?(:'script_id')

  self.script_id = attributes[:'script_id'] if attributes[:'script_id']

  self.status = attributes[:'status'] if attributes[:'status']
  self.status = "ENABLED" if status.nil? && !attributes.key?(:'status') # rubocop:disable Style/StringLiterals

  self.repeat_interval_in_seconds = attributes[:'repeatIntervalInSeconds'] if attributes[:'repeatIntervalInSeconds']

  raise 'You cannot provide both :repeatIntervalInSeconds and :repeat_interval_in_seconds' if attributes.key?(:'repeatIntervalInSeconds') && attributes.key?(:'repeat_interval_in_seconds')

  self.repeat_interval_in_seconds = attributes[:'repeat_interval_in_seconds'] if attributes[:'repeat_interval_in_seconds']

  self.is_run_once = attributes[:'isRunOnce'] unless attributes[:'isRunOnce'].nil?
  self.is_run_once = false if is_run_once.nil? && !attributes.key?(:'isRunOnce') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isRunOnce and :is_run_once' if attributes.key?(:'isRunOnce') && attributes.key?(:'is_run_once')

  self.is_run_once = attributes[:'is_run_once'] unless attributes[:'is_run_once'].nil?
  self.is_run_once = false if is_run_once.nil? && !attributes.key?(:'isRunOnce') && !attributes.key?(:'is_run_once') # rubocop:disable Style/StringLiterals

  self.timeout_in_seconds = attributes[:'timeoutInSeconds'] if attributes[:'timeoutInSeconds']

  raise 'You cannot provide both :timeoutInSeconds and :timeout_in_seconds' if attributes.key?(:'timeoutInSeconds') && attributes.key?(:'timeout_in_seconds')

  self.timeout_in_seconds = attributes[:'timeout_in_seconds'] if attributes[:'timeout_in_seconds']

  self.target = attributes[:'target'] if attributes[:'target']

  self.script_parameters = attributes[:'scriptParameters'] if attributes[:'scriptParameters']

  raise 'You cannot provide both :scriptParameters and :script_parameters' if attributes.key?(:'scriptParameters') && attributes.key?(:'script_parameters')

  self.script_parameters = attributes[:'script_parameters'] if attributes[:'script_parameters']

  self.configuration = attributes[:'configuration'] if attributes[:'configuration']

  self.availability_configuration = attributes[:'availabilityConfiguration'] if attributes[:'availabilityConfiguration']

  raise 'You cannot provide both :availabilityConfiguration and :availability_configuration' if attributes.key?(:'availabilityConfiguration') && attributes.key?(:'availability_configuration')

  self.availability_configuration = attributes[:'availability_configuration'] if attributes[:'availability_configuration']

  self.maintenance_window_schedule = attributes[:'maintenanceWindowSchedule'] if attributes[:'maintenanceWindowSchedule']

  raise 'You cannot provide both :maintenanceWindowSchedule and :maintenance_window_schedule' if attributes.key?(:'maintenanceWindowSchedule') && attributes.key?(:'maintenance_window_schedule')

  self.maintenance_window_schedule = attributes[:'maintenance_window_schedule'] if attributes[:'maintenance_window_schedule']

  self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']

  raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')

  self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

  raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')

  self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']

  self.is_run_now = attributes[:'isRunNow'] unless attributes[:'isRunNow'].nil?
  self.is_run_now = false if is_run_now.nil? && !attributes.key?(:'isRunNow') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isRunNow and :is_run_now' if attributes.key?(:'isRunNow') && attributes.key?(:'is_run_now')

  self.is_run_now = attributes[:'is_run_now'] unless attributes[:'is_run_now'].nil?
  self.is_run_now = false if is_run_now.nil? && !attributes.key?(:'isRunNow') && !attributes.key?(:'is_run_now') # rubocop:disable Style/StringLiterals

  self.scheduling_policy = attributes[:'schedulingPolicy'] if attributes[:'schedulingPolicy']

  raise 'You cannot provide both :schedulingPolicy and :scheduling_policy' if attributes.key?(:'schedulingPolicy') && attributes.key?(:'scheduling_policy')

  self.scheduling_policy = attributes[:'scheduling_policy'] if attributes[:'scheduling_policy']

  self.batch_interval_in_seconds = attributes[:'batchIntervalInSeconds'] if attributes[:'batchIntervalInSeconds']

  raise 'You cannot provide both :batchIntervalInSeconds and :batch_interval_in_seconds' if attributes.key?(:'batchIntervalInSeconds') && attributes.key?(:'batch_interval_in_seconds')

  self.batch_interval_in_seconds = attributes[:'batch_interval_in_seconds'] if attributes[:'batch_interval_in_seconds']
end

Instance Attribute Details

#availability_configurationOCI::ApmSynthetics::Models::AvailabilityConfiguration



94
95
96
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 94

def availability_configuration
  @availability_configuration
end

#batch_interval_in_secondsInteger

Time interval between two runs in round robin batch mode (SchedulingPolicy - BATCHED_ROUND_ROBIN).

Returns:

  • (Integer)


121
122
123
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 121

def batch_interval_in_seconds
  @batch_interval_in_seconds
end

#configurationOCI::ApmSynthetics::Models::MonitorConfiguration



91
92
93
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 91

def configuration
  @configuration
end

#defined_tagsHash<String, Hash<String, Object>>

Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {\"foo-namespace\": {\"bar-key\": \"value\"}}

Returns:

  • (Hash<String, Hash<String, Object>>)


109
110
111
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 109

def defined_tags
  @defined_tags
end

#display_nameString

[Required] Unique name that can be edited. The name should not contain any confidential information.

Returns:

  • (String)


34
35
36
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 34

def display_name
  @display_name
end

#freeform_tagsHash<String, String>

Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {\"bar-key\": \"value\"}

Returns:

  • (Hash<String, String>)


103
104
105
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 103

def freeform_tags
  @freeform_tags
end

#is_run_nowBOOLEAN

If isRunNow is enabled, then the monitor will run immediately.

Returns:

  • (BOOLEAN)


113
114
115
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 113

def is_run_now
  @is_run_now
end

#is_run_onceBOOLEAN

If runOnce is enabled, then the monitor will run once.

Returns:

  • (BOOLEAN)


64
65
66
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 64

def is_run_once
  @is_run_once
end

#maintenance_window_scheduleOCI::ApmSynthetics::Models::MaintenanceWindowSchedule



97
98
99
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 97

def maintenance_window_schedule
  @maintenance_window_schedule
end

#monitor_typeString

[Required] Type of monitor.

Returns:

  • (String)


38
39
40
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 38

def monitor_type
  @monitor_type
end

#repeat_interval_in_secondsInteger

[Required] Interval in seconds after the start time when the job should be repeated. Minimum repeatIntervalInSeconds should be 300 seconds for Scripted REST, Scripted Browser and Browser monitors, and 60 seconds for REST monitor.

Returns:

  • (Integer)


60
61
62
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 60

def repeat_interval_in_seconds
  @repeat_interval_in_seconds
end

#scheduling_policyString

Scheduling policy to decide the distribution of monitor executions on vantage points.

Returns:

  • (String)


117
118
119
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 117

def scheduling_policy
  @scheduling_policy
end

#script_idString

The OCID of the script. scriptId is mandatory for creation of SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null.

Returns:

  • (String)


50
51
52
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 50

def script_id
  @script_id
end

#script_parametersArray<OCI::ApmSynthetics::Models::MonitorScriptParameter>

List of script parameters in the monitor. This is valid only for SCRIPTED_BROWSER and SCRIPTED_REST monitor types. For other monitor types, it should be set to null. Example: [{\"paramName\": \"userid\", \"paramValue\":\"testuser\"}]



88
89
90
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 88

def script_parameters
  @script_parameters
end

#statusString

Enables or disables the monitor.

Returns:

  • (String)


54
55
56
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 54

def status
  @status
end

#targetString

Specify the endpoint on which to run the monitor. For BROWSER, REST and NETWORK monitor types, target is mandatory. 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. If target is not specified in the SCRIPTED_BROWSER monitor type, then the monitor will run the selected script as it is. For NETWORK monitor with TCP protocol, a port needs to be provided along with target. Example: 192.168.0.1:80

Returns:

  • (String)


81
82
83
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 81

def target
  @target
end

#timeout_in_secondsInteger

Timeout in seconds. If isFailureRetried is true, then timeout cannot be more than 30% of repeatIntervalInSeconds time for monitors. If isFailureRetried is false, then timeout cannot be more than 50% of repeatIntervalInSeconds time for monitors. Also, timeoutInSeconds should be a multiple of 60 for Scripted REST, Scripted Browser and Browser monitors. Monitor will be allowed to run only for timeoutInSeconds time. It would be terminated after that.

Returns:

  • (Integer)


72
73
74
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 72

def timeout_in_seconds
  @timeout_in_seconds
end

#vantage_pointsArray<String>

[Required] A list of public and dedicated vantage points from which to execute the monitor. Use /publicVantagePoints to fetch public vantage points, and /dedicatedVantagePoints to fetch dedicated vantage points.

Returns:

  • (Array<String>)


44
45
46
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 44

def vantage_points
  @vantage_points
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 124

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'displayName',
    'monitor_type': :'monitorType',
    'vantage_points': :'vantagePoints',
    'script_id': :'scriptId',
    'status': :'status',
    'repeat_interval_in_seconds': :'repeatIntervalInSeconds',
    'is_run_once': :'isRunOnce',
    'timeout_in_seconds': :'timeoutInSeconds',
    'target': :'target',
    'script_parameters': :'scriptParameters',
    'configuration': :'configuration',
    'availability_configuration': :'availabilityConfiguration',
    'maintenance_window_schedule': :'maintenanceWindowSchedule',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'is_run_now': :'isRunNow',
    'scheduling_policy': :'schedulingPolicy',
    'batch_interval_in_seconds': :'batchIntervalInSeconds'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 150

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'String',
    'monitor_type': :'String',
    'vantage_points': :'Array<String>',
    'script_id': :'String',
    'status': :'String',
    'repeat_interval_in_seconds': :'Integer',
    'is_run_once': :'BOOLEAN',
    'timeout_in_seconds': :'Integer',
    'target': :'String',
    'script_parameters': :'Array<OCI::ApmSynthetics::Models::MonitorScriptParameter>',
    'configuration': :'OCI::ApmSynthetics::Models::MonitorConfiguration',
    'availability_configuration': :'OCI::ApmSynthetics::Models::AvailabilityConfiguration',
    'maintenance_window_schedule': :'OCI::ApmSynthetics::Models::MaintenanceWindowSchedule',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'is_run_now': :'BOOLEAN',
    'scheduling_policy': :'String',
    'batch_interval_in_seconds': :'Integer'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 340

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    display_name == other.display_name &&
    monitor_type == other.monitor_type &&
    vantage_points == other.vantage_points &&
    script_id == other.script_id &&
    status == other.status &&
    repeat_interval_in_seconds == other.repeat_interval_in_seconds &&
    is_run_once == other.is_run_once &&
    timeout_in_seconds == other.timeout_in_seconds &&
    target == other.target &&
    script_parameters == other.script_parameters &&
    configuration == other.configuration &&
    availability_configuration == other.availability_configuration &&
    maintenance_window_schedule == other.maintenance_window_schedule &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    is_run_now == other.is_run_now &&
    scheduling_policy == other.scheduling_policy &&
    batch_interval_in_seconds == other.batch_interval_in_seconds
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 387

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


367
368
369
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 367

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



376
377
378
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 376

def hash
  [display_name, monitor_type, vantage_points, script_id, status, repeat_interval_in_seconds, is_run_once, timeout_in_seconds, target, script_parameters, configuration, availability_configuration, maintenance_window_schedule, freeform_tags, defined_tags, is_run_now, scheduling_policy, batch_interval_in_seconds].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



420
421
422
423
424
425
426
427
428
429
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 420

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



414
415
416
# File 'lib/oci/apm_synthetics/models/create_monitor_details.rb', line 414

def to_s
  to_hash.to_s
end