// 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 ExampleCreateOpensearchCluster() {
	// 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.CreateOpensearchClusterRequest{CreateOpensearchClusterDetails: opensearch.CreateOpensearchClusterDetails{VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		DataNodeHostMemoryGB:         common.Int(92372),
		MasterNodeCount:              common.Int(588),
		MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
			OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{PingSchedule: common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value"),
				DisplayName:       common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(false),
				Mode:              opensearch.CccModeReplicationOnly}}},
		SearchNodeCount:                      common.Int(185),
		SoftwareVersion:                      common.String("EXAMPLE-softwareVersion-Value"),
		DataNodeCount:                        common.Int(33),
		DataNodeHostType:                     opensearch.DataNodeHostTypeFlex,
		FreeformTags:                         map[string]string{"EXAMPLE_KEY_Ss70V": "EXAMPLE_VALUE_G78r0PxUCJME7qzFkYuC"},
		OpendashboardNodeHostShape:           common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
		SearchNodeHostOcpuCount:              common.Int(9121),
		SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
		CompartmentId:                        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		MasterNodeHostShape:                  common.String("EXAMPLE-masterNodeHostShape-Value"),
		OpendashboardNodeHostOcpuCount:       common.Int(8393),
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		DisplayName:                          common.String("EXAMPLE-displayName-Value"),
		SearchNodeHostMemoryGB:               common.Int(41015),
		SearchNodeHostType:                   opensearch.SearchNodeHostTypeFlex,
		SearchNodeStorageGB:                  common.Int(38498),
		SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		BackupPolicy: &opensearch.BackupPolicy{RetentionInDays: common.Int(345),
			FrequencyInHours: common.Int(667),
			IsEnabled:        common.Bool(true)},
		MaintenanceDetails:             &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		MasterNodeHostMemoryGB:         common.Int(65355),
		MasterNodeHostType:             opensearch.MasterNodeHostTypeBm,
		DataNodeHostShape:              common.String("EXAMPLE-dataNodeHostShape-Value"),
		DataNodeStorageGB:              common.Int(88867),
		SearchNodeHostShape:            common.String("EXAMPLE-searchNodeHostShape-Value"),
		SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		VcnId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		DataNodeHostBareMetalShape:     common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		DefinedTags:                    map[string]map[string]interface{}{"EXAMPLE_KEY_Q6IQv": map[string]interface{}{"EXAMPLE_KEY_yUpm7": "EXAMPLE--Value"}},
		OpendashboardNodeCount:         common.Int(247),
		OpendashboardNodeHostMemoryGB:  common.Int(5907),
		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")},
		SubnetCompartmentId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		SystemTags:              map[string]map[string]interface{}{"EXAMPLE_KEY_1QqBa": map[string]interface{}{"EXAMPLE_KEY_JDcp6": "EXAMPLE--Value"}},
		DataNodeHostOcpuCount:   common.Int(2579),
		InboundClusterIds:       []string{"EXAMPLE--Value"},
		MasterNodeHostOcpuCount: common.Int(3668),
		SecurityMode:            opensearch.SecurityModeDisabled},
		OpcRequestId:  common.String("RGQN78RCFOSKZNDUSUCG<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

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

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