// 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{CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseCloneDetails{DbVersion: common.String("EXAMPLE-dbVersion-Value"),
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadApex,
IsDevTier: common.Bool(false),
IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
BackupRetentionPeriodInDays: common.Int(3474),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_CzZus": map[string]interface{}{"EXAMPLE_KEY_99e5C": "EXAMPLE--Value"}},
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelBringYourOwnLicense,
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
WhitelistedIps: []string{"EXAMPLE--Value"},
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSunday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
DbName: common.String("EXAMPLE-dbName-Value"),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_343kA": map[string]interface{}{"EXAMPLE_KEY_crPth": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
IsAutoScalingForStorageEnabled: common.Bool(false),
NsgIds: []string{"EXAMPLE--Value"},
OcpuCount: common.Float32(6811.188),
SecretVersionNumber: common.Int(27),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_n0cnw": "EXAMPLE_VALUE_VWweNWliNMr4LIGsMDzz"},
IsAutoScalingEnabled: common.Bool(false),
AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
ComputeCount: common.Float32(558.31665),
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
InMemoryPercentage: common.Int(857),
IsMtlsConnectionRequired: common.Bool(false),
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
ByolComputeCountLimit: common.Float32(1849.5864),
IsDedicated: common.Bool(false),
CloneType: database.CreateAutonomousDatabaseCloneDetailsCloneTypeFull,
DataStorageSizeInTBs: common.Int(113),
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{MaxIdleTimeInMinutes: common.Int(311),
Name: database.DatabaseToolNameMongodbApi,
ComputeCount: common.Float32(6284.484),
IsEnabled: common.Bool(true)}},
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
SourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value"),
IsAccessControlEnabled: common.Bool(true),
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
DataStorageSizeInGBs: common.Int(47828),
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
ResourcePoolSummary: &database.ResourcePoolSummary{AvailableComputeCapacity: common.Int(4),
AvailableStorageCapacityInTBs: common.Float64(573.8533),
IsDisabled: common.Bool(true),
PoolSize: common.Int(69),
PoolStorageSizeInTBs: common.Int(386),
TotalComputeCapacity: common.Int(413)},
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeEarly,
EncryptionKey: database.OciKeyDetails{KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value")},
IsDataGuardEnabled: common.Bool(false),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
CpuCoreCount: common.Int(88),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
IsBackupRetentionLocked: common.Bool(false),
IsFreeTier: common.Bool(true),
IsLocalDataGuardEnabled: common.Bool(false),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value"),
DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameFriday}}},
OpcDryRun: common.Bool(false),
OpcRequestId: common.String("YOKXFTIT3RGTAELVBZLF<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}
// 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)
}