|
| 1 | +// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// 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. |
| 3 | +// Code generated. DO NOT EDIT. |
| 4 | + |
| 5 | +// Core Services API |
| 6 | +// |
| 7 | +// Use the Core Services API to manage resources such as virtual cloud networks (VCNs), |
| 8 | +// compute instances, and block storage volumes. For more information, see the console |
| 9 | +// documentation for the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm), |
| 10 | +// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and |
| 11 | +// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. |
| 12 | +// The required permissions are documented in the |
| 13 | +// Details for the Core Services (https://docs.cloud.oracle.com/iaas/Content/Identity/Reference/corepolicyreference.htm) article. |
| 14 | +// |
| 15 | + |
| 16 | +package core |
| 17 | + |
| 18 | +import ( |
| 19 | + "fmt" |
| 20 | + "github.com/oracle/oci-go-sdk/v65/common" |
| 21 | + "strings" |
| 22 | +) |
| 23 | + |
| 24 | +// FlowLogCaptureFilterRuleDetails The set of rules governing what traffic the VCN flow log collects. |
| 25 | +type FlowLogCaptureFilterRuleDetails struct { |
| 26 | + |
| 27 | + // Indicates whether a VCN flow log capture filter rule is enabled. |
| 28 | + IsEnabled *bool `mandatory:"false" json:"isEnabled"` |
| 29 | + |
| 30 | + // A lower number indicates a higher priority, range 0-9. Each rule must have a distinct priority. |
| 31 | + Priority *int `mandatory:"false" json:"priority"` |
| 32 | + |
| 33 | + // Sampling interval as `1` of `X`, where `X` is an integer not greater than `100000`. |
| 34 | + SamplingRate *int `mandatory:"false" json:"samplingRate"` |
| 35 | + |
| 36 | + // Traffic from this CIDR will be captured in the VCN flow log. |
| 37 | + SourceCidr *string `mandatory:"false" json:"sourceCidr"` |
| 38 | + |
| 39 | + // Traffic to this CIDR will be captured in the VCN flow log. |
| 40 | + DestinationCidr *string `mandatory:"false" json:"destinationCidr"` |
| 41 | + |
| 42 | + // The transport protocol the filter uses. |
| 43 | + Protocol *string `mandatory:"false" json:"protocol"` |
| 44 | + |
| 45 | + IcmpOptions *IcmpOptions `mandatory:"false" json:"icmpOptions"` |
| 46 | + |
| 47 | + TcpOptions *TcpOptions `mandatory:"false" json:"tcpOptions"` |
| 48 | + |
| 49 | + UdpOptions *UdpOptions `mandatory:"false" json:"udpOptions"` |
| 50 | + |
| 51 | + // Type or types of VCN flow logs to store. `ALL` includes records for both accepted traffic and |
| 52 | + // rejected traffic. |
| 53 | + FlowLogType FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum `mandatory:"false" json:"flowLogType,omitempty"` |
| 54 | + |
| 55 | + // Include or exclude a `ruleAction` object. |
| 56 | + RuleAction FlowLogCaptureFilterRuleDetailsRuleActionEnum `mandatory:"false" json:"ruleAction,omitempty"` |
| 57 | +} |
| 58 | + |
| 59 | +func (m FlowLogCaptureFilterRuleDetails) String() string { |
| 60 | + return common.PointerString(m) |
| 61 | +} |
| 62 | + |
| 63 | +// ValidateEnumValue returns an error when providing an unsupported enum value |
| 64 | +// This function is being called during constructing API request process |
| 65 | +// Not recommended for calling this function directly |
| 66 | +func (m FlowLogCaptureFilterRuleDetails) ValidateEnumValue() (bool, error) { |
| 67 | + errMessage := []string{} |
| 68 | + |
| 69 | + if _, ok := GetMappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnum(string(m.FlowLogType)); !ok && m.FlowLogType != "" { |
| 70 | + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for FlowLogType: %s. Supported values are: %s.", m.FlowLogType, strings.Join(GetFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumStringValues(), ","))) |
| 71 | + } |
| 72 | + if _, ok := GetMappingFlowLogCaptureFilterRuleDetailsRuleActionEnum(string(m.RuleAction)); !ok && m.RuleAction != "" { |
| 73 | + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for RuleAction: %s. Supported values are: %s.", m.RuleAction, strings.Join(GetFlowLogCaptureFilterRuleDetailsRuleActionEnumStringValues(), ","))) |
| 74 | + } |
| 75 | + if len(errMessage) > 0 { |
| 76 | + return true, fmt.Errorf(strings.Join(errMessage, "\n")) |
| 77 | + } |
| 78 | + return false, nil |
| 79 | +} |
| 80 | + |
| 81 | +// FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum Enum with underlying type: string |
| 82 | +type FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum string |
| 83 | + |
| 84 | +// Set of constants representing the allowable values for FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum |
| 85 | +const ( |
| 86 | + FlowLogCaptureFilterRuleDetailsFlowLogTypeAll FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum = "ALL" |
| 87 | + FlowLogCaptureFilterRuleDetailsFlowLogTypeReject FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum = "REJECT" |
| 88 | + FlowLogCaptureFilterRuleDetailsFlowLogTypeAccept FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum = "ACCEPT" |
| 89 | +) |
| 90 | + |
| 91 | +var mappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnum = map[string]FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum{ |
| 92 | + "ALL": FlowLogCaptureFilterRuleDetailsFlowLogTypeAll, |
| 93 | + "REJECT": FlowLogCaptureFilterRuleDetailsFlowLogTypeReject, |
| 94 | + "ACCEPT": FlowLogCaptureFilterRuleDetailsFlowLogTypeAccept, |
| 95 | +} |
| 96 | + |
| 97 | +var mappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumLowerCase = map[string]FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum{ |
| 98 | + "all": FlowLogCaptureFilterRuleDetailsFlowLogTypeAll, |
| 99 | + "reject": FlowLogCaptureFilterRuleDetailsFlowLogTypeReject, |
| 100 | + "accept": FlowLogCaptureFilterRuleDetailsFlowLogTypeAccept, |
| 101 | +} |
| 102 | + |
| 103 | +// GetFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumValues Enumerates the set of values for FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum |
| 104 | +func GetFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumValues() []FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum { |
| 105 | + values := make([]FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum, 0) |
| 106 | + for _, v := range mappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnum { |
| 107 | + values = append(values, v) |
| 108 | + } |
| 109 | + return values |
| 110 | +} |
| 111 | + |
| 112 | +// GetFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumStringValues Enumerates the set of values in String for FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum |
| 113 | +func GetFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumStringValues() []string { |
| 114 | + return []string{ |
| 115 | + "ALL", |
| 116 | + "REJECT", |
| 117 | + "ACCEPT", |
| 118 | + } |
| 119 | +} |
| 120 | + |
| 121 | +// GetMappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnum performs case Insensitive comparison on enum value and return the desired enum |
| 122 | +func GetMappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnum(val string) (FlowLogCaptureFilterRuleDetailsFlowLogTypeEnum, bool) { |
| 123 | + enum, ok := mappingFlowLogCaptureFilterRuleDetailsFlowLogTypeEnumLowerCase[strings.ToLower(val)] |
| 124 | + return enum, ok |
| 125 | +} |
| 126 | + |
| 127 | +// FlowLogCaptureFilterRuleDetailsRuleActionEnum Enum with underlying type: string |
| 128 | +type FlowLogCaptureFilterRuleDetailsRuleActionEnum string |
| 129 | + |
| 130 | +// Set of constants representing the allowable values for FlowLogCaptureFilterRuleDetailsRuleActionEnum |
| 131 | +const ( |
| 132 | + FlowLogCaptureFilterRuleDetailsRuleActionInclude FlowLogCaptureFilterRuleDetailsRuleActionEnum = "INCLUDE" |
| 133 | + FlowLogCaptureFilterRuleDetailsRuleActionExclude FlowLogCaptureFilterRuleDetailsRuleActionEnum = "EXCLUDE" |
| 134 | +) |
| 135 | + |
| 136 | +var mappingFlowLogCaptureFilterRuleDetailsRuleActionEnum = map[string]FlowLogCaptureFilterRuleDetailsRuleActionEnum{ |
| 137 | + "INCLUDE": FlowLogCaptureFilterRuleDetailsRuleActionInclude, |
| 138 | + "EXCLUDE": FlowLogCaptureFilterRuleDetailsRuleActionExclude, |
| 139 | +} |
| 140 | + |
| 141 | +var mappingFlowLogCaptureFilterRuleDetailsRuleActionEnumLowerCase = map[string]FlowLogCaptureFilterRuleDetailsRuleActionEnum{ |
| 142 | + "include": FlowLogCaptureFilterRuleDetailsRuleActionInclude, |
| 143 | + "exclude": FlowLogCaptureFilterRuleDetailsRuleActionExclude, |
| 144 | +} |
| 145 | + |
| 146 | +// GetFlowLogCaptureFilterRuleDetailsRuleActionEnumValues Enumerates the set of values for FlowLogCaptureFilterRuleDetailsRuleActionEnum |
| 147 | +func GetFlowLogCaptureFilterRuleDetailsRuleActionEnumValues() []FlowLogCaptureFilterRuleDetailsRuleActionEnum { |
| 148 | + values := make([]FlowLogCaptureFilterRuleDetailsRuleActionEnum, 0) |
| 149 | + for _, v := range mappingFlowLogCaptureFilterRuleDetailsRuleActionEnum { |
| 150 | + values = append(values, v) |
| 151 | + } |
| 152 | + return values |
| 153 | +} |
| 154 | + |
| 155 | +// GetFlowLogCaptureFilterRuleDetailsRuleActionEnumStringValues Enumerates the set of values in String for FlowLogCaptureFilterRuleDetailsRuleActionEnum |
| 156 | +func GetFlowLogCaptureFilterRuleDetailsRuleActionEnumStringValues() []string { |
| 157 | + return []string{ |
| 158 | + "INCLUDE", |
| 159 | + "EXCLUDE", |
| 160 | + } |
| 161 | +} |
| 162 | + |
| 163 | +// GetMappingFlowLogCaptureFilterRuleDetailsRuleActionEnum performs case Insensitive comparison on enum value and return the desired enum |
| 164 | +func GetMappingFlowLogCaptureFilterRuleDetailsRuleActionEnum(val string) (FlowLogCaptureFilterRuleDetailsRuleActionEnum, bool) { |
| 165 | + enum, ok := mappingFlowLogCaptureFilterRuleDetailsRuleActionEnumLowerCase[strings.ToLower(val)] |
| 166 | + return enum, ok |
| 167 | +} |
0 commit comments