// 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.VmIntel,
blockVolumesPerformance: 945,
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: false,
assignPrivateDnsRecord: true,
definedTags: {
EXAMPLE_KEY_qRMsb :{
EXAMPLE_KEY_6XXQm :"EXAMPLE--Value"
}
},
displayName: "EXAMPLE-displayName-Value",
freeformTags: {
EXAMPLE_KEY_h7Ta2 :"EXAMPLE_VALUE_wrEZp8ASsUfdqOFYozc0"
},
hostnameLabel: "EXAMPLE-hostnameLabel-Value",
nsgIds: ["EXAMPLE--Value" ],
privateIp: "EXAMPLE-privateIp-Value",
skipSourceDestCheck: true,
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_XsQ24 :{
EXAMPLE_KEY_lkLci :"EXAMPLE--Value"
}
},
displayName: "EXAMPLE-displayName-Value",
faultDomain: "EXAMPLE-faultDomain-Value",
freeformTags: {
EXAMPLE_KEY_lQf40 :"EXAMPLE_VALUE_i6BYQkLj04JVQMnwSYUI"
},
hostnameLabel: "EXAMPLE-hostnameLabel-Value",
ipxeScript: "EXAMPLE-ipxeScript-Value",
instanceOptions: {
areLegacyImdsEndpointsDisabled: true,
}
,
preemptibleInstanceConfig: {
preemptionAction: {
type: "TERMINATE", preserveBootVolume: true
}
,
}
,
agentConfig: {
isMonitoringDisabled: false,
isManagementDisabled: true,
areAllPluginsDisabled: false,
pluginsConfig: [{
name: "EXAMPLE-name-Value",
desiredState: cloudmigrations.models.InstanceAgentPluginConfigDetails.DesiredState.Enabled,
}
],
}
,
shape: "EXAMPLE-shape-Value",
shapeConfig: {
ocpus: 1060.5615,
memoryInGBs: 384.75217,
baselineOcpuUtilization: cloudmigrations.models.LaunchInstanceShapeConfigDetails.BaselineOcpuUtilization.Baseline12,
}
,
sourceDetails: {
sourceType: "image", bootVolumeSizeInGBs: 717,
imageId: "ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
bootVolumeVpusPerGB: 906
}
,
isPvEncryptionInTransitEnabled: false,
}
,
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: "GOJMYWNHAMJEX8HAIBRH<unique_ID>",
};
// Send request to the Client.
const updateTargetAssetResponse = await client.updateTargetAsset(updateTargetAssetRequest);
}
catch (error) {
console.log("updateTargetAsset Failed with error " + error);
}
})();