// 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 ExampleCreateAutonomousDatabase() {
// 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.CreateAutonomousDatabaseRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAutonomousDatabaseDetails: database.CreateCrossTenancyDisasterRecoveryDetails{ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_3oNtq": map[string]interface{}{"EXAMPLE_KEY_sgHHr": "EXAMPLE--Value"}},
IsAutoScalingEnabled: common.Bool(false),
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_Xw0S5": "EXAMPLE_VALUE_L9a8i1cHlJzhYb8tN7Uk"},
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
DisasterRecoveryType: database.DisasterRecoveryConfigurationDisasterRecoveryTypeBackupBased,
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeEarly,
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(2592.591),
IsEnabled: common.Bool(false),
MaxIdleTimeInMinutes: common.Int(864),
Name: database.DatabaseToolNameMongodbApi}},
IsLocalDataGuardEnabled: common.Bool(false),
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameMonday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
IsAccessControlEnabled: common.Bool(true),
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
ResourcePoolSummary: &database.ResourcePoolSummary{PoolStorageSizeInTBs: common.Int(412),
TotalComputeCapacity: common.Int(299),
AvailableComputeCapacity: common.Int(871),
AvailableStorageCapacityInTBs: common.Float64(4433.5054),
IsDisabled: common.Bool(true),
PoolSize: common.Int(55)},
WhitelistedIps: []string{"EXAMPLE--Value"},
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
EncryptionKey: database.AzureKeyDetails{KeyName: common.String("EXAMPLE-keyName-Value"),
VaultUri: common.String("EXAMPLE-vaultUri-Value")},
IsBackupRetentionLocked: common.Bool(true),
OcpuCount: common.Float32(7440.2935),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
ComputeCount: common.Float32(1452.4314),
DbName: common.String("EXAMPLE-dbName-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
NsgIds: []string{"EXAMPLE--Value"},
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameTuesday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelLicenseIncluded,
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_rnroh": map[string]interface{}{"EXAMPLE_KEY_nstj3": "EXAMPLE--Value"}},
SourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value"),
DataStorageSizeInGBs: common.Int(94738),
ArePrimaryWhitelistedIpsUsed: common.Bool(true),
CpuCoreCount: common.Int(121),
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadDw,
IsAutoScalingForStorageEnabled: common.Bool(false),
IsDataGuardEnabled: common.Bool(true),
DataStorageSizeInTBs: common.Int(70),
IsMtlsConnectionRequired: common.Bool(false),
SecretVersionNumber: common.Int(16),
BackupRetentionPeriodInDays: common.Int(2571),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
ByolComputeCountLimit: common.Float32(7699.5303),
InMemoryPercentage: common.Int(987),
IsDedicated: common.Bool(false),
IsFreeTier: common.Bool(true),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
IsDevTier: common.Bool(false),
IsReplicateAutomaticBackups: common.Bool(true)},
OpcDryRun: common.Bool(false),
OpcRequestId: common.String("TTUYE8BRC1QNHGN9XA4H<unique_ID>")}
// Send the request using the service client
resp, err := client.CreateAutonomousDatabase(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}