// 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.CreateCrossRegionDisasterRecoveryDetails{SourceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value"),
			SubnetId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			ComputeModel:            database.CreateAutonomousDatabaseBaseComputeModelEcpu,
			CustomerContacts:        []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			DisplayName:             common.String("EXAMPLE-displayName-Value"),
			IsBackupRetentionLocked: common.Bool(true),
			EncryptionKey: database.GcpKeyDetails{Location: common.String("EXAMPLE-location-Value"),
				Project:         common.String("EXAMPLE-project-Value"),
				KeyName:         common.String("EXAMPLE-keyName-Value"),
				KeyRing:         common.String("EXAMPLE-keyRing-Value"),
				KmsRestEndpoint: common.String("EXAMPLE-kmsRestEndpoint-Value")},
			ByolComputeCountLimit:             common.Float32(2906.7188),
			PrivateEndpointIp:                 common.String("EXAMPLE-privateEndpointIp-Value"),
			AdminPassword:                     common.String("EXAMPLE-adminPassword-Value"),
			CharacterSet:                      common.String("EXAMPLE-characterSet-Value"),
			AutonomousMaintenanceScheduleType: database.CreateAutonomousDatabaseBaseAutonomousMaintenanceScheduleTypeEarly,
			DataStorageSizeInGBs:              common.Int(56836),
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(2565.6301),
				IsEnabled:            common.Bool(false),
				MaxIdleTimeInMinutes: common.Int(313),
				Name:                 database.DatabaseToolNameMongodbApi}},
			IsDataGuardEnabled: common.Bool(false),
			OcpuCount:          common.Float32(4312.007),
			AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameFriday},
				MaintenanceEndTime:   common.String("EXAMPLE-maintenanceEndTime-Value"),
				MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value")},
			FreeformTags:                   map[string]string{"EXAMPLE_KEY_YeIxr": "EXAMPLE_VALUE_AsfzSwsLdqMM1UHeYHlB"},
			KmsKeyId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
			NcharacterSet:                  common.String("EXAMPLE-ncharacterSet-Value"),
			DefinedTags:                    map[string]map[string]interface{}{"EXAMPLE_KEY_XzpIV": map[string]interface{}{"EXAMPLE_KEY_Rb2kA": "EXAMPLE--Value"}},
			TransportableTablespace:        &database.ImportTransportableTablespaceDetails{TtsBundleUrl: common.String("EXAMPLE-ttsBundleUrl-Value")},
			VaultId:                        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
			DatabaseEdition:                database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
			DbWorkload:                     database.CreateAutonomousDatabaseBaseDbWorkloadOltp,
			InMemoryPercentage:             common.Int(67),
			IsAutoScalingForStorageEnabled: common.Bool(true),
			IsDevTier:                      common.Bool(true),
			SecretId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			SecurityAttributes:             map[string]map[string]interface{}{"EXAMPLE_KEY_BNH71": map[string]interface{}{"EXAMPLE_KEY_uLWqK": "EXAMPLE--Value"}},
			DbName:                         common.String("EXAMPLE-dbName-Value"),
			IsFreeTier:                     common.Bool(false),
			LicenseModel:                   database.CreateAutonomousDatabaseBaseLicenseModelBringYourOwnLicense,
			DbVersion:                      common.String("EXAMPLE-dbVersion-Value"),
			NsgIds:                         []string{"EXAMPLE--Value"},
			PrivateEndpointLabel:           common.String("EXAMPLE-privateEndpointLabel-Value"),
			RemoteDisasterRecoveryType:     database.DisasterRecoveryConfigurationDisasterRecoveryTypeAdg,
			SecretVersionNumber:            common.Int(59),
			ArePrimaryWhitelistedIpsUsed:   common.Bool(true),
			CompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			IsMtlsConnectionRequired:       common.Bool(false),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSaturday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime:  common.String("EXAMPLE-scheduledStopTime-Value")}},
			StandbyWhitelistedIps:                    []string{"EXAMPLE--Value"},
			AutonomousContainerDatabaseId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousContainerDatabaseId-Value"),
			ComputeCount:                             common.Float32(3614.7214),
			CpuCoreCount:                             common.Int(17),
			DataStorageSizeInTBs:                     common.Int(23),
			BackupRetentionPeriodInDays:              common.Int(2432),
			IsAccessControlEnabled:                   common.Bool(false),
			IsLocalDataGuardEnabled:                  common.Bool(false),
			IsPreviewVersionWithServiceTermsAccepted: common.Bool(false),
			IsReplicateAutomaticBackups:              common.Bool(false),
			ResourcePoolSummary: &database.ResourcePoolSummary{PoolSize: common.Int(14),
				PoolStorageSizeInTBs:          common.Int(533),
				TotalComputeCapacity:          common.Int(120),
				AvailableComputeCapacity:      common.Int(869),
				AvailableStorageCapacityInTBs: common.Float64(489.91263),
				IsDisabled:                    common.Bool(false)},
			WhitelistedIps:       []string{"EXAMPLE--Value"},
			IsAutoScalingEnabled: common.Bool(false),
			IsDedicated:          common.Bool(true),
			ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			SubscriptionId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value")},
		OpcDryRun:    common.Bool(true),
		OpcRequestId: common.String("OCUDRLCB6NQMDMTMGSCS<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)
}