// 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{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateOpensearchClusterDetails: opensearch.CreateOpensearchClusterDetails{OpendashboardNodeCount: common.Int(393),
			OpendashboardNodeHostMemoryGB: common.Int(3664),
			DisplayName:                   common.String("EXAMPLE-displayName-Value"),
			BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(577),
				IsEnabled:       common.Bool(false),
				RetentionInDays: common.Int(319)},
			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},
			DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
			DataNodeStorageGB:          common.Int(53248),
			SearchNodeHostType:         opensearch.SearchNodeHostTypeFlex,
			OutboundClusterConfig: &opensearch.OutboundClusterConfig{OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
				IsSkipUnavailable: common.Bool(true),
				Mode:              opensearch.CccModeSearchOnly,
				PingSchedule:      common.String("EXAMPLE-pingSchedule-Value"),
				SeedClusterId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}},
				IsEnabled: common.Bool(false)},
			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(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"),
			SubnetCompartmentId:                  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
			SubnetId:                             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			VcnId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
			DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_PCz4W": map[string]interface{}{"EXAMPLE_KEY_KDU61": "EXAMPLE--Value"}},
			DataNodeHostShape:                    common.String("EXAMPLE-dataNodeHostShape-Value"),
			MasterNodeHostMemoryGB:               common.Int(77378),
			MasterNodeHostOcpuCount:              common.Int(1200),
			MasterNodeHostShape:                  common.String("EXAMPLE-masterNodeHostShape-Value"),
			SearchNodeHostMemoryGB:               common.Int(26789),
			VcnCompartmentId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
			DataNodeHostMemoryGB:                 common.Int(15373),
			InboundClusterIds:                    []string{"EXAMPLE--Value"},
			OpendashboardNodeHostShape:           common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
			SearchNodeCount:                      common.Int(639),
			SearchNodeHostOcpuCount:              common.Int(8199),
			MasterNodeCount:                      common.Int(417),
			NsgId:                                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
			ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
			CompartmentId:                        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DataNodeHostOcpuCount:                common.Int(2538),
			DataNodeHostType:                     opensearch.DataNodeHostTypeBm,
			SearchNodeStorageGB:                  common.Int(43674),
			SecurityAttributes:                   map[string]map[string]interface{}{"EXAMPLE_KEY_3xbm8": map[string]interface{}{"EXAMPLE_KEY_20unU": "EXAMPLE--Value"}},
			MasterNodeHostType:                   opensearch.MasterNodeHostTypeBm,
			SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
			SecurityMode:                         opensearch.SecurityModePermissive,
			SystemTags:                           map[string]map[string]interface{}{"EXAMPLE_KEY_60mw8": map[string]interface{}{"EXAMPLE_KEY_m3OC5": "EXAMPLE--Value"}},
			FreeformTags:                         map[string]string{"EXAMPLE_KEY_4oP8A": "EXAMPLE_VALUE_q36ljB60P6sJJvOy3ze4"},
			OpendashboardNodeHostOcpuCount:       common.Int(7141),
			DataNodeCount:                        common.Int(1),
			MaintenanceDetails:                   &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
			MasterNodeHostBareMetalShape:         common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
			SearchNodeHostShape:                  common.String("EXAMPLE-searchNodeHostShape-Value")},
		OpcRequestId: common.String("COWD4JNCSSY6GWKX8UFF<unique_ID>")}

	// 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)
}