// 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{CoordinatorNodeHostMemoryGB: common.Int(28090),
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
MlNodeCount: common.Int(406),
OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(true),
OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
IsSkipUnavailable: common.Bool(false),
Mode: opensearch.CccModeReplicationOnly,
PingSchedule: common.String("EXAMPLE-pingSchedule-Value"),
SeedClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}}},
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_enp5A": map[string]interface{}{"EXAMPLE_KEY_RL9iX": "EXAMPLE--Value"}},
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
DataNodeHostMemoryGB: common.Int(79593),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_sFIxV": map[string]interface{}{"EXAMPLE_KEY_hjbAE": "EXAMPLE--Value"}},
MasterNodeHostMemoryGB: common.Int(40325),
MasterNodeHostType: opensearch.MasterNodeHostTypeBm,
MlNodeHostType: opensearch.MlNodeHostTypeFlex,
MlNodeStorageGB: common.Int(94573),
OpendashboardNodeHostOcpuCount: common.Int(6414),
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(356),
IsEnabled: common.Bool(true),
RetentionInDays: common.Int(147)},
CertificateConfig: &opensearch.CertificateConfig{DashboardCertificateMode: opensearch.CertificateModeOpensearchService,
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},
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
DataNodeStorageGB: common.Int(62640),
LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(6603),
LoadBalancerMinBandwidthInMbps: common.Int(7478),
LoadBalancerServiceType: opensearch.LoadBalancerConfigLoadBalancerServiceTypeLoadBalancer},
MlNodeHostMemoryGB: common.Int(74221),
MlNodeHostOcpuCount: common.Int(8707),
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
MlNodeHostShape: common.String("EXAMPLE-mlNodeHostShape-Value"),
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
CoordinatorNodeCount: common.Int(274),
CoordinatorNodeHostOcpuCount: common.Int(950),
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
SecuritySamlConfig: &opensearch.SecuritySamlConfig{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"),
IdpEntityId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-idpEntityId-Value"),
IdpMetadataContent: common.String("EXAMPLE-idpMetadataContent-Value")},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_B5WlB": map[string]interface{}{"EXAMPLE_KEY_Im0TJ": "EXAMPLE--Value"}},
SearchNodeHostMemoryGB: common.Int(5242),
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
DataNodeCount: common.Int(523),
DataNodeHostOcpuCount: common.Int(7967),
MasterNodeHostOcpuCount: common.Int(1428),
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
SearchNodeCount: common.Int(306),
SecurityMode: opensearch.SecurityModePermissive,
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
OpendashboardNodeHostMemoryGB: common.Int(3900),
SearchNodeStorageGB: common.Int(93928),
CoordinatorNodeHostShape: common.String("EXAMPLE-coordinatorNodeHostShape-Value"),
CoordinatorNodeHostType: opensearch.CoordinatorNodeHostTypeFlex,
DataNodeHostType: opensearch.DataNodeHostTypeBm,
NsgId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
OpendashboardNodeCount: common.Int(667),
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_7LqWu": "EXAMPLE_VALUE_JD4fhjdbeQ3lqf96PIoE"},
InboundClusterIds: []string{"EXAMPLE--Value"},
MasterNodeCount: common.Int(589),
SearchNodeHostOcpuCount: common.Int(4295)},
OpcRequestId: common.String("SLYXFJTN1OBWZZ8HHVPH<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)
}