// 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 createTargetAssetDetails = {
type: "INSTANCE", preferredShapeType: cloudmigrations.models.VmTargetAsset.PreferredShapeType.Vm,
blockVolumesPerformance: 997,
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: true,
definedTags: {
EXAMPLE_KEY_KHqSC :{
EXAMPLE_KEY_furYw :"EXAMPLE--Value"
}
},
displayName: "EXAMPLE-displayName-Value",
freeformTags: {
EXAMPLE_KEY_xWnoi :"EXAMPLE_VALUE_OjzlxDcJTxchAhUbrwpa"
},
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_fMbip :{
EXAMPLE_KEY_yHS4s :"EXAMPLE--Value"
}
},
displayName: "EXAMPLE-displayName-Value",
faultDomain: "EXAMPLE-faultDomain-Value",
freeformTags: {
EXAMPLE_KEY_nT3rO :"EXAMPLE_VALUE_RReBgTEC93BrCqy29w31"
},
hostnameLabel: "EXAMPLE-hostnameLabel-Value",
ipxeScript: "EXAMPLE-ipxeScript-Value",
instanceOptions: {
areLegacyImdsEndpointsDisabled: true,
}
,
preemptibleInstanceConfig: {
preemptionAction: {
type: "TERMINATE", preserveBootVolume: false
}
,
}
,
agentConfig: {
isMonitoringDisabled: true,
isManagementDisabled: true,
areAllPluginsDisabled: true,
pluginsConfig: [{
name: "EXAMPLE-name-Value",
desiredState: cloudmigrations.models.InstanceAgentPluginConfigDetails.DesiredState.Disabled,
}
],
}
,
shape: "EXAMPLE-shape-Value",
shapeConfig: {
ocpus: 7391.64,
memoryInGBs: 8554.694,
baselineOcpuUtilization: cloudmigrations.models.LaunchInstanceShapeConfigDetails.BaselineOcpuUtilization.Baseline11,
}
,
sourceDetails: {
sourceType: "image", bootVolumeSizeInGBs: 873,
imageId: "ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
bootVolumeVpusPerGB: 130
}
,
isPvEncryptionInTransitEnabled: false,
}
,
migrationPlanId: "ocid1.test.oc1..<unique_ID>EXAMPLE-migrationPlanId-Value",
isExcludedFromExecution: true
}
const createTargetAssetRequest: cloudmigrations.requests.CreateTargetAssetRequest = {
createTargetAssetDetails: createTargetAssetDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "WUFVWKE7B58UINPRTOXJ<unique_ID>",
};
// Send request to the Client.
const createTargetAssetResponse = await client.createTargetAsset(createTargetAssetRequest);
}
catch (error) {
console.log("createTargetAsset Failed with error " + error);
}
})();