class SematextCloud::AlertRule

Attributes

account_email[RW]
allowed_app_types[RW]
analyzing_time[RW]
app_display_state[RW]
app_id[RW]
app_name[RW]
app_state[RW]
app_token[RW]
app_type[RW]
back_to_normal_needed[RW]
chart_key[RW]
color[RW]
creator_email[RW]
default_agg_type[RW]
description[RW]
disallowed_app_types[RW]
enabled[RW]
estimate_operation[RW]
estimate_value[RW]
filter_values[RW]
filter_values_obj[RW]
ignore_regular_events_enabled[RW]
integrations[RW]
last_data_received_date[RW]
last_sent[RW]
last_triggered[RW]
metadata[RW]
metric_key[RW]
metric_label[RW]
min_delay_between_notifications_in_minutes[RW]
name[RW]
notification_emails[RW]
notification_integrations[RW]
notifications_enabled[RW]
query[RW]
report_name[RW]
rule_key[RW]
rule_type[RW]
runbook[RW]
saved_query_id[RW]
schedule[RW]
sematext_service[RW]
send_to_email[RW]
timezone[RW]
use_only_alert_rule_integrations[RW]
user_permissions[RW]
value_column_name[RW]
value_name[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/SematextCloud/models/alert_rule.rb, line 136
def self.attribute_map
  {
    :'account_email' => :'accountEmail',
    :'allowed_app_types' => :'allowedAppTypes',
    :'analyzing_time' => :'analyzingTime',
    :'app_display_state' => :'appDisplayState',
    :'app_id' => :'appId',
    :'app_name' => :'appName',
    :'app_state' => :'appState',
    :'app_token' => :'appToken',
    :'app_type' => :'appType',
    :'back_to_normal_needed' => :'backToNormalNeeded',
    :'chart_key' => :'chartKey',
    :'color' => :'color',
    :'creator_email' => :'creatorEmail',
    :'default_agg_type' => :'defaultAggType',
    :'description' => :'description',
    :'disallowed_app_types' => :'disallowedAppTypes',
    :'enabled' => :'enabled',
    :'estimate_operation' => :'estimateOperation',
    :'estimate_value' => :'estimateValue',
    :'filter_values' => :'filterValues',
    :'filter_values_obj' => :'filterValuesObj',
    :'ignore_regular_events_enabled' => :'ignoreRegularEventsEnabled',
    :'integrations' => :'integrations',
    :'last_data_received_date' => :'lastDataReceivedDate',
    :'last_sent' => :'lastSent',
    :'last_triggered' => :'lastTriggered',
    :'metadata' => :'metadata',
    :'metric_key' => :'metricKey',
    :'metric_label' => :'metricLabel',
    :'min_delay_between_notifications_in_minutes' => :'minDelayBetweenNotificationsInMinutes',
    :'name' => :'name',
    :'notification_emails' => :'notificationEmails',
    :'notification_integrations' => :'notificationIntegrations',
    :'notifications_enabled' => :'notificationsEnabled',
    :'query' => :'query',
    :'report_name' => :'reportName',
    :'rule_key' => :'ruleKey',
    :'rule_type' => :'ruleType',
    :'runbook' => :'runbook',
    :'saved_query_id' => :'savedQueryId',
    :'schedule' => :'schedule',
    :'sematext_service' => :'sematextService',
    :'send_to_email' => :'sendToEmail',
    :'timezone' => :'timezone',
    :'use_only_alert_rule_integrations' => :'useOnlyAlertRuleIntegrations',
    :'user_permissions' => :'userPermissions',
    :'value_column_name' => :'valueColumnName',
    :'value_name' => :'valueName'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/SematextCloud/models/alert_rule.rb, line 245
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 }

  if attributes.has_key?(:'accountEmail')
    self.account_email = attributes[:'accountEmail']
  end

  if attributes.has_key?(:'allowedAppTypes')
    if (value = attributes[:'allowedAppTypes']).is_a?(Array)
      self.allowed_app_types = value
    end
  end

  if attributes.has_key?(:'analyzingTime')
    self.analyzing_time = attributes[:'analyzingTime']
  end

  if attributes.has_key?(:'appDisplayState')
    self.app_display_state = attributes[:'appDisplayState']
  end

  if attributes.has_key?(:'appId')
    self.app_id = attributes[:'appId']
  end

  if attributes.has_key?(:'appName')
    self.app_name = attributes[:'appName']
  end

  if attributes.has_key?(:'appState')
    self.app_state = attributes[:'appState']
  end

  if attributes.has_key?(:'appToken')
    self.app_token = attributes[:'appToken']
  end

  if attributes.has_key?(:'appType')
    self.app_type = attributes[:'appType']
  end

  if attributes.has_key?(:'backToNormalNeeded')
    self.back_to_normal_needed = attributes[:'backToNormalNeeded']
  end

  if attributes.has_key?(:'chartKey')
    self.chart_key = attributes[:'chartKey']
  end

  if attributes.has_key?(:'color')
    self.color = attributes[:'color']
  end

  if attributes.has_key?(:'creatorEmail')
    self.creator_email = attributes[:'creatorEmail']
  end

  if attributes.has_key?(:'defaultAggType')
    self.default_agg_type = attributes[:'defaultAggType']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'disallowedAppTypes')
    if (value = attributes[:'disallowedAppTypes']).is_a?(Array)
      self.disallowed_app_types = value
    end
  end

  if attributes.has_key?(:'enabled')
    self.enabled = attributes[:'enabled']
  end

  if attributes.has_key?(:'estimateOperation')
    self.estimate_operation = attributes[:'estimateOperation']
  end

  if attributes.has_key?(:'estimateValue')
    self.estimate_value = attributes[:'estimateValue']
  end

  if attributes.has_key?(:'filterValues')
    self.filter_values = attributes[:'filterValues']
  end

  if attributes.has_key?(:'filterValuesObj')
    if (value = attributes[:'filterValuesObj']).is_a?(Array)
      self.filter_values_obj = value
    end
  end

  if attributes.has_key?(:'ignoreRegularEventsEnabled')
    self.ignore_regular_events_enabled = attributes[:'ignoreRegularEventsEnabled']
  end

  if attributes.has_key?(:'integrations')
    self.integrations = attributes[:'integrations']
  end

  if attributes.has_key?(:'lastDataReceivedDate')
    self.last_data_received_date = attributes[:'lastDataReceivedDate']
  end

  if attributes.has_key?(:'lastSent')
    self.last_sent = attributes[:'lastSent']
  end

  if attributes.has_key?(:'lastTriggered')
    self.last_triggered = attributes[:'lastTriggered']
  end

  if attributes.has_key?(:'metadata')
    self.metadata = attributes[:'metadata']
  end

  if attributes.has_key?(:'metricKey')
    self.metric_key = attributes[:'metricKey']
  end

  if attributes.has_key?(:'metricLabel')
    self.metric_label = attributes[:'metricLabel']
  end

  if attributes.has_key?(:'minDelayBetweenNotificationsInMinutes')
    self.min_delay_between_notifications_in_minutes = attributes[:'minDelayBetweenNotificationsInMinutes']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'notificationEmails')
    if (value = attributes[:'notificationEmails']).is_a?(Array)
      self.notification_emails = value
    end
  end

  if attributes.has_key?(:'notificationIntegrations')
    if (value = attributes[:'notificationIntegrations']).is_a?(Array)
      self.notification_integrations = value
    end
  end

  if attributes.has_key?(:'notificationsEnabled')
    self.notifications_enabled = attributes[:'notificationsEnabled']
  end

  if attributes.has_key?(:'query')
    self.query = attributes[:'query']
  end

  if attributes.has_key?(:'reportName')
    self.report_name = attributes[:'reportName']
  end

  if attributes.has_key?(:'ruleKey')
    self.rule_key = attributes[:'ruleKey']
  end

  if attributes.has_key?(:'ruleType')
    self.rule_type = attributes[:'ruleType']
  end

  if attributes.has_key?(:'runbook')
    self.runbook = attributes[:'runbook']
  end

  if attributes.has_key?(:'savedQueryId')
    self.saved_query_id = attributes[:'savedQueryId']
  end

  if attributes.has_key?(:'schedule')
    if (value = attributes[:'schedule']).is_a?(Array)
      self.schedule = value
    end
  end

  if attributes.has_key?(:'sematextService')
    self.sematext_service = attributes[:'sematextService']
  end

  if attributes.has_key?(:'sendToEmail')
    self.send_to_email = attributes[:'sendToEmail']
  end

  if attributes.has_key?(:'timezone')
    self.timezone = attributes[:'timezone']
  end

  if attributes.has_key?(:'useOnlyAlertRuleIntegrations')
    self.use_only_alert_rule_integrations = attributes[:'useOnlyAlertRuleIntegrations']
  end

  if attributes.has_key?(:'userPermissions')
    self.user_permissions = attributes[:'userPermissions']
  end

  if attributes.has_key?(:'valueColumnName')
    self.value_column_name = attributes[:'valueColumnName']
  end

  if attributes.has_key?(:'valueName')
    self.value_name = attributes[:'valueName']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/SematextCloud/models/alert_rule.rb, line 190
def self.swagger_types
  {
    :'account_email' => :'String',
    :'allowed_app_types' => :'Array<Integer>',
    :'analyzing_time' => :'String',
    :'app_display_state' => :'String',
    :'app_id' => :'Integer',
    :'app_name' => :'String',
    :'app_state' => :'String',
    :'app_token' => :'String',
    :'app_type' => :'String',
    :'back_to_normal_needed' => :'BOOLEAN',
    :'chart_key' => :'String',
    :'color' => :'String',
    :'creator_email' => :'String',
    :'default_agg_type' => :'String',
    :'description' => :'String',
    :'disallowed_app_types' => :'Array<Integer>',
    :'enabled' => :'BOOLEAN',
    :'estimate_operation' => :'String',
    :'estimate_value' => :'Float',
    :'filter_values' => :'String',
    :'filter_values_obj' => :'Array<FilterValue>',
    :'ignore_regular_events_enabled' => :'BOOLEAN',
    :'integrations' => :'String',
    :'last_data_received_date' => :'Integer',
    :'last_sent' => :'Integer',
    :'last_triggered' => :'Integer',
    :'metadata' => :'Object',
    :'metric_key' => :'String',
    :'metric_label' => :'String',
    :'min_delay_between_notifications_in_minutes' => :'String',
    :'name' => :'String',
    :'notification_emails' => :'Array<String>',
    :'notification_integrations' => :'Array<NotificationIntegration>',
    :'notifications_enabled' => :'BOOLEAN',
    :'query' => :'String',
    :'report_name' => :'String',
    :'rule_key' => :'Integer',
    :'rule_type' => :'String',
    :'runbook' => :'String',
    :'saved_query_id' => :'Integer',
    :'schedule' => :'Array<AlertRuleScheduleWeekdayDto>',
    :'sematext_service' => :'String',
    :'send_to_email' => :'String',
    :'timezone' => :'String',
    :'use_only_alert_rule_integrations' => :'BOOLEAN',
    :'user_permissions' => :'UserPermissions',
    :'value_column_name' => :'String',
    :'value_name' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/SematextCloud/models/alert_rule.rb, line 483
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      account_email == o.account_email &&
      allowed_app_types == o.allowed_app_types &&
      analyzing_time == o.analyzing_time &&
      app_display_state == o.app_display_state &&
      app_id == o.app_id &&
      app_name == o.app_name &&
      app_state == o.app_state &&
      app_token == o.app_token &&
      app_type == o.app_type &&
      back_to_normal_needed == o.back_to_normal_needed &&
      chart_key == o.chart_key &&
      color == o.color &&
      creator_email == o.creator_email &&
      default_agg_type == o.default_agg_type &&
      description == o.description &&
      disallowed_app_types == o.disallowed_app_types &&
      enabled == o.enabled &&
      estimate_operation == o.estimate_operation &&
      estimate_value == o.estimate_value &&
      filter_values == o.filter_values &&
      filter_values_obj == o.filter_values_obj &&
      ignore_regular_events_enabled == o.ignore_regular_events_enabled &&
      integrations == o.integrations &&
      last_data_received_date == o.last_data_received_date &&
      last_sent == o.last_sent &&
      last_triggered == o.last_triggered &&
      metadata == o.metadata &&
      metric_key == o.metric_key &&
      metric_label == o.metric_label &&
      min_delay_between_notifications_in_minutes == o.min_delay_between_notifications_in_minutes &&
      name == o.name &&
      notification_emails == o.notification_emails &&
      notification_integrations == o.notification_integrations &&
      notifications_enabled == o.notifications_enabled &&
      query == o.query &&
      report_name == o.report_name &&
      rule_key == o.rule_key &&
      rule_type == o.rule_type &&
      runbook == o.runbook &&
      saved_query_id == o.saved_query_id &&
      schedule == o.schedule &&
      sematext_service == o.sematext_service &&
      send_to_email == o.send_to_email &&
      timezone == o.timezone &&
      use_only_alert_rule_integrations == o.use_only_alert_rule_integrations &&
      user_permissions == o.user_permissions &&
      value_column_name == o.value_column_name &&
      value_name == o.value_name
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/SematextCloud/models/alert_rule.rb, line 572
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = SematextCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/SematextCloud/models/alert_rule.rb, line 638
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/SematextCloud/models/alert_rule.rb, line 551
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/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)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/SematextCloud/models/alert_rule.rb, line 538
def eql?(o)
  self == o
end
estimate_operation=(estimate_operation) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] estimate_operation Object to be assigned

# File lib/SematextCloud/models/alert_rule.rb, line 473
def estimate_operation=(estimate_operation)
  validator = EnumAttributeValidator.new('String', ['LESS', 'MORE', 'EQUAL', 'UN_EQUAL', 'LESS_OR_EQUAL', 'MORE_OR_EQUAL'])
  unless validator.valid?(estimate_operation)
    fail ArgumentError, 'invalid value for "estimate_operation", must be one of #{validator.allowable_values}.'
  end
  @estimate_operation = estimate_operation
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/SematextCloud/models/alert_rule.rb, line 544
def hash
  [account_email, allowed_app_types, analyzing_time, app_display_state, app_id, app_name, app_state, app_token, app_type, back_to_normal_needed, chart_key, color, creator_email, default_agg_type, description, disallowed_app_types, enabled, estimate_operation, estimate_value, filter_values, filter_values_obj, ignore_regular_events_enabled, integrations, last_data_received_date, last_sent, last_triggered, metadata, metric_key, metric_label, min_delay_between_notifications_in_minutes, name, notification_emails, notification_integrations, notifications_enabled, query, report_name, rule_key, rule_type, runbook, saved_query_id, schedule, sematext_service, send_to_email, timezone, use_only_alert_rule_integrations, user_permissions, value_column_name, value_name].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/SematextCloud/models/alert_rule.rb, line 458
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/SematextCloud/models/alert_rule.rb, line 618
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/SematextCloud/models/alert_rule.rb, line 624
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/SematextCloud/models/alert_rule.rb, line 612
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/SematextCloud/models/alert_rule.rb, line 465
def valid?
  estimate_operation_validator = EnumAttributeValidator.new('String', ['LESS', 'MORE', 'EQUAL', 'UN_EQUAL', 'LESS_OR_EQUAL', 'MORE_OR_EQUAL'])
  return false unless estimate_operation_validator.valid?(@estimate_operation)
  true
end