// 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("U8RD2GW6VABQHXCAQJSI<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseCloneDetails{CloneType: database.CreateAutonomousDatabaseCloneDetailsCloneTypeMetadata,
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{IsEnabled: common.Bool(true),
MaxIdleTimeInMinutes: common.Int(963),
Name: database.DatabaseToolNameDatabaseActions,
ComputeCount: common.Float32(7190.1294)}},
AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
IsDataGuardEnabled: common.Bool(false),
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
NsgIds: []string{"EXAMPLE--Value"},
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameWednesday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
DbName: common.String("EXAMPLE-dbName-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_K6mtr": map[string]interface{}{"EXAMPLE_KEY_jOkpX": "EXAMPLE--Value"}},
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
ResourcePoolSummary: &database.ResourcePoolSummary{IsDisabled: common.Bool(false),
PoolSize: common.Int(808),
PoolStorageSizeInTBs: common.Int(718),
TotalComputeCapacity: common.Int(833),
AvailableComputeCapacity: common.Int(893),
AvailableStorageCapacityInTBs: common.Float64(7233.3115)},
SecretVersionNumber: common.Int(13),
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
CpuCoreCount: common.Int(127),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
ComputeCount: common.Float32(2716.235),
DataStorageSizeInGBs: common.Int(71740),
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
EncryptionKey: database.AzureKeyDetails{VaultUri: common.String("EXAMPLE-vaultUri-Value"),
KeyName: common.String("EXAMPLE-keyName-Value")},
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
OcpuCount: common.Float32(2851.8152),
ByolComputeCountLimit: common.Float32(4730.676),
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeRegular,
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadLh,
SourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value"),
IsPreviewVersionWithServiceTermsAccepted: common.Bool(false),
IsBackupRetentionLocked: common.Bool(true),
IsLocalDataGuardEnabled: common.Bool(true),
WhitelistedIps: []string{"EXAMPLE--Value"},
InMemoryPercentage: common.Int(478),
IsAccessControlEnabled: common.Bool(false),
IsFreeTier: common.Bool(false),
IsMtlsConnectionRequired: common.Bool(true),
DataStorageSizeInTBs: common.Int(219),
FreeformTags: map[string]string{"EXAMPLE_KEY_7vXjQ": "EXAMPLE_VALUE_jEfSUeltXb2nccFsTciY"},
IsAutoScalingForStorageEnabled: common.Bool(true),
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameTuesday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_EUGjy": map[string]interface{}{"EXAMPLE_KEY_VAw5c": "EXAMPLE--Value"}},
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
IsDedicated: common.Bool(false),
IsDevTier: common.Bool(false),
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelLicenseIncluded,
BackupRetentionPeriodInDays: common.Int(360),
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
IsAutoScalingEnabled: common.Bool(false),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value")},
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)
}