// 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(false),
		OpcRequestId: common.String("YG8EOVPSR8RGJP9VEAHO<unique_ID>"),
		UpdateAutonomousDatabaseDetails: database.UpdateAutonomousDatabaseDetails{AutoRefreshFrequencyInSeconds: common.Int(110042),
			AutonomousDatabaseMaintenanceWindow: &database.AutonomousDatabaseMaintenanceWindowSummary{MaintenanceStartTime: common.String("EXAMPLE-maintenanceStartTime-Value"),
				DayOfWeek:          &database.DayOfWeek{Name: database.DayOfWeekNameSaturday},
				MaintenanceEndTime: common.String("EXAMPLE-maintenanceEndTime-Value")},
			DbVersion:                         common.String("EXAMPLE-dbVersion-Value"),
			FreeformTags:                      map[string]string{"EXAMPLE_KEY_2zXUR": "EXAMPLE_VALUE_viIZqFmMnhw8tGKri0yZ"},
			IsDataGuardEnabled:                common.Bool(true),
			IsDisableDbVersionUpgradeSchedule: common.Bool(false),
			IsMtlsConnectionRequired:          common.Bool(false),
			LocalAdgResourcePoolLeaderId:      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-localAdgResourcePoolLeaderId-Value"),
			CpuCoreCount:                      common.Int(53),
			NsgIds:                            []string{"EXAMPLE--Value"},
			SecurityAttributes:                map[string]map[string]interface{}{"EXAMPLE_KEY_58cI7": map[string]interface{}{"EXAMPLE_KEY_ALXmn": "EXAMPLE--Value"}},
			SubnetId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			IsDevTier:                         common.Bool(false),
			PeerDbId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerDbId-Value"),
			PermissionLevel:                   database.UpdateAutonomousDatabaseDetailsPermissionLevelRestricted,
			DbName:                            common.String("EXAMPLE-dbName-Value"),
			IsDisconnectPeer:                  common.Bool(true),
			IsAutoScalingEnabled:              common.Bool(true),
			IsAutoScalingForStorageEnabled:    common.Bool(true),
			ResourcePoolSummary: &database.ResourcePoolSummary{AvailableStorageCapacityInTBs: common.Float64(4872.5264),
				IsDisabled:               common.Bool(true),
				PoolSize:                 common.Int(803),
				PoolStorageSizeInTBs:     common.Int(979),
				TotalComputeCapacity:     common.Int(239),
				AvailableComputeCapacity: common.Int(720)},
			AutoRefreshPointLagInSeconds:      common.Int(215892),
			AutonomousMaintenanceScheduleType: database.UpdateAutonomousDatabaseDetailsAutonomousMaintenanceScheduleTypeRegular,
			ByolComputeCountLimit:             common.Float32(7478.3457),
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{Name: database.DatabaseToolNameApex,
				ComputeCount:         common.Float32(7323.3286),
				IsEnabled:            common.Bool(true),
				MaxIdleTimeInMinutes: common.Int(479)}},
			ArePrimaryWhitelistedIpsUsed:  common.Bool(true),
			DbWorkload:                    database.UpdateAutonomousDatabaseDetailsDbWorkloadApex,
			IsLocalDataGuardEnabled:       common.Bool(false),
			TimeScheduledDbVersionUpgrade: &common.SDKTime{Time: time.Now()},
			VanityUrlDetails: &database.VanityUrlDetails{ApiGatewayId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-apiGatewayId-Value"),
				IsDisabled:        common.Bool(false),
				VanityUrlHostName: common.String("EXAMPLE-vanityUrlHostName-Value")},
			TimeMaintenancePauseUntil:   &common.SDKTime{Time: time.Now()},
			BackupRetentionPeriodInDays: common.Int(675),
			LongTermBackupSchedule: &database.LongTermBackUpScheduleDetails{RetentionPeriodInDays: common.Int(266),
				TimeOfBackup:  &common.SDKTime{Time: time.Now()},
				IsDisabled:    common.Bool(true),
				RepeatCadence: database.LongTermBackUpScheduleDetailsRepeatCadenceMonthly},
			PrivateEndpointIp:                    common.String("EXAMPLE-privateEndpointIp-Value"),
			AdminPassword:                        common.String("EXAMPLE-adminPassword-Value"),
			IsScheduleDbVersionUpgradeToEarliest: common.Bool(true),
			StandbyWhitelistedIps:                []string{"EXAMPLE--Value"},
			TimeOfAutoRefreshStart:               &common.SDKTime{Time: time.Now()},
			SecretId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			ComputeModel:                         database.UpdateAutonomousDatabaseDetailsComputeModelEcpu,
			CustomerContacts:                     []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			OpenMode:                             database.UpdateAutonomousDatabaseDetailsOpenModeWrite,
			PrivateEndpointLabel:                 common.String("EXAMPLE-privateEndpointLabel-Value"),
			RefreshableMode:                      database.UpdateAutonomousDatabaseDetailsRefreshableModeAutomatic,
			ResourcePoolLeaderId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			DataStorageSizeInTBs:                 common.Int(329),
			DatabaseEdition:                      database.AutonomousDatabaseSummaryDatabaseEditionStandardEdition,
			DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_BpPmV": map[string]interface{}{"EXAMPLE_KEY_aTfTj": "EXAMPLE--Value"}},
			IsFreeTier:                           common.Bool(true),
			IsRefreshableClone:                   common.Bool(false),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameWednesday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime:  common.String("EXAMPLE-scheduledStopTime-Value")}},
			WhitelistedIps:                       []string{"EXAMPLE--Value"},
			DataStorageSizeInGBs:                 common.Int(37980),
			LicenseModel:                         database.UpdateAutonomousDatabaseDetailsLicenseModelBringYourOwnLicense,
			ComputeCount:                         common.Float32(1152.23),
			DisplayName:                          common.String("EXAMPLE-displayName-Value"),
			InMemoryPercentage:                   common.Int(993),
			IsAccessControlEnabled:               common.Bool(false),
			IsBackupRetentionLocked:              common.Bool(true),
			LocalAdgAutoFailoverMaxDataLossLimit: common.Int(170),
			EncryptionKey:                        database.OracleManagedKeyDetails{},
			OcpuCount:                            common.Float32(3695.6775),
			SecretVersionNumber:                  common.Int(33)}}

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