# Virtual machines

## GET /api/v1/servers/virtual/GetServers

> Get a list of virtual machines

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/GetServers":{"get":{"tags":["servers/virtual"],"summary":"Get a list of virtual machines","operationId":"ApiV1ServersVirtualGetserversGet","parameters":[{"name":"Cluster","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfVirtualServerDetailsItem"}},"application/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfVirtualServerDetailsItem"}},"text/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfVirtualServerDetailsItem"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ListResultDtoOfVirtualServerDetailsItem":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/VirtualServerDetailsItem"},"nullable":true}},"additionalProperties":false},"VirtualServerDetailsItem":{"type":"object","properties":{"username":{"type":"string","description":"The user that creatd the vm","nullable":true},"tenancy_name":{"type":"string","description":"Name of the tenant where the VM has been created","nullable":true},"rpool":{"type":"string","description":"Resource pool where the VM has been created","nullable":true},"directAttachedStoragePersisted":{"type":"boolean"},"id":{"type":"string","description":"The name of the virtual machine","nullable":true},"namespace":{"type":"string","nullable":true},"configuration":{"type":"string","description":"A VM configuration ID","nullable":true},"storage":{"type":"integer","description":"The amount of storage attached to the VM in GB","format":"int64","nullable":true},"gpu_type":{"type":"string","description":"The specific host GPU type","nullable":true},"gpus":{"type":"integer","description":"Number of GPUs attached to the VM","format":"int32","nullable":true},"vcpus":{"type":"integer","description":"Number of vCPUs available to the VM","format":"int32","nullable":true},"memory":{"type":"integer","description":"Amount of system memory available in GB","format":"int64","nullable":true},"ip":{"type":"string","description":"The public IP address of the VM","nullable":true},"privateIp":{"type":"string","description":"The private IP address of the VM","nullable":true},"image":{"type":"string","description":"Name of the VM image used","nullable":true},"cluster":{"type":"string","description":"The cluster where the VM is allocated","nullable":true},"nodeSelector":{"type":"string","description":"The specific node where the VM is scheduled","nullable":true},"status":{"type":"string","description":"The status of the VM (e.g. 'PLANNED', 'PENDING' 'PENDING_RESOURCES', 'PENDING_READINESS', 'ONLINE', 'OFFLINE')","nullable":true},"storageType":{"type":"string","nullable":true},"rootDiskSize":{"type":"string","nullable":true},"lastUpdated":{"type":"string","format":"date-time"}},"additionalProperties":false}}}}
```

## GET /api/v1/servers/virtual/GetServer

> Get detailed information about a specific virtual machine

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/GetServer":{"get":{"tags":["servers/virtual"],"summary":"Get detailed information about a specific virtual machine","operationId":"ApiV1ServersVirtualGetserverGet","parameters":[{"name":"Id","in":"query","description":"The virtual machine id","required":true,"schema":{"type":"string"}},{"name":"Namespace","in":"query","description":"The namespace/vpc where the virtual machine lives. Default one is same as tenant name.","required":true,"schema":{"type":"string"}},{"name":"Cluster","in":"query","description":"The cluster you're operating on","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}},"application/json":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}},"text/json":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"VirtualServerDetailsItem":{"type":"object","properties":{"username":{"type":"string","description":"The user that creatd the vm","nullable":true},"tenancy_name":{"type":"string","description":"Name of the tenant where the VM has been created","nullable":true},"rpool":{"type":"string","description":"Resource pool where the VM has been created","nullable":true},"directAttachedStoragePersisted":{"type":"boolean"},"id":{"type":"string","description":"The name of the virtual machine","nullable":true},"namespace":{"type":"string","nullable":true},"configuration":{"type":"string","description":"A VM configuration ID","nullable":true},"storage":{"type":"integer","description":"The amount of storage attached to the VM in GB","format":"int64","nullable":true},"gpu_type":{"type":"string","description":"The specific host GPU type","nullable":true},"gpus":{"type":"integer","description":"Number of GPUs attached to the VM","format":"int32","nullable":true},"vcpus":{"type":"integer","description":"Number of vCPUs available to the VM","format":"int32","nullable":true},"memory":{"type":"integer","description":"Amount of system memory available in GB","format":"int64","nullable":true},"ip":{"type":"string","description":"The public IP address of the VM","nullable":true},"privateIp":{"type":"string","description":"The private IP address of the VM","nullable":true},"image":{"type":"string","description":"Name of the VM image used","nullable":true},"cluster":{"type":"string","description":"The cluster where the VM is allocated","nullable":true},"nodeSelector":{"type":"string","description":"The specific node where the VM is scheduled","nullable":true},"status":{"type":"string","description":"The status of the VM (e.g. 'PLANNED', 'PENDING' 'PENDING_RESOURCES', 'PENDING_READINESS', 'ONLINE', 'OFFLINE')","nullable":true},"storageType":{"type":"string","nullable":true},"rootDiskSize":{"type":"string","nullable":true},"lastUpdated":{"type":"string","format":"date-time"}},"additionalProperties":false}}}}
```

## POST /api/v1/servers/virtual/CreateServer

> Create a new virtual machine using a pre-defined configuration

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/CreateServer":{"post":{"tags":["servers/virtual"],"summary":"Create a new virtual machine using a pre-defined configuration","operationId":"ApiV1ServersVirtualCreateserverPost","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/CreateVirtualServerInput"}},"application/json":{"schema":{"$ref":"#/components/schemas/CreateVirtualServerInput"}},"text/json":{"schema":{"$ref":"#/components/schemas/CreateVirtualServerInput"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/CreateVirtualServerInput"}}}},"responses":{"202":{"description":"Accepted","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}},"application/json":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}},"text/json":{"schema":{"$ref":"#/components/schemas/VirtualServerDetailsItem"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"500":{"description":"Server Error"},"503":{"description":"Server Error"}}}}},"components":{"schemas":{"CreateVirtualServerInput":{"required":["cluster","configuration","ssh_keys","vpc"],"type":"object","properties":{"name":{"maxLength":52,"minLength":0,"type":"string","description":"Name of virtual server to be created. If not provided, name will be auto-generated.\r\nMust be 52 characters or less.","nullable":true},"rpool":{"type":"string","description":"Name of the pool to be used. If not provided, first pool assigned to a tenant will be used. In case of no pool assigned, 'on-demand' will be used.","nullable":true},"vpc":{"minLength":1,"type":"string","description":"Name of the VPC to be used. Usually this will match the tenant name."},"configuration":{"minLength":1,"type":"string","description":"Name of the configuration to be used. For possible values, refer to the otput of api/v1/servers/virtual/GetConfigurations, field 'name' DenvrDashboard.Servers.Dtos.ServerConfiguration.Name"},"cluster":{"minLength":1,"type":"string","description":"Cluster to be used. For possible values, refer to the otput of api/v1/clusters/GetAll\"/>"},"ssh_keys":{"minItems":1,"type":"array","items":{"type":"string"}},"snapshotName":{"type":"string","description":"Snapshot name.","nullable":true},"operatingSystemImage":{"type":"string","description":"Name of the Operating System image to be used.","nullable":true},"personalStorageMountPath":{"type":"string","description":"Personal storage file system mount path.","nullable":true},"tenantSharedAdditionalStorage":{"type":"string","description":"Tenant shared storage file system mount path.","nullable":true},"persistStorage":{"type":"boolean","description":"Whether direct attached storage should be persistant or ephemeral."},"directStorageMountPath":{"type":"string","description":"Direct attached storage mount path.","nullable":true},"rootDiskSize":{"type":"integer","description":"Size of root disk to be created (Gi).","format":"int32"},"selectedNode":{"type":"string","description":"Specific node name to target for VM deployment. \r\nUsed for non-on-demand resource pools to allow node-specific scheduling.\r\nMaps to Kubernetes nodeSelector with kubernetes.io/hostname label.","nullable":true}},"additionalProperties":false},"VirtualServerDetailsItem":{"type":"object","properties":{"username":{"type":"string","description":"The user that creatd the vm","nullable":true},"tenancy_name":{"type":"string","description":"Name of the tenant where the VM has been created","nullable":true},"rpool":{"type":"string","description":"Resource pool where the VM has been created","nullable":true},"directAttachedStoragePersisted":{"type":"boolean"},"id":{"type":"string","description":"The name of the virtual machine","nullable":true},"namespace":{"type":"string","nullable":true},"configuration":{"type":"string","description":"A VM configuration ID","nullable":true},"storage":{"type":"integer","description":"The amount of storage attached to the VM in GB","format":"int64","nullable":true},"gpu_type":{"type":"string","description":"The specific host GPU type","nullable":true},"gpus":{"type":"integer","description":"Number of GPUs attached to the VM","format":"int32","nullable":true},"vcpus":{"type":"integer","description":"Number of vCPUs available to the VM","format":"int32","nullable":true},"memory":{"type":"integer","description":"Amount of system memory available in GB","format":"int64","nullable":true},"ip":{"type":"string","description":"The public IP address of the VM","nullable":true},"privateIp":{"type":"string","description":"The private IP address of the VM","nullable":true},"image":{"type":"string","description":"Name of the VM image used","nullable":true},"cluster":{"type":"string","description":"The cluster where the VM is allocated","nullable":true},"nodeSelector":{"type":"string","description":"The specific node where the VM is scheduled","nullable":true},"status":{"type":"string","description":"The status of the VM (e.g. 'PLANNED', 'PENDING' 'PENDING_RESOURCES', 'PENDING_READINESS', 'ONLINE', 'OFFLINE')","nullable":true},"storageType":{"type":"string","nullable":true},"rootDiskSize":{"type":"string","nullable":true},"lastUpdated":{"type":"string","format":"date-time"}},"additionalProperties":false}}}}
```

## POST /api/v1/servers/virtual/StartServer

> Start a virtual machine that has been previously set up and provisioned, but is currently OFFLINE

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/StartServer":{"post":{"tags":["servers/virtual"],"summary":"Start a virtual machine that has been previously set up and provisioned, but is currently OFFLINE","operationId":"ApiV1ServersVirtualStartserverPost","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}}}},"responses":{"202":{"description":"Accepted","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"500":{"description":"Server Error"},"503":{"description":"Server Error"}}}}},"components":{"schemas":{"ServerCommandInput":{"required":["cluster","id","namespace"],"type":"object","properties":{"id":{"minLength":1,"type":"string","description":"The virtual machine id"},"namespace":{"minLength":1,"type":"string","description":"The namespace/vpc where the virtual machine lives. Default one is same as tenant name."},"cluster":{"minLength":1,"type":"string","description":"The cluster you're operating on"}},"additionalProperties":false},"ServerCommandOutput":{"type":"object","properties":{"id":{"type":"string","nullable":true},"cluster":{"type":"string","nullable":true},"status":{"type":"string","nullable":true}},"additionalProperties":false}}}}
```

## POST /api/v1/servers/virtual/StopServer

> Stop a virtual machine, ensuring a secure and orderly shutdown of its operations within the cloud environment

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/StopServer":{"post":{"tags":["servers/virtual"],"summary":"Stop a virtual machine, ensuring a secure and orderly shutdown of its operations within the cloud environment","operationId":"ApiV1ServersVirtualStopserverPost","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/ServerCommandInput"}}}},"responses":{"202":{"description":"Accepted","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ServerCommandInput":{"required":["cluster","id","namespace"],"type":"object","properties":{"id":{"minLength":1,"type":"string","description":"The virtual machine id"},"namespace":{"minLength":1,"type":"string","description":"The namespace/vpc where the virtual machine lives. Default one is same as tenant name."},"cluster":{"minLength":1,"type":"string","description":"The cluster you're operating on"}},"additionalProperties":false},"ServerCommandOutput":{"type":"object","properties":{"id":{"type":"string","nullable":true},"cluster":{"type":"string","nullable":true},"status":{"type":"string","nullable":true}},"additionalProperties":false}}}}
```

## DELETE /api/v1/servers/virtual/DestroyServer

> Permanently delete a specified virtual machine, effectively wiping all its data and freeing up resources for other uses

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/DestroyServer":{"delete":{"tags":["servers/virtual"],"summary":"Permanently delete a specified virtual machine, effectively wiping all its data and freeing up resources for other uses","operationId":"ApiV1ServersVirtualDestroyserverDelete","parameters":[{"name":"DeleteSnapshots","in":"query","description":"Should also delete snapshots with virtual machine.","schema":{"type":"boolean"}},{"name":"Id","in":"query","description":"The virtual machine id","required":true,"schema":{"type":"string"}},{"name":"Namespace","in":"query","description":"The namespace/vpc where the virtual machine lives. Default one is same as tenant name.","required":true,"schema":{"type":"string"}},{"name":"Cluster","in":"query","description":"The cluster you're operating on","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Accepted","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerCommandOutput"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"409":{"description":"Conflict"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ServerCommandOutput":{"type":"object","properties":{"id":{"type":"string","nullable":true},"cluster":{"type":"string","nullable":true},"status":{"type":"string","nullable":true}},"additionalProperties":false}}}}
```

## GET /api/v1/servers/virtual/GetConfigurations

> Get detailed information on available configurations for virtual machines

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/GetConfigurations":{"get":{"tags":["servers/virtual"],"summary":"Get detailed information on available configurations for virtual machines","operationId":"ApiV1ServersVirtualGetconfigurationsGet","responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerConfiguration"}},"application/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerConfiguration"}},"text/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerConfiguration"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ListResultDtoOfServerConfiguration":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ServerConfiguration"},"nullable":true}},"additionalProperties":false},"ServerConfiguration":{"type":"object","properties":{"id":{"type":"integer","format":"int32"},"user_friendly_name":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"os_version":{"type":"string","nullable":true,"deprecated":true},"os_type":{"type":"string","nullable":true,"deprecated":true},"storage":{"type":"integer","format":"int64"},"gpu_type":{"type":"string","nullable":true,"deprecated":true},"gpu_family":{"type":"string","nullable":true,"deprecated":true},"gpu_brand":{"type":"string","nullable":true,"deprecated":true},"gpu_name":{"type":"string","nullable":true,"deprecated":true},"type":{"type":"string","nullable":true},"brand_family":{"type":"string","nullable":true},"brand":{"type":"string","nullable":true},"text_name":{"type":"string","nullable":true},"gpus":{"type":"integer","format":"int32"},"vcpus":{"type":"integer","format":"int32"},"memory":{"type":"integer","format":"int64"},"price":{"type":"number","format":"double"},"compute_network":{"type":"string","nullable":true},"is_gpu_platform":{"type":"boolean"},"clusters":{"type":"array","items":{"type":"string"},"nullable":true}},"additionalProperties":false}}}}
```

## GET /api/v1/servers/virtual/GetAvailability

> Get information about the current availability of different virtual machine configurations

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/GetAvailability":{"get":{"tags":["servers/virtual"],"summary":"Get information about the current availability of different virtual machine configurations","operationId":"ApiV1ServersVirtualGetavailabilityGet","parameters":[{"name":"cluster","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"resourcePool","in":"query","description":"","schema":{"type":"string"}},{"name":"reportNodes","in":"query","description":"controls if Count and MaxCount is calculated and returned in the response. If they are not needed, use 'false' to improve response time of the endpoint.","schema":{"type":"boolean","default":true}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerAvailability"}},"application/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerAvailability"}},"text/json":{"schema":{"$ref":"#/components/schemas/ListResultDtoOfServerAvailability"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ListResultDtoOfServerAvailability":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ServerAvailability"},"nullable":true}},"additionalProperties":false},"ServerAvailability":{"type":"object","properties":{"configuration":{"type":"string","nullable":true},"cluster":{"type":"string","nullable":true},"rpool":{"type":"string","nullable":true},"type":{"type":"string","nullable":true,"deprecated":true},"price":{"type":"number","format":"double"},"available":{"type":"boolean"},"count":{"type":"integer","description":"number of servers that can be created with this configuration.","format":"int32"},"maxCount":{"type":"integer","description":"maximum number of servers that can be created with this configuration. 0 if resource pool is on-demand.","format":"int32"},"availableNodeNames":{"type":"array","items":{"type":"string"},"description":"List of node names where this configuration is available. Omitted for on-demand resource pools","nullable":true}},"additionalProperties":false}}}}
```

## GET /api/v1/servers/virtual/GetVirtualMachineBootLogs

> Get boot logs for a specific virtual machine

```json
{"openapi":"3.0.1","info":{"title":"DenvrCloud API","version":"v1"},"paths":{"/api/v1/servers/virtual/GetVirtualMachineBootLogs":{"get":{"tags":["servers/virtual"],"summary":"Get boot logs for a specific virtual machine","operationId":"ApiV1ServersVirtualGetvirtualmachinebootlogsGet","parameters":[{"name":"Id","in":"query","description":"The virtual machine id","required":true,"schema":{"type":"string"}},{"name":"Namespace","in":"query","description":"The namespace/vpc where the virtual machine lives. Default one is same as tenant name.","required":true,"schema":{"type":"string"}},{"name":"Cluster","in":"query","description":"The cluster you're operating on","required":true,"schema":{"type":"string"}},{"name":"Limit","in":"query","description":"The maximum number of log entries to return. Defaults to 2000.","required":true,"schema":{"maximum":10000,"minimum":1,"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ServerBootLogsOutput"}},"application/json":{"schema":{"$ref":"#/components/schemas/ServerBootLogsOutput"}},"text/json":{"schema":{"$ref":"#/components/schemas/ServerBootLogsOutput"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"},"409":{"description":"Conflict"},"500":{"description":"Server Error"}}}}},"components":{"schemas":{"ServerBootLogsOutput":{"type":"object","properties":{"id":{"type":"string","nullable":true},"namespace":{"type":"string","nullable":true},"cluster":{"type":"string","nullable":true},"bootLogs":{"type":"string","nullable":true}},"additionalProperties":false}}}}
```
