// 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"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
	"github.com/oracle/oci-go-sdk/v65/opensearch"
)

func ExampleUpdateOpensearchCluster() {
	// 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 := opensearch.NewOpensearchClusterClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := opensearch.UpdateOpensearchClusterRequest{OpcRequestId: common.String("EXREIGVUBF8GRANLOPOM<unique_ID>"),
		OpensearchClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-opensearchClusterId-Value"),
		UpdateOpensearchClusterDetails: opensearch.UpdateOpensearchClusterDetails{DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_xM1tk": map[string]interface{}{"EXAMPLE_KEY_qddw8": "EXAMPLE--Value"}},
			DisplayName:  common.String("EXAMPLE-displayName-Value"),
			FreeformTags: map[string]string{"EXAMPLE_KEY_cspue": "EXAMPLE_VALUE_2pGtDN3RRBDxjTT1ajpq"},
			BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(551),
				IsEnabled:       common.Bool(true),
				RetentionInDays: common.Int(755)},
			CertificateConfig: &opensearch.CertificateConfig{OpenSearchApiCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchApiCertificateId-Value"),
				OpenSearchDashboardCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchDashboardCertificateId-Value"),
				ClusterCertificateMode:           opensearch.CertificateModeOciCertificatesService,
				DashboardCertificateMode:         opensearch.CertificateModeOciCertificatesService},
			OutboundClusterConfig: &opensearch.OutboundClusterConfig{OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(false),
				Mode:              opensearch.CccModeSearchOnly,
				PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}},
				IsEnabled: common.Bool(false)},
			SecurityAttributes:     map[string]map[string]interface{}{"EXAMPLE_KEY_jk44L": map[string]interface{}{"EXAMPLE_KEY_pYW1E": "EXAMPLE--Value"}},
			SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
			SoftwareVersion:        common.String("EXAMPLE-softwareVersion-Value"),
			LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(3984),
				LoadBalancerMinBandwidthInMbps: common.Int(3072),
				LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer},
			MaintenanceDetails: &opensearch.UpdateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
			SecurityMode:       opensearch.SecurityModeDisabled,
			SecuritySamlConfig: &opensearch.SecuritySamlConfig{AdminBackendRole: common.String("EXAMPLE-adminBackendRole-Value"),
				IdpEntityId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-idpEntityId-Value"),
				IdpMetadataContent: common.String("EXAMPLE-idpMetadataContent-Value"),
				IsEnabled:          common.Bool(true),
				OpendashboardUrl:   common.String("EXAMPLE-opendashboardUrl-Value"),
				RolesKey:           common.String("EXAMPLE-rolesKey-Value"),
				SubjectKey:         common.String("EXAMPLE-subjectKey-Value")},
			ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
			SecurityMasterUserPasswordHash:       common.String("EXAMPLE-securityMasterUserPasswordHash-Value")},
		IfMatch: common.String("EXAMPLE-ifMatch-Value")}

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

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