1// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2// Code generated. DO NOT EDIT.
3
4// Core Services API
5//
6// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
7// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
8// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
9// to manage resources such as virtual cloud networks (VCNs), compute instances, and
10// block storage volumes.
11//
12
13package core
14
15import (
16	"github.com/oracle/oci-go-sdk/common"
17)
18
19// EgressSecurityRule A rule for allowing outbound IP packets.
20type EgressSecurityRule struct {
21
22	// Conceptually, this is the range of IP addresses that a packet originating from the instance
23	// can go to.
24	// Allowed values:
25	//   * IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`
26	//     Note that IPv6 addressing is currently supported only in the Government Cloud.
27	//   * The `cidrBlock` value for a Service, if you're
28	//     setting up a security list rule for traffic destined for a particular `Service` through
29	//     a service gateway. For example: `oci-phx-objectstorage`.
30	Destination *string `mandatory:"true" json:"destination"`
31
32	// The transport protocol. Specify either `all` or an IPv4 protocol number as
33	// defined in
34	// Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml).
35	// Options are supported only for ICMP ("1"), TCP ("6"), UDP ("17"), and ICMPv6 ("58").
36	Protocol *string `mandatory:"true" json:"protocol"`
37
38	// Type of destination for the rule. The default is `CIDR_BLOCK`.
39	// Allowed values:
40	//   * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation.
41	//   * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a
42	//     Service (the rule is for traffic destined for a
43	//     particular `Service` through a service gateway).
44	DestinationType EgressSecurityRuleDestinationTypeEnum `mandatory:"false" json:"destinationType,omitempty"`
45
46	// Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code
47	// as defined in:
48	// * ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml)
49	// * ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml)
50	// If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and
51	// codes are allowed. If you do provide this object, the type is required and the code is optional.
52	// To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination
53	// Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify
54	// multiple codes for a single type, create a separate security list rule for each.
55	IcmpOptions *IcmpOptions `mandatory:"false" json:"icmpOptions"`
56
57	// A stateless rule allows traffic in one direction. Remember to add a corresponding
58	// stateless rule in the other direction if you need to support bidirectional traffic. For
59	// example, if egress traffic allows TCP destination port 80, there should be an ingress
60	// rule to allow TCP source port 80. Defaults to false, which means the rule is stateful
61	// and a corresponding rule is not necessary for bidirectional traffic.
62	IsStateless *bool `mandatory:"false" json:"isStateless"`
63
64	// Optional and valid only for TCP. Use to specify particular destination ports for TCP rules.
65	// If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
66	TcpOptions *TcpOptions `mandatory:"false" json:"tcpOptions"`
67
68	// Optional and valid only for UDP. Use to specify particular destination ports for UDP rules.
69	// If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
70	UdpOptions *UdpOptions `mandatory:"false" json:"udpOptions"`
71}
72
73func (m EgressSecurityRule) String() string {
74	return common.PointerString(m)
75}
76
77// EgressSecurityRuleDestinationTypeEnum Enum with underlying type: string
78type EgressSecurityRuleDestinationTypeEnum string
79
80// Set of constants representing the allowable values for EgressSecurityRuleDestinationTypeEnum
81const (
82	EgressSecurityRuleDestinationTypeCidrBlock        EgressSecurityRuleDestinationTypeEnum = "CIDR_BLOCK"
83	EgressSecurityRuleDestinationTypeServiceCidrBlock EgressSecurityRuleDestinationTypeEnum = "SERVICE_CIDR_BLOCK"
84)
85
86var mappingEgressSecurityRuleDestinationType = map[string]EgressSecurityRuleDestinationTypeEnum{
87	"CIDR_BLOCK":         EgressSecurityRuleDestinationTypeCidrBlock,
88	"SERVICE_CIDR_BLOCK": EgressSecurityRuleDestinationTypeServiceCidrBlock,
89}
90
91// GetEgressSecurityRuleDestinationTypeEnumValues Enumerates the set of values for EgressSecurityRuleDestinationTypeEnum
92func GetEgressSecurityRuleDestinationTypeEnumValues() []EgressSecurityRuleDestinationTypeEnum {
93	values := make([]EgressSecurityRuleDestinationTypeEnum, 0)
94	for _, v := range mappingEgressSecurityRuleDestinationType {
95		values = append(values, v)
96	}
97	return values
98}
99