// 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{DataNodeCount: common.Int(132),
		MlNodeCount:                          common.Int(382),
		NsgId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		VcnId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		CoordinatorNodeHostShape:             common.String("EXAMPLE-coordinatorNodeHostShape-Value"),
		MlNodeHostMemoryGB:                   common.Int(52753),
		SearchNodeHostType:                   opensearch.SearchNodeHostTypeFlex,
		DataNodeHostBareMetalShape:           common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		MasterNodeHostOcpuCount:              common.Int(6316),
		SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
		SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		MasterNodeHostMemoryGB:               common.Int(57987),
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
			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")}}},
		SearchNodeCount:      common.Int(659),
		DataNodeHostMemoryGB: common.Int(45286),
		DataNodeStorageGB:    common.Int(32612),
		MlNodeStorageGB:      common.Int(92864),
		SecurityMode:         opensearch.SecurityModeEnforcing,
		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"),
		VcnCompartmentId:    common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(845),
			IsEnabled:       common.Bool(true),
			RetentionInDays: common.Int(155)},
		CoordinatorNodeHostType:        opensearch.CoordinatorNodeHostTypeFlex,
		DisplayName:                    common.String("EXAMPLE-displayName-Value"),
		InboundClusterIds:              []string{"EXAMPLE--Value"},
		OpendashboardNodeHostShape:     common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
		SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		SoftwareVersion:                common.String("EXAMPLE-softwareVersion-Value"),
		CoordinatorNodeCount:           common.Int(610),
		MlNodeHostType:                 opensearch.MlNodeHostTypeFlex,
		SecurityAttributes:             map[string]map[string]interface{}{"EXAMPLE_KEY_q2wFV": map[string]interface{}{"EXAMPLE_KEY_fpIeh": "EXAMPLE--Value"}},
		SystemTags:                     map[string]map[string]interface{}{"EXAMPLE_KEY_GExRT": map[string]interface{}{"EXAMPLE_KEY_vmGFJ": "EXAMPLE--Value"}},
		CompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		MasterNodeCount:                common.Int(705),
		CertificateConfig: &opensearch.CertificateConfig{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"),
			ClusterCertificateMode:           opensearch.CertificateModeOpensearchService},
		DataNodeHostShape:              common.String("EXAMPLE-dataNodeHostShape-Value"),
		MasterNodeHostShape:            common.String("EXAMPLE-masterNodeHostShape-Value"),
		OpendashboardNodeHostMemoryGB:  common.Int(5709),
		OpendashboardNodeHostOcpuCount: common.Int(4920),
		SearchNodeStorageGB:            common.Int(79324),
		DataNodeHostType:               opensearch.DataNodeHostTypeBm,
		LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(5095),
			LoadBalancerMinBandwidthInMbps: common.Int(477),
			LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeNetworkLoadBalancer},
		FreeformTags:                 map[string]string{"EXAMPLE_KEY_21BAj": "EXAMPLE_VALUE_MLZUBI8yMcx6zZwMDRvv"},
		MlNodeHostShape:              common.String("EXAMPLE-mlNodeHostShape-Value"),
		CoordinatorNodeHostMemoryGB:  common.Int(30777),
		MaintenanceDetails:           &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		MlNodeHostOcpuCount:          common.Int(3173),
		SearchNodeHostShape:          common.String("EXAMPLE-searchNodeHostShape-Value"),
		CoordinatorNodeHostOcpuCount: common.Int(4710),
		DataNodeHostOcpuCount:        common.Int(3192),
		MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		SearchNodeHostMemoryGB:       common.Int(15497),
		DefinedTags:                  map[string]map[string]interface{}{"EXAMPLE_KEY_P2E5H": map[string]interface{}{"EXAMPLE_KEY_9wYTS": "EXAMPLE--Value"}},
		MasterNodeHostType:           opensearch.MasterNodeHostTypeFlex,
		OpendashboardNodeCount:       common.Int(982),
		SearchNodeHostOcpuCount:      common.Int(4223)},
		OpcRequestId:  common.String("VWS5ZJSHOJ9CCHPT7BOI<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)
}