// 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 ocvp from "oci-ocvp";
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 ocvp.ClusterClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const createClusterDetails = {
      sddcId: "ocid1.test.oc1..<unique_ID>EXAMPLE-sddcId-Value",
      computeAvailabilityDomain: "EXAMPLE-computeAvailabilityDomain-Value",
      displayName: "EXAMPLE-displayName-Value",
      instanceDisplayNamePrefix: "EXAMPLE-instanceDisplayNamePrefix-Value",
      esxiHostsCount: 43,
      networkConfiguration: {
        provisioningSubnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-provisioningSubnetId-Value",
        vsphereVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vsphereVlanId-Value",
        vmotionVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vmotionVlanId-Value",
        vsanVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vsanVlanId-Value",
        nsxVTepVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-nsxVTepVlanId-Value",
        nsxEdgeVTepVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-nsxEdgeVTepVlanId-Value",
        nsxEdgeUplink1VlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-nsxEdgeUplink1VlanId-Value",
        nsxEdgeUplink2VlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-nsxEdgeUplink2VlanId-Value",
        replicationVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-replicationVlanId-Value",
        provisioningVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-provisioningVlanId-Value",
        hcxVlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-hcxVlanId-Value"
      },
      initialCommitment: ocvp.models.Commitment.OneYear,
      workloadNetworkCidr: "EXAMPLE-workloadNetworkCidr-Value",
      initialHostShapeName: "EXAMPLE-initialHostShapeName-Value",
      initialHostOcpuCount: 6097.636,
      isShieldedInstanceEnabled: true,
      capacityReservationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
      datastores: [
        {
          blockVolumeIds: ["EXAMPLE--Value"],
          datastoreType: ocvp.models.DatastoreTypes.Workload
        }
      ],
      vmwareSoftwareVersion: "EXAMPLE-vmwareSoftwareVersion-Value",
      esxiSoftwareVersion: "EXAMPLE-esxiSoftwareVersion-Value",
      freeformTags: {
        EXAMPLE_KEY_Loszh: "EXAMPLE_VALUE_7AlOgrnEreZichdMNEdP"
      },
      definedTags: {
        EXAMPLE_KEY_TmBAC: {
          EXAMPLE_KEY_JHL4r: "EXAMPLE--Value"
        }
      }
    };

    const createClusterRequest: ocvp.requests.CreateClusterRequest = {
      createClusterDetails: createClusterDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "LQ5BFJAXX4PCLRPUKXSW<unique_ID>"
    };

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