// 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.UndeleteAutonomousDatabaseDetails{IsAutoScalingEnabled: common.Bool(true),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
DataStorageSizeInTBs: common.Int(26),
WhitelistedIps: []string{"EXAMPLE--Value"},
FreeformTags: map[string]string{"EXAMPLE_KEY_lhNyB": "EXAMPLE_VALUE_LYn6lHAWqpXd7vwxapbP"},
InMemoryPercentage: common.Int(593),
OcpuCount: common.Float32(5064.746),
DisplayName: common.String("EXAMPLE-displayName-Value"),
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
IsAccessControlEnabled: common.Bool(true),
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
DataStorageSizeInGBs: common.Int(53511),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
IsDataGuardEnabled: common.Bool(false),
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(5579.602),
IsEnabled: common.Bool(true),
MaxIdleTimeInMinutes: common.Int(733),
Name: database.DatabaseToolNameOrds}},
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
CpuCoreCount: common.Int(76),
EncryptionKey: database.OracleManagedKeyDetails{},
IsDevTier: common.Bool(true),
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
SourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value"),
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSunday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelBringYourOwnLicense,
NsgIds: []string{"EXAMPLE--Value"},
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
BackupRetentionPeriodInDays: common.Int(2534),
ComputeCount: common.Float32(2389.895),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_N5NeS": map[string]interface{}{"EXAMPLE_KEY_houbm": "EXAMPLE--Value"}},
ByolComputeCountLimit: common.Float32(7567.2207),
IsBackupRetentionLocked: common.Bool(false),
IsDedicated: common.Bool(true),
IsFreeTier: common.Bool(true),
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameFriday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_Jd44A": map[string]interface{}{"EXAMPLE_KEY_zbdDw": "EXAMPLE--Value"}},
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadLh,
IsAutoScalingForStorageEnabled: common.Bool(true),
IsLocalDataGuardEnabled: common.Bool(true),
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
DbName: common.String("EXAMPLE-dbName-Value"),
IsMtlsConnectionRequired: common.Bool(false),
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeEarly,
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
SecretVersionNumber: common.Int(40),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
ResourcePoolSummary: &database.ResourcePoolSummary{AvailableComputeCapacity: common.Int(987),
AvailableStorageCapacityInTBs: common.Float64(4836.9287),
IsDisabled: common.Bool(false),
PoolSize: common.Int(38),
PoolStorageSizeInTBs: common.Int(261),
TotalComputeCapacity: common.Int(671)},
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value")},
OpcDryRun: common.Bool(true),
OpcRequestId: common.String("NNTPSCJYFZMOL08ZL3JV<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)
}