// 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/database"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateDataGuardAssociation() {
	// 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 := database.NewDatabaseClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := database.CreateDataGuardAssociationRequest{CreateDataGuardAssociationDetails: database.CreateDataGuardAssociationWithNewDbSystemDetails{ComputeCount: common.Int(831),
		DatabaseSoftwareImageId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value"),
		LicenseModel:                       database.CreateDataGuardAssociationWithNewDbSystemDetailsLicenseModelBringYourOwnLicense,
		StorageVolumePerformanceMode:       database.CreateDataGuardAssociationWithNewDbSystemDetailsStorageVolumePerformanceModeHighPerformance,
		CpuCoreCount:                       common.Int(24),
		Hostname:                           common.String("EXAMPLE-hostname-Value"),
		ProtectionMode:                     database.CreateDataGuardAssociationDetailsProtectionModePerformance,
		Shape:                              common.String("EXAMPLE-shape-Value"),
		SubnetId:                           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		SubscriptionId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
		PrivateIpV6:                        common.String("EXAMPLE-privateIpV6-Value"),
		DatabaseDefinedTags:                map[string]map[string]interface{}{"EXAMPLE_KEY_fEUEJ": map[string]interface{}{"EXAMPLE_KEY_j22nV": "EXAMPLE--Value"}},
		DbSystemSecurityAttributes:         map[string]map[string]interface{}{"EXAMPLE_KEY_g7w9W": map[string]interface{}{"EXAMPLE_KEY_OHXlJ": "EXAMPLE--Value"}},
		IsActiveDataGuardEnabled:           common.Bool(true),
		AvailabilityDomain:                 common.String("EXAMPLE-availabilityDomain-Value"),
		DbSystemDefinedTags:                map[string]map[string]interface{}{"EXAMPLE_KEY_XEU4E": map[string]interface{}{"EXAMPLE_KEY_wjFV1": "EXAMPLE--Value"}},
		FaultDomains:                       []string{"EXAMPLE--Value"},
		PrivateIp:                          common.String("EXAMPLE-privateIp-Value"),
		SourceEncryptionKeyLocationDetails: database.AwsEncryptionKeyDetails{AwsEncryptionKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-awsEncryptionKeyId-Value")},
		TransportType:                      database.CreateDataGuardAssociationDetailsTransportTypeAsync,
		DbSystemFreeformTags:               map[string]string{"EXAMPLE_KEY_wFJxB": "EXAMPLE_VALUE_LERIndPmP5IKIhgNZh7H"},
		Domain:                             common.String("EXAMPLE-domain-Value"),
		TimeZone:                           common.String("EXAMPLE-timeZone-Value"),
		ClusterPlacementGroupId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
		DatabaseAdminPassword:              common.String("EXAMPLE-databaseAdminPassword-Value"),
		NodeCount:                          common.Int(1),
		DatabaseFreeformTags:               map[string]string{"EXAMPLE_KEY_BwDH5": "EXAMPLE_VALUE_ucW7lKxLjNdveVRNkb7y"},
		DisplayName:                        common.String("EXAMPLE-displayName-Value"),
		NsgIds:                             []string{"EXAMPLE--Value"},
		PeerDbUniqueName:                   common.String("EXAMPLE-peerDbUniqueName-Value"),
		ComputeModel:                       database.CreateDataGuardAssociationWithNewDbSystemDetailsComputeModelOcpu,
		DataCollectionOptions: &database.DataCollectionOptions{IsHealthMonitoringEnabled: common.Bool(true),
			IsIncidentLogsEnabled:      common.Bool(true),
			IsDiagnosticsEventsEnabled: common.Bool(false)},
		PeerSidPrefix:       common.String("EXAMPLE-peerSidPrefix-Value"),
		BackupNetworkNsgIds: []string{"EXAMPLE--Value"}},
		DatabaseId:    common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

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

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