// 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("GCANWBLBAPEDQSY0IEK5<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
CreateOpensearchClusterDetails: opensearch.CreateOpensearchClusterDetails{DataNodeStorageGB: common.Int(68711),
SubnetCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value"),
MasterNodeHostShape: common.String("EXAMPLE-masterNodeHostShape-Value"),
MasterNodeHostType: opensearch.MasterNodeHostTypeFlex,
OutboundClusterConfig: &opensearch.OutboundClusterConfig{IsEnabled: common.Bool(false),
OutboundClusters: []opensearch.OutboundClusterSummary{opensearch.OutboundClusterSummary{DisplayName: common.String("EXAMPLE-displayName-Value"),
IsSkipUnavailable: common.Bool(true),
Mode: opensearch.CccModeSearchAndReplication,
PingSchedule: common.String("EXAMPLE-pingSchedule-Value"),
SeedClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value")}}},
ReverseConnectionEndpointCustomerIps: []string{"EXAMPLE--Value"},
SearchNodeHostOcpuCount: common.Int(6586),
SecurityMode: opensearch.SecurityModeEnforcing,
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_cgTOX": map[string]interface{}{"EXAMPLE_KEY_qtsuF": "EXAMPLE--Value"}},
DataNodeHostType: opensearch.DataNodeHostTypeFlex,
OpendashboardNodeHostShape: common.String("EXAMPLE-opendashboardNodeHostShape-Value"),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_Kn2S7": map[string]interface{}{"EXAMPLE_KEY_Bdb6R": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
MasterNodeHostBareMetalShape: common.String("EXAMPLE-masterNodeHostBareMetalShape-Value"),
MasterNodeHostMemoryGB: common.Int(59616),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_ZueV7": map[string]interface{}{"EXAMPLE_KEY_I4Uva": "EXAMPLE--Value"}},
MaintenanceDetails: &opensearch.CreateMaintenanceDetails{NotificationEmailIds: []string{"EXAMPLE--Value"}},
MasterNodeCount: common.Int(831),
SearchNodeHostShape: common.String("EXAMPLE-searchNodeHostShape-Value"),
SecurityMasterUserName: common.String("EXAMPLE-securityMasterUserName-Value"),
SecurityMasterUserPasswordHash: common.String("EXAMPLE-securityMasterUserPasswordHash-Value"),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
DataNodeCount: common.Int(669),
DataNodeHostShape: common.String("EXAMPLE-dataNodeHostShape-Value"),
NsgId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value"),
SearchNodeHostMemoryGB: common.Int(3601),
VcnId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DataNodeHostMemoryGB: common.Int(40072),
MasterNodeHostOcpuCount: common.Int(1508),
OpendashboardNodeHostOcpuCount: common.Int(6574),
SearchNodeHostType: opensearch.SearchNodeHostTypeFlex,
SearchNodeStorageGB: common.Int(84614),
SecuritySamlConfig: &opensearch.SecuritySamlConfig{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),
OpendashboardUrl: common.String("EXAMPLE-opendashboardUrl-Value")},
SoftwareVersion: common.String("EXAMPLE-softwareVersion-Value"),
CertificateConfig: &opensearch.CertificateConfig{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"),
ClusterCertificateMode: opensearch.CertificateModeOciCertificatesService},
FreeformTags: map[string]string{"EXAMPLE_KEY_EgSyG": "EXAMPLE_VALUE_Tn98w0wknWEbhnIq26sE"},
InboundClusterIds: []string{"EXAMPLE--Value"},
OpendashboardNodeCount: common.Int(77),
OpendashboardNodeHostMemoryGB: common.Int(3002),
SearchNodeCount: common.Int(125),
VcnCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value"),
BackupPolicy: &opensearch.BackupPolicy{FrequencyInHours: common.Int(840),
IsEnabled: common.Bool(true),
RetentionInDays: common.Int(529)},
DataNodeHostBareMetalShape: common.String("EXAMPLE-dataNodeHostBareMetalShape-Value"),
DataNodeHostOcpuCount: common.Int(6221)}}
// 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)
}