// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
package main
import (
"context"
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/core"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
)
func ExampleCreateCaptureFilter() {
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
client, err := core.NewVirtualNetworkClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := core.CreateCaptureFilterRequest{CreateCaptureFilterDetails: core.CreateCaptureFilterDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_Ts6sm": map[string]interface{}{"EXAMPLE_KEY_8kWtV": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
FilterType: core.CreateCaptureFilterDetailsFilterTypeFlowlog,
FlowLogCaptureFilterRules: []core.FlowLogCaptureFilterRuleDetails{core.FlowLogCaptureFilterRuleDetails{FlowLogType: core.FlowLogCaptureFilterRuleDetailsFlowLogTypeAccept,
Priority: common.Int(5),
RuleAction: core.FlowLogCaptureFilterRuleDetailsRuleActionInclude,
SamplingRate: common.Int(88914),
UdpOptions: &core.UdpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(57157),
Min: common.Int(26589)},
SourcePortRange: &core.PortRange{Max: common.Int(65360),
Min: common.Int(36350)}},
DestinationCidr: common.String("EXAMPLE-destinationCidr-Value"),
IcmpOptions: &core.IcmpOptions{Type: common.Int(89),
Code: common.Int(13)},
IsEnabled: common.Bool(false),
Protocol: common.String("EXAMPLE-protocol-Value"),
SourceCidr: common.String("EXAMPLE-sourceCidr-Value"),
TcpOptions: &core.TcpOptions{SourcePortRange: &core.PortRange{Max: common.Int(34138),
Min: common.Int(50580)},
DestinationPortRange: &core.PortRange{Min: common.Int(51093),
Max: common.Int(60810)}}}},
FreeformTags: map[string]string{"EXAMPLE_KEY_gzxjh": "EXAMPLE_VALUE_tSmfCosK7Q4H52FMGfur"},
VtapCaptureFilterRules: []core.VtapCaptureFilterRuleDetails{core.VtapCaptureFilterRuleDetails{TrafficDirection: core.VtapCaptureFilterRuleDetailsTrafficDirectionIngress,
UdpOptions: &core.UdpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(16967),
Min: common.Int(13431)},
SourcePortRange: &core.PortRange{Max: common.Int(11441),
Min: common.Int(24198)}},
DestinationCidr: common.String("EXAMPLE-destinationCidr-Value"),
IcmpOptions: &core.IcmpOptions{Code: common.Int(7),
Type: common.Int(2)},
Protocol: common.String("EXAMPLE-protocol-Value"),
RuleAction: core.VtapCaptureFilterRuleDetailsRuleActionExclude,
SourceCidr: common.String("EXAMPLE-sourceCidr-Value"),
TcpOptions: &core.TcpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(29771),
Min: common.Int(17699)},
SourcePortRange: &core.PortRange{Max: common.Int(59350),
Min: common.Int(15364)}}}}},
OpcRequestId: common.String("KHXOELCQLZVRFWJ469EA<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}
// Send the request using the service client
resp, err := client.CreateCaptureFilter(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}