// 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{DataCollectionOptions: &database.DataCollectionOptions{IsHealthMonitoringEnabled: common.Bool(false),
IsIncidentLogsEnabled: common.Bool(false),
IsDiagnosticsEventsEnabled: common.Bool(true)},
DisplayName: common.String("EXAMPLE-displayName-Value"),
ClusterPlacementGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
DatabaseSoftwareImageId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value"),
DbSystemFreeformTags: map[string]string{"EXAMPLE_KEY_vFkEO": "EXAMPLE_VALUE_fmZH67vcSV6q4C6DOQZC"},
PrivateIpV6: common.String("EXAMPLE-privateIpV6-Value"),
Shape: common.String("EXAMPLE-shape-Value"),
DbSystemDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_kraPB": map[string]interface{}{"EXAMPLE_KEY_VdWR8": "EXAMPLE--Value"}},
TimeZone: common.String("EXAMPLE-timeZone-Value"),
AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
FaultDomains: []string{"EXAMPLE--Value"},
IsActiveDataGuardEnabled: common.Bool(false),
NodeCount: common.Int(1),
ProtectionMode: database.CreateDataGuardAssociationDetailsProtectionModePerformance,
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
ComputeCount: common.Int(309),
ComputeModel: database.CreateDataGuardAssociationWithNewDbSystemDetailsComputeModelEcpu,
LicenseModel: database.CreateDataGuardAssociationWithNewDbSystemDetailsLicenseModelLicenseIncluded,
NsgIds: []string{"EXAMPLE--Value"},
PrivateIp: common.String("EXAMPLE-privateIp-Value"),
StorageVolumePerformanceMode: database.CreateDataGuardAssociationWithNewDbSystemDetailsStorageVolumePerformanceModeBalanced,
TransportType: database.CreateDataGuardAssociationDetailsTransportTypeSync,
DatabaseAdminPassword: common.String("EXAMPLE-databaseAdminPassword-Value"),
DatabaseDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_wINc3": map[string]interface{}{"EXAMPLE_KEY_sslrS": "EXAMPLE--Value"}},
DatabaseFreeformTags: map[string]string{"EXAMPLE_KEY_EE5ef": "EXAMPLE_VALUE_sBqjQEh2YgUrCoRqyqg2"},
Domain: common.String("EXAMPLE-domain-Value"),
PeerDbUniqueName: common.String("EXAMPLE-peerDbUniqueName-Value"),
PeerSidPrefix: common.String("EXAMPLE-peerSidPrefix-Value"),
CpuCoreCount: common.Int(30),
DbSystemSecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_qR1M5": map[string]interface{}{"EXAMPLE_KEY_cep4Z": "EXAMPLE--Value"}},
Hostname: common.String("EXAMPLE-hostname-Value"),
SourceEncryptionKeyLocationDetails: database.ExternalHsmEncryptionDetails{HsmPassword: common.String("EXAMPLE-hsmPassword-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)
}