Class: OCI::Core::Models::IngressSecurityRule

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/models/ingress_security_rule.rb

Overview

A rule for allowing inbound IP packets.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ IngressSecurityRule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/oci/core/models/ingress_security_rule.rb', line 64

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[:'icmpOptions']
    self.icmp_options = attributes[:'icmpOptions']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#icmp_optionsOCI::Core::Models::IcmpOptions

Optional and valid only for ICMP. Use to specify a particular ICMP type and code as defined in [ICMP Parameters](www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml). If you specify ICMP as the protocol but omit this object, then all ICMP types and codes are allowed. If you do provide this object, the type is required and the code is optional. To enable MTU negotiation for ingress internet traffic, make sure to allow type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don’t Fragment was Set"). If you need to specify multiple codes for a single type, create a separate security list rule for each.



18
19
20
# File 'lib/oci/core/models/ingress_security_rule.rb', line 18

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 ingress traffic allows TCP destination port 80, there should be an egress 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)


27
28
29
# File 'lib/oci/core/models/ingress_security_rule.rb', line 27

def is_stateless
  @is_stateless
end

#protocolString

[Required] The transport protocol. Specify either ‘all` or an IPv4 protocol number as defined in [Protocol Numbers](www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). Options are supported only for ICMP ("1"), TCP ("6"), and UDP ("17").

Returns:

  • (String)


35
36
37
# File 'lib/oci/core/models/ingress_security_rule.rb', line 35

def protocol
  @protocol
end

#sourceString

[Required] The source CIDR block for the ingress rule. This is the range of IP addresses that a packet coming into the instance can come from.

Returns:

  • (String)


41
42
43
# File 'lib/oci/core/models/ingress_security_rule.rb', line 41

def source
  @source
end

#tcp_optionsOCI::Core::Models::TcpOptions

Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. If you specify TCP as the protocol but omit this object, then all destination ports are allowed.



47
48
49
# File 'lib/oci/core/models/ingress_security_rule.rb', line 47

def tcp_options
  @tcp_options
end

#udp_optionsOCI::Core::Models::UdpOptions

Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. If you specify UDP as the protocol but omit this object, then all destination ports are allowed.



53
54
55
# File 'lib/oci/core/models/ingress_security_rule.rb', line 53

def udp_options
  @udp_options
end

Instance Method Details

#==(other_object) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other_object (Object)

    to be compared



122
123
124
125
126
127
128
129
130
131
# File 'lib/oci/core/models/ingress_security_rule.rb', line 122

def ==(other_object)
  return true if self.equal?(other_object)
  self.class == other_object.class &&
      icmp_options == other_object.icmp_options &&
      is_stateless == other_object.is_stateless &&
      protocol == other_object.protocol &&
      source == other_object.source &&
      tcp_options == other_object.tcp_options &&
      udp_options == other_object.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



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/core/models/ingress_security_rule.rb', line 148

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)
        self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.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_object) ⇒ Boolean

Parameters:

  • other_object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


135
136
137
# File 'lib/oci/core/models/ingress_security_rule.rb', line 135

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



141
142
143
# File 'lib/oci/core/models/ingress_security_rule.rb', line 141

def hash
  [icmp_options, is_stateless, protocol, source, 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



173
174
175
176
177
178
179
180
181
# File 'lib/oci/core/models/ingress_security_rule.rb', line 173

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



167
168
169
# File 'lib/oci/core/models/ingress_security_rule.rb', line 167

def to_s
  to_hash.to_s
end