// 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{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(120),
		DataNodeHostType:                     opensearch.DataNodeHostTypeBm,
		MasterNodeHostShape:                  common.String("EXAMPLE-masterNodeHostShape-Value"),
		NsgId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
		ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
		SearchNodeHostType:                   opensearch.SearchNodeHostTypeFlex,
		SystemTags:                           map[string]map[string]interface{}{"EXAMPLE_KEY_j3e3c": map[string]interface{}{"EXAMPLE_KEY_v5wq5": "EXAMPLE--Value"}},
		DataNodeHostBareMetalShape:           common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
		DataNodeHostShape:                    common.String("EXAMPLE-dataNodeHostShape-Value"),
		LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerServiceType: opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer,
			LoadBalancerMaxBandwidthInMbps: common.Int(2343),
			LoadBalancerMinBandwidthInMbps: common.Int(4848)},
		MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
		OpendashboardNodeCount:       common.Int(61),
		BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(658),
			IsEnabled:       common.Bool(false),
			RetentionInDays: common.Int(68)},
		CompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		DataNodeHostMemoryGB:           common.Int(8001),
		MaintenanceDetails:             &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
		OpendashboardNodeHostOcpuCount: common.Int(9713),
		SearchNodeCount:                common.Int(647),
		SecurityAttributes:             map[string]map[string]interface{}{"EXAMPLE_KEY_WEisY": map[string]interface{}{"EXAMPLE_KEY_u6lV5": "EXAMPLE--Value"}},
		VcnCompartmentId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
		OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
			OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(true),
				Mode:              opensearch.CccModeReplicationOnly,
				PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}}},
		FreeformTags:                   map[string]string{"EXAMPLE_KEY_QEor2": "EXAMPLE_VALUE_a5Nn2rdhTtJnDhXJazmi"},
		MasterNodeCount:                common.Int(527),
		MasterNodeHostMemoryGB:         common.Int(41191),
		MasterNodeHostOcpuCount:        common.Int(2445),
		OpendashboardNodeHostShape:     common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
		SecurityMasterUserName:         common.String("EXAMPLE-securityMasterUserName-Value"),
		SubnetId:                       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
		DisplayName:                    common.String("EXAMPLE-displayName-Value"),
		SearchNodeHostShape:            common.String("EXAMPLE-searchNodeHostShape-Value"),
		SubnetCompartmentId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
		InboundClusterIds:              []string{"EXAMPLE--Value"},
		SearchNodeHostOcpuCount:        common.Int(5418),
		SearchNodeStorageGB:            common.Int(31979),
		SecurityMode:                   opensearch.SecurityModeDisabled,
		VcnId:                          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
		DataNodeHostOcpuCount:          common.Int(9167),
		MasterNodeHostType:             opensearch.MasterNodeHostTypeFlex,
		SearchNodeHostMemoryGB:         common.Int(81022),
		DataNodeStorageGB:              common.Int(35186),
		DefinedTags:                    map[string]map[string]interface{}{"EXAMPLE_KEY_Jsjdk": map[string]interface{}{"EXAMPLE_KEY_PLOAZ": "EXAMPLE--Value"}},
		OpendashboardNodeHostMemoryGB:  common.Int(1036),
		SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
		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")},
		SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value")},
		OpcRequestId:  common.String("MKYUEOFMPFAA4KIOCVQ6<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)
}