/** 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 com.oracle.bmc.ConfigFileReader;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.cloudbridge.InventoryClient;
import com.oracle.bmc.cloudbridge.model.*;
import com.oracle.bmc.cloudbridge.requests.*;
import com.oracle.bmc.cloudbridge.responses.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.UUID;
import java.util.Arrays;
public class UpdateAssetExample {
public static void main(String[] args) throws Exception {
/**
* 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.
*/
final ConfigFileReader.ConfigFile configFile = ConfigFileReader.parseDefault();
final AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(configFile);
/* Create a service client */
InventoryClient client = InventoryClient.builder().build(provider);
/* Create a request and dependent object(s). */
UpdateAssetDetails updateAssetDetails = UpdateAwsEc2AssetDetails.builder()
.compute(ComputeProperties.builder()
.primaryIp("EXAMPLE-primaryIp-Value")
.dnsName("EXAMPLE-dnsName-Value")
.description("EXAMPLE-description-Value")
.coresCount(328)
.cpuModel("EXAMPLE-cpuModel-Value")
.gpuDevicesCount(762)
.gpuDevices(new ArrayList<>(Arrays.asList(GpuDevice.builder()
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.coresCount(453)
.memoryInMBs(933L)
.manufacturer("EXAMPLE-manufacturer-Value").build())))
.threadsPerCoreCount(673)
.memoryInMBs(823L)
.isPmemEnabled(false)
.pmemInMBs(747L)
.operatingSystem("EXAMPLE-operatingSystem-Value")
.operatingSystemVersion("EXAMPLE-operatingSystemVersion-Value")
.hostName("EXAMPLE-hostName-Value")
.powerState("EXAMPLE-powerState-Value")
.guestState("EXAMPLE-guestState-Value")
.isTpmEnabled(true)
.connectedNetworks(140)
.nicsCount(563)
.nics(new ArrayList<>(Arrays.asList(Nic.builder()
.label("EXAMPLE-label-Value")
.switchName("EXAMPLE-switchName-Value")
.macAddress("EXAMPLE-macAddress-Value")
.macAddressType("EXAMPLE-macAddressType-Value")
.networkName("EXAMPLE-networkName-Value")
.ipAddresses(new ArrayList<>(Arrays.asList("EXAMPLE--Value"))).build())))
.storageProvisionedInMBs(239L)
.disksCount(390)
.disks(new ArrayList<>(Arrays.asList(Disk.builder()
.name("EXAMPLE-name-Value")
.bootOrder(343)
.uuid("EXAMPLE-uuid-Value")
.uuidLun("EXAMPLE-uuidLun-Value")
.sizeInMBs(173L)
.location("EXAMPLE-location-Value")
.persistentMode("EXAMPLE-persistentMode-Value")
.isCbtEnabled(true).build())))
.firmware("EXAMPLE-firmware-Value")
.latencySensitivity("EXAMPLE-latencySensitivity-Value")
.nvdimms(new ArrayList<>(Arrays.asList(Nvdimm.builder()
.label("EXAMPLE-label-Value")
.unitNumber(178)
.controllerKey(68).build())))
.nvdimmController(NvdimmController.builder()
.label("EXAMPLE-label-Value")
.busNumber(907).build())
.scsiController(ScsiController.builder()
.label("EXAMPLE-label-Value")
.unitNumber(237)
.sharedBus("EXAMPLE-sharedBus-Value").build())
.hardwareVersion("EXAMPLE-hardwareVersion-Value").build())
.vm(VmProperties.builder()
.hypervisorVendor("EXAMPLE-hypervisorVendor-Value")
.hypervisorVersion("EXAMPLE-hypervisorVersion-Value")
.hypervisorHost("EXAMPLE-hypervisorHost-Value").build())
.awsEc2(AwsEc2Properties.builder()
.architecture("EXAMPLE-architecture-Value")
.bootMode("EXAMPLE-bootMode-Value")
.capacityReservationKey("EXAMPLE-capacityReservationKey-Value")
.areElasticInferenceAcceleratorsPresent(true)
.isEnclaveOptions(true)
.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("Tue Sep 05 23:23:43 UTC 2045"))
.licenses(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.maintenanceOptions("EXAMPLE-maintenanceOptions-Value")
.monitoring("EXAMPLE-monitoring-Value")
.networkInterfaces(new ArrayList<>(Arrays.asList(InstanceNetworkInterface.builder()
.association(InstanceNetworkInterfaceAssociation.builder()
.carrierIp("EXAMPLE-carrierIp-Value")
.customerOwnedIp("EXAMPLE-customerOwnedIp-Value")
.ipOwnerKey("EXAMPLE-ipOwnerKey-Value")
.publicDnsName("EXAMPLE-publicDnsName-Value")
.publicIp("EXAMPLE-publicIp-Value").build())
.attachment(InstanceNetworkInterfaceAttachment.builder()
.attachmentKey("EXAMPLE-attachmentKey-Value")
.timeAttach(new Date("Sun Mar 30 20:30:33 UTC 2036"))
.isDeleteOnTermination(false)
.deviceIndex(313)
.networkCardIndex(620)
.status("EXAMPLE-status-Value").build())
.description("EXAMPLE-description-Value")
.securityGroups(new ArrayList<>(Arrays.asList(GroupIdentifier.builder()
.groupKey("EXAMPLE-groupKey-Value")
.groupName("EXAMPLE-groupName-Value").build())))
.interfaceType("EXAMPLE-interfaceType-Value")
.ipv4Prefixes(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.ipv6Addresses(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.ipv6Prefixes(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.macAddress("EXAMPLE-macAddress-Value")
.networkInterfaceKey("EXAMPLE-networkInterfaceKey-Value")
.ownerKey("EXAMPLE-ownerKey-Value")
.privateIpAddresses(new ArrayList<>(Arrays.asList(InstancePrivateIpAddress.builder()
.association(InstanceNetworkInterfaceAssociation.builder()
.carrierIp("EXAMPLE-carrierIp-Value")
.customerOwnedIp("EXAMPLE-customerOwnedIp-Value")
.ipOwnerKey("EXAMPLE-ipOwnerKey-Value")
.publicDnsName("EXAMPLE-publicDnsName-Value")
.publicIp("EXAMPLE-publicIp-Value").build())
.isPrimary(false)
.privateDnsName("EXAMPLE-privateDnsName-Value")
.privateIpAddress("EXAMPLE-privateIpAddress-Value").build())))
.isSourceDestCheck(true)
.status("EXAMPLE-status-Value")
.subnetKey("EXAMPLE-subnetKey-Value").build())))
.placement(Placement.builder()
.affinity("EXAMPLE-affinity-Value")
.availabilityZone("EXAMPLE-availabilityZone-Value")
.groupName("EXAMPLE-groupName-Value")
.hostKey("EXAMPLE-hostKey-Value")
.hostResourceGroupArn("EXAMPLE-hostResourceGroupArn-Value")
.partitionNumber(67)
.spreadDomain("EXAMPLE-spreadDomain-Value")
.tenancy("EXAMPLE-tenancy-Value").build())
.privateDnsName("EXAMPLE-privateDnsName-Value")
.privateIpAddress("EXAMPLE-privateIpAddress-Value")
.rootDeviceName("EXAMPLE-rootDeviceName-Value")
.rootDeviceType("EXAMPLE-rootDeviceType-Value")
.securityGroups(new ArrayList<>(Arrays.asList(GroupIdentifier.builder()
.groupKey("EXAMPLE-groupKey-Value")
.groupName("EXAMPLE-groupName-Value").build())))
.isSourceDestCheck(true)
.isSpotInstance(true)
.sriovNetSupport("EXAMPLE-sriovNetSupport-Value")
.state(InstanceState.builder()
.code(102)
.name("EXAMPLE-name-Value").build())
.subnetKey("EXAMPLE-subnetKey-Value")
.tags(new ArrayList<>(Arrays.asList(Tag.builder()
.key("EXAMPLE-key-Value")
.value("EXAMPLE-value-Value").build())))
.tpmSupport("EXAMPLE-tpmSupport-Value")
.virtualizationType("EXAMPLE-virtualizationType-Value")
.vpcKey("EXAMPLE-vpcKey-Value").build())
.awsEc2Cost(MonthlyCostSummary.builder()
.amount(299.4156)
.currencyCode("EXAMPLE-currencyCode-Value").build())
.attachedEbsVolumesCost(MonthlyCostSummary.builder()
.amount(8044.963)
.currencyCode("EXAMPLE-currencyCode-Value").build())
.displayName("EXAMPLE-displayName-Value")
.assetSourceIds(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.freeformTags(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_oWCzc","EXAMPLE_VALUE_o7So8UarGqO8WOXODmwz");
}
})
.definedTags(new HashMap<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>() {
{
put("EXAMPLE_KEY_ny2VW",new HashMap<java.lang.String, java.lang.Object>() {
{
put("EXAMPLE_KEY_6goej","EXAMPLE--Value");
}
});
}
}).build();
UpdateAssetRequest updateAssetRequest = UpdateAssetRequest.builder()
.assetId("ocid1.test.oc1..<unique_ID>EXAMPLE-assetId-Value")
.updateAssetDetails(updateAssetDetails)
.ifMatch("EXAMPLE-ifMatch-Value")
.opcRequestId("VXFQDI3WFMLIDC5RG276<unique_ID>").build();
/* Send request to the Client */
UpdateAssetResponse response = client.updateAsset(updateAssetRequest);
}
}