// 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("PGKJJKB9AHSJRA7LULHC<unique_ID>"),
		UpdateAutonomousDatabaseDetails: database.UpdateAutonomousDatabaseDetails{ArePrimaryWhitelistedIpsUsed: common.Bool(false),
			DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_KdXwF": map[string]interface{}{"EXAMPLE_KEY_Cmose": "EXAMPLE--Value"}},
			IsScheduleDbVersionUpgradeToEarliest: common.Bool(false),
			PrivateEndpointIp:                    common.String("EXAMPLE-privateEndpointIp-Value"),
			ResourcePoolLeaderId:                 common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-resourcePoolLeaderId-Value"),
			SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			AutonomousMaintenanceScheduleType:    database.UpdateAutonomousDatabaseDetailsAutonomousMaintenanceScheduleTypeEarly,
			BackupRetentionPeriodInDays:          common.Int(712),
			DbName:                               common.String("EXAMPLE-dbName-Value"),
			LocalAdgAutoFailoverMaxDataLossLimit: common.Int(476),
			LongTermBackupSchedule: &database.LongTermBackUpScheduleDetails{IsDisabled: common.Bool(true),
				RepeatCadence:         database.LongTermBackUpScheduleDetailsRepeatCadenceYearly,
				RetentionPeriodInDays: common.Int(3081),
				TimeOfBackup:          &common.SDKTime{Time: time.Now()}},
			SecurityAttributes:     map[string]map[string]interface{}{"EXAMPLE_KEY_fB2RR": map[string]interface{}{"EXAMPLE_KEY_zaLWW": "EXAMPLE--Value"}},
			TimeOfAutoRefreshStart: &common.SDKTime{Time: time.Now()},
			ComputeCount:           common.Float32(3441.1465),
			OcpuCount:              common.Float32(9563.99),
			StandbyWhitelistedIps:  []string{"EXAMPLE--Value"},
			DbVersion:              common.String("EXAMPLE-dbVersion-Value"),
			IsRefreshableClone:     common.Bool(false),
			LicenseModel:           database.UpdateAutonomousDatabaseDetailsLicenseModelBringYourOwnLicense,
			OpenMode:               database.UpdateAutonomousDatabaseDetailsOpenModeWrite,
			DataStorageSizeInTBs:   common.Int(167),
			DatabaseEdition:        database.AutonomousDatabaseSummaryDatabaseEditionEnterpriseEdition,
			DbToolsDetails: []database.DatabaseTool{database.DatabaseTool{ComputeCount: common.Float32(5550.4917),
				IsEnabled:            common.Bool(false),
				MaxIdleTimeInMinutes: common.Int(736),
				Name:                 database.DatabaseToolNameDatabaseActions}},
			DisplayName:                       common.String("EXAMPLE-displayName-Value"),
			InMemoryPercentage:                common.Int(224),
			IsAutoScalingEnabled:              common.Bool(true),
			IsDisconnectPeer:                  common.Bool(true),
			CustomerContacts:                  []database.CustomerContact{database.CustomerContact{Email: common.String("EXAMPLE-email-Value")}},
			IsAccessControlEnabled:            common.Bool(true),
			IsDevTier:                         common.Bool(false),
			IsBackupRetentionLocked:           common.Bool(true),
			IsDisableDbVersionUpgradeSchedule: common.Bool(true),
			IsMtlsConnectionRequired:          common.Bool(true),
			NsgIds:                            []string{"EXAMPLE--Value"},
			PermissionLevel:                   database.UpdateAutonomousDatabaseDetailsPermissionLevelUnrestricted,
			SecretId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
			VanityUrlDetails: &database.VanityUrlDetails{ApiGatewayId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-apiGatewayId-Value"),
				IsDisabled:        common.Bool(true),
				VanityUrlHostName: common.String("EXAMPLE-vanityUrlHostName-Value")},
			ByolComputeCountLimit:        common.Float32(9585.65),
			CpuCoreCount:                 common.Int(2),
			FreeformTags:                 map[string]string{"EXAMPLE_KEY_ryoy2": "EXAMPLE_VALUE_gkFL9lf93NvdGsaJv5mk"},
			IsDataGuardEnabled:           common.Bool(true),
			IsFreeTier:                   common.Bool(true),
			WhitelistedIps:               []string{"EXAMPLE--Value"},
			AutoRefreshPointLagInSeconds: common.Int(211053),
			PeerDbId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerDbId-Value"),
			ScheduledOperations: []database.ScheduledOperationDetails{database.ScheduledOperationDetails{DayOfWeek: &database.DayOfWeek{Name: database.DayOfWeekNameSunday},
				ScheduledStartTime: common.String("EXAMPLE-scheduledStartTime-Value"),
				ScheduledStopTime:  common.String("EXAMPLE-scheduledStopTime-Value")}},
			SecretVersionNumber:           common.Int(39),
			AdminPassword:                 common.String("EXAMPLE-adminPassword-Value"),
			AutoRefreshFrequencyInSeconds: common.Int(462427),
			DataStorageSizeInGBs:          common.Int(48591),
			DbWorkload:                    database.UpdateAutonomousDatabaseDetailsDbWorkloadApex,
			PrivateEndpointLabel:          common.String("EXAMPLE-privateEndpointLabel-Value"),
			ComputeModel:                  database.UpdateAutonomousDatabaseDetailsComputeModelEcpu,
			EncryptionKey: database.GcpKeyDetails{KmsRestEndpoint: common.String("EXAMPLE-kmsRestEndpoint-Value"),
				Location: common.String("EXAMPLE-location-Value"),
				Project:  common.String("EXAMPLE-project-Value"),
				KeyName:  common.String("EXAMPLE-keyName-Value"),
				KeyRing:  common.String("EXAMPLE-keyRing-Value")},
			RefreshableMode:                database.UpdateAutonomousDatabaseDetailsRefreshableModeAutomatic,
			IsAutoScalingForStorageEnabled: common.Bool(false),
			IsLocalDataGuardEnabled:        common.Bool(true),
			ResourcePoolSummary: &database.ResourcePoolSummary{TotalComputeCapacity: common.Int(4),
				AvailableComputeCapacity: common.Int(842),
				IsDisabled:               common.Bool(false),
				PoolSize:                 common.Int(815)},
			TimeScheduledDbVersionUpgrade: &common.SDKTime{Time: time.Now()}}}

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