// 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{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseFromBackupDetails{ByolComputeCountLimit: common.Float32(2184.282),
DbName: common.String("EXAMPLE-dbName-Value"),
OcpuCount: common.Float32(1796.0459),
IsLocalDataGuardEnabled: common.Bool(false),
DataStorageSizeInGBs: common.Int(114333),
SubscriptionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
TransportableTablespace: &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
DisplayName: common.String("EXAMPLE-displayName-Value"),
IsAutoScalingEnabled: common.Bool(false),
IsBackupRetentionLocked: common.Bool(true),
DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{Name: database.DatabaseToolNameDatabaseActions,
ComputeCount: common.Float32(9103.525),
IsEnabled: common.Bool(false),
MaxIdleTimeInMinutes: common.Int(351)}},
IsAccessControlEnabled: common.Bool(false),
ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
CpuCoreCount: common.Int(64),
DbWorkload: database.CreateAutonomousDatabaseBaseDbWorkloadApex,
IsDedicated: common.Bool(true),
SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
ArePrimaryWhitelistedIpsUsed: common.Bool(false),
AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
BackupRetentionPeriodInDays: common.Int(1036),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
IsDevTier: common.Bool(false),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
IsDataGuardEnabled: common.Bool(true),
ResourcePoolSummary: &database.ResourcePoolSummary{IsDisabled: common.Bool(true),
PoolSize: common.Int(724),
PoolStorageSizeInTBs: common.Int(203),
TotalComputeCapacity: common.Int(126),
AvailableComputeCapacity: common.Int(99),
AvailableStorageCapacityInTBs: common.Float64(9713.826)},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_A2nHH": map[string]interface{}{"EXAMPLE_KEY_yGIML": "EXAMPLE--Value"}},
DataStorageSizeInTBs: common.Int(273),
PrivateEndpointIp: common.String("EXAMPLE-privateEndpointIp-Value"),
ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSunday},
ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value")}},
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_8u7JG": map[string]interface{}{"EXAMPLE_KEY_k1hDg": "EXAMPLE--Value"}},
InMemoryPercentage: common.Int(579),
IsFreeTier: common.Bool(true),
NsgIds: []string{"EXAMPLE--Value"},
StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
CloneType: database.CreateAutonomousDatabaseFromBackupDetailsCloneTypePartial,
PrivateEndpointLabel: common.String("EXAMPLE-privateEndpointLabel-Value"),
SecretVersionNumber: common.Int(37),
AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameThursday},
MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value"),
MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
CloneTableSpaceList: []int{176},
ComputeModel: database.CreateAutonomousDatabaseBaseComputeModelOcpu,
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
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")},
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
IsAutoScalingForStorageEnabled: common.Bool(true),
LicenseModel: database.CreateAutonomousDatabaseBaseLicenseModelLicenseIncluded,
WhitelistedIps: []string{"EXAMPLE--Value"},
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
FreeformTags: map[string]string{"EXAMPLE_KEY_OTu2d": "EXAMPLE_VALUE_Xtiy4IvIw9uzWBTrRrEN"},
IsPreviewVersionWithServiceTermsAccepted: common.Bool(false),
AutonomousDatabaseBackupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseBackupId-Value"),
AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeRegular,
ComputeCount: common.Float32(2778.7607),
IsMtlsConnectionRequired: common.Bool(false)},
OpcDryRun: common.Bool(true),
OpcRequestId: common.String("LUXHA4XAMVQD7HFSJ2P6<unique_ID>")}
// 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)
}