class OpsgenieSdk::CreateIntegrationAction

Attributes

_alias[RW]
alert_actions[RW]
append_attachments[RW]
custom_priority[RW]
description[RW]
entity[RW]
extra_properties[RW]
filter[RW]
ignore_alert_actions_from_payload[RW]
ignore_extra_properties_from_payload[RW]
ignore_recipients_from_payload[RW]
ignore_responders_from_payload[RW]
ignore_tags_from_payload[RW]
ignore_teams_from_payload[RW]
message[RW]
name[RW]
note[RW]
order[RW]
priority[RW]
recipients[RW]
responders[RW]
source[RW]
tags[RW]
type[RW]
user[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 90
def self.attribute_map
  {
    :'name' => :'name',
    :'order' => :'order',
    :'filter' => :'filter',
    :'type' => :'type',
    :'user' => :'user',
    :'note' => :'note',
    :'_alias' => :'alias',
    :'source' => :'source',
    :'message' => :'message',
    :'description' => :'description',
    :'entity' => :'entity',
    :'priority' => :'priority',
    :'custom_priority' => :'customPriority',
    :'append_attachments' => :'appendAttachments',
    :'alert_actions' => :'alertActions',
    :'ignore_alert_actions_from_payload' => :'ignoreAlertActionsFromPayload',
    :'recipients' => :'recipients',
    :'responders' => :'responders',
    :'ignore_recipients_from_payload' => :'ignoreRecipientsFromPayload',
    :'ignore_teams_from_payload' => :'ignoreTeamsFromPayload',
    :'tags' => :'tags',
    :'ignore_tags_from_payload' => :'ignoreTagsFromPayload',
    :'extra_properties' => :'extraProperties',
    :'ignore_extra_properties_from_payload' => :'ignoreExtraPropertiesFromPayload',
    :'ignore_responders_from_payload' => :'ignoreRespondersFromPayload'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 153
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?(:'name')
    self.name = attributes[:'name']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'extraProperties')
    if (value = attributes[:'extraProperties']).is_a?(Hash)
      self.extra_properties = value
    end
  end

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

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

Attribute type mapping.

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 121
def self.swagger_types
  {
    :'name' => :'String',
    :'order' => :'Integer',
    :'filter' => :'IntegrationActionFilter',
    :'type' => :'String',
    :'user' => :'String',
    :'note' => :'String',
    :'_alias' => :'String',
    :'source' => :'String',
    :'message' => :'String',
    :'description' => :'String',
    :'entity' => :'String',
    :'priority' => :'String',
    :'custom_priority' => :'String',
    :'append_attachments' => :'BOOLEAN',
    :'alert_actions' => :'Array<String>',
    :'ignore_alert_actions_from_payload' => :'BOOLEAN',
    :'recipients' => :'Array<Recipient>',
    :'responders' => :'Array<Recipient>',
    :'ignore_recipients_from_payload' => :'BOOLEAN',
    :'ignore_teams_from_payload' => :'BOOLEAN',
    :'tags' => :'Array<String>',
    :'ignore_tags_from_payload' => :'BOOLEAN',
    :'extra_properties' => :'Hash<String, String>',
    :'ignore_extra_properties_from_payload' => :'BOOLEAN',
    :'ignore_responders_from_payload' => :'BOOLEAN'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 339
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      order == o.order &&
      filter == o.filter &&
      type == o.type &&
      user == o.user &&
      note == o.note &&
      _alias == o._alias &&
      source == o.source &&
      message == o.message &&
      description == o.description &&
      entity == o.entity &&
      priority == o.priority &&
      custom_priority == o.custom_priority &&
      append_attachments == o.append_attachments &&
      alert_actions == o.alert_actions &&
      ignore_alert_actions_from_payload == o.ignore_alert_actions_from_payload &&
      recipients == o.recipients &&
      responders == o.responders &&
      ignore_recipients_from_payload == o.ignore_recipients_from_payload &&
      ignore_teams_from_payload == o.ignore_teams_from_payload &&
      tags == o.tags &&
      ignore_tags_from_payload == o.ignore_tags_from_payload &&
      extra_properties == o.extra_properties &&
      ignore_extra_properties_from_payload == o.ignore_extra_properties_from_payload &&
      ignore_responders_from_payload == o.ignore_responders_from_payload
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/opsgenie_sdk/models/create_integration_action.rb, line 405
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 = OpsgenieSdk.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/opsgenie_sdk/models/create_integration_action.rb, line 471
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/opsgenie_sdk/models/create_integration_action.rb, line 384
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 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/opsgenie_sdk/models/create_integration_action.rb, line 371
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 377
def hash
  [name, order, filter, type, user, note, _alias, source, message, description, entity, priority, custom_priority, append_attachments, alert_actions, ignore_alert_actions_from_payload, recipients, responders, ignore_recipients_from_payload, ignore_teams_from_payload, tags, ignore_tags_from_payload, extra_properties, ignore_extra_properties_from_payload, ignore_responders_from_payload].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/opsgenie_sdk/models/create_integration_action.rb, line 272
def list_invalid_properties
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if !@order.nil? && @order < 0
    invalid_properties.push('invalid value for "order", must be greater than or equal to 0.')
  end

  if @filter.nil?
    invalid_properties.push('invalid value for "filter", filter cannot be nil.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  invalid_properties
end
order=(order) click to toggle source

Custom attribute writer method with validation @param [Object] order Value to be assigned

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 309
def order=(order)
  if !order.nil? && order < 0
    fail ArgumentError, 'invalid value for "order", must be greater than or equal to 0.'
  end

  @order = order
end
priority=(priority) click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 329
def priority=(priority)
  validator = EnumAttributeValidator.new('String', ['P1', 'P2', 'P3', 'P4', 'P5'])
  unless validator.valid?(priority)
    fail ArgumentError, 'invalid value for "priority", must be one of #{validator.allowable_values}.'
  end
  @priority = priority
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/opsgenie_sdk/models/create_integration_action.rb, line 451
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/opsgenie_sdk/models/create_integration_action.rb, line 457
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/opsgenie_sdk/models/create_integration_action.rb, line 445
def to_s
  to_hash.to_s
end
type=(type) click to toggle source

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

# File lib/opsgenie_sdk/models/create_integration_action.rb, line 319
def type=(type)
  validator = EnumAttributeValidator.new('String', ['acknowledge', 'addNote', 'close', 'create', 'ignore'])
  unless validator.valid?(type)
    fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
  end
  @type = type
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/opsgenie_sdk/models/create_integration_action.rb, line 295
def valid?
  return false if @name.nil?
  return false if !@order.nil? && @order < 0
  return false if @filter.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ['acknowledge', 'addNote', 'close', 'create', 'ignore'])
  return false unless type_validator.valid?(@type)
  priority_validator = EnumAttributeValidator.new('String', ['P1', 'P2', 'P3', 'P4', 'P5'])
  return false unless priority_validator.valid?(@priority)
  true
end