// 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: "AWS_EC2", compute: {
primaryIp: "EXAMPLE-primaryIp-Value",
dnsName: "EXAMPLE-dnsName-Value",
description: "EXAMPLE-description-Value",
coresCount: 694,
cpuModel: "EXAMPLE-cpuModel-Value",
gpuDevicesCount: 823,
gpuDevices: [{
name: "EXAMPLE-name-Value",
description: "EXAMPLE-description-Value",
coresCount: 743,
memoryInMBs: 602,
manufacturer: "EXAMPLE-manufacturer-Value",
}
],
threadsPerCoreCount: 374,
memoryInMBs: 846,
isPmemEnabled: true,
pmemInMBs: 75,
operatingSystem: "EXAMPLE-operatingSystem-Value",
operatingSystemVersion: "EXAMPLE-operatingSystemVersion-Value",
hostName: "EXAMPLE-hostName-Value",
powerState: "EXAMPLE-powerState-Value",
guestState: "EXAMPLE-guestState-Value",
isTpmEnabled: false,
connectedNetworks: 981,
nicsCount: 264,
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: 829,
disksCount: 409,
disks: [{
name: "EXAMPLE-name-Value",
bootOrder: 327,
uuid: "EXAMPLE-uuid-Value",
uuidLun: "EXAMPLE-uuidLun-Value",
sizeInMBs: 616,
location: "EXAMPLE-location-Value",
persistentMode: "EXAMPLE-persistentMode-Value",
isCbtEnabled: false,
}
],
firmware: "EXAMPLE-firmware-Value",
latencySensitivity: "EXAMPLE-latencySensitivity-Value",
nvdimms: [{
label: "EXAMPLE-label-Value",
unitNumber: 645,
controllerKey: 644,
}
],
nvdimmController: {
label: "EXAMPLE-label-Value",
busNumber: 517,
}
,
scsiController: {
label: "EXAMPLE-label-Value",
unitNumber: 787,
sharedBus: "EXAMPLE-sharedBus-Value",
}
,
hardwareVersion: "EXAMPLE-hardwareVersion-Value",
}
,
vm: {
hypervisorVendor: "EXAMPLE-hypervisorVendor-Value",
hypervisorVersion: "EXAMPLE-hypervisorVersion-Value",
hypervisorHost: "EXAMPLE-hypervisorHost-Value",
}
,
awsEc2: {
architecture: "EXAMPLE-architecture-Value",
bootMode: "EXAMPLE-bootMode-Value",
capacityReservationKey: "EXAMPLE-capacityReservationKey-Value",
areElasticInferenceAcceleratorsPresent: true,
isEnclaveOptions: false,
isHibernationOptions: true,
imageKey: "EXAMPLE-imageKey-Value",
instanceKey: "EXAMPLE-instanceKey-Value",
instanceLifecycle: "EXAMPLE-instanceLifecycle-Value",
instanceType: "EXAMPLE-instanceType-Value",
ipAddress: "EXAMPLE-ipAddress-Value",
ipv6Address: "EXAMPLE-ipv6Address-Value",
kernelKey: "EXAMPLE-kernelKey-Value",
timeLaunch: new Date("Fri May 31 22:56:46 UTC 2019"),
licenses: ["EXAMPLE--Value" ],
maintenanceOptions: "EXAMPLE-maintenanceOptions-Value",
monitoring: "EXAMPLE-monitoring-Value",
networkInterfaces: [{
association: {
carrierIp: "EXAMPLE-carrierIp-Value",
customerOwnedIp: "EXAMPLE-customerOwnedIp-Value",
ipOwnerKey: "EXAMPLE-ipOwnerKey-Value",
publicDnsName: "EXAMPLE-publicDnsName-Value",
publicIp: "EXAMPLE-publicIp-Value",
}
,
attachment: {
attachmentKey: "EXAMPLE-attachmentKey-Value",
timeAttach: new Date("Sun Mar 17 03:13:20 UTC 2002"),
isDeleteOnTermination: true,
deviceIndex: 339,
networkCardIndex: 148,
status: "EXAMPLE-status-Value",
}
,
description: "EXAMPLE-description-Value",
securityGroups: [{
groupKey: "EXAMPLE-groupKey-Value",
groupName: "EXAMPLE-groupName-Value",
}
],
interfaceType: "EXAMPLE-interfaceType-Value",
ipv4Prefixes: ["EXAMPLE--Value" ],
ipv6Addresses: ["EXAMPLE--Value" ],
ipv6Prefixes: ["EXAMPLE--Value" ],
macAddress: "EXAMPLE-macAddress-Value",
networkInterfaceKey: "EXAMPLE-networkInterfaceKey-Value",
ownerKey: "EXAMPLE-ownerKey-Value",
privateIpAddresses: [{
association: {
carrierIp: "EXAMPLE-carrierIp-Value",
customerOwnedIp: "EXAMPLE-customerOwnedIp-Value",
ipOwnerKey: "EXAMPLE-ipOwnerKey-Value",
publicDnsName: "EXAMPLE-publicDnsName-Value",
publicIp: "EXAMPLE-publicIp-Value",
}
,
isPrimary: false,
privateDnsName: "EXAMPLE-privateDnsName-Value",
privateIpAddress: "EXAMPLE-privateIpAddress-Value",
}
],
isSourceDestCheck: true,
status: "EXAMPLE-status-Value",
subnetKey: "EXAMPLE-subnetKey-Value",
}
],
placement: {
affinity: "EXAMPLE-affinity-Value",
availabilityZone: "EXAMPLE-availabilityZone-Value",
groupName: "EXAMPLE-groupName-Value",
hostKey: "EXAMPLE-hostKey-Value",
hostResourceGroupArn: "EXAMPLE-hostResourceGroupArn-Value",
partitionNumber: 219,
spreadDomain: "EXAMPLE-spreadDomain-Value",
tenancy: "EXAMPLE-tenancy-Value",
}
,
privateDnsName: "EXAMPLE-privateDnsName-Value",
privateIpAddress: "EXAMPLE-privateIpAddress-Value",
rootDeviceName: "EXAMPLE-rootDeviceName-Value",
rootDeviceType: "EXAMPLE-rootDeviceType-Value",
securityGroups: [{
groupKey: "EXAMPLE-groupKey-Value",
groupName: "EXAMPLE-groupName-Value",
}
],
isSourceDestCheck: true,
isSpotInstance: false,
sriovNetSupport: "EXAMPLE-sriovNetSupport-Value",
state: {
code: 486,
name: "EXAMPLE-name-Value",
}
,
subnetKey: "EXAMPLE-subnetKey-Value",
tags: [{
key: "EXAMPLE-key-Value",
value: "EXAMPLE-value-Value",
}
],
tpmSupport: "EXAMPLE-tpmSupport-Value",
virtualizationType: "EXAMPLE-virtualizationType-Value",
vpcKey: "EXAMPLE-vpcKey-Value",
}
,
awsEc2Cost: {
amount: 2546.286,
currencyCode: "EXAMPLE-currencyCode-Value",
}
,
attachedEbsVolumesCost: {
amount: 2625.7734,
currencyCode: "EXAMPLE-currencyCode-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_5Amyg :"EXAMPLE_VALUE_yRBmGjWWYAPaArCHEaoF"
},
definedTags: {
EXAMPLE_KEY_7ofXH :{
EXAMPLE_KEY_XZCUg :"EXAMPLE--Value"
}
}
}
const createAssetRequest: cloudbridge.requests.CreateAssetRequest = {
createAssetDetails: createAssetDetails,
opcRequestId: "ZNGQECHX0ZEPF9JMZVBZ<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);
}
})();