// 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: 800,
cpuModel: "EXAMPLE-cpuModel-Value",
gpuDevicesCount: 357,
gpuDevices: [
{
name: "EXAMPLE-name-Value",
description: "EXAMPLE-description-Value",
coresCount: 32,
memoryInMBs: 263,
manufacturer: "EXAMPLE-manufacturer-Value"
}
],
threadsPerCoreCount: 409,
memoryInMBs: 814,
isPmemEnabled: false,
pmemInMBs: 793,
operatingSystem: "EXAMPLE-operatingSystem-Value",
operatingSystemVersion: "EXAMPLE-operatingSystemVersion-Value",
hostName: "EXAMPLE-hostName-Value",
powerState: "EXAMPLE-powerState-Value",
guestState: "EXAMPLE-guestState-Value",
isTpmEnabled: true,
connectedNetworks: 46,
nicsCount: 206,
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: 6,
disksCount: 986,
disks: [
{
name: "EXAMPLE-name-Value",
bootOrder: 232,
uuid: "EXAMPLE-uuid-Value",
uuidLun: "EXAMPLE-uuidLun-Value",
sizeInMBs: 202,
location: "EXAMPLE-location-Value",
persistentMode: "EXAMPLE-persistentMode-Value"
}
],
firmware: "EXAMPLE-firmware-Value",
latencySensitivity: "EXAMPLE-latencySensitivity-Value",
nvdimms: [
{
label: "EXAMPLE-label-Value",
unitNumber: 703,
controllerKey: 895
}
],
nvdimmController: {
label: "EXAMPLE-label-Value",
busNumber: 857
},
scsiController: {
label: "EXAMPLE-label-Value",
unitNumber: 0,
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: true,
faultToleranceState: "EXAMPLE-faultToleranceState-Value",
faultToleranceBandwidth: 180,
faultToleranceSecondaryLatency: 578
},
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_Ku4pP: "EXAMPLE_VALUE_X6MxrQvUnoERZMrhSn0h"
},
definedTags: {
EXAMPLE_KEY_GtNtx: {
EXAMPLE_KEY_qjkY6: "EXAMPLE--Value"
}
}
};
const createAssetRequest: cloudbridge.requests.CreateAssetRequest = {
createAssetDetails: createAssetDetails,
opcRequestId: "LPUPYYIBZ58LWWOTN7ND<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);
}
})();