// 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{SearchNodeCount: common.Int(120),
		SearchNodeHostShape:           common.String("EXAMPLE-searchNodeHostShape-Value"),
		DataNodeHostShape:             common.String("EXAMPLE-dataNodeHostShape-Value"),
		MasterNodeHostType:            opensearch.MasterNodeHostTypeBm,
		OpendashboardNodeHostMemoryGB: common.Int(5114),
		SecurityAttributes:            map[string]map[string]interface{}{"EXAMPLE_KEY_Hf2LV": map[string]interface{}{"EXAMPLE_KEY_24PzF": "EXAMPLE--Value"}},
		SecurityMasterUserName:        common.String("EXAMPLE-securityMasterUserName-Value"),
		SecuritySamlConfig: &opensearch.SecuritySamlConfig{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"),
			AdminBackendRole:   common.String("EXAMPLE-adminBackendRole-Value")},
		SoftwareVersion:                common.String("EXAMPLE-softwareVersion-Value"),
		VcnCompartmentId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		CompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		MasterNodeHostShape:            common.String("EXAMPLE-masterNodeHostShape-Value"),
		MlNodeHostMemoryGB:             common.Int(35145),
		MlNodeHostShape:                common.String("EXAMPLE-mlNodeHostShape-Value"),
		NsgId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
		SearchNodeHostOcpuCount:        common.Int(1767),
		SearchNodeHostType:             opensearch.SearchNodeHostTypeFlex,
		SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		CertificateConfig: &opensearch.CertificateConfig{OpenSearchDashboardCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchDashboardCertificateId-Value"),
			ClusterCertificateMode:     opensearch.CertificateModeOciCertificatesService,
			DashboardCertificateMode:   opensearch.CertificateModeOciCertificatesService,
			OpenSearchApiCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchApiCertificateId-Value")},
		DataNodeCount:                        common.Int(230),
		DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_3GAzX": map[string]interface{}{"EXAMPLE_KEY_U9uza": "EXAMPLE--Value"}},
		MlNodeHostType:                       opensearch.MlNodeHostTypeFlex,
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		SecurityMode:                         opensearch.SecurityModeDisabled,
		MaintenanceDetails:                   &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		OpendashboardNodeCount:               common.Int(338),
		SubnetCompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		DataNodeHostMemoryGB:                 common.Int(5421),
		DataNodeHostType:                     opensearch.DataNodeHostTypeFlex,
		InboundClusterIds:                    []string{"EXAMPLE--Value"},
		MasterNodeHostOcpuCount:              common.Int(3129),
		SearchNodeHostMemoryGB:               common.Int(59839),
		SearchNodeStorageGB:                  common.Int(85929),
		BackupPolicy: &opensearch.BackupPolicy{IsEnabled: common.Bool(false),
			RetentionInDays:  common.Int(254),
			FrequencyInHours: common.Int(424)},
		DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		DataNodeHostOcpuCount:      common.Int(3750),
		DataNodeStorageGB:          common.Int(78497),
		LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(1283),
			LoadBalancerMinBandwidthInMbps: common.Int(5679),
			LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeNetworkLoadBalancer},
		MlNodeCount:     common.Int(761),
		MlNodeStorageGB: common.Int(72960),
		SubnetId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		FreeformTags:    map[string]string{"EXAMPLE_KEY_41tE1": "EXAMPLE_VALUE_4aFjSp4JLZ26fKWazySs"},
		MasterNodeCount: common.Int(461),
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(true),
			OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(true),
				Mode:              opensearch.CccModeSearchAndReplication,
				PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}}},
		SystemTags:                     map[string]map[string]interface{}{"EXAMPLE_KEY_BoU2E": map[string]interface{}{"EXAMPLE_KEY_5z9b7": "EXAMPLE--Value"}},
		VcnId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		DisplayName:                    common.String("EXAMPLE-displayName-Value"),
		MasterNodeHostBareMetalShape:   common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		MasterNodeHostMemoryGB:         common.Int(51042),
		MlNodeHostOcpuCount:            common.Int(4696),
		OpendashboardNodeHostOcpuCount: common.Int(7030),
		OpendashboardNodeHostShape:     common.String("EXAMPLE-opendashboardNodeHostShape-Value")},
		OpcRequestId:  common.String("1A700CUPI61UYEEQ6BI9<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)
}