// 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 cloudmigrations from "oci-cloudmigrations";
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 cloudmigrations.MigrationClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  updateTargetAssetDetails = {
		type: "INSTANCE",		preferredShapeType: cloudmigrations.models.VmTargetAsset.PreferredShapeType.VmIntelGpu,
		blockVolumesPerformance: 253,
		msLicense: "EXAMPLE-msLicense-Value",
		userSpec: {
			availabilityDomain: "EXAMPLE-availabilityDomain-Value",
			capacityReservationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
			compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
			createVnicDetails: {
				assignPublicIp: true,
				assignPrivateDnsRecord: false,
				definedTags: {
					EXAMPLE_KEY_LISKG :{
						EXAMPLE_KEY_fHqYi :"EXAMPLE--Value"
						}
					},
				displayName: "EXAMPLE-displayName-Value",
				freeformTags: {
					EXAMPLE_KEY_5BprY :"EXAMPLE_VALUE_EWegti78Y4fNNlpvlS0T"
					},
				hostnameLabel: "EXAMPLE-hostnameLabel-Value",
				nsgIds: ["EXAMPLE--Value"						],
				privateIp: "EXAMPLE-privateIp-Value",
				skipSourceDestCheck: false,
				subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				vlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value",

				}
,
			dedicatedVmHostId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value",
			definedTags: {
				EXAMPLE_KEY_zPuKa :{
					EXAMPLE_KEY_Rj858 :"EXAMPLE--Value"
					}
				},
			displayName: "EXAMPLE-displayName-Value",
			faultDomain: "EXAMPLE-faultDomain-Value",
			freeformTags: {
				EXAMPLE_KEY_tVQj2 :"EXAMPLE_VALUE_yq6ojyaQVtRuPknH8OkG"
				},
			hostnameLabel: "EXAMPLE-hostnameLabel-Value",
			ipxeScript: "EXAMPLE-ipxeScript-Value",
			instanceOptions: {
				areLegacyImdsEndpointsDisabled: true,

				}
,
			preemptibleInstanceConfig: {
				preemptionAction: {
					type: "TERMINATE",					preserveBootVolume: true

					}
,

				}
,
			agentConfig: {
				isMonitoringDisabled: true,
				isManagementDisabled: false,
				areAllPluginsDisabled: true,
				pluginsConfig: [{
						name: "EXAMPLE-name-Value",
						desiredState: cloudmigrations.models.InstanceAgentPluginConfigDetails.DesiredState.Enabled,

						}
						],

				}
,
			shape: "EXAMPLE-shape-Value",
			shapeConfig: {
				ocpus: 1506.7053,
				memoryInGBs: 7595.0195,
				baselineOcpuUtilization: cloudmigrations.models.LaunchInstanceShapeConfigDetails.BaselineOcpuUtilization.Baseline18,

				}
,
			sourceDetails: {
				sourceType: "image",				bootVolumeSizeInGBs: 169,
				imageId: "ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
				kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
				bootVolumeVpusPerGB: 690

				}
,
			isPvEncryptionInTransitEnabled: true,

			}
,
		isExcludedFromExecution: false

		}

	const updateTargetAssetRequest: cloudmigrations.requests.UpdateTargetAssetRequest = { 
	targetAssetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-targetAssetId-Value",
	updateTargetAssetDetails: updateTargetAssetDetails,
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	ifMatch: "EXAMPLE-ifMatch-Value",
	opcRequestId: "OT4SV3QIM42BOO9XDTEF<unique_ID>",

		}; 


     // Send request to the Client.
     const updateTargetAssetResponse = await client.updateTargetAsset(updateTargetAssetRequest);
     }
     catch (error) {
         console.log("updateTargetAsset Failed with error  " + error);
     }
})();