Class: OCI::VnMonitoring::Models::IngressSecurityRule
- Inherits:
-
Object
- Object
- OCI::VnMonitoring::Models::IngressSecurityRule
- Defined in:
- lib/oci/vn_monitoring/models/ingress_security_rule.rb
Overview
A rule for allowing inbound IP packets.
Constant Summary collapse
- SOURCE_TYPE_ENUM =
[ SOURCE_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze, SOURCE_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze, SOURCE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
- #icmp_options ⇒ OCI::VnMonitoring::Models::IcmpOptions
-
#is_stateless ⇒ BOOLEAN
A stateless rule allows traffic in one direction.
-
#protocol ⇒ String
**[Required]** The transport protocol.
-
#source ⇒ String
**[Required]** Conceptually, this is the range of IP addresses that a packet coming into the instance can come from.
-
#source_type ⇒ String
Type of source for the rule.
- #tcp_options ⇒ OCI::VnMonitoring::Models::TcpOptions
- #udp_options ⇒ OCI::VnMonitoring::Models::UdpOptions
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ IngressSecurityRule
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ IngressSecurityRule
Initializes the object
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 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 113 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. = attributes[:'icmpOptions'] if attributes[:'icmpOptions'] raise 'You cannot provide both :icmpOptions and :icmp_options' if attributes.key?(:'icmpOptions') && attributes.key?(:'icmp_options') self. = 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.source = attributes[:'source'] if attributes[:'source'] self.source_type = attributes[:'sourceType'] if attributes[:'sourceType'] self.source_type = "CIDR_BLOCK" if source_type.nil? && !attributes.key?(:'sourceType') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :sourceType and :source_type' if attributes.key?(:'sourceType') && attributes.key?(:'source_type') self.source_type = attributes[:'source_type'] if attributes[:'source_type'] self.source_type = "CIDR_BLOCK" if source_type.nil? && !attributes.key?(:'sourceType') && !attributes.key?(:'source_type') # rubocop:disable Style/StringLiterals self. = attributes[:'tcpOptions'] if attributes[:'tcpOptions'] raise 'You cannot provide both :tcpOptions and :tcp_options' if attributes.key?(:'tcpOptions') && attributes.key?(:'tcp_options') self. = attributes[:'tcp_options'] if attributes[:'tcp_options'] self. = attributes[:'udpOptions'] if attributes[:'udpOptions'] raise 'You cannot provide both :udpOptions and :udp_options' if attributes.key?(:'udpOptions') && attributes.key?(:'udp_options') self. = attributes[:'udp_options'] if attributes[:'udp_options'] end |
Instance Attribute Details
#icmp_options ⇒ OCI::VnMonitoring::Models::IcmpOptions
18 19 20 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 18 def @icmp_options end |
#is_stateless ⇒ BOOLEAN
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.
27 28 29 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 27 def is_stateless @is_stateless end |
#protocol ⇒ String
**[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"), UDP ("17"), and ICMPv6 ("58").
35 36 37 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 35 def protocol @protocol end |
#source ⇒ String
**[Required]** Conceptually, this is the range of IP addresses that a packet coming into the instance can come from.
Allowed values:
* IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`.
IPv6 addressing is supported for all commercial and government regions. See
[IPv6 Addresses](https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm).
* The `cidrBlock` value for a {Service}, if you're
setting up a security list rule for traffic coming from a particular `Service` through
a service gateway. For example: `oci-phx-objectstorage`.
51 52 53 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 51 def source @source end |
#source_type ⇒ String
Type of source for the rule. The default is `CIDR_BLOCK`.
* `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation.
* `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a
{Service} (the rule is for traffic coming from a
particular `Service` through a service gateway).
62 63 64 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 62 def source_type @source_type end |
#tcp_options ⇒ OCI::VnMonitoring::Models::TcpOptions
65 66 67 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 65 def @tcp_options end |
#udp_options ⇒ OCI::VnMonitoring::Models::UdpOptions
68 69 70 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 68 def @udp_options end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 71 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'icmp_options': :'icmpOptions', 'is_stateless': :'isStateless', 'protocol': :'protocol', 'source': :'source', 'source_type': :'sourceType', 'tcp_options': :'tcpOptions', 'udp_options': :'udpOptions' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 86 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'icmp_options': :'OCI::VnMonitoring::Models::IcmpOptions', 'is_stateless': :'BOOLEAN', 'protocol': :'String', 'source': :'String', 'source_type': :'String', '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.
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 176 def ==(other) return true if equal?(other) self.class == other.class && == other. && is_stateless == other.is_stateless && protocol == other.protocol && source == other.source && source_type == other.source_type && == other. && == other. end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 212 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
192 193 194 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 192 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
201 202 203 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 201 def hash [, is_stateless, protocol, source, source_type, , ].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
245 246 247 248 249 250 251 252 253 254 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 245 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_s ⇒ String
Returns the string representation of the object
239 240 241 |
# File 'lib/oci/vn_monitoring/models/ingress_security_rule.rb', line 239 def to_s to_hash.to_s end |