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