// 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"
	"time"

	"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(true),
		OpcRequestId:  common.String("0HBGOFJWN7YADNWXPKWS<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateAutonomousDatabaseDetails: database.CreateAutonomousDatabaseFromBackupTimestampDetails{CustomerContacts: []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			DatabaseEdition: database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
			IsDedicated:     common.Bool(false),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value"),
				DayOfWeek:         &database.DayOfWeek{Name: database.DayOfWeekNameTuesday}}},
			SecretVersionNumber:           common.Int(43),
			InMemoryPercentage:            common.Int(470),
			AutonomousContainerDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
			CharacterSet:                  common.String("EXAMPLE-characterSet-Value"),
			Timestamp:                     &common.SDKTime{Time: time.Now()},
			ComputeCount:                  common.Float32(460.17456),
			DataStorageSizeInTBs:          common.Int(255),
			IsDevTier:                     common.Bool(true),
			OcpuCount:                     common.Float32(7854.9146),
			DisplayName:                   common.String("EXAMPLE-displayName-Value"),
			SecurityAttributes:            map[string]map[string]interface{}{"EXAMPLE_KEY_EOeXD": map[string]interface{}{"EXAMPLE_KEY_W0rrB": "EXAMPLE--Value"}},
			DbWorkload:                    database.CreateAutonomousDatabaseBaseDbWorkloadApex,
			CompartmentId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			FreeformTags:                  map[string]string{"EXAMPLE_KEY_L6DIa": "EXAMPLE_VALUE_pEJ7lW4esELFoO3TvMxl"},
			NcharacterSet:                 common.String("EXAMPLE-ncharacterSet-Value"),
			IsMtlsConnectionRequired:      common.Bool(false),
			ResourcePoolLeaderId:          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			PrivateEndpointIp:             common.String("EXAMPLE-privateEndpointIp-Value"),
			VaultId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
			SubscriptionId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"),
			DataStorageSizeInGBs:          common.Int(8697),
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(4340.598),
				IsEnabled:            common.Bool(true),
				MaxIdleTimeInMinutes: common.Int(767),
				Name:                 database.DatabaseToolNameOrds}},
			IsAutoScalingForStorageEnabled: common.Bool(true),
			NsgIds:                         []string{"EXAMPLE--Value"},
			SubnetId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			SecretId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			ByolComputeCountLimit:          common.Float32(401.66916),
			IsBackupRetentionLocked:        common.Bool(true),
			IsFreeTier:                     common.Bool(false),
			IsLocalDataGuardEnabled:        common.Bool(true),
			ResourcePoolSummary: &database.ResourcePoolSummary{AvailableComputeCapacity: common.Int(641),
				AvailableStorageCapacityInTBs: common.Float64(4589.2656),
				IsDisabled:                    common.Bool(false),
				PoolSize:                      common.Int(646),
				PoolStorageSizeInTBs:          common.Int(4),
				TotalComputeCapacity:          common.Int(958)},
			WhitelistedIps:                           []string{"EXAMPLE--Value"},
			AutonomousMaintenanceScheduleType:        database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeRegular,
			IsAccessControlEnabled:                   common.Bool(false),
			IsAutoScalingEnabled:                     common.Bool(false),
			IsPreviewVersionWithServiceTermsAccepted: common.Bool(true),
			StandbyWhitelistedIps:                    []string{"EXAMPLE--Value"},
			TransportableTablespace:                  &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
			AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSaturday},
				MaintenanceEndTime:   common.String("EXAMPLE-maintenanceEndTime-Value"),
				MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
			CloneTableSpaceList:          []int{21},
			CloneType:                    database.CreateAutonomousDatabaseFromBackupTimestampDetailsCloneTypePartial,
			DbVersion:                    common.String("EXAMPLE-dbVersion-Value"),
			DefinedTags:                  map[string]map[string]interface{}{"EXAMPLE_KEY_xRsvV": map[string]interface{}{"EXAMPLE_KEY_umznX": "EXAMPLE--Value"}},
			KmsKeyId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
			LicenseModel:                 database.CreateAutonomousDatabaseBaseLicenseModelLicenseIncluded,
			ComputeModel:                 database.CreateAutonomousDatabaseBaseComputeModelEcpu,
			ArePrimaryWhitelistedIpsUsed: common.Bool(false),
			DbName:                       common.String("EXAMPLE-dbName-Value"),
			IsDataGuardEnabled:           common.Bool(false),
			PrivateEndpointLabel:         common.String("EXAMPLE-privateEndpointLabel-Value"),
			AdminPassword:                common.String("EXAMPLE-adminPassword-Value"),
			AutonomousDatabaseId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseId-Value"),
			BackupRetentionPeriodInDays:  common.Int(2480),
			CpuCoreCount:                 common.Int(123),
			EncryptionKey: database.AwsKeyDetails{ArnRole: common.String("EXAMPLE-arnRole-Value"),
				ExternalId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-externalId-Value"),
				KeyArn:             common.String("EXAMPLE-keyArn-Value"),
				ServiceEndpointUri: common.String("EXAMPLE-serviceEndpointUri-Value")},
			UseLatestAvailableBackupTimeStamp: common.Bool(true)}}

	// 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)
}