// 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 ExampleCreateIPSecConnection() {
	// 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.CreateIPSecConnectionRequest{CreateIpSecConnectionDetails: core.CreateIpSecConnectionDetails{CpeId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-cpeId-Value"),
		CpeLocalIdentifier:     common.String("EXAMPLE-cpeLocalIdentifier-Value"),
		CpeLocalIdentifierType: core.CreateIpSecConnectionDetailsCpeLocalIdentifierTypeIpAddress,
		DefinedTags:            map[string]map[string]interface{}{"EXAMPLE_KEY_UPw2L": map[string]interface{}{"EXAMPLE_KEY_2MYPP": "EXAMPLE--Value"}},
		DisplayName:            common.String("EXAMPLE-displayName-Value"),
		FreeformTags:           map[string]string{"EXAMPLE_KEY_h9blr": "EXAMPLE_VALUE_feY7uGaYlbMpBG2E7rS5"},
		TunnelConfiguration: []core.CreateIpSecConnectionTunnelDetails{core.CreateIpSecConnectionTunnelDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
			DpdConfig: &core.DpdConfig{DpdTimeoutInSec: common.Int(612),
				DpdMode: core.DpdConfigDpdModeInitiateAndRespond},
			DrgRouteTableId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-drgRouteTableId-Value"),
			IkeVersion:                core.CreateIpSecConnectionTunnelDetailsIkeVersionV2,
			NatTranslationEnabled:     core.CreateIpSecConnectionTunnelDetailsNatTranslationEnabledEnabled,
			OracleInitiation:          core.CreateIpSecConnectionTunnelDetailsOracleInitiationInitiatorOrResponder,
			OracleTunnelIp:            common.String("EXAMPLE-oracleTunnelIp-Value"),
			AssociatedVirtualCircuits: []string{"EXAMPLE--Value"},
			EncryptionDomainConfig: &core.CreateIpSecTunnelEncryptionDomainDetails{CpeTrafficSelector: []string{"EXAMPLE--Value"},
				OracleTrafficSelector: []string{"EXAMPLE--Value"}},
			PhaseOneConfig: &core.PhaseOneConfigDetails{AuthenticationAlgorithm: core.PhaseOneConfigDetailsAuthenticationAlgorithmSha196,
				DiffieHelmanGroup:      core.PhaseOneConfigDetailsDiffieHelmanGroupGroup19,
				EncryptionAlgorithm:    core.PhaseOneConfigDetailsEncryptionAlgorithm256Cbc,
				IsCustomPhaseOneConfig: common.Bool(true),
				LifetimeInSeconds:      common.Int(268)},
			PhaseTwoConfig: &core.PhaseTwoConfigDetails{EncryptionAlgorithm: core.PhaseTwoConfigDetailsEncryptionAlgorithm192Cbc,
				IsCustomPhaseTwoConfig:  common.Bool(false),
				IsPfsEnabled:            common.Bool(true),
				LifetimeInSeconds:       common.Int(242),
				PfsDhGroup:              core.PhaseTwoConfigDetailsPfsDhGroupGroup2,
				AuthenticationAlgorithm: core.PhaseTwoConfigDetailsAuthenticationAlgorithmSha2256128},
			Routing:      core.CreateIpSecConnectionTunnelDetailsRoutingBgp,
			SharedSecret: common.String("EXAMPLE-sharedSecret-Value"),
			BgpSessionConfig: &core.CreateIpSecTunnelBgpSessionDetails{CustomerInterfaceIpv6: common.String("EXAMPLE-customerInterfaceIpv6-Value"),
				OracleInterfaceIp:   common.String("EXAMPLE-oracleInterfaceIp-Value"),
				OracleInterfaceIpv6: common.String("EXAMPLE-oracleInterfaceIpv6-Value"),
				CustomerBgpAsn:      common.String("EXAMPLE-customerBgpAsn-Value"),
				CustomerInterfaceIp: common.String("EXAMPLE-customerInterfaceIp-Value")}}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		DrgId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-drgId-Value"),
		StaticRoutes:  []string{"EXAMPLE--Value"}},
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

	// Send the request using the service client
	resp, err := client.CreateIPSecConnection(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}