// 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 ExampleLaunchDbSystem() {
	// 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.LaunchDbSystemRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		LaunchDbSystemDetails: database.LaunchDbSystemFromDatabaseDetails{ClusterName: common.String("EXAMPLE-clusterName-Value"),
			DataStoragePercentage: common.Int(865),
			DbHome: &database.CreateDbHomeFromDatabaseDetails{Database: &database.CreateDatabaseFromAnotherDatabaseDetails{PluggableDatabases: []string{"EXAMPLE--Value"},
				TimeStampForPointInTimeRecovery: &common.SDKTime{Time: time.Now()},
				AdminPassword:                   common.String("EXAMPLE-adminPassword-Value"),
				BackupTDEPassword:               common.String("EXAMPLE-backupTDEPassword-Value"),
				DatabaseId:                      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value"),
				DbName:                          common.String("EXAMPLE-dbName-Value"),
				DbUniqueName:                    common.String("EXAMPLE-dbUniqueName-Value")},
				DefinedTags:              map[string]map[string]interface{}{"EXAMPLE_KEY_8Rpl0": map[string]interface{}{"EXAMPLE_KEY_X13kR": "EXAMPLE--Value"}},
				DisplayName:              common.String("EXAMPLE-displayName-Value"),
				FreeformTags:             map[string]string{"EXAMPLE_KEY_viiTv": "EXAMPLE_VALUE_GGTmk9Fjsi6El5v2C467"},
				IsUnifiedAuditingEnabled: common.Bool(true)},
			DisplayName:                  common.String("EXAMPLE-displayName-Value"),
			PrivateIpV6:                  common.String("EXAMPLE-privateIpV6-Value"),
			SecurityAttributes:           map[string]map[string]interface{}{"EXAMPLE_KEY_Dp3xM": map[string]interface{}{"EXAMPLE_KEY_kkPXY": "EXAMPLE--Value"}},
			Shape:                        common.String("EXAMPLE-shape-Value"),
			SubnetId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			DbSystemOptions:              &database.DbSystemOptions{StorageManagement: database.DbSystemOptionsStorageManagementLvm},
			DiskRedundancy:               database.LaunchDbSystemFromDatabaseDetailsDiskRedundancyNormal,
			KmsKeyId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
			LicenseModel:                 database.LaunchDbSystemFromDatabaseDetailsLicenseModelBringYourOwnLicense,
			PrivateIp:                    common.String("EXAMPLE-privateIp-Value"),
			BackupSubnetId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value"),
			CpuCoreCount:                 common.Int(801),
			FaultDomains:                 []string{"EXAMPLE--Value"},
			NodeCount:                    common.Int(99),
			SshPublicKeys:                []string{"EXAMPLE--Value"},
			AvailabilityDomain:           common.String("EXAMPLE-availabilityDomain-Value"),
			FreeformTags:                 map[string]string{"EXAMPLE_KEY_AXttp": "EXAMPLE_VALUE_hlFLtuwyioxRch5kuuf4"},
			NsgIds:                       []string{"EXAMPLE--Value"},
			Domain:                       common.String("EXAMPLE-domain-Value"),
			Hostname:                     common.String("EXAMPLE-hostname-Value"),
			KmsKeyVersionId:              common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value"),
			TimeZone:                     common.String("EXAMPLE-timeZone-Value"),
			BackupNetworkNsgIds:          []string{"EXAMPLE--Value"},
			CompartmentId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DatabaseEdition:              database.LaunchDbSystemFromDatabaseDetailsDatabaseEditionEnterpriseEditionExtremePerformance,
			SparseDiskgroup:              common.Bool(false),
			StorageVolumePerformanceMode: database.LaunchDbSystemBaseStorageVolumePerformanceModeBalanced,
			DataCollectionOptions: &database.DataCollectionOptions{IsDiagnosticsEventsEnabled: common.Bool(false),
				IsHealthMonitoringEnabled: common.Bool(true),
				IsIncidentLogsEnabled:     common.Bool(false)},
			DefinedTags:                map[string]map[string]interface{}{"EXAMPLE_KEY_iyflL": map[string]interface{}{"EXAMPLE_KEY_kVI58": "EXAMPLE--Value"}},
			InitialDataStorageSizeInGB: common.Int(172)}}

	// Send the request using the service client
	resp, err := client.LaunchDbSystem(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}

Was this article helpful?