Class: OCI::VnMonitoring::Models::EgressSecurityRule

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

Overview

A rule for allowing outbound IP packets.

Constant Summary collapse

DESTINATION_TYPE_ENUM =
[
  DESTINATION_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze,
  DESTINATION_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze,
  DESTINATION_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 = {}) ⇒ EgressSecurityRule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 124

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

  self.destination_type = attributes[:'destinationType'] if attributes[:'destinationType']
  self.destination_type = "CIDR_BLOCK" if destination_type.nil? && !attributes.key?(:'destinationType') # rubocop:disable Style/StringLiterals

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

  self.destination_type = attributes[:'destination_type'] if attributes[:'destination_type']
  self.destination_type = "CIDR_BLOCK" if destination_type.nil? && !attributes.key?(:'destinationType') && !attributes.key?(:'destination_type') # rubocop:disable Style/StringLiterals

  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.is_stateless = attributes[:'isStateless'] unless attributes[:'isStateless'].nil?

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

  self.is_stateless = attributes[:'is_stateless'] unless attributes[:'is_stateless'].nil?

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

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

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

Instance Attribute Details

#descriptionString

An optional description of your choice for the rule.

Returns:

  • (String)


76
77
78
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 76

def description
  @description
end

#destinationString

[Required] Conceptually, this is the range of IP addresses that a packet originating from the instance can go to.

Allowed values:

  • IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56 Note that IPv6 addressing is currently supported only in certain regions. See IPv6 Addresses.

  • The cidrBlock value for a Service, if you're setting up a security list rule for traffic destined for a particular Service through a service gateway. For example: oci-phx-objectstorage.

Returns:

  • (String)


32
33
34
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 32

def destination
  @destination
end

#destination_typeString

Type of destination for the rule. The default is CIDR_BLOCK.

Allowed values:

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.

  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).

Returns:

  • (String)


45
46
47
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 45

def destination_type
  @destination_type
end

#icmp_optionsOCI::VnMonitoring::Models::IcmpOptions



48
49
50
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 48

def icmp_options
  @icmp_options
end

#is_statelessBOOLEAN

A stateless rule allows traffic in one direction. Remember to add a corresponding stateless rule in the other direction if you need to support bidirectional traffic. For example, if egress traffic allows TCP destination port 80, there should be an ingress rule to allow TCP source port 80. Defaults to false, which means the rule is stateful and a corresponding rule is not necessary for bidirectional traffic.

Returns:

  • (BOOLEAN)


57
58
59
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 57

def is_stateless
  @is_stateless
end

#protocolString

[Required] The transport protocol. Specify either all or an IPv4 protocol number as defined in Protocol Numbers. Options are supported only for ICMP ("1"), TCP ("6"), UDP ("17"), and ICMPv6 ("58").

Returns:

  • (String)


65
66
67
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 65

def protocol
  @protocol
end

#tcp_optionsOCI::VnMonitoring::Models::TcpOptions



68
69
70
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 68

def tcp_options
  @tcp_options
end

#udp_optionsOCI::VnMonitoring::Models::UdpOptions



71
72
73
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 71

def udp_options
  @udp_options
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'destination': :'destination',
    'destination_type': :'destinationType',
    'icmp_options': :'icmpOptions',
    'is_stateless': :'isStateless',
    'protocol': :'protocol',
    'tcp_options': :'tcpOptions',
    'udp_options': :'udpOptions',
    'description': :'description'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 95

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'destination': :'String',
    'destination_type': :'String',
    'icmp_options': :'OCI::VnMonitoring::Models::IcmpOptions',
    'is_stateless': :'BOOLEAN',
    'protocol': :'String',
    'tcp_options': :'OCI::VnMonitoring::Models::TcpOptions',
    'udp_options': :'OCI::VnMonitoring::Models::UdpOptions',
    'description': :'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



189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 189

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

  self.class == other.class &&
    destination == other.destination &&
    destination_type == other.destination_type &&
    icmp_options == other.icmp_options &&
    is_stateless == other.is_stateless &&
    protocol == other.protocol &&
    tcp_options == other.tcp_options &&
    udp_options == other.udp_options &&
    description == other.description
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



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 226

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


206
207
208
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 206

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



215
216
217
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 215

def hash
  [destination, destination_type, icmp_options, is_stateless, protocol, tcp_options, udp_options, description].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



259
260
261
262
263
264
265
266
267
268
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 259

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



253
254
255
# File 'lib/oci/vn_monitoring/models/egress_security_rule.rb', line 253

def to_s
  to_hash.to_s
end