// 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{OpcDryRun: common.Bool(false),
OpcRequestId: common.String("TOGOBXCQ3LDVNLCQJEUC<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseFromBackupDetails{AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value"),
DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameMonday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value")},
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
ResourcePoolSummary: &database.ResourcePoolSummary{TotalComputeCapacity: common.Int(407),
AvailableComputeCapacity: common.Int(390),
AvailableStorageCapacityInTBs: common.Float64(8041.875),
IsDisabled: common.Bool(true),
PoolSize: common.Int(164),
PoolStorageSizeInTBs: common.Int(423)},
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
CpuCoreCount: common.Int(81),
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadLh,
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
WhitelistedIps: []string{"EXAMPLE--Value"},
ByolComputeCountLimit: common.Float32(4406.058),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_8xcKT": map[string]interface{}{"EXAMPLE_KEY_o5lPv": "EXAMPLE--Value"}},
InMemoryPercentage: common.Int(664),
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
CloneTableSpaceList: []int{489},
IsDataGuardEnabled: common.Bool(true),
IsFreeTier: common.Bool(false),
ComputeCount: common.Float32(3217.3416),
IsDedicated: common.Bool(true),
IsMtlsConnectionRequired: common.Bool(true),
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelBringYourOwnLicense,
NsgIds: []string{"EXAMPLE--Value"},
EncryptionKey: database.GcpKeyDetails{KmsRestEndpoint: common.String("EXAMPLE-kmsRestEndpoint-Value"),
Location: common.String("EXAMPLE-location-Value"),
Project: common.String("EXAMPLE-project-Value"),
KeyName: common.String("EXAMPLE-keyName-Value"),
KeyRing: common.String("EXAMPLE-keyRing-Value")},
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DataStorageSizeInGBs: common.Int(12440),
IsAccessControlEnabled: common.Bool(true),
IsAutoScalingEnabled: common.Bool(false),
SecretVersionNumber: common.Int(23),
DbName: common.String("EXAMPLE-dbName-Value"),
IsBackupRetentionLocked: common.Bool(false),
FreeformTags: map[string]string{"EXAMPLE_KEY_VLNkF": "EXAMPLE_VALUE_Ip3t78cObtEGkS9drUgR"},
OcpuCount: common.Float32(7520.7515),
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
IsDevTier: common.Bool(true),
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameThursday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
BackupRetentionPeriodInDays: common.Int(874),
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
IsLocalDataGuardEnabled: common.Bool(true),
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeEarly,
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{Name: database.DatabaseToolNameOrds,
ComputeCount: common.Float32(5160.033),
IsEnabled: common.Bool(true),
MaxIdleTimeInMinutes: common.Int(81)}},
IsAutoScalingForStorageEnabled: common.Bool(false),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_XCIuA": map[string]interface{}{"EXAMPLE_KEY_CUy9H": "EXAMPLE--Value"}},
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionStandardEdition,
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
DataStorageSizeInTBs: common.Int(138),
DisplayName: common.String("EXAMPLE-displayName-Value"),
AutonomousDatabaseBackupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseBackupId-Value"),
CloneType: database.CreateAutonomousDatabaseFromBackupDetailsCloneTypeFull}}
// 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)
}