// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.CloudbridgeService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Cloudbridge
{
public class CreateAssetExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createAssetDetails = new Oci.CloudbridgeService.Models.CreateVmwareVmAssetDetails
{
Compute = new Oci.CloudbridgeService.Models.ComputeProperties
{
PrimaryIp = "EXAMPLE-primaryIp-Value",
DnsName = "EXAMPLE-dnsName-Value",
Description = "EXAMPLE-description-Value",
CoresCount = 580,
CpuModel = "EXAMPLE-cpuModel-Value",
GpuDevicesCount = 833,
GpuDevices = new List<Oci.CloudbridgeService.Models.GpuDevice>
{
new Oci.CloudbridgeService.Models.GpuDevice
{
Name = "EXAMPLE-name-Value",
Description = "EXAMPLE-description-Value",
CoresCount = 869,
MemoryInMBs = 375,
Manufacturer = "EXAMPLE-manufacturer-Value"
}
},
ThreadsPerCoreCount = 361,
MemoryInMBs = 866,
IsPmemEnabled = true,
PmemInMBs = 486,
OperatingSystem = "EXAMPLE-operatingSystem-Value",
OperatingSystemVersion = "EXAMPLE-operatingSystemVersion-Value",
HostName = "EXAMPLE-hostName-Value",
PowerState = "EXAMPLE-powerState-Value",
GuestState = "EXAMPLE-guestState-Value",
IsTpmEnabled = true,
ConnectedNetworks = 181,
NicsCount = 957,
Nics = new List<Oci.CloudbridgeService.Models.Nic>
{
new Oci.CloudbridgeService.Models.Nic
{
Label = "EXAMPLE-label-Value",
SwitchName = "EXAMPLE-switchName-Value",
MacAddress = "EXAMPLE-macAddress-Value",
MacAddressType = "EXAMPLE-macAddressType-Value",
NetworkName = "EXAMPLE-networkName-Value",
IpAddresses = new List<string>
{
"EXAMPLE--Value"
}
}
},
StorageProvisionedInMBs = 160,
DisksCount = 375,
Disks = new List<Oci.CloudbridgeService.Models.Disk>
{
new Oci.CloudbridgeService.Models.Disk
{
Name = "EXAMPLE-name-Value",
BootOrder = 403,
Uuid = "EXAMPLE-uuid-Value",
UuidLun = "EXAMPLE-uuidLun-Value",
SizeInMBs = 901,
Location = "EXAMPLE-location-Value",
PersistentMode = "EXAMPLE-persistentMode-Value",
IsCbtEnabled = true
}
},
Firmware = "EXAMPLE-firmware-Value",
LatencySensitivity = "EXAMPLE-latencySensitivity-Value",
Nvdimms = new List<Oci.CloudbridgeService.Models.Nvdimm>
{
new Oci.CloudbridgeService.Models.Nvdimm
{
Label = "EXAMPLE-label-Value",
UnitNumber = 743,
ControllerKey = 314
}
},
NvdimmController = new Oci.CloudbridgeService.Models.NvdimmController
{
Label = "EXAMPLE-label-Value",
BusNumber = 239
},
ScsiController = new Oci.CloudbridgeService.Models.ScsiController
{
Label = "EXAMPLE-label-Value",
UnitNumber = 489,
SharedBus = "EXAMPLE-sharedBus-Value"
},
HardwareVersion = "EXAMPLE-hardwareVersion-Value"
},
Vm = new Oci.CloudbridgeService.Models.VmProperties
{
HypervisorVendor = "EXAMPLE-hypervisorVendor-Value",
HypervisorVersion = "EXAMPLE-hypervisorVersion-Value",
HypervisorHost = "EXAMPLE-hypervisorHost-Value"
},
VmwareVm = new Oci.CloudbridgeService.Models.VmwareVmProperties
{
Cluster = "EXAMPLE-cluster-Value",
CustomerFields = new List<string>
{
"EXAMPLE--Value"
},
CustomerTags = new List<Oci.CloudbridgeService.Models.CustomerTag>
{
new Oci.CloudbridgeService.Models.CustomerTag
{
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 = 114,
FaultToleranceSecondaryLatency = 630
},
VmwareVCenter = new Oci.CloudbridgeService.Models.VmwareVCenterProperties
{
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 = new List<string>
{
"EXAMPLE--Value"
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_u8lQ9",
"EXAMPLE_VALUE_bXmEs3ix6nvDGqFiIEBr"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_d6ESm",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_BjfVI",
"EXAMPLE--Value"
}
}
}
}
};
var createAssetRequest = new Oci.CloudbridgeService.Requests.CreateAssetRequest
{
CreateAssetDetails = createAssetDetails,
OpcRequestId = "NRKU9YTNIDSRI2PA8UP5<unique_ID>",
OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
};
// 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.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new InventoryClient(provider, new ClientConfiguration()))
{
var response = await client.CreateAsset(createAssetRequest);
// Retrieve value from the response.
var id = response.Asset.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateAsset Failed with {e.Message}");
throw e;
}
}
}
}