Class: OCI::VnMonitoring::Models::SecurityAction

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/vn_monitoring/models/security_action.rb

Overview

Defines the security action details taken on the traffic. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

ACTION_ENUM =
[
  ACTION_ALLOWED = 'ALLOWED'.freeze,
  ACTION_DENIED = 'DENIED'.freeze,
  ACTION_ZPR_DENIED = 'ZPR_DENIED'.freeze,
  ACTION_ZPR_ALLOWED = 'ZPR_ALLOWED'.freeze,
  ACTION_ZPR_CIDR_UNSUPPORTED = 'ZPR_CIDR_UNSUPPORTED'.freeze,
  ACTION_ZPR_NSG_UNSUPPORTED = 'ZPR_NSG_UNSUPPORTED'.freeze,
  ACTION_ZPR_POLICY_NOT_EVALUATED_MISSING_ROUTE = 'ZPR_POLICY_NOT_EVALUATED_MISSING_ROUTE'.freeze,
  ACTION_ZPR_POLICY_NOT_EVALUATED_SL_NSG_DENIED = 'ZPR_POLICY_NOT_EVALUATED_SL_NSG_DENIED'.freeze,
  ACTION_ZPR_MISSING_POLICY = 'ZPR_MISSING_POLICY'.freeze,
  ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
ACTION_TYPE_ENUM =
[
  ACTION_TYPE_EXPLICIT = 'EXPLICIT'.freeze,
  ACTION_TYPE_IMPLICIT = 'IMPLICIT'.freeze,
  ACTION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SecurityAction

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :action (String)

    The value to assign to the #action property

  • :action_type (String)

    The value to assign to the #action_type property



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 91

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

  self.action_type = attributes[:'actionType'] if attributes[:'actionType']

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

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

Instance Attribute Details

#actionString

[Required] Action taken on the traffic.

Returns:

  • (String)


34
35
36
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 34

def action
  @action
end

#action_typeString

[Required] Type of the SecurityAction.

Returns:

  • (String)


38
39
40
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 38

def action_type
  @action_type
end

Class Method Details

.attribute_mapObject

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



41
42
43
44
45
46
47
48
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'action': :'action',
    'action_type': :'actionType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 65

def self.get_subtype(object_hash)
  type = object_hash[:'action'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::VnMonitoring::Models::AllowedSecurityAction' if type == 'ALLOWED'
  return 'OCI::VnMonitoring::Models::ZprMissingPolicySecurityAction' if type == 'ZPR_MISSING_POLICY'
  return 'OCI::VnMonitoring::Models::ZprDeniedSecurityAction' if type == 'ZPR_DENIED'
  return 'OCI::VnMonitoring::Models::ZprPolicyNotEvaluatedMissingRouteSecurityAction' if type == 'ZPR_POLICY_NOT_EVALUATED_MISSING_ROUTE'
  return 'OCI::VnMonitoring::Models::ZprNsgUnsupportedSecurityAction' if type == 'ZPR_NSG_UNSUPPORTED'
  return 'OCI::VnMonitoring::Models::ZprAllowedSecurityAction' if type == 'ZPR_ALLOWED'
  return 'OCI::VnMonitoring::Models::DeniedSecurityAction' if type == 'DENIED'
  return 'OCI::VnMonitoring::Models::ZprCidrUnsupportedSecurityAction' if type == 'ZPR_CIDR_UNSUPPORTED'
  return 'OCI::VnMonitoring::Models::ZprPolicyNotEvaluatedSlNsgDeniedSecurityAction' if type == 'ZPR_POLICY_NOT_EVALUATED_SL_NSG_DENIED'

  # TODO: Log a warning when the subtype is not found.
  'OCI::VnMonitoring::Models::SecurityAction'
end

.swagger_typesObject

Attribute type mapping.



51
52
53
54
55
56
57
58
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 51

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'action': :'String',
    'action_type': :'String'
    # 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



139
140
141
142
143
144
145
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 139

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

  self.class == other.class &&
    action == other.action &&
    action_type == other.action_type
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



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 170

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


150
151
152
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 150

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



159
160
161
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 159

def hash
  [action, action_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 203

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



197
198
199
# File 'lib/oci/vn_monitoring/models/security_action.rb', line 197

def to_s
  to_hash.to_s
end