Class: OCI::StackMonitoring::Models::CreateMonitoringTemplateDetails

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

Overview

The information about new monitoring template. The monitoring template name should be unique in a compartment.

Constant Summary collapse

MESSAGE_FORMAT_ENUM =
[
  MESSAGE_FORMAT_RAW = 'RAW'.freeze,
  MESSAGE_FORMAT_PRETTY_JSON = 'PRETTY_JSON'.freeze,
  MESSAGE_FORMAT_ONS_OPTIMIZED = 'ONS_OPTIMIZED'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateMonitoringTemplateDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



120
121
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
148
149
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
176
177
178
179
180
181
182
183
184
185
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 120

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.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.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.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']
end

Instance Attribute Details

#compartment_idString

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

Returns:

  • (String)


23
24
25
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 23

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


63
64
65
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 63

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)


27
28
29
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 27

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, such as a topic.

Returns:

  • (Array<String>)


31
32
33
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 31

def destinations
  @destinations
end

#display_nameString

[Required] A user-friendly name for the monitoring template. It is unique and mutable in nature. Avoid entering confidential information.

Returns:

  • (String)


19
20
21
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 19

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


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

def freeform_tags
  @freeform_tags
end

#is_alarms_enabledBOOLEAN

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

Returns:

  • (BOOLEAN)


35
36
37
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 35

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)


39
40
41
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 39

def is_split_notification_enabled
  @is_split_notification_enabled
end

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

[Required] List of members of this monitoring template



43
44
45
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 43

def members
  @members
end

#message_formatString

The format to use for alarm notifications.

Returns:

  • (String)


51
52
53
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 51

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)


47
48
49
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 47

def repeat_notification_duration
  @repeat_notification_duration
end

Class Method Details

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 66

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'displayName',
    'compartment_id': :'compartmentId',
    'description': :'description',
    'destinations': :'destinations',
    'is_alarms_enabled': :'isAlarmsEnabled',
    'is_split_notification_enabled': :'isSplitNotificationEnabled',
    'members': :'members',
    'repeat_notification_duration': :'repeatNotificationDuration',
    'message_format': :'messageFormat',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 85

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'String',
    'compartment_id': :'String',
    'description': :'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',
    'freeform_tags': :'Hash<String, String>',
    'defined_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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 202

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

  self.class == other.class &&
    display_name == other.display_name &&
    compartment_id == other.compartment_id &&
    description == other.description &&
    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 &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_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



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 242

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


222
223
224
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 222

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



231
232
233
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 231

def hash
  [display_name, compartment_id, description, destinations, is_alarms_enabled, is_split_notification_enabled, members, repeat_notification_duration, message_format, freeform_tags, defined_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



275
276
277
278
279
280
281
282
283
284
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 275

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



269
270
271
# File 'lib/oci/stack_monitoring/models/create_monitoring_template_details.rb', line 269

def to_s
  to_hash.to_s
end