// 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{DisplayName: common.String("EXAMPLE-displayName-Value"),
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
DataNodeHostOcpuCount: common.Int(2383),
OpendashboardNodeCount: common.Int(111),
SecurityMode: opensearch.SecurityModePermissive,
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(130),
IsEnabled: common.Bool(true),
RetentionInDays: common.Int(920)},
SearchNodeHostMemoryGB: common.Int(23145),
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
SearchNodeCount: common.Int(438),
InboundClusterIds: []string{"EXAMPLE--Value"},
MasterNodeCount: common.Int(927),
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
MasterNodeHostType: opensearch.MasterNodeHostTypeBm,
OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
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")}}},
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")},
DataNodeCount: common.Int(204),
MasterNodeHostMemoryGB: common.Int(81314),
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_2xXzI": map[string]interface{}{"EXAMPLE_KEY_MxSWO": "EXAMPLE--Value"}},
DataNodeStorageGB: common.Int(98799),
FreeformTags: map[string]string{"EXAMPLE_KEY_j0wbc": "EXAMPLE_VALUE_1jcHNTqHyuJsJm2d0gnr"},
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_EKQV0": map[string]interface{}{"EXAMPLE_KEY_SemDe": "EXAMPLE--Value"}},
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
DataNodeHostType: opensearch.DataNodeHostTypeFlex,
MasterNodeHostOcpuCount: common.Int(2090),
OpendashboardNodeHostMemoryGB: common.Int(9513),
SearchNodeHostOcpuCount: common.Int(3911),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
DataNodeHostMemoryGB: common.Int(97634),
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
OpendashboardNodeHostOcpuCount: common.Int(6158),
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
SearchNodeStorageGB: common.Int(40942),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
OpcRequestId: common.String("WGZJZCVIXFPIMYQSS70V<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)
}