// 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 UpdateAssetExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateAssetDetails = new Oci.CloudbridgeService.Models.UpdateVmwareVmAssetDetails
{
Compute = new Oci.CloudbridgeService.Models.ComputeProperties
{
PrimaryIp = "EXAMPLE-primaryIp-Value",
DnsName = "EXAMPLE-dnsName-Value",
Description = "EXAMPLE-description-Value",
CoresCount = 38,
CpuModel = "EXAMPLE-cpuModel-Value",
GpuDevicesCount = 369,
GpuDevices = new List<Oci.CloudbridgeService.Models.GpuDevice>
{
new Oci.CloudbridgeService.Models.GpuDevice
{
Name = "EXAMPLE-name-Value",
Description = "EXAMPLE-description-Value",
CoresCount = 309,
MemoryInMBs = 967,
Manufacturer = "EXAMPLE-manufacturer-Value"
}
},
ThreadsPerCoreCount = 68,
MemoryInMBs = 158,
IsPmemEnabled = true,
PmemInMBs = 948,
OperatingSystem = "EXAMPLE-operatingSystem-Value",
OperatingSystemVersion = "EXAMPLE-operatingSystemVersion-Value",
HostName = "EXAMPLE-hostName-Value",
PowerState = "EXAMPLE-powerState-Value",
GuestState = "EXAMPLE-guestState-Value",
IsTpmEnabled = true,
ConnectedNetworks = 161,
NicsCount = 635,
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 = 380,
DisksCount = 148,
Disks = new List<Oci.CloudbridgeService.Models.Disk>
{
new Oci.CloudbridgeService.Models.Disk
{
Name = "EXAMPLE-name-Value",
BootOrder = 972,
Uuid = "EXAMPLE-uuid-Value",
UuidLun = "EXAMPLE-uuidLun-Value",
SizeInMBs = 861,
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 = 448,
ControllerKey = 313
}
},
NvdimmController = new Oci.CloudbridgeService.Models.NvdimmController
{
Label = "EXAMPLE-label-Value",
BusNumber = 620
},
ScsiController = new Oci.CloudbridgeService.Models.ScsiController
{
Label = "EXAMPLE-label-Value",
UnitNumber = 882,
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 = 317,
FaultToleranceSecondaryLatency = 835
},
VmwareVCenter = new Oci.CloudbridgeService.Models.VmwareVCenterProperties
{
VcenterKey = "EXAMPLE-vcenterKey-Value",
VcenterVersion = "EXAMPLE-vcenterVersion-Value",
DataCenter = "EXAMPLE-dataCenter-Value"
},
DisplayName = "EXAMPLE-displayName-Value",
AssetSourceIds = new List<string>
{
"EXAMPLE--Value"
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_ODmwz",
"EXAMPLE_VALUE_6goejny2VW8WRsZNK7HA"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_Z882J",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_T0U0Q",
"EXAMPLE--Value"
}
}
}
}
};
var updateAssetRequest = new Oci.CloudbridgeService.Requests.UpdateAssetRequest
{
AssetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-assetId-Value",
UpdateAssetDetails = updateAssetDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "UUDUVXFQDI3WFMLIDC5R<unique_ID>"
};
// 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.UpdateAsset(updateAssetRequest);
// Retrieve value from the response.
var id = response.Asset.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateAsset Failed with {e.Message}");
throw e;
}
}
}
}