// 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{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcDryRun:    common.Bool(false),
		OpcRequestId: common.String("WQCIWSBCTEOV58WPLF3B<unique_ID>"),
		UpdateAutonomousDatabaseDetails: database.UpdateAutonomousDatabaseDetails{FreeformTags: map[string]string{"EXAMPLE_KEY_4LedT": "EXAMPLE_VALUE_1W8TQFAiK7CnuJG66ayy"},
			NsgIds:                               []string{"EXAMPLE--Value"},
			PrivateEndpointLabel:                 common.String("EXAMPLE-privateEndpointLabel-Value"),
			ComputeModel:                         database.UpdateAutonomousDatabaseDetailsComputeModelOcpu,
			ByolComputeCountLimit:                common.Float32(7838.582),
			DatabaseEdition:                      database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
			IsAutoScalingEnabled:                 common.Bool(false),
			IsAutoScalingForStorageEnabled:       common.Bool(false),
			IsMtlsConnectionRequired:             common.Bool(false),
			ArePrimaryWhitelistedIpsUsed:         common.Bool(true),
			IsFreeTier:                           common.Bool(false),
			IsDevTier:                            common.Bool(true),
			DbWorkload:                           database.UpdateAutonomousDatabaseDetailsDbWorkloadApex,
			OpenMode:                             database.UpdateAutonomousDatabaseDetailsOpenModeOnly,
			DataStorageSizeInGBs:                 common.Int(77807),
			InMemoryPercentage:                   common.Int(652),
			LocalAdgAutoFailoverMaxDataLossLimit: common.Int(1203),
			LongTermBackupSchedule: &database.LongTermBackUpScheduleDetails{RepeatCadence: database.LongTermBackUpScheduleDetailsRepeatCadenceMonthly,
				RetentionPeriodInDays: common.Int(3151),
				TimeOfBackup:          &common.SDKTime{Time: time.Now()},
				IsDisabled:            common.Bool(false)},
			OcpuCount:            common.Float32(305.26935),
			PermissionLevel:      database.UpdateAutonomousDatabaseDetailsPermissionLevelUnrestricted,
			ResourcePoolLeaderId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			CpuCoreCount:         common.Int(47),
			DbVersion:            common.String("EXAMPLE-dbVersion-Value"),
			SubnetId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			WhitelistedIps:       []string{"EXAMPLE--Value"},
			DataStorageSizeInTBs: common.Int(339),
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{IsEnabled: common.Bool(false),
				MaxIdleTimeInMinutes: common.Int(588),
				Name:                 database.DatabaseToolNameGraphStudio,
				ComputeCount:         common.Float32(2209.8076)}},
			IsDisableDbVersionUpgradeSchedule:    common.Bool(true),
			IsRefreshableClone:                   common.Bool(true),
			IsScheduleDbVersionUpgradeToEarliest: common.Bool(false),
			LicenseModel:                         database.UpdateAutonomousDatabaseDetailsLicenseModelBringYourOwnLicense,
			AutonomousMaintenanceScheduleType:    database.UpdateAutonomousDatabaseDetailsAutonomousMaintenanceScheduleTypeEarly,
			StandbyWhitelistedIps:                []string{"EXAMPLE--Value"},
			IsLocalDataGuardEnabled:              common.Bool(true),
			IsDataGuardEnabled:                   common.Bool(false),
			BackupRetentionPeriodInDays:          common.Int(2880),
			DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_kNSTr": map[string]interface{}{"EXAMPLE_KEY_fJzS2": "EXAMPLE--Value"}},
			IsBackupRetentionLocked:              common.Bool(false),
			IsDisconnectPeer:                     common.Bool(false),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{ScheduledStopTime: common.String("EXAMPLE-scheduledStopTime-Value"),
				DayOfWeek:          &database.DayOfWeek{Name: database.DayOfWeekNameSaturday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value")}},
			SecretVersionNumber:           common.Int(50),
			AdminPassword:                 common.String("EXAMPLE-adminPassword-Value"),
			RefreshableMode:               database.UpdateAutonomousDatabaseDetailsRefreshableModeManual,
			SecurityAttributes:            map[string]map[string]interface{}{"EXAMPLE_KEY_zQGbp": map[string]interface{}{"EXAMPLE_KEY_Yofz4": "EXAMPLE--Value"}},
			CustomerContacts:              []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			PeerDbId:                      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerDbId-Value"),
			AutoRefreshPointLagInSeconds:  common.Int(263151),
			ComputeCount:                  common.Float32(2747.726),
			DbName:                        common.String("EXAMPLE-dbName-Value"),
			IsAccessControlEnabled:        common.Bool(true),
			PrivateEndpointIp:             common.String("EXAMPLE-privateEndpointIp-Value"),
			TimeOfAutoRefreshStart:        &common.SDKTime{Time: time.Now()},
			AutoRefreshFrequencyInSeconds: common.Int(292191),
			TimeScheduledDbVersionUpgrade: &common.SDKTime{Time: time.Now()},
			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")},
			ResourcePoolSummary: &database.ResourcePoolSummary{AvailableComputeCapacity: common.Int(561),
				IsDisabled:           common.Bool(true),
				PoolSize:             common.Int(713),
				TotalComputeCapacity: common.Int(706)},
			SecretId:    common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value")},
		AutonomousDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-autonomousDatabaseId-Value")}

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