// 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{DataNodeHostOcpuCount: common.Int(2164),
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
DataNodeHostType: opensearch.DataNodeHostTypeFlex,
InboundClusterIds: []string{"EXAMPLE--Value"},
MlNodeHostOcpuCount: common.Int(7324),
OpendashboardNodeHostMemoryGB: common.Int(3481),
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
DataNodeHostMemoryGB: common.Int(43435),
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
MasterNodeHostType: opensearch.MasterNodeHostTypeBm,
MlNodeHostMemoryGB: common.Int(41180),
NsgId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
SearchNodeCount: common.Int(61),
SearchNodeHostOcpuCount: common.Int(6157),
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
MlNodeCount: common.Int(64),
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(false),
Mode: opensearch.CccModeReplicationOnly,
PingSchedule: common.String("EXAMPLE-pingSchedule-Value")}}},
SearchNodeHostMemoryGB: common.Int(66109),
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_u6O9j": map[string]interface{}{"EXAMPLE_KEY_MOYFR": "EXAMPLE--Value"}},
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(501),
IsEnabled: common.Bool(true),
RetentionInDays: common.Int(453)},
DataNodeCount: common.Int(321),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_N7jr4": map[string]interface{}{"EXAMPLE_KEY_ul17u": "EXAMPLE--Value"}},
MlNodeHostType: opensearch.MlNodeHostTypeFlex,
OpendashboardNodeCount: common.Int(448),
OpendashboardNodeHostOcpuCount: common.Int(4598),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_qgAcQ": map[string]interface{}{"EXAMPLE_KEY_K5RHL": "EXAMPLE--Value"}},
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
DataNodeStorageGB: common.Int(92982),
DisplayName: common.String("EXAMPLE-displayName-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_7gjaA": "EXAMPLE_VALUE_cu9NAfs8OoxO962fI98A"},
LoadBalancerConfig: &opensearch.LoadBalancerConfig{LoadBalancerMaxBandwidthInMbps: common.Int(2418),
LoadBalancerMinBandwidthInMbps: common.Int(6827),
LoadBalancerServiceType: opensearch.LoadBalancerConfigLoadBalancerServiceTypeNetworkLoadBalancer},
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
MasterNodeHostMemoryGB: common.Int(35219),
MasterNodeHostOcpuCount: common.Int(9375),
MlNodeStorageGB: common.Int(98348),
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
SecuritySamlConfig: &opensearch.SecuritySamlConfig{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"),
IdpEntityId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-idpEntityId-Value")},
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
CertificateConfig: &opensearch.CertificateConfig{ClusterCertificateMode: opensearch.CertificateModeOciCertificatesService,
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")},
MasterNodeCount: common.Int(502),
MlNodeHostShape: common.String("EXAMPLE-mlNodeHostShape-Value"),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
SearchNodeStorageGB: common.Int(46117),
SecurityMode: opensearch.SecurityModeEnforcing,
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
OpcRequestId: common.String("TQCMF9XQDKLY5V72UJBE<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)
}