// 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(19627),
		DataNodeHostShape:            common.String("EXAMPLE-dataNodeHostShape-Value"),
		MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		OpendashboardNodeHostShape:   common.String("EXAMPLE-opendashboardNodeHostShape-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")}}},
		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.CertificateModeOpensearchService,
			DashboardCertificateMode:         opensearch.CertificateModeOciCertificatesService},
		LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(5674),
			LoadBalancerMinBandwidthInMbps: common.Int(2178),
			LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer},
		MlNodeCount:                          common.Int(114),
		MlNodeHostMemoryGB:                   common.Int(32022),
		NsgId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
		OpendashboardNodeCount:               common.Int(241),
		OpendashboardNodeHostOcpuCount:       common.Int(5162),
		SearchNodeHostOcpuCount:              common.Int(241),
		DataNodeStorageGB:                    common.Int(30624),
		DataNodeHostBareMetalShape:           common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		MasterNodeCount:                      common.Int(169),
		SearchNodeHostMemoryGB:               common.Int(28538),
		SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
		SoftwareVersion:                      common.String("EXAMPLE-softwareVersion-Value"),
		SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		MasterNodeHostOcpuCount:              common.Int(3694),
		MlNodeHostOcpuCount:                  common.Int(9041),
		MlNodeHostType:                       opensearch.MlNodeHostTypeFlex,
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		SecurityMasterUserPasswordHash:       common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		SecuritySamlConfig: &opensearch.SecuritySamlConfig{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"),
			AdminBackendRole:   common.String("EXAMPLE-adminBackendRole-Value")},
		VcnId:                         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		DataNodeCount:                 common.Int(46),
		DataNodeHostType:              opensearch.DataNodeHostTypeFlex,
		MlNodeHostShape:               common.String("EXAMPLE-mlNodeHostShape-Value"),
		SubnetCompartmentId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		MlNodeStorageGB:               common.Int(28421),
		OpendashboardNodeHostMemoryGB: common.Int(6829),
		SearchNodeCount:               common.Int(811),
		SearchNodeStorageGB:           common.Int(79059),
		SecurityAttributes:            map[string]map[string]interface{}{"EXAMPLE_KEY_N7jr4": map[string]interface{}{"EXAMPLE_KEY_ul17u": "EXAMPLE--Value"}},
		SecurityMode:                  opensearch.SecurityModePermissive,
		VcnCompartmentId:              common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		InboundClusterIds:             []string{"EXAMPLE--Value"},
		DataNodeHostOcpuCount:         common.Int(1637),
		MasterNodeHostMemoryGB:        common.Int(24666),
		MasterNodeHostShape:           common.String("EXAMPLE-masterNodeHostShape-Value"),
		MasterNodeHostType:            opensearch.MasterNodeHostTypeBm,
		DefinedTags:                   map[string]map[string]interface{}{"EXAMPLE_KEY_fs8Oo": map[string]interface{}{"EXAMPLE_KEY_cu9NA": "EXAMPLE--Value"}},
		FreeformTags:                  map[string]string{"EXAMPLE_KEY_97PEK": "EXAMPLE_VALUE_uwRhXgkLfiYvWgj7gjaA"},
		MaintenanceDetails:            &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		SearchNodeHostShape:           common.String("EXAMPLE-searchNodeHostShape-Value"),
		SearchNodeHostType:            opensearch.SearchNodeHostTypeFlex,
		SystemTags:                    map[string]map[string]interface{}{"EXAMPLE_KEY_fI98A": map[string]interface{}{"EXAMPLE_KEY_xO962": "EXAMPLE--Value"}},
		DisplayName:                   common.String("EXAMPLE-displayName-Value"),
		BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(795),
			IsEnabled:       common.Bool(false),
			RetentionInDays: common.Int(472)},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
		OpcRequestId:  common.String("MOYFRU6O9JK5RHLQGACQ<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)
}