// 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{OpcRequestId: common.String("YGTN98W0WKNWEBHNIQ26<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateOpensearchClusterDetails: opensearch.CreateOpensearchClusterDetails{MasterNodeHostType: opensearch.MasterNodeHostTypeBm,
NsgId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
SearchNodeCount: common.Int(152),
SearchNodeHostOcpuCount: common.Int(715),
SecurityMode: opensearch.SecurityModePermissive,
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
MasterNodeHostMemoryGB: common.Int(20912),
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
OpendashboardNodeHostMemoryGB: common.Int(6520),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
SearchNodeStorageGB: common.Int(22228),
SecuritySamlConfig: &opensearch.SecuritySamlConfig{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(false),
OpendashboardUrl: common.String("EXAMPLE-opendashboardUrl-Value"),
RolesKey: common.String("EXAMPLE-rolesKey-Value"),
SubjectKey: common.String("EXAMPLE-subjectKey-Value")},
CertificateConfig: &opensearch.CertificateConfig{ClusterCertificateMode: opensearch.CertificateModeOciCertificatesService,
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")},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DataNodeStorageGB: common.Int(12786),
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
MasterNodeHostOcpuCount: common.Int(1788),
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_lny1a": map[string]interface{}{"EXAMPLE_KEY_7mFgi": "EXAMPLE--Value"}},
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(565),
IsEnabled: common.Bool(false),
RetentionInDays: common.Int(876)},
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
SearchNodeHostMemoryGB: common.Int(61887),
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
DataNodeCount: common.Int(911),
DataNodeHostType: opensearch.DataNodeHostTypeFlex,
FreeformTags: map[string]string{"EXAMPLE_KEY_zovwe": "EXAMPLE_VALUE_pOPaFHQxC855TID3UTJH"},
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_wzdXp": map[string]interface{}{"EXAMPLE_KEY_ujeJK": "EXAMPLE--Value"}},
MasterNodeCount: common.Int(791),
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
OpendashboardNodeCount: common.Int(997),
OpendashboardNodeHostOcpuCount: common.Int(9596),
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
DataNodeHostMemoryGB: common.Int(80425),
DataNodeHostOcpuCount: common.Int(8311),
InboundClusterIds: []string{"EXAMPLE--Value"},
OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
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.CccModeSearchOnly,
PingSchedule: common.String("EXAMPLE-pingSchedule-Value")}}},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_DyEgS": map[string]interface{}{"EXAMPLE_KEY_kMRvq": "EXAMPLE--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)
}