// 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{CoordinatorNodeCount: common.Int(833),
			DataNodeHostType:            opensearch.DataNodeHostTypeBm,
			MasterNodeHostOcpuCount:     common.Int(4712),
			SecurityMode:                opensearch.SecurityModePermissive,
			CoordinatorNodeHostMemoryGB: common.Int(41805),
			InboundClusterIds:           []string{"EXAMPLE--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(true),
				OpendashboardUrl:   common.String("EXAMPLE-opendashboardUrl-Value"),
				RolesKey:           common.String("EXAMPLE-rolesKey-Value")},
			MlNodeHostOcpuCount:            common.Int(9380),
			SearchNodeHostType:             opensearch.SearchNodeHostTypeFlex,
			OpendashboardNodeHostOcpuCount: common.Int(4084),
			DataNodeHostShape:              common.String("EXAMPLE-dataNodeHostShape-Value"),
			MasterNodeHostShape:            common.String("EXAMPLE-masterNodeHostShape-Value"),
			SearchNodeStorageGB:            common.Int(26703),
			BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(838),
				IsEnabled:       common.Bool(false),
				RetentionInDays: common.Int(576)},
			OpendashboardNodeHostShape:           common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
			SearchNodeCount:                      common.Int(748),
			OpendashboardNodeCount:               common.Int(496),
			ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
			SecurityAttributes:                   map[string]map[string]interface{}{"EXAMPLE_KEY_iLR12": map[string]interface{}{"EXAMPLE_KEY_Ogc53": "EXAMPLE--Value"}},
			SecurityMasterUserName:               common.String("EXAMPLE-securityMasterUserName-Value"),
			DataNodeHostMemoryGB:                 common.Int(26813),
			DataNodeHostOcpuCount:                common.Int(7623),
			DefinedTags:                          map[string]map[string]interface{}{"EXAMPLE_KEY_P14Ex": map[string]interface{}{"EXAMPLE_KEY_wuSlO": "EXAMPLE--Value"}},
			MasterNodeHostBareMetalShape:         common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
			SecurityMasterUserPasswordHash:       common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
			SearchNodeHostMemoryGB:               common.Int(50580),
			DisplayName:                          common.String("EXAMPLE-displayName-Value"),
			LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(1363),
				LoadBalancerMinBandwidthInMbps: common.Int(7413),
				LoadBalancerServiceType:        opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer},
			MasterNodeCount: common.Int(604),
			CertificateConfig: &opensearch.CertificateConfig{ClusterCertificateMode: opensearch.CertificateModeOpensearchService,
				DashboardCertificateMode:         opensearch.CertificateModeOciCertificatesService,
				OpenSearchApiCertificateId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchApiCertificateId-Value"),
				OpenSearchDashboardCertificateId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchDashboardCertificateId-Value")},
			MlNodeCount:                  common.Int(291),
			MlNodeStorageGB:              common.Int(43773),
			NsgId:                        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
			SoftwareVersion:              common.String("EXAMPLE-softwareVersion-Value"),
			SystemTags:                   map[string]map[string]interface{}{"EXAMPLE_KEY_2ypRU": map[string]interface{}{"EXAMPLE_KEY_dtZkH": "EXAMPLE--Value"}},
			MasterNodeHostType:           opensearch.MasterNodeHostTypeFlex,
			CoordinatorNodeHostType:      opensearch.CoordinatorNodeHostTypeFlex,
			DataNodeHostBareMetalShape:   common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
			DataNodeStorageGB:            common.Int(73467),
			MaintenanceDetails:           &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
			MasterNodeHostMemoryGB:       common.Int(52647),
			MlNodeHostShape:              common.String("EXAMPLE-mlNodeHostShape-Value"),
			MlNodeHostType:               opensearch.MlNodeHostTypeFlex,
			CompartmentId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			CoordinatorNodeHostOcpuCount: common.Int(4367),
			FreeformTags:                 map[string]string{"EXAMPLE_KEY_OTIG1": "EXAMPLE_VALUE_KoZ8RbTlyRDYzi4WFoWl"},
			SearchNodeHostOcpuCount:      common.Int(8080),
			SearchNodeHostShape:          common.String("EXAMPLE-searchNodeHostShape-Value"),
			VcnCompartmentId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
			SubnetCompartmentId:          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
			SubnetId:                     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			DataNodeCount:                common.Int(104),
			OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(true),
				OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{IsSkipUnavailable: common.Bool(false),
					Mode:          opensearch.CccModeSearchOnly,
					PingSchedule:  common.String("EXAMPLE-pingSchedule-Value"),
					SeedClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value"),
					DisplayName:   common.String("EXAMPLE-displayName-Value")}}},
			VcnId:                         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
			CoordinatorNodeHostShape:      common.String("EXAMPLE-coordinatorNodeHostShape-Value"),
			MlNodeHostMemoryGB:            common.Int(47500),
			OpendashboardNodeHostMemoryGB: common.Int(5407)},
		OpcRequestId: common.String("AMD0JCWHJMCTYQMXN7MX<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)
}