// 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{DataNodeHostMemoryGB: common.Int(9585),
		DataNodeHostOcpuCount:         common.Int(3330),
		DataNodeHostType:              opensearch.DataNodeHostTypeFlex,
		MasterNodeCount:               common.Int(519),
		MasterNodeHostBareMetalShape:  common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		MasterNodeHostOcpuCount:       common.Int(3738),
		OpendashboardNodeHostMemoryGB: common.Int(4287),
		OpendashboardNodeHostShape:    common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
		BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(440),
			IsEnabled:       common.Bool(false),
			RetentionInDays: common.Int(748)},
		CompartmentId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		DisplayName:             common.String("EXAMPLE-displayName-Value"),
		MasterNodeHostMemoryGB:  common.Int(61860),
		MasterNodeHostShape:     common.String("EXAMPLE-masterNodeHostShape-Value"),
		SearchNodeHostOcpuCount: common.Int(8525),
		SearchNodeHostShape:     common.String("EXAMPLE-searchNodeHostShape-Value"),
		SearchNodeHostType:      opensearch.SearchNodeHostTypeFlex,
		CertificateConfig: &opensearch.CertificateConfig{ClusterCertificateMode: opensearch.CertificateModeOpensearchService,
			DashboardCertificateMode:         opensearch.CertificateModeOpensearchService,
			OpenSearchApiCertificateId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchApiCertificateId-Value"),
			OpenSearchDashboardCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchDashboardCertificateId-Value")},
		LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(1706),
			LoadBalancerMinBandwidthInMbps: common.Int(118),
			LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer},
		MaintenanceDetails:                   &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		NsgId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
		OpendashboardNodeHostOcpuCount:       common.Int(3480),
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
		SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		DataNodeHostShape:                    common.String("EXAMPLE-dataNodeHostShape-Value"),
		DataNodeStorageGB:                    common.Int(6287),
		MasterNodeHostType:                   opensearch.MasterNodeHostTypeFlex,
		OpendashboardNodeCount:               common.Int(189),
		SearchNodeStorageGB:                  common.Int(86332),
		SecurityMode:                         opensearch.SecurityModeDisabled,
		SoftwareVersion:                      common.String("EXAMPLE-softwareVersion-Value"),
		VcnId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		DataNodeCount:                        common.Int(713),
		DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_TI4QG": map[string]interface{}{"EXAMPLE_KEY_rGlD0": "EXAMPLE--Value"}},
		FreeformTags:                         map[string]string{"EXAMPLE_KEY_syLeo": "EXAMPLE_VALUE_2FwsvbTskshxHn8upSpl"},
		InboundClusterIds:                    []string{"EXAMPLE--Value"},
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
			OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(false),
				Mode:              opensearch.CccModeReplicationOnly,
				PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}}},
		SecurityAttributes:             map[string]map[string]interface{}{"EXAMPLE_KEY_cvURQ": map[string]interface{}{"EXAMPLE_KEY_G09fQ": "EXAMPLE--Value"}},
		SubnetCompartmentId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		VcnCompartmentId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		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(false),
			OpendashboardUrl:   common.String("EXAMPLE-opendashboardUrl-Value"),
			RolesKey:           common.String("EXAMPLE-rolesKey-Value"),
			SubjectKey:         common.String("EXAMPLE-subjectKey-Value")},
		SearchNodeCount:            common.Int(745),
		DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		SearchNodeHostMemoryGB:     common.Int(70670),
		SystemTags:                 map[string]map[string]interface{}{"EXAMPLE_KEY_PeFEv": map[string]interface{}{"EXAMPLE_KEY_vvIRl": "EXAMPLE--Value"}}},
		OpcRequestId:  common.String("0QTQ19CJB4L1NXCXGNPJ<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)
}