Vcenter Namespaces Mobility Virtualmachines Imports create

Vcenter Namespaces Mobility Virtualmachines Imports create

Creates a new Import based on the specifications.

This API supports importing a single VM specified in the Vcenter Namespaces Mobility Virtualmachines Imports CreateSpec into the target namespace. This will result in the VM becoming a VM Service managed VM. If the VM has First Class Disks attached, those First Class Disks will be registered to the Supervisor as PersistentVolumeClaim resources attached to the VM.

This API triggers a cancellable task and returns its identifier. Use this identifier to query basic task information by calling the Tasks.get operation, or to query import operation-specific information through the GET /vcenter/namespaces/{namespace}/mobility/virtualmachines/imports/{task} task. The task is retained as per the default retention rules configured in vCenter.

This is a non-idempotent API that creates custom resources on the Supervisor as a side effect. If the API returns an error, manually address them before attempting import again.

After the import to the Supervisor, power cycles are required to perform guest customization to update the network configuration to restore network connectivity.

This operation was added in vSphere API 9.0.0.0.

Returns an authorization error if you do not have all of the privileges described as follows:

  • The resource com.vmware.vcenter.namespaces.Instance referenced by the parameter namespace requires Namespaces.Edit.
  • The resource VirtualMachine referenced by the property Vcenter Namespaces Mobility Virtualmachines Imports CreateSpec.vm requires VirtualMachine.Supervisor.Transfer.
Request
URI
POST
https://{api_host}/api/vcenter/namespaces/{namespace}/mobility/virtualmachines/imports
COPY
Path Parameters
string
namespace
Required

Identifier for the namespace.

The parameter must be an identifier for the resource type: com.vmware.vcenter.namespaces.Instance.


Request Body

Specification for the Import.

Show optional properties

{
    "vm": "string"
}
{
    "vm": "string",
    "storage_policy": "string",
    "subnet_mappings": {
        "subnet_mappings": {
            "name": "string",
            "type": "string"
        }
    },
    "network_customization": {
        "customization_sysprep_user_data": {
            "computer_name": "string",
            "full_name": "string",
            "org_name": "string",
            "product_id": "string"
        }
    }
}
string
vm
Required

The VM to be imported.

This property was added in vSphere API 9.0.0.0.

When clients pass a value of this schema as a parameter, the property must be an identifier for the resource type: VirtualMachine. When operations return a value of this schema as a response, the property will be an identifier for the resource type: VirtualMachine.

string
storage_policy
Optional

Storage policy to be used for the importing VM. A storage policy different from the VM's current storage policy might result in the associated storage resources being relocated to a datastore that conforms with the selected storage policy.

This property was added in vSphere API 9.0.0.0.

If missing or null, and the target namespace has only a single storage policy, that storage policy will be used.

When clients pass a value of this schema as a parameter, the property must be an identifier for the resource type: SpsStorageProfile. When operations return a value of this schema as a response, the property will be an identifier for the resource type: SpsStorageProfile.

object
subnet_mappings
Optional

Map of network device keys to Subnet information specifying the Subnets to which the VM's network devices should be connected.

The key of the map is the device key of the network device on the VM, and the value is the Subnet information. Each device key must be unique within the map; overlapping or duplicate device keys are not allowed.

This property was added in vSphere API 9.0.0.0.

If missing or null, or any ethernet card is not specified, the default network configuration for the VM's target namespace will be used.

When clients pass a value of this schema as a parameter, the key in the property map must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Ethernet. When operations return a value of this schema as a response, the key in the property map will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Ethernet.

network_customization
Optional

Network customization settings for Windows VM.

This property was added in vSphere API 9.0.0.0.

If missing or null, Windows VM will not be able to receive new network identity assigned from the Supervisor workload network. This may result in a loss of network connectivity for VM that requires automated network identity configuration post import, such as systems not using DHCP. This field is not used for non-Windows VM.

Authentication
This operation uses the following authentication methods.
Responses
201

The task identifier for the import operation.

The response will be an identifier for the resource type: com.vmware.cis.task.

Returns string of type(s) application/json
Operation doesn't return any data structure

400

Vapi Std Errors InvalidArgument if the arguments are invalid. For example:

  • If Vcenter Namespaces Mobility Virtualmachines Imports CustomizationSysprepUserData.computer_name does not conform to requirements.
  • If Vcenter Namespaces Mobility Virtualmachines Imports CreateSpec.storage_policy needs to be specified.

Vapi Std Errors Unsupported if the Supervisor does not support importing VM.

Returns Vapi Std Errors Error of type(s) application/json
"Vapi Std Errors Error Object"
array of object
messages
Required

Stack of one or more localizable messages for human error consumers.

The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.

Each subsequent message in the stack describes the "cause" of the prior message.

object
data
Optional

Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.

Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.

The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.

Some operations will not set this property when reporting errors.

string
error_type
Required

Discriminator field to help API consumers identify the structure type.

For more information see: Vapi Std Errors Error Type.

This property was added in vSphere API 6.7.2.

Can be missing or null for compatibility with preceding implementations.


401

if the user is not authenticated.

Returns Vapi Std Errors Unauthenticated of type(s) application/json
This response body class contains all of the following: InlineVapi Std Errors Unauthenticated0
"Vapi Std Errors Unauthenticated Object"
string
challenge
Optional

Indicates the authentication challenges applicable to the target API provider. It can be used by a client to discover the correct authentication scheme to use. The exact syntax of the value is defined by the specific provider, the protocol and authentication schemes used.

For example, a provider using REST may adhere to the WWW-Authenticate HTTP header specification, RFC7235, section 4.1. In this case an example challenge value may be: SIGN realm="27da1358-2ba4-11e9-b210-d663bd873d93",sts="http://vcenter/sso?vsphere.local", Basic realm="vCenter"

This property was added in vSphere API 7.0.0.0.

This property is optional because it was added in a newer version than its parent node.


403

if the user does not have Namespaces.Edit privilege on the target Namespace and VirtualMachine.Namespaces.Transfer privilege on the VM.

Returns Vapi Std Errors Unauthorized of type(s) application/json
This response body class contains all of the following: InlineVapi Std Errors Unauthorized0
"Vapi Std Errors Unauthorized Object"

404

if any of the specified resources (such as importing VM, target namespace, target storage, or target network) cannot be found.

Returns Vapi Std Errors NotFound of type(s) application/json
This response body class contains all of the following: InlineVapi Std Errors NotFound0
"Vapi Std Errors NotFound Object"

500

Vapi Std Errors Error if the system reports an error while responding to the request.

Vapi Std Errors UnableToAllocateResource if the target namespace does not have sufficient resources for the importing VM.

Returns Vapi Std Errors Error of type(s) application/json
"Vapi Std Errors Error Object"
array of object
messages
Required

Stack of one or more localizable messages for human error consumers.

The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.

Each subsequent message in the stack describes the "cause" of the prior message.

object
data
Optional

Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.

Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.

The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.

Some operations will not set this property when reporting errors.

string
error_type
Required

Discriminator field to help API consumers identify the structure type.

For more information see: Vapi Std Errors Error Type.

This property was added in vSphere API 6.7.2.

Can be missing or null for compatibility with preceding implementations.


503

if the system is unable to communicate with the Supervisor.

Returns Vapi Std Errors ServiceUnavailable of type(s) application/json
This response body class contains all of the following: InlineVapi Std Errors ServiceUnavailable0
"Vapi Std Errors ServiceUnavailable Object"

Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"vm:"string"}' https://{api_host}/api/vcenter/namespaces/{namespace}/mobility/virtualmachines/imports