// 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{OpcRequestId: common.String("YT1NCXHS0YXILFGQNQBN<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseFromBackupDetails{AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadDw,
IsAutoScalingEnabled: common.Bool(false),
IsLocalDataGuardEnabled: common.Bool(true),
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
SecretVersionNumber: common.Int(46),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
AutonomousDatabaseBackupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseBackupId-Value"),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
IsAutoScalingForStorageEnabled: common.Bool(false),
OcpuCount: common.Float32(8233.789),
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_vIKJ3": "EXAMPLE_VALUE_2OKDB4dhytD0OCAGaFCS"},
IsDataGuardEnabled: common.Bool(false),
NsgIds: []string{"EXAMPLE--Value"},
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
IsDedicated: common.Bool(true),
IsDevTier: common.Bool(true),
IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeRegular,
CloneType: database.CreateAutonomousDatabaseFromBackupDetailsCloneTypeMetadata,
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_SGnq7": map[string]interface{}{"EXAMPLE_KEY_aVWTA": "EXAMPLE--Value"}},
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
WhitelistedIps: []string{"EXAMPLE--Value"},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelEcpu,
DbName: common.String("EXAMPLE-dbName-Value"),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
BackupRetentionPeriodInDays: common.Int(1537),
ComputeCount: common.Float32(2828.6653),
InMemoryPercentage: common.Int(289),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_uQrph": map[string]interface{}{"EXAMPLE_KEY_6yVBo": "EXAMPLE--Value"}},
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameThursday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{MaxIdleTimeInMinutes: common.Int(499),
Name: database.DatabaseToolNameMongodbApi,
ComputeCount: common.Float32(8001.871),
IsEnabled: common.Bool(false)}},
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")},
IsAccessControlEnabled: common.Bool(false),
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelLicenseIncluded,
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameWednesday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
CpuCoreCount: common.Int(27),
ResourcePoolSummary: &database.ResourcePoolSummary{PoolStorageSizeInTBs: common.Int(727),
TotalComputeCapacity: common.Int(630),
AvailableComputeCapacity: common.Int(1),
AvailableStorageCapacityInTBs: common.Float64(7493.888),
IsDisabled: common.Bool(true),
PoolSize: common.Int(115)},
ByolComputeCountLimit: common.Float32(690.2021),
IsFreeTier: common.Bool(false),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
DataStorageSizeInGBs: common.Int(100194),
DataStorageSizeInTBs: common.Int(95),
CloneTableSpaceList: []int{524},
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionStandardEdition,
IsBackupRetentionLocked: common.Bool(false),
IsMtlsConnectionRequired: common.Bool(true)},
OpcDryRun: common.Bool(false)}
// 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)
}