// 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 ExampleUpdateAutonomousDatabase() {
	// 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.UpdateAutonomousDatabaseRequest{AutonomousDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseId-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcDryRun:    common.Bool(true),
		OpcRequestId: common.String("2SRCMCMNYFFFDEBHRZDJ<unique_ID>"),
		UpdateAutonomousDatabaseDetails: database.UpdateAutonomousDatabaseDetails{ArePrimaryWhitelistedIpsUsed: common.Bool(true),
			AutoRefreshFrequencyInSeconds:        common.Int(52770),
			FreeformTags:                         map[string]string{"EXAMPLE_KEY_iyc3q": "EXAMPLE_VALUE_iiBSFLrCjQ2Nc1rzPfY5"},
			LocalAdgAutoFailoverMaxDataLossLimit: common.Int(941),
			DatabaseEdition:                      database.AutonomousDatabaseSummaryDatabaseEditionStandardEdition,
			ByolComputeCountLimit:                common.Float32(4141.597),
			LicenseModel:                         database.UpdateAutonomousDatabaseDetailsLicenseModelLicenseIncluded,
			ResourcePoolSummary: &database.ResourcePoolSummary{AvailableComputeCapacity: common.Int(11),
				IsDisabled:           common.Bool(false),
				PoolSize:             common.Int(588),
				TotalComputeCapacity: common.Int(744)},
			SecretVersionNumber:           common.Int(11),
			IsAutoScalingEnabled:          common.Bool(true),
			OcpuCount:                     common.Float32(4554.3726),
			TimeScheduledDbVersionUpgrade: &common.SDKTime{Time: time.Now()},
			ComputeModel:                  database.UpdateAutonomousDatabaseDetailsComputeModelOcpu,
			DbWorkload:                    database.UpdateAutonomousDatabaseDetailsDbWorkloadDw,
			InMemoryPercentage:            common.Int(537),
			IsRefreshableClone:            common.Bool(false),
			WhitelistedIps:                []string{"EXAMPLE--Value"},
			BackupRetentionPeriodInDays:   common.Int(585),
			LongTermBackupSchedule: &database.LongTermBackUpScheduleDetails{RepeatCadence: database.LongTermBackUpScheduleDetailsRepeatCadenceOneTime,
				RetentionPeriodInDays: common.Int(3254),
				TimeOfBackup:          &common.SDKTime{Time: time.Now()},
				IsDisabled:            common.Bool(true)},
			NsgIds:                 []string{"EXAMPLE--Value"},
			TimeOfAutoRefreshStart: &common.SDKTime{Time: time.Now()},
			IsDataGuardEnabled:     common.Bool(false),
			CustomerContacts:       []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			DataStorageSizeInGBs:   common.Int(44202),
			DefinedTags:            map[string]map[string]interface{}{"EXAMPLE_KEY_LNlCO": map[string]interface{}{"EXAMPLE_KEY_fcTCc": "EXAMPLE--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")},
			IsAutoScalingForStorageEnabled:    common.Bool(false),
			OpenMode:                          database.UpdateAutonomousDatabaseDetailsOpenModeOnly,
			DbVersion:                         common.String("EXAMPLE-dbVersion-Value"),
			DisplayName:                       common.String("EXAMPLE-displayName-Value"),
			IsAccessControlEnabled:            common.Bool(false),
			SecretId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			SubnetId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			IsDevTier:                         common.Bool(true),
			IsDisableDbVersionUpgradeSchedule: common.Bool(false),
			IsMtlsConnectionRequired:          common.Bool(true),
			DataStorageSizeInTBs:              common.Int(322),
			PrivateEndpointLabel:              common.String("EXAMPLE-privateEndpointLabel-Value"),
			CpuCoreCount:                      common.Int(121),
			IsFreeTier:                        common.Bool(false),
			IsLocalDataGuardEnabled:           common.Bool(false),
			RefreshableMode:                   database.UpdateAutonomousDatabaseDetailsRefreshableModeManual,
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(1021.22784),
				IsEnabled:            common.Bool(false),
				MaxIdleTimeInMinutes: common.Int(429),
				Name:                 database.DatabaseToolNameGraphStudio}},
			IsDisconnectPeer:                     common.Bool(false),
			PrivateEndpointIp:                    common.String("EXAMPLE-privateEndpointIp-Value"),
			SecurityAttributes:                   map[string]map[string]interface{}{"EXAMPLE_KEY_fSUJ3": map[string]interface{}{"EXAMPLE_KEY_BLJjq": "EXAMPLE--Value"}},
			AdminPassword:                        common.String("EXAMPLE-adminPassword-Value"),
			AutoRefreshPointLagInSeconds:         common.Int(293485),
			DbName:                               common.String("EXAMPLE-dbName-Value"),
			PermissionLevel:                      database.UpdateAutonomousDatabaseDetailsPermissionLevelUnrestricted,
			IsBackupRetentionLocked:              common.Bool(true),
			IsScheduleDbVersionUpgradeToEarliest: common.Bool(false),
			ResourcePoolLeaderId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			StandbyWhitelistedIps:                []string{"EXAMPLE--Value"},
			PeerDbId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerDbId-Value"),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameFriday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime:  common.String("EXAMPLE-scheduledStopTime-Value")}},
			ComputeCount:                      common.Float32(2269.144),
			AutonomousMaintenanceScheduleType: database.UpdateAutonomousDatabaseDetailsAutonomousMaintenanceScheduleTypeRegular}}

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

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