[{"label":"Latest (1.0)","version":"latest"}]
srs-for-vsphere

Create Runspace

Description

Runspace creation and preparation time depends on the requested runspace details. If a connection to the vCenter Servers is requested, the operation creates a PowerShell instance, loads PowerCLI modules, and connects PowerCLI to the vCenter Servers.

Request

Request

URL

URL


post
https://{api_host}/api/runspaces
Copy

Request Body

Request Body

Runspace of mimetype application/json Optional

Desired runspace resource.

{
	"creation_time": "string",
	"error_details": {
		"code": 0,
		"details": "string",
		"error_message": "string"
	},
	"id": "string",
	"name": "string",
	"run_vc_connection_script": false,
	"state": "ready",
	"vc_connection_script_id": "string"
}
string as date-time
creation_time Optional

The time at which the object was created. String representing time in format ISO 8601.


error_details Optional

ErrorDetails object gives information for an API error.


string
id Optional

Unique identifier for the object.


string
name Optional

Name of the runspace. It is optional to give a name of the runspace on create request. If name was not specified on runspace creation the field has null value.


boolean
run_vc_connection_script Optional

Boolean that indicates whether PowerCLI connection has to be initialized when a Runspace creation is requested.

It is optional to request VCenter Servers connection to be initialized on create request. If true is specified PowerCLI Connect-VIServer cmdlet will be called in the create PowerShell instance. Connect-VIServer uses the authorized user’s SSO SAML token to connect to the vCenter Servers. Connection to all linked vCetner Servers will be established. When requested the runspace creation will be slower with the time needed for PowerCLI modules loading and Connect-VIServer execution time. _vc_connection_script_state field will hold state of the script completion. In case errors have occured during connect script execution _vc_connection_script_error_records will be populated.

Default value is false.


state Optional

RunspaceState defines possible runspace states.

Possible values are: readyactivecreatingerror


string
vc_connection_script_id Optional

Id of the vc connection script if it was requested on the runspace create request. You can use this id to retrieve all the details of the script execution. The script could fail and the details about the script failure would be available in the scriptexecutions API.

Authentication

Authentication

This operation uses the following authentication methods.

Response

Response

Response Body

Response Body

202 Accepted

Returns Runspace of type application/json

The request is accepted. The Location header is returned in the response that leads you to the runspace resource. The runspace resource is in creation state initially.

{
	"creation_time": "string",
	"error_details": {
		"code": 0,
		"details": "string",
		"error_message": "string"
	},
	"id": "string",
	"name": "string",
	"run_vc_connection_script": false,
	"state": "ready",
	"vc_connection_script_id": "string"
}
string as date-time
creation_time Optional

The time at which the object was created. String representing time in format ISO 8601.


error_details Optional

ErrorDetails object gives information for an API error.


string
id Optional

Unique identifier for the object.


string
name Optional

Name of the runspace. It is optional to give a name of the runspace on create request. If name was not specified on runspace creation the field has null value.


boolean
run_vc_connection_script Optional

Boolean that indicates whether PowerCLI connection has to be initialized when a Runspace creation is requested.

It is optional to request VCenter Servers connection to be initialized on create request. If true is specified PowerCLI Connect-VIServer cmdlet will be called in the create PowerShell instance. Connect-VIServer uses the authorized user’s SSO SAML token to connect to the vCenter Servers. Connection to all linked vCetner Servers will be established. When requested the runspace creation will be slower with the time needed for PowerCLI modules loading and Connect-VIServer execution time. _vc_connection_script_state field will hold state of the script completion. In case errors have occured during connect script execution _vc_connection_script_error_records will be populated.

Default value is false.


state Optional

RunspaceState defines possible runspace states.

Possible values are: readyactivecreatingerror


string
vc_connection_script_id Optional

Id of the vc connection script if it was requested on the runspace create request. You can use this id to retrieve all the details of the script execution. The script could fail and the details about the script failure would be available in the scriptexecutions API.

Errors

Errors

ErrorDetails
401

Unauthorized


ErrorDetails
500

Server Error

Code Samples

Code Samples

cURL Command

curl -X POST -H "Content-Type: application/json" -d '{"creation_time":"string","error_details":{"code":0,"details":"string","error_message":"string"},"id":"string","name":"string","run_vc_connection_script":false,"state":"ready","vc_connection_script_id":"string"}' https://{api_host}/api/runspaces
Vendor Extensions

Vendor Extensions

This operation contains the following vendor extensions defined in the spec:
x-vmw-vapi-methodname: create
x-vmw-vapi-servicename: runspaces


[{"label":"Latest (1.0)","version":"latest"}]
srs-for-vsphere
Feedback

Was this page helpful?