Class: OCI::VnMonitoring::Models::VtapCaptureFilterRuleDetails

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

Overview

This resource contains the rules governing what traffic a VTAP mirrors.

Constant Summary collapse

TRAFFIC_DIRECTION_ENUM =
[
  TRAFFIC_DIRECTION_INGRESS = 'INGRESS'.freeze,
  TRAFFIC_DIRECTION_EGRESS = 'EGRESS'.freeze,
  TRAFFIC_DIRECTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
RULE_ACTION_ENUM =
[
  RULE_ACTION_INCLUDE = 'INCLUDE'.freeze,
  RULE_ACTION_EXCLUDE = 'EXCLUDE'.freeze,
  RULE_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VtapCaptureFilterRuleDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



109
110
111
112
113
114
115
116
117
118
119
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
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 109

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

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

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

  self.rule_action = attributes[:'ruleAction'] if attributes[:'ruleAction']

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

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

  self.source_cidr = attributes[:'sourceCidr'] if attributes[:'sourceCidr']

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

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

  self.destination_cidr = attributes[:'destinationCidr'] if attributes[:'destinationCidr']

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

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

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

  self.icmp_options = attributes[:'icmpOptions'] if attributes[:'icmpOptions']

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

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

  self.tcp_options = attributes[:'tcpOptions'] if attributes[:'tcpOptions']

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

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

  self.udp_options = attributes[:'udpOptions'] if attributes[:'udpOptions']

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

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

Instance Attribute Details

#destination_cidrString

Traffic sent to this CIDR block through the VTAP source will be mirrored to the VTAP target.

Returns:

  • (String)


43
44
45
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 43

def destination_cidr
  @destination_cidr
end

#icmp_optionsOCI::VnMonitoring::Models::IcmpOptions



55
56
57
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 55

def icmp_options
  @icmp_options
end

#protocolString

The transport protocol used in the filter. If do not choose a protocol, all protocols will be used in the filter. Supported options are: * 1 = ICMP * 6 = TCP * 17 = UDP

Returns:

  • (String)


52
53
54
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 52

def protocol
  @protocol
end

#rule_actionString

Include or exclude packets meeting this definition from mirrored traffic.

Returns:

  • (String)


33
34
35
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 33

def rule_action
  @rule_action
end

#source_cidrString

Traffic from this CIDR block to the VTAP source will be mirrored to the VTAP target.

Returns:

  • (String)


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

def source_cidr
  @source_cidr
end

#tcp_optionsOCI::VnMonitoring::Models::TcpOptions



58
59
60
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 58

def tcp_options
  @tcp_options
end

#traffic_directionString

[Required] The traffic direction the VTAP is configured to mirror.

Returns:

  • (String)


28
29
30
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 28

def traffic_direction
  @traffic_direction
end

#udp_optionsOCI::VnMonitoring::Models::UdpOptions



61
62
63
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 61

def udp_options
  @udp_options
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'traffic_direction': :'trafficDirection',
    'rule_action': :'ruleAction',
    'source_cidr': :'sourceCidr',
    'destination_cidr': :'destinationCidr',
    'protocol': :'protocol',
    'icmp_options': :'icmpOptions',
    'tcp_options': :'tcpOptions',
    'udp_options': :'udpOptions'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 80

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'traffic_direction': :'String',
    'rule_action': :'String',
    'source_cidr': :'String',
    'destination_cidr': :'String',
    'protocol': :'String',
    'icmp_options': :'OCI::VnMonitoring::Models::IcmpOptions',
    'tcp_options': :'OCI::VnMonitoring::Models::TcpOptions',
    'udp_options': :'OCI::VnMonitoring::Models::UdpOptions'
    # 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



193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 193

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

  self.class == other.class &&
    traffic_direction == other.traffic_direction &&
    rule_action == other.rule_action &&
    source_cidr == other.source_cidr &&
    destination_cidr == other.destination_cidr &&
    protocol == other.protocol &&
    icmp_options == other.icmp_options &&
    tcp_options == other.tcp_options &&
    udp_options == other.udp_options
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



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 230

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


210
211
212
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 210

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



219
220
221
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 219

def hash
  [traffic_direction, rule_action, source_cidr, destination_cidr, protocol, icmp_options, tcp_options, udp_options].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



263
264
265
266
267
268
269
270
271
272
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 263

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



257
258
259
# File 'lib/oci/vn_monitoring/models/vtap_capture_filter_rule_details.rb', line 257

def to_s
  to_hash.to_s
end