// 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{PrivateIpV6: common.String("EXAMPLE-privateIpV6-Value"),
ProtectionMode: database.CreateDataGuardAssociationDetailsProtectionModePerformance,
DatabaseDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_HBgav": map[string]interface{}{"EXAMPLE_KEY_79j7P": "EXAMPLE--Value"}},
PrivateIp: common.String("EXAMPLE-privateIp-Value"),
Hostname: common.String("EXAMPLE-hostname-Value"),
NsgIds: []string{"EXAMPLE--Value"},
StorageVolumePerformanceMode: database.CreateDataGuardAssociationWithNewDbSystemDetailsStorageVolumePerformanceModeBalanced,
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
CpuCoreCount: common.Int(29),
DatabaseAdminPassword: common.String("EXAMPLE-databaseAdminPassword-Value"),
DbSystemFreeformTags: map[string]string{"EXAMPLE_KEY_vOcNf": "EXAMPLE_VALUE_cXmT0U1Ngwhh5Fk8JJIe"},
Shape: common.String("EXAMPLE-shape-Value"),
TimeZone: common.String("EXAMPLE-timeZone-Value"),
DataCollectionOptions: &database.DataCollectionOptions{IsDiagnosticsEventsEnabled: common.Bool(true),
IsHealthMonitoringEnabled: common.Bool(true),
IsIncidentLogsEnabled: common.Bool(true)},
IsActiveDataGuardEnabled: common.Bool(true),
BackupNetworkNsgIds: []string{"EXAMPLE--Value"},
Domain: common.String("EXAMPLE-domain-Value"),
FaultDomains: []string{"EXAMPLE--Value"},
LicenseModel: database.CreateDataGuardAssociationWithNewDbSystemDetailsLicenseModelBringYourOwnLicense,
DbSystemDefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_O5TZb": map[string]interface{}{"EXAMPLE_KEY_Y52Vg": "EXAMPLE--Value"}},
PeerDbUniqueName: common.String("EXAMPLE-peerDbUniqueName-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
DatabaseSoftwareImageId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value"),
NodeCount: common.Int(1),
PeerSidPrefix: common.String("EXAMPLE-peerSidPrefix-Value"),
SourceEncryptionKeyLocationDetails: database.ExternalHsmEncryptionDetails{HsmPassword: common.String("EXAMPLE-hsmPassword-Value")},
TransportType: database.CreateDataGuardAssociationDetailsTransportTypeAsync,
DatabaseFreeformTags: map[string]string{"EXAMPLE_KEY_3MEW6": "EXAMPLE_VALUE_lVPMNppdFsBqt0oQVzuS"},
DbSystemSecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_wwpyE": map[string]interface{}{"EXAMPLE_KEY_9Kej2": "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)
}