// 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 cloudbridge from "oci-cloudbridge";
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 cloudbridge.InventoryClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const createAssetDetails = {
assetType: "VMWARE_VM", compute: {
primaryIp: "EXAMPLE-primaryIp-Value",
dnsName: "EXAMPLE-dnsName-Value",
description: "EXAMPLE-description-Value",
coresCount: 526,
cpuModel: "EXAMPLE-cpuModel-Value",
gpuDevicesCount: 205,
gpuDevices: [{
name: "EXAMPLE-name-Value",
description: "EXAMPLE-description-Value",
coresCount: 36,
memoryInMBs: 688,
manufacturer: "EXAMPLE-manufacturer-Value",
}
],
threadsPerCoreCount: 355,
memoryInMBs: 461,
isPmemEnabled: true,
pmemInMBs: 817,
operatingSystem: "EXAMPLE-operatingSystem-Value",
operatingSystemVersion: "EXAMPLE-operatingSystemVersion-Value",
hostName: "EXAMPLE-hostName-Value",
powerState: "EXAMPLE-powerState-Value",
guestState: "EXAMPLE-guestState-Value",
isTpmEnabled: true,
connectedNetworks: 522,
nicsCount: 604,
nics: [{
label: "EXAMPLE-label-Value",
switchName: "EXAMPLE-switchName-Value",
macAddress: "EXAMPLE-macAddress-Value",
macAddressType: "EXAMPLE-macAddressType-Value",
networkName: "EXAMPLE-networkName-Value",
ipAddresses: ["EXAMPLE--Value" ],
}
],
storageProvisionedInMBs: 820,
disksCount: 377,
disks: [{
name: "EXAMPLE-name-Value",
bootOrder: 728,
uuid: "EXAMPLE-uuid-Value",
uuidLun: "EXAMPLE-uuidLun-Value",
sizeInMBs: 96,
location: "EXAMPLE-location-Value",
persistentMode: "EXAMPLE-persistentMode-Value",
isCbtEnabled: true,
}
],
firmware: "EXAMPLE-firmware-Value",
latencySensitivity: "EXAMPLE-latencySensitivity-Value",
nvdimms: [{
label: "EXAMPLE-label-Value",
unitNumber: 977,
controllerKey: 863,
}
],
nvdimmController: {
label: "EXAMPLE-label-Value",
busNumber: 371,
}
,
scsiController: {
label: "EXAMPLE-label-Value",
unitNumber: 110,
sharedBus: "EXAMPLE-sharedBus-Value",
}
,
hardwareVersion: "EXAMPLE-hardwareVersion-Value",
}
,
vm: {
hypervisorVendor: "EXAMPLE-hypervisorVendor-Value",
hypervisorVersion: "EXAMPLE-hypervisorVersion-Value",
hypervisorHost: "EXAMPLE-hypervisorHost-Value",
}
,
vmwareVm: {
cluster: "EXAMPLE-cluster-Value",
customerFields: ["EXAMPLE--Value" ],
customerTags: [{
name: "EXAMPLE-name-Value",
description: "EXAMPLE-description-Value",
}
],
instanceUuid: "EXAMPLE-instanceUuid-Value",
path: "EXAMPLE-path-Value",
vmwareToolsStatus: "EXAMPLE-vmwareToolsStatus-Value",
isDisksUuidEnabled: true,
isDisksCbtEnabled: false,
faultToleranceState: "EXAMPLE-faultToleranceState-Value",
faultToleranceBandwidth: 373,
faultToleranceSecondaryLatency: 349,
}
,
vmwareVCenter: {
vcenterKey: "EXAMPLE-vcenterKey-Value",
vcenterVersion: "EXAMPLE-vcenterVersion-Value",
dataCenter: "EXAMPLE-dataCenter-Value",
}
,
displayName: "EXAMPLE-displayName-Value",
inventoryId: "ocid1.test.oc1..<unique_ID>EXAMPLE-inventoryId-Value",
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
sourceKey: "EXAMPLE-sourceKey-Value",
externalAssetKey: "EXAMPLE-externalAssetKey-Value",
assetSourceIds: ["EXAMPLE--Value" ],
freeformTags: {
EXAMPLE_KEY_dArTZ :"EXAMPLE_VALUE_7v23yZKogfopBYLoEjbc"
},
definedTags: {
EXAMPLE_KEY_Ub0LZ :{
EXAMPLE_KEY_MMQwn :"EXAMPLE--Value"
}
}
}
const createAssetRequest: cloudbridge.requests.CreateAssetRequest = {
createAssetDetails: createAssetDetails,
opcRequestId: "HAEUWLVND1QRXCHKK0BQ<unique_ID>",
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
};
// Send request to the Client.
const createAssetResponse = await client.createAsset(createAssetRequest);
}
catch (error) {
console.log("createAsset Failed with error " + error);
}
})();