// 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.New,
description: "EXAMPLE-description-Value",
freeformTags: {
EXAMPLE_KEY_ynWpH :"EXAMPLE_VALUE_ESSn41dJQGg2gBRoS07F"
},
definedTags: {
EXAMPLE_KEY_VKGAp :{
EXAMPLE_KEY_l7HJK :"EXAMPLE--Value"
}
},
lifecycleDetails: "EXAMPLE-lifecycleDetails-Value",
availabilityDomain: "EXAMPLE-availabilityDomain-Value",
dateExpectedCapacityHandover: new Date("Mon Feb 24 14:40:15 UTC 2042"),
requestState: capacitymanagement.models.CreateOccCapacityRequestDetails.RequestState.Created,
details: [{
resourceType: "EXAMPLE-resourceType-Value",
workloadType: "EXAMPLE-workloadType-Value",
sourceWorkloadType: "EXAMPLE-sourceWorkloadType-Value",
expectedHandoverQuantity: 401,
dateExpectedHandover: new Date("Sun Dec 05 11:29:32 UTC 2004"),
actualHandoverQuantity: 980,
dateActualHandover: new Date("Wed Mar 04 05:28:43 UTC 2048"),
availabilityDomain: "EXAMPLE-availabilityDomain-Value",
associatedOccHandoverResourceBlockList: [{
occHandoverResourceBlockId: "ocid1.test.oc1..<unique_ID>EXAMPLE-occHandoverResourceBlockId-Value",
handoverQuantity: 867,
}
],
resourceName: "EXAMPLE-resourceName-Value",
demandQuantity: 987,
}
],
}
const createOccCapacityRequestRequest: capacitymanagement.requests.CreateOccCapacityRequestRequest = {
createOccCapacityRequestDetails: createOccCapacityRequestDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "CAIIE22JG3YSN58VXZWK<unique_ID>",
};
// Send request to the Client.
const createOccCapacityRequestResponse = await client.createOccCapacityRequest(createOccCapacityRequestRequest);
}
catch (error) {
console.log("createOccCapacityRequest Failed with error " + error);
}
})();