// 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{MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		DataNodeHostBareMetalShape:           common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_JsJm2": map[string]interface{}{"EXAMPLE_KEY_TqHyu": "EXAMPLE--Value"}},
		OpendashboardNodeHostOcpuCount:       common.Int(9192),
		SecurityMasterUserPasswordHash:       common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		SecuritySamlConfig: &opensearch.SecuritySamlConfig{IsEnabled: common.Bool(false),
			OpendashboardUrl:   common.String("EXAMPLE-opendashboardUrl-Value"),
			RolesKey:           common.String("EXAMPLE-rolesKey-Value"),
			SubjectKey:         common.String("EXAMPLE-subjectKey-Value"),
			AdminBackendRole:   common.String("EXAMPLE-adminBackendRole-Value"),
			IdpEntityId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-idpEntityId-Value"),
			IdpMetadataContent: common.String("EXAMPLE-idpMetadataContent-Value")},
		SubnetId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		SystemTags:                   map[string]map[string]interface{}{"EXAMPLE_KEY_MxSWO": map[string]interface{}{"EXAMPLE_KEY_d0gnr": "EXAMPLE--Value"}},
		DataNodeStorageGB:            common.Int(30946),
		MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		SearchNodeHostOcpuCount:      common.Int(5557),
		SecurityMasterUserName:       common.String("EXAMPLE-securityMasterUserName-Value"),
		DataNodeHostType:             opensearch.DataNodeHostTypeFlex,
		MasterNodeHostType:           opensearch.MasterNodeHostTypeFlex,
		OpendashboardNodeHostShape:   common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
			IsSkipUnavailable: common.Bool(true),
			Mode:              opensearch.CccModeSearchOnly,
			PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
			SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}},
			IsEnabled: common.Bool(false)},
		VcnCompartmentId:              common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		DataNodeHostMemoryGB:          common.Int(55563),
		InboundClusterIds:             []string{"EXAMPLE--Value"},
		SearchNodeStorageGB:           common.Int(7152),
		SecurityMode:                  opensearch.SecurityModePermissive,
		SubnetCompartmentId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		DataNodeHostShape:             common.String("EXAMPLE-dataNodeHostShape-Value"),
		SearchNodeCount:               common.Int(623),
		DataNodeHostOcpuCount:         common.Int(9948),
		MasterNodeCount:               common.Int(351),
		MasterNodeHostShape:           common.String("EXAMPLE-masterNodeHostShape-Value"),
		OpendashboardNodeHostMemoryGB: common.Int(2026),
		SearchNodeHostType:            opensearch.SearchNodeHostTypeFlex,
		BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(170),
			IsEnabled:       common.Bool(false),
			RetentionInDays: common.Int(911)},
		CompartmentId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		FreeformTags:            map[string]string{"EXAMPLE_KEY_A6Nho": "EXAMPLE_VALUE_JRFqOhrgMPj0wbc1jcHN"},
		MasterNodeHostMemoryGB:  common.Int(3042),
		SearchNodeHostShape:     common.String("EXAMPLE-searchNodeHostShape-Value"),
		DataNodeCount:           common.Int(610),
		DisplayName:             common.String("EXAMPLE-displayName-Value"),
		SearchNodeHostMemoryGB:  common.Int(71451),
		SoftwareVersion:         common.String("EXAMPLE-softwareVersion-Value"),
		VcnId:                   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		MasterNodeHostOcpuCount: common.Int(4567),
		OpendashboardNodeCount:  common.Int(282)},
		OpcRequestId:  common.String("2XXZISEMDEEKQV0WGZJZ<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)
}