// 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{BackupNetworkNsgIds: []string{"EXAMPLE--Value"},
		DbSystemDefinedTags:          map[string]map[string]interface{}{"EXAMPLE_KEY_NWbq6": map[string]interface{}{"EXAMPLE_KEY_bnBO4": "EXAMPLE--Value"}},
		Shape:                        common.String("EXAMPLE-shape-Value"),
		CpuCoreCount:                 common.Int(61),
		DatabaseAdminPassword:        common.String("EXAMPLE-databaseAdminPassword-Value"),
		PeerSidPrefix:                common.String("EXAMPLE-peerSidPrefix-Value"),
		PrivateIp:                    common.String("EXAMPLE-privateIp-Value"),
		StorageVolumePerformanceMode: database.CreateDataGuardAssociationWithNewDbSystemDetailsStorageVolumePerformanceModeBalanced,
		SubscriptionId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
		DbSystemSecurityAttributes:   map[string]map[string]interface{}{"EXAMPLE_KEY_rixjg": map[string]interface{}{"EXAMPLE_KEY_jYEZE": "EXAMPLE--Value"}},
		ProtectionMode:               database.CreateDataGuardAssociationDetailsProtectionModeAvailability,
		SubnetId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		AvailabilityDomain:           common.String("EXAMPLE-availabilityDomain-Value"),
		ComputeCount:                 common.Int(875),
		DataCollectionOptions: &database.DataCollectionOptions{IsIncidentLogsEnabled: common.Bool(false),
			IsDiagnosticsEventsEnabled: common.Bool(true),
			IsHealthMonitoringEnabled:  common.Bool(false)},
		DatabaseDefinedTags:                map[string]map[string]interface{}{"EXAMPLE_KEY_d2Bco": map[string]interface{}{"EXAMPLE_KEY_UUfR6": "EXAMPLE--Value"}},
		Domain:                             common.String("EXAMPLE-domain-Value"),
		PrivateIpV6:                        common.String("EXAMPLE-privateIpV6-Value"),
		TransportType:                      database.CreateDataGuardAssociationDetailsTransportTypeAsync,
		DatabaseSoftwareImageId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value"),
		NsgIds:                             []string{"EXAMPLE--Value"},
		TimeZone:                           common.String("EXAMPLE-timeZone-Value"),
		DbSystemFreeformTags:               map[string]string{"EXAMPLE_KEY_QzN9H": "EXAMPLE_VALUE_XZiC92he3l95778oNkLN"},
		IsActiveDataGuardEnabled:           common.Bool(true),
		LicenseModel:                       database.CreateDataGuardAssociationWithNewDbSystemDetailsLicenseModelLicenseIncluded,
		PeerDbUniqueName:                   common.String("EXAMPLE-peerDbUniqueName-Value"),
		ClusterPlacementGroupId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
		ComputeModel:                       database.CreateDataGuardAssociationWithNewDbSystemDetailsComputeModelEcpu,
		DatabaseFreeformTags:               map[string]string{"EXAMPLE_KEY_qwTbH": "EXAMPLE_VALUE_358lbIFeStAkPPYhwb9Y"},
		Hostname:                           common.String("EXAMPLE-hostname-Value"),
		NodeCount:                          common.Int(1),
		DisplayName:                        common.String("EXAMPLE-displayName-Value"),
		FaultDomains:                       []string{"EXAMPLE--Value"},
		SourceEncryptionKeyLocationDetails: database.AzureEncryptionKeyDetails{AzureEncryptionKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-azureEncryptionKeyId-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)
}