// 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{DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
SearchNodeStorageGB: common.Int(56649),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
SearchNodeCount: common.Int(139),
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
DataNodeCount: common.Int(145),
DataNodeHostMemoryGB: common.Int(38121),
MasterNodeHostMemoryGB: common.Int(4033),
OpendashboardNodeCount: common.Int(505),
SecuritySamlConfig: &opensearch.SecuritySamlConfig{OpendashboardUrl: common.String("EXAMPLE-opendashboardUrl-Value"),
RolesKey: common.String("EXAMPLE-rolesKey-Value"),
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)},
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(211),
IsEnabled: common.Bool(false),
RetentionInDays: common.Int(868)},
InboundClusterIds: []string{"EXAMPLE--Value"},
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
MasterNodeHostType: opensearch.MasterNodeHostTypeBm,
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_sKZnD": map[string]interface{}{"EXAMPLE_KEY_8RcfO": "EXAMPLE--Value"}},
OpendashboardNodeHostMemoryGB: common.Int(7771),
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_b0Kox": map[string]interface{}{"EXAMPLE_KEY_USUcG": "EXAMPLE--Value"}},
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DataNodeHostOcpuCount: common.Int(5550),
DisplayName: common.String("EXAMPLE-displayName-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_yUpm7": "EXAMPLE_VALUE_Q6IQvJDcp61QqBargqn7"},
OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(true),
OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{SeedClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
IsSkipUnavailable: common.Bool(true),
Mode: opensearch.CccModeSearchOnly,
PingSchedule: common.String("EXAMPLE-pingSchedule-Value")}}},
SearchNodeHostMemoryGB: common.Int(46612),
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
MasterNodeCount: common.Int(905),
MasterNodeHostOcpuCount: common.Int(5915),
SearchNodeHostOcpuCount: common.Int(586),
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
SecurityMode: opensearch.SecurityModeDisabled,
DataNodeHostType: opensearch.DataNodeHostTypeBm,
DataNodeStorageGB: common.Int(26592),
OpendashboardNodeHostOcpuCount: common.Int(3032),
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value")},
OpcRequestId: common.String("UWPPEVLOKLFOGWTZUMWC<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)
}