# 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).

require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
core_client = OCI::Core::VirtualNetworkClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_capture_filter_response =
  core_client.update_capture_filter(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-captureFilterId-Value',
    OCI::Core::Models::UpdateCaptureFilterDetails.new(
      defined_tags: {
        'EXAMPLE_KEY_IYNMm' => { 'EXAMPLE_KEY_JjZim' => 'EXAMPLE--Value' }
      },
      display_name: 'EXAMPLE-displayName-Value',
      vtap_capture_filter_rules: [
        OCI::Core::Models::VtapCaptureFilterRuleDetails.new(
          traffic_direction: 'INGRESS',
          rule_action: 'EXCLUDE',
          source_cidr: 'EXAMPLE-sourceCidr-Value',
          destination_cidr: 'EXAMPLE-destinationCidr-Value',
          protocol: 'EXAMPLE-protocol-Value',
          icmp_options: OCI::Core::Models::IcmpOptions.new(type: 61, code: 5),
          tcp_options:
            OCI::Core::Models::TcpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 9432, min: 53_091),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 56_770, min: 30_813)
            ),
          udp_options:
            OCI::Core::Models::UdpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 57_594, min: 46_944),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 46_878, min: 59_000)
            )
        )
      ],
      flow_log_capture_filter_rules: [
        OCI::Core::Models::FlowLogCaptureFilterRuleDetails.new(
          is_enabled: false,
          priority: 0,
          sampling_rate: 35_518,
          source_cidr: 'EXAMPLE-sourceCidr-Value',
          destination_cidr: 'EXAMPLE-destinationCidr-Value',
          protocol: 'EXAMPLE-protocol-Value',
          icmp_options: OCI::Core::Models::IcmpOptions.new(type: 101, code: 10),
          tcp_options:
            OCI::Core::Models::TcpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 43_979, min: 39_421),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 8948, min: 58_717)
            ),
          udp_options:
            OCI::Core::Models::UdpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 58_136, min: 53_700),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 18_321, min: 1293)
            ),
          flow_log_type: 'ALL',
          rule_action: 'INCLUDE'
        )
      ],
      freeform_tags: {
        'EXAMPLE_KEY_Za26S' => 'EXAMPLE_VALUE_BKc78ZpIVu2118xnGcr5'
      }
    )
  )

# Get the data from response
puts "#{update_capture_filter_response.data}"