// 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).

import * as opensearch from "oci-opensearch";
import common = require("oci-common");

// 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.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new opensearch.OpensearchClusterClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  createOpensearchClusterDetails = {
		displayName: "EXAMPLE-displayName-Value",
		compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
		softwareVersion: "EXAMPLE-softwareVersion-Value",
		masterNodeCount: 845,
		masterNodeHostType: opensearch.models.MasterNodeHostType.Flex,
		masterNodeHostBareMetalShape: "EXAMPLE-masterNodeHostBareMetalShape-Value",
		masterNodeHostShape: "EXAMPLE-masterNodeHostShape-Value",
		masterNodeHostOcpuCount: 894,
		masterNodeHostMemoryGB: 45549,
		dataNodeCount: 75,
		dataNodeHostType: opensearch.models.DataNodeHostType.Flex,
		dataNodeHostBareMetalShape: "EXAMPLE-dataNodeHostBareMetalShape-Value",
		dataNodeHostShape: "EXAMPLE-dataNodeHostShape-Value",
		dataNodeHostOcpuCount: 5519,
		dataNodeHostMemoryGB: 69443,
		dataNodeStorageGB: 8644,
		opendashboardNodeHostShape: "EXAMPLE-opendashboardNodeHostShape-Value",
		opendashboardNodeCount: 185,
		opendashboardNodeHostOcpuCount: 7759,
		opendashboardNodeHostMemoryGB: 7243,
		searchNodeCount: 871,
		searchNodeHostType: opensearch.models.SearchNodeHostType.Flex,
		searchNodeHostShape: "EXAMPLE-searchNodeHostShape-Value",
		searchNodeHostOcpuCount: 7269,
		searchNodeHostMemoryGB: 31123,
		searchNodeStorageGB: 47505,
		vcnId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value",
		subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
		vcnCompartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vcnCompartmentId-Value",
		subnetCompartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetCompartmentId-Value",
		securityMode: opensearch.models.SecurityMode.Permissive,
		securityMasterUserName: "EXAMPLE-securityMasterUserName-Value",
		securityMasterUserPasswordHash: "EXAMPLE-securityMasterUserPasswordHash-Value",
		securitySamlConfig: {
			isEnabled: true,
			idpMetadataContent: "EXAMPLE-idpMetadataContent-Value",
			idpEntityId: "ocid1.test.oc1..<unique_ID>EXAMPLE-idpEntityId-Value",
			opendashboardUrl: "EXAMPLE-opendashboardUrl-Value",
			adminBackendRole: "EXAMPLE-adminBackendRole-Value",
			subjectKey: "EXAMPLE-subjectKey-Value",
			rolesKey: "EXAMPLE-rolesKey-Value",

			}
,
		backupPolicy: {
			isEnabled: true,
			retentionInDays: 121,
			frequencyInHours: 941,

			}
,
		nsgId: "ocid1.test.oc1..<unique_ID>EXAMPLE-nsgId-Value",
		reverseConnectionEndpointCustomerIps: ["EXAMPLE--Value"				],
		inboundClusterIds: ["EXAMPLE--Value"				],
		outboundClusterConfig: {
			isEnabled: false,
			outboundClusters: [{
					displayName: "EXAMPLE-displayName-Value",
					pingSchedule: "EXAMPLE-pingSchedule-Value",
					isSkipUnavailable: false,
					seedClusterId: "ocid1.test.oc1..<unique_ID>EXAMPLE-seedClusterId-Value",
					mode: opensearch.models.CccMode.ReplicationOnly,

					}
					],

			}
,
		maintenanceDetails: {
			notificationEmailIds: ["EXAMPLE--Value"					],

			}
,
		certificateConfig: {
			clusterCertificateMode: opensearch.models.CertificateMode.OciCertificatesService,
			dashboardCertificateMode: opensearch.models.CertificateMode.OpensearchService,
			openSearchApiCertificateId: "ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchApiCertificateId-Value",
			openSearchDashboardCertificateId: "ocid1.test.oc1..<unique_ID>EXAMPLE-openSearchDashboardCertificateId-Value",

			}
,
		freeformTags: {
			EXAMPLE_KEY_1WXM2 :"EXAMPLE_VALUE_u3f23LyyADdWUSCBcbgc"
			},
		definedTags: {
			EXAMPLE_KEY_03wvs :{
				EXAMPLE_KEY_T58Hi :"EXAMPLE--Value"
				}
			},
		systemTags: {
			EXAMPLE_KEY_ZAK40 :{
				EXAMPLE_KEY_PX92m :"EXAMPLE--Value"
				}
			},
		securityAttributes: {
			EXAMPLE_KEY_05EUn :{
				EXAMPLE_KEY_IVNeH :"EXAMPLE--Value"
				}
			},

		}

	const createOpensearchClusterRequest: opensearch.requests.CreateOpensearchClusterRequest = { 
	createOpensearchClusterDetails: createOpensearchClusterDetails,
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	opcRequestId: "KERLKCTSPVXW71ZOHHQ4<unique_ID>",

		}; 


     // Send request to the Client.
     const createOpensearchClusterResponse = await client.createOpensearchCluster(createOpensearchClusterRequest);
     }
     catch (error) {
         console.log("createOpensearchCluster Failed with error  " + error);
     }
})();