1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. 4 5 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class EgressSecurityRule(object): 12 """ 13 A rule for allowing outbound IP packets. 14 """ 15 16 #: A constant which can be used with the destination_type property of a EgressSecurityRule. 17 #: This constant has a value of "CIDR_BLOCK" 18 DESTINATION_TYPE_CIDR_BLOCK = "CIDR_BLOCK" 19 20 #: A constant which can be used with the destination_type property of a EgressSecurityRule. 21 #: This constant has a value of "SERVICE_CIDR_BLOCK" 22 DESTINATION_TYPE_SERVICE_CIDR_BLOCK = "SERVICE_CIDR_BLOCK" 23 24 def __init__(self, **kwargs): 25 """ 26 Initializes a new EgressSecurityRule object with values from keyword arguments. 27 The following keyword arguments are supported (corresponding to the getters/setters of this class): 28 29 :param destination: 30 The value to assign to the destination property of this EgressSecurityRule. 31 :type destination: str 32 33 :param destination_type: 34 The value to assign to the destination_type property of this EgressSecurityRule. 35 Allowed values for this property are: "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", 'UNKNOWN_ENUM_VALUE'. 36 Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. 37 :type destination_type: str 38 39 :param icmp_options: 40 The value to assign to the icmp_options property of this EgressSecurityRule. 41 :type icmp_options: oci.core.models.IcmpOptions 42 43 :param is_stateless: 44 The value to assign to the is_stateless property of this EgressSecurityRule. 45 :type is_stateless: bool 46 47 :param protocol: 48 The value to assign to the protocol property of this EgressSecurityRule. 49 :type protocol: str 50 51 :param tcp_options: 52 The value to assign to the tcp_options property of this EgressSecurityRule. 53 :type tcp_options: oci.core.models.TcpOptions 54 55 :param udp_options: 56 The value to assign to the udp_options property of this EgressSecurityRule. 57 :type udp_options: oci.core.models.UdpOptions 58 59 :param description: 60 The value to assign to the description property of this EgressSecurityRule. 61 :type description: str 62 63 """ 64 self.swagger_types = { 65 'destination': 'str', 66 'destination_type': 'str', 67 'icmp_options': 'IcmpOptions', 68 'is_stateless': 'bool', 69 'protocol': 'str', 70 'tcp_options': 'TcpOptions', 71 'udp_options': 'UdpOptions', 72 'description': 'str' 73 } 74 75 self.attribute_map = { 76 'destination': 'destination', 77 'destination_type': 'destinationType', 78 'icmp_options': 'icmpOptions', 79 'is_stateless': 'isStateless', 80 'protocol': 'protocol', 81 'tcp_options': 'tcpOptions', 82 'udp_options': 'udpOptions', 83 'description': 'description' 84 } 85 86 self._destination = None 87 self._destination_type = None 88 self._icmp_options = None 89 self._is_stateless = None 90 self._protocol = None 91 self._tcp_options = None 92 self._udp_options = None 93 self._description = None 94 95 @property 96 def destination(self): 97 """ 98 **[Required]** Gets the destination of this EgressSecurityRule. 99 Conceptually, this is the range of IP addresses that a packet originating from the instance 100 can go to. 101 102 Allowed values: 103 104 * IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56` 105 Note that IPv6 addressing is currently supported only in certain regions. See 106 `IPv6 Addresses`__. 107 108 * The `cidrBlock` value for a :class:`Service`, if you're 109 setting up a security list rule for traffic destined for a particular `Service` through 110 a service gateway. For example: `oci-phx-objectstorage`. 111 112 __ https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm 113 114 115 :return: The destination of this EgressSecurityRule. 116 :rtype: str 117 """ 118 return self._destination 119 120 @destination.setter 121 def destination(self, destination): 122 """ 123 Sets the destination of this EgressSecurityRule. 124 Conceptually, this is the range of IP addresses that a packet originating from the instance 125 can go to. 126 127 Allowed values: 128 129 * IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56` 130 Note that IPv6 addressing is currently supported only in certain regions. See 131 `IPv6 Addresses`__. 132 133 * The `cidrBlock` value for a :class:`Service`, if you're 134 setting up a security list rule for traffic destined for a particular `Service` through 135 a service gateway. For example: `oci-phx-objectstorage`. 136 137 __ https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm 138 139 140 :param destination: The destination of this EgressSecurityRule. 141 :type: str 142 """ 143 self._destination = destination 144 145 @property 146 def destination_type(self): 147 """ 148 Gets the destination_type of this EgressSecurityRule. 149 Type of destination for the rule. The default is `CIDR_BLOCK`. 150 151 Allowed values: 152 153 * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. 154 155 * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a 156 :class:`Service` (the rule is for traffic destined for a 157 particular `Service` through a service gateway). 158 159 Allowed values for this property are: "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", 'UNKNOWN_ENUM_VALUE'. 160 Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. 161 162 163 :return: The destination_type of this EgressSecurityRule. 164 :rtype: str 165 """ 166 return self._destination_type 167 168 @destination_type.setter 169 def destination_type(self, destination_type): 170 """ 171 Sets the destination_type of this EgressSecurityRule. 172 Type of destination for the rule. The default is `CIDR_BLOCK`. 173 174 Allowed values: 175 176 * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. 177 178 * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a 179 :class:`Service` (the rule is for traffic destined for a 180 particular `Service` through a service gateway). 181 182 183 :param destination_type: The destination_type of this EgressSecurityRule. 184 :type: str 185 """ 186 allowed_values = ["CIDR_BLOCK", "SERVICE_CIDR_BLOCK"] 187 if not value_allowed_none_or_none_sentinel(destination_type, allowed_values): 188 destination_type = 'UNKNOWN_ENUM_VALUE' 189 self._destination_type = destination_type 190 191 @property 192 def icmp_options(self): 193 """ 194 Gets the icmp_options of this EgressSecurityRule. 195 196 :return: The icmp_options of this EgressSecurityRule. 197 :rtype: oci.core.models.IcmpOptions 198 """ 199 return self._icmp_options 200 201 @icmp_options.setter 202 def icmp_options(self, icmp_options): 203 """ 204 Sets the icmp_options of this EgressSecurityRule. 205 206 :param icmp_options: The icmp_options of this EgressSecurityRule. 207 :type: oci.core.models.IcmpOptions 208 """ 209 self._icmp_options = icmp_options 210 211 @property 212 def is_stateless(self): 213 """ 214 Gets the is_stateless of this EgressSecurityRule. 215 A stateless rule allows traffic in one direction. Remember to add a corresponding 216 stateless rule in the other direction if you need to support bidirectional traffic. For 217 example, if egress traffic allows TCP destination port 80, there should be an ingress 218 rule to allow TCP source port 80. Defaults to false, which means the rule is stateful 219 and a corresponding rule is not necessary for bidirectional traffic. 220 221 222 :return: The is_stateless of this EgressSecurityRule. 223 :rtype: bool 224 """ 225 return self._is_stateless 226 227 @is_stateless.setter 228 def is_stateless(self, is_stateless): 229 """ 230 Sets the is_stateless of this EgressSecurityRule. 231 A stateless rule allows traffic in one direction. Remember to add a corresponding 232 stateless rule in the other direction if you need to support bidirectional traffic. For 233 example, if egress traffic allows TCP destination port 80, there should be an ingress 234 rule to allow TCP source port 80. Defaults to false, which means the rule is stateful 235 and a corresponding rule is not necessary for bidirectional traffic. 236 237 238 :param is_stateless: The is_stateless of this EgressSecurityRule. 239 :type: bool 240 """ 241 self._is_stateless = is_stateless 242 243 @property 244 def protocol(self): 245 """ 246 **[Required]** Gets the protocol of this EgressSecurityRule. 247 The transport protocol. Specify either `all` or an IPv4 protocol number as 248 defined in 249 `Protocol Numbers`__. 250 Options are supported only for ICMP (\"1\"), TCP (\"6\"), UDP (\"17\"), and ICMPv6 (\"58\"). 251 252 __ http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml 253 254 255 :return: The protocol of this EgressSecurityRule. 256 :rtype: str 257 """ 258 return self._protocol 259 260 @protocol.setter 261 def protocol(self, protocol): 262 """ 263 Sets the protocol of this EgressSecurityRule. 264 The transport protocol. Specify either `all` or an IPv4 protocol number as 265 defined in 266 `Protocol Numbers`__. 267 Options are supported only for ICMP (\"1\"), TCP (\"6\"), UDP (\"17\"), and ICMPv6 (\"58\"). 268 269 __ http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml 270 271 272 :param protocol: The protocol of this EgressSecurityRule. 273 :type: str 274 """ 275 self._protocol = protocol 276 277 @property 278 def tcp_options(self): 279 """ 280 Gets the tcp_options of this EgressSecurityRule. 281 282 :return: The tcp_options of this EgressSecurityRule. 283 :rtype: oci.core.models.TcpOptions 284 """ 285 return self._tcp_options 286 287 @tcp_options.setter 288 def tcp_options(self, tcp_options): 289 """ 290 Sets the tcp_options of this EgressSecurityRule. 291 292 :param tcp_options: The tcp_options of this EgressSecurityRule. 293 :type: oci.core.models.TcpOptions 294 """ 295 self._tcp_options = tcp_options 296 297 @property 298 def udp_options(self): 299 """ 300 Gets the udp_options of this EgressSecurityRule. 301 302 :return: The udp_options of this EgressSecurityRule. 303 :rtype: oci.core.models.UdpOptions 304 """ 305 return self._udp_options 306 307 @udp_options.setter 308 def udp_options(self, udp_options): 309 """ 310 Sets the udp_options of this EgressSecurityRule. 311 312 :param udp_options: The udp_options of this EgressSecurityRule. 313 :type: oci.core.models.UdpOptions 314 """ 315 self._udp_options = udp_options 316 317 @property 318 def description(self): 319 """ 320 Gets the description of this EgressSecurityRule. 321 An optional description of your choice for the rule. 322 323 324 :return: The description of this EgressSecurityRule. 325 :rtype: str 326 """ 327 return self._description 328 329 @description.setter 330 def description(self, description): 331 """ 332 Sets the description of this EgressSecurityRule. 333 An optional description of your choice for the rule. 334 335 336 :param description: The description of this EgressSecurityRule. 337 :type: str 338 """ 339 self._description = description 340 341 def __repr__(self): 342 return formatted_flat_dict(self) 343 344 def __eq__(self, other): 345 if other is None: 346 return False 347 348 return self.__dict__ == other.__dict__ 349 350 def __ne__(self, other): 351 return not self == other 352