Class: OCI::StackMonitoring::Models::MonitoringTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/stack_monitoring/models/monitoring_template.rb

Overview

Detailed information of the Monitoring Template

Constant Summary collapse

STATUS_ENUM =
[
  STATUS_NOT_APPLIED = 'NOT_APPLIED'.freeze,
  STATUS_APPLIED = 'APPLIED'.freeze,
  STATUS_PARTIAL_APPLIED = 'PARTIAL_APPLIED'.freeze,
  STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
MESSAGE_FORMAT_ENUM =
[
  MESSAGE_FORMAT_RAW = 'RAW'.freeze,
  MESSAGE_FORMAT_PRETTY_JSON = 'PRETTY_JSON'.freeze,
  MESSAGE_FORMAT_ONS_OPTIMIZED = 'ONS_OPTIMIZED'.freeze,
  MESSAGE_FORMAT_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MonitoringTemplate

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
308
309
310
311
312
313
314
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 203

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.id = attributes[:'id'] if attributes[:'id']

  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.tenant_id = attributes[:'tenantId'] if attributes[:'tenantId']

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

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

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

  self.is_alarms_enabled = attributes[:'isAlarmsEnabled'] unless attributes[:'isAlarmsEnabled'].nil?
  self.is_alarms_enabled = true if is_alarms_enabled.nil? && !attributes.key?(:'isAlarmsEnabled') # rubocop:disable Style/StringLiterals

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

  self.is_alarms_enabled = attributes[:'is_alarms_enabled'] unless attributes[:'is_alarms_enabled'].nil?
  self.is_alarms_enabled = true if is_alarms_enabled.nil? && !attributes.key?(:'isAlarmsEnabled') && !attributes.key?(:'is_alarms_enabled') # rubocop:disable Style/StringLiterals

  self.is_split_notification_enabled = attributes[:'isSplitNotificationEnabled'] unless attributes[:'isSplitNotificationEnabled'].nil?
  self.is_split_notification_enabled = true if is_split_notification_enabled.nil? && !attributes.key?(:'isSplitNotificationEnabled') # rubocop:disable Style/StringLiterals

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

  self.is_split_notification_enabled = attributes[:'is_split_notification_enabled'] unless attributes[:'is_split_notification_enabled'].nil?
  self.is_split_notification_enabled = true if is_split_notification_enabled.nil? && !attributes.key?(:'isSplitNotificationEnabled') && !attributes.key?(:'is_split_notification_enabled') # rubocop:disable Style/StringLiterals

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

  self.repeat_notification_duration = attributes[:'repeatNotificationDuration'] if attributes[:'repeatNotificationDuration']

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

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

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

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

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

  self.total_alarm_conditions = attributes[:'totalAlarmConditions'] if attributes[:'totalAlarmConditions']

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

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

  self.total_applied_alarm_conditions = attributes[:'totalAppliedAlarmConditions'] if attributes[:'totalAppliedAlarmConditions']

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

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

  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.system_tags = attributes[:'systemTags'] if attributes[:'systemTags']

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

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

Instance Attribute Details

#compartment_idString

[Required] The OCID of the compartment containing the monitoringTemplate.

Returns:

  • (String)


49
50
51
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 49

def compartment_id
  @compartment_id
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>>)


113
114
115
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 113

def defined_tags
  @defined_tags
end

#descriptionString

A user-friendly description for the monitoring template. It does not have to be unique, and it's changeable. Avoid entering confidential information.

Returns:

  • (String)


53
54
55
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 53

def description
  @description
end

#destinationsArray<String>

[Required] A list of destinations for alarm notifications. Each destination is represented by the OCID of a related resource.

Returns:

  • (Array<String>)


65
66
67
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 65

def destinations
  @destinations
end

#display_nameString

[Required] A user-friendly name for the monitoring template. It should be unique, and it's mutable in nature. Avoid entering confidential information.

Returns:

  • (String)


41
42
43
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 41

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>)


107
108
109
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 107

def freeform_tags
  @freeform_tags
end

#idString

[Required] The OCID of the monitoringTemplate

Returns:

  • (String)


37
38
39
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 37

def id
  @id
end

#is_alarms_enabledBOOLEAN

Whether the alarm is enabled or disabled. Default value is enabled.

Returns:

  • (BOOLEAN)


69
70
71
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 69

def is_alarms_enabled
  @is_alarms_enabled
end

#is_split_notification_enabledBOOLEAN

Whether the alarm notification is enabled or disabled, it will be Enabled by default.

Returns:

  • (BOOLEAN)


73
74
75
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 73

def is_split_notification_enabled
  @is_split_notification_enabled
end

#lifecycle_stateString

[Required] The current lifecycle state of the monitoring template.

Returns:

  • (String)


61
62
63
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 61

def lifecycle_state
  @lifecycle_state
end

#membersArray<OCI::StackMonitoring::Models::MemberReference>

[Required] List of members of this monitoring template.



77
78
79
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 77

def members
  @members
end

#message_formatString

The format to use for alarm notifications.

Returns:

  • (String)


85
86
87
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 85

def message_format
  @message_format
end

#repeat_notification_durationString

The frequency for re-submitting alarm notifications, if the alarm keeps firing without interruption. Format defined by ISO 8601. For example, PT4H indicates four hours. Minimum- PT1M. Maximum - P30D.

Returns:

  • (String)


81
82
83
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 81

def repeat_notification_duration
  @repeat_notification_duration
end

#statusString

[Required] The current status of the monitoring template i.e. whether it is Applied or NotApplied.

Returns:

  • (String)


57
58
59
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 57

def status
  @status
end

#system_tagsHash<String, Hash<String, Object>>

Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {\"orcl-cloud\": {\"free-tier-retained\": \"true\"}}

Returns:

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


119
120
121
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 119

def system_tags
  @system_tags
end

#tenant_idString

[Required] Tenant Identifier OCID

Returns:

  • (String)


45
46
47
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 45

def tenant_id
  @tenant_id
end

#time_createdDateTime

[Required] The date and time the monitoringTemplate was created. Format defined by RFC3339.

Returns:

  • (DateTime)


97
98
99
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 97

def time_created
  @time_created
end

#time_updatedDateTime

[Required] The date and time the monitoringTemplate was last updated. Format defined by RFC3339.

Returns:

  • (DateTime)


101
102
103
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 101

def time_updated
  @time_updated
end

#total_alarm_conditionsFloat

[Required] Total Alarm Conditions

Returns:

  • (Float)


89
90
91
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 89

def total_alarm_conditions
  @total_alarm_conditions
end

#total_applied_alarm_conditionsFloat

[Required] Total Applied Alarm Conditions

Returns:

  • (Float)


93
94
95
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 93

def total_applied_alarm_conditions
  @total_applied_alarm_conditions
end

Class Method Details

.attribute_mapObject

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



122
123
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/stack_monitoring/models/monitoring_template.rb', line 122

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'display_name': :'displayName',
    'tenant_id': :'tenantId',
    'compartment_id': :'compartmentId',
    'description': :'description',
    'status': :'status',
    'lifecycle_state': :'lifecycleState',
    'destinations': :'destinations',
    'is_alarms_enabled': :'isAlarmsEnabled',
    'is_split_notification_enabled': :'isSplitNotificationEnabled',
    'members': :'members',
    'repeat_notification_duration': :'repeatNotificationDuration',
    'message_format': :'messageFormat',
    'total_alarm_conditions': :'totalAlarmConditions',
    'total_applied_alarm_conditions': :'totalAppliedAlarmConditions',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'system_tags': :'systemTags'
    # 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
174
175
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 150

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'display_name': :'String',
    'tenant_id': :'String',
    'compartment_id': :'String',
    'description': :'String',
    'status': :'String',
    'lifecycle_state': :'String',
    'destinations': :'Array<String>',
    'is_alarms_enabled': :'BOOLEAN',
    'is_split_notification_enabled': :'BOOLEAN',
    'members': :'Array<OCI::StackMonitoring::Models::MemberReference>',
    'repeat_notification_duration': :'String',
    'message_format': :'String',
    'total_alarm_conditions': :'Float',
    'total_applied_alarm_conditions': :'Float',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'system_tags': :'Hash<String, Hash<String, Object>>'
    # 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



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 362

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

  self.class == other.class &&
    id == other.id &&
    display_name == other.display_name &&
    tenant_id == other.tenant_id &&
    compartment_id == other.compartment_id &&
    description == other.description &&
    status == other.status &&
    lifecycle_state == other.lifecycle_state &&
    destinations == other.destinations &&
    is_alarms_enabled == other.is_alarms_enabled &&
    is_split_notification_enabled == other.is_split_notification_enabled &&
    members == other.members &&
    repeat_notification_duration == other.repeat_notification_duration &&
    message_format == other.message_format &&
    total_alarm_conditions == other.total_alarm_conditions &&
    total_applied_alarm_conditions == other.total_applied_alarm_conditions &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    system_tags == other.system_tags
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



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 411

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


391
392
393
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 391

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



400
401
402
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 400

def hash
  [id, display_name, tenant_id, compartment_id, description, status, lifecycle_state, destinations, is_alarms_enabled, is_split_notification_enabled, members, repeat_notification_duration, message_format, total_alarm_conditions, total_applied_alarm_conditions, time_created, time_updated, freeform_tags, defined_tags, system_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



444
445
446
447
448
449
450
451
452
453
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 444

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



438
439
440
# File 'lib/oci/stack_monitoring/models/monitoring_template.rb', line 438

def to_s
  to_hash.to_s
end