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

    // Create a request and dependent object(s).
    const createOccCapacityRequestDetails = {
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      occAvailabilityCatalogId: "ocid1.test.oc1..<unique_ID>EXAMPLE-occAvailabilityCatalogId-Value",
      namespace: capacitymanagement.models.Namespace.Compute,
      region: "EXAMPLE-region-Value",
      displayName: "EXAMPLE-displayName-Value",
      requestType: capacitymanagement.requests.OccCapacityRequest.RequestType.Transfer,
      description: "EXAMPLE-description-Value",
      freeformTags: {
        EXAMPLE_KEY_IrLMu: "EXAMPLE_VALUE_1lvJbticfptvn7JDOtVB"
      },
      definedTags: {
        EXAMPLE_KEY_PKJJM: {
          EXAMPLE_KEY_bvMeU: "EXAMPLE--Value"
        }
      },
      lifecycleDetails: "EXAMPLE-lifecycleDetails-Value",
      availabilityDomain: "EXAMPLE-availabilityDomain-Value",
      dateExpectedCapacityHandover: new Date("Sun May 23 02:03:50 UTC 2010"),
      requestState: capacitymanagement.models.CreateOccCapacityRequestDetails.RequestState.Created,
      details: [
        {
          resourceType: "EXAMPLE-resourceType-Value",
          workloadType: "EXAMPLE-workloadType-Value",
          sourceWorkloadType: "EXAMPLE-sourceWorkloadType-Value",
          expectedHandoverQuantity: 380,
          dateExpectedHandover: new Date("Thu Dec 28 21:29:02 UTC 2006"),
          actualHandoverQuantity: 567,
          dateActualHandover: new Date("Thu May 30 17:04:37 UTC 2013"),
          resourceName: "EXAMPLE-resourceName-Value",
          demandQuantity: 81
        }
      ]
    };

    const createOccCapacityRequestRequest: capacitymanagement.requests.CreateOccCapacityRequestRequest = {
      createOccCapacityRequestDetails: createOccCapacityRequestDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "BEDXQZEL47PJP1FQBUEL<unique_ID>"
    };

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