// 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{OpcRequestId: common.String("FZDE7MEM4NHLACIVCFPN<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateCaptureFilterDetails: core.CreateCaptureFilterDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
FilterType: core.CreateCaptureFilterDetailsFilterTypeFlowlog,
FlowLogCaptureFilterRules: []core.FlowLogCaptureFilterRuleDetails{core.FlowLogCaptureFilterRuleDetails{TcpOptions: &core.TcpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(11540),
Min: common.Int(12759)},
SourcePortRange: &core.PortRange{Max: common.Int(39942),
Min: common.Int(42623)}},
IcmpOptions: &core.IcmpOptions{Code: common.Int(13),
Type: common.Int(216)},
IsEnabled: common.Bool(false),
Protocol: common.String("EXAMPLE-protocol-Value"),
SourceCidr: common.String("EXAMPLE-sourceCidr-Value"),
SamplingRate: common.Int(89935),
UdpOptions: &core.UdpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(55227),
Min: common.Int(40396)},
SourcePortRange: &core.PortRange{Max: common.Int(49867),
Min: common.Int(35459)}},
DestinationCidr: common.String("EXAMPLE-destinationCidr-Value"),
FlowLogType: core.FlowLogCaptureFilterRuleDetailsFlowLogTypeAll,
Priority: common.Int(3),
RuleAction: core.FlowLogCaptureFilterRuleDetailsRuleActionInclude}},
FreeformTags: map[string]string{"EXAMPLE_KEY_8OXkA": "EXAMPLE_VALUE_zOXnm2wUEyXNyIGb2pxi"},
VtapCaptureFilterRules: []core.VtapCaptureFilterRuleDetails{core.VtapCaptureFilterRuleDetails{UdpOptions: &core.UdpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(56883),
Min: common.Int(32791)},
SourcePortRange: &core.PortRange{Max: common.Int(23695),
Min: common.Int(34468)}},
DestinationCidr: common.String("EXAMPLE-destinationCidr-Value"),
IcmpOptions: &core.IcmpOptions{Code: common.Int(3),
Type: common.Int(33)},
Protocol: common.String("EXAMPLE-protocol-Value"),
RuleAction: core.VtapCaptureFilterRuleDetailsRuleActionInclude,
SourceCidr: common.String("EXAMPLE-sourceCidr-Value"),
TcpOptions: &core.TcpOptions{DestinationPortRange: &core.PortRange{Max: common.Int(38864),
Min: common.Int(23892)},
SourcePortRange: &core.PortRange{Max: common.Int(64298),
Min: common.Int(9953)}},
TrafficDirection: core.VtapCaptureFilterRuleDetailsTrafficDirectionIngress}},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_4GK3D": map[string]interface{}{"EXAMPLE_KEY_LUG0Q": "EXAMPLE--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)
}