// 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"),
		OpcRequestId: common.String("PSQJK0HT1FHZDBEKTYJE<unique_ID>"),
		UpdateAutonomousDatabaseDetails: database.UpdateAutonomousDatabaseDetails{StandbyWhitelistedIps: []string{"EXAMPLE--Value"},
			TimeOfAutoRefreshStart:               &common.SDKTime{Time: time.Now()},
			BackupRetentionPeriodInDays:          common.Int(1143),
			CpuCoreCount:                         common.Int(80),
			CustomerContacts:                     []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			LocalAdgAutoFailoverMaxDataLossLimit: common.Int(1182),
			SecretVersionNumber:                  common.Int(59),
			NsgIds:                               []string{"EXAMPLE--Value"},
			RefreshableMode:                      database.UpdateAutonomousDatabaseDetailsRefreshableModeManual,
			SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{IsEnabled: common.Bool(true),
				MaxIdleTimeInMinutes: common.Int(129),
				Name:                 database.DatabaseToolNameOrds,
				ComputeCount:         common.Float32(194.76901)}},
			DbVersion:                     common.String("EXAMPLE-dbVersion-Value"),
			IsAutoScalingEnabled:          common.Bool(false),
			IsFreeTier:                    common.Bool(false),
			IsLocalDataGuardEnabled:       common.Bool(true),
			PrivateEndpointIp:             common.String("EXAMPLE-privateEndpointIp-Value"),
			AutoRefreshPointLagInSeconds:  common.Int(38598),
			DbWorkload:                    database.UpdateAutonomousDatabaseDetailsDbWorkloadDw,
			DisplayName:                   common.String("EXAMPLE-displayName-Value"),
			IsDevTier:                     common.Bool(true),
			PermissionLevel:               database.UpdateAutonomousDatabaseDetailsPermissionLevelRestricted,
			AutoRefreshFrequencyInSeconds: common.Int(464906),
			DefinedTags:                   map[string]map[string]interface{}{"EXAMPLE_KEY_AcGZW": map[string]interface{}{"EXAMPLE_KEY_5N1lU": "EXAMPLE--Value"}},
			OpenMode:                      database.UpdateAutonomousDatabaseDetailsOpenModeOnly,
			DatabaseEdition:               database.AutonomousDatabaseSummaryDatabaseEditionStandardEdition,
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSunday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime:  common.String("EXAMPLE-scheduledStopTime-Value")}},
			SecretId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			WhitelistedIps:           []string{"EXAMPLE--Value"},
			AdminPassword:            common.String("EXAMPLE-adminPassword-Value"),
			ComputeModel:             database.UpdateAutonomousDatabaseDetailsComputeModelOcpu,
			LicenseModel:             database.UpdateAutonomousDatabaseDetailsLicenseModelLicenseIncluded,
			PeerDbId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerDbId-Value"),
			PrivateEndpointLabel:     common.String("EXAMPLE-privateEndpointLabel-Value"),
			IsMtlsConnectionRequired: common.Bool(true),
			LongTermBackupSchedule: &database.LongTermBackUpScheduleDetails{IsDisabled: common.Bool(false),
				RepeatCadence:         database.LongTermBackUpScheduleDetailsRepeatCadenceYearly,
				RetentionPeriodInDays: common.Int(1126),
				TimeOfBackup:          &common.SDKTime{Time: time.Now()}},
			ResourcePoolLeaderId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			ArePrimaryWhitelistedIpsUsed:   common.Bool(false),
			ComputeCount:                   common.Float32(637.1687),
			DataStorageSizeInTBs:           common.Int(143),
			FreeformTags:                   map[string]string{"EXAMPLE_KEY_lIvtI": "EXAMPLE_VALUE_Vmmlc7aeJq1jbjPhw7Lt"},
			IsAutoScalingForStorageEnabled: common.Bool(false),
			IsRefreshableClone:             common.Bool(true),
			OcpuCount:                      common.Float32(503.59488),
			ResourcePoolSummary: &database.ResourcePoolSummary{IsDisabled: common.Bool(false),
				PoolSize: common.Int(622)},
			DataStorageSizeInGBs:   common.Int(21562),
			DbName:                 common.String("EXAMPLE-dbName-Value"),
			InMemoryPercentage:     common.Int(759),
			IsAccessControlEnabled: common.Bool(false),
			IsDataGuardEnabled:     common.Bool(false)}}

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