// 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{SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
TransportType: database.CreateDataGuardAssociationDetailsTransportTypeAsync,
PeerSidPrefix: common.String("EXAMPLE-peerSidPrefix-Value"),
DatabaseAdminPassword: common.String("EXAMPLE-databaseAdminPassword-Value"),
DbSystemDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_CDGDX": map[string]interface{}{"EXAMPLE_KEY_t9b3B": "EXAMPLE--Value"}},
DbSystemSecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_tmXJC": map[string]interface{}{"EXAMPLE_KEY_VpoT5": "EXAMPLE--Value"}},
BackupNetworkNsgIds: []string{"EXAMPLE--Value"},
DatabaseFreeformTags: map[string]string{"EXAMPLE_KEY_AkaZt": "EXAMPLE_VALUE_ykGigH7MPRZytFD6VB7H"},
DisplayName: common.String("EXAMPLE-displayName-Value"),
ComputeCount: common.Int(707),
IsActiveDataGuardEnabled: common.Bool(false),
FaultDomains: []string{"EXAMPLE--Value"},
NodeCount: common.Int(1),
Shape: common.String("EXAMPLE-shape-Value"),
StorageVolumePerformanceMode: database.CreateDataGuardAssociationWithNewDbSystemDetailsStorageVolumePerformanceModeHighPerformance,
NsgIds: []string{"EXAMPLE--Value"},
PrivateIpV6: common.String("EXAMPLE-privateIpV6-Value"),
CpuCoreCount: common.Int(54),
DataCollectionOptions: &database.DataCollectionOptions{IsDiagnosticsEventsEnabled: common.Bool(false),
IsHealthMonitoringEnabled: common.Bool(false),
IsIncidentLogsEnabled: common.Bool(true)},
DbSystemFreeformTags: map[string]string{"EXAMPLE_KEY_Gt0qW": "EXAMPLE_VALUE_AiyKMn05IozNufwKtrTY"},
Domain: common.String("EXAMPLE-domain-Value"),
TimeZone: common.String("EXAMPLE-timeZone-Value"),
ClusterPlacementGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
ComputeModel: database.CreateDataGuardAssociationWithNewDbSystemDetailsComputeModelOcpu,
DatabaseDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_O5jV1": map[string]interface{}{"EXAMPLE_KEY_MywiP": "EXAMPLE--Value"}},
DatabaseSoftwareImageId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value"),
Hostname: common.String("EXAMPLE-hostname-Value"),
SourceEncryptionKeyLocationDetails: database.GoogleCloudProviderEncryptionKeyDetails{GoogleCloudProviderEncryptionKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-googleCloudProviderEncryptionKeyId-Value")},
LicenseModel: database.CreateDataGuardAssociationWithNewDbSystemDetailsLicenseModelBringYourOwnLicense,
PrivateIp: common.String("EXAMPLE-privateIp-Value"),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
PeerDbUniqueName: common.String("EXAMPLE-peerDbUniqueName-Value"),
ProtectionMode: database.CreateDataGuardAssociationDetailsProtectionModeProtection},
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)
}