Skip to content

Latest commit

 

History

History
1740 lines (1216 loc) · 58.7 KB

File metadata and controls

1740 lines (1216 loc) · 58.7 KB

hyperstack.VirtualMachineApi

All URIs are relative to https://infrahub-api.nexgencloud.com/v1

Method HTTP request Description
add_vm_label PUT /core/virtual-machines/{vm_id}/label Edit virtual machine labels
attach_firewalls_to_vm POST /core/virtual-machines/{vm_id}/attach-firewalls Attach firewalls to a virtual machine
check_vm_name_availability GET /core/virtual-machines/name-availability/{name} Fetch virtual machine name availability
create_firewall_rule_for_vm POST /core/virtual-machines/{vm_id}/sg-rules Add firewall rule to virtual machine
create_snapshot_for_vm POST /core/virtual-machines/{vm_id}/snapshots Create snapshot from a virtual machine
create_vms POST /core/virtual-machines Create virtual machines
delete_firewall_rule_for_vm DELETE /core/virtual-machines/{vm_id}/sg-rules/{sg_rule_id} Delete firewall rule from virtual machine
delete_vm DELETE /core/virtual-machines/{vm_id} Delete virtual machine
get_contract_vms GET /core/virtual-machines/contract/{contract_id}/virtual-machines Retrieve virtual machines associated with a contract
get_vm GET /core/virtual-machines/{vm_id} Retrieve virtual machine details
get_vm_logs GET /core/virtual-machines/{vm_id}/logs Get virtual machine logs
get_vm_metrics GET /core/virtual-machines/{vm_id}/metrics Retrieve virtual machine performance metrics
hard_reboot_vm GET /core/virtual-machines/{vm_id}/hard-reboot Hard reboot virtual machine
hibernate_vm GET /core/virtual-machines/{vm_id}/hibernate Hibernate virtual machine
list_vms GET /core/virtual-machines List virtual machines
request_vm_logs POST /core/virtual-machines/{vm_id}/logs Request virtual machine logs
resize_vm POST /core/virtual-machines/{vm_id}/resize Resize virtual machine
restore_vm_from_hibernation GET /core/virtual-machines/{vm_id}/hibernate-restore Restore virtual machine from hibernation
start_vm GET /core/virtual-machines/{vm_id}/start Start virtual machine
stop_vm GET /core/virtual-machines/{vm_id}/stop Stop virtual machine

add_vm_label

ResponseModel add_vm_label(vm_id, payload)

Edit virtual machine labels

Adds one or more labels to an existing virtual machine. Provide the virtual machine ID in the path to add labels to the specified VM. For multiple labels, add a space between each label in the request body.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.edit_label_of_an_existing_vm_payload import EditLabelOfAnExistingVMPayload
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.EditLabelOfAnExistingVMPayload() # EditLabelOfAnExistingVMPayload | 

    try:
        # Edit virtual machine labels
        api_response = api_instance.add_vm_label(vm_id, payload)
        print("The response of VirtualMachineApi->add_vm_label:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->add_vm_label: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload EditLabelOfAnExistingVMPayload

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Labels edited successfully -
400 Bad Request -
401 Unauthorized -
404 Not Found -
409 Conflict -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

attach_firewalls_to_vm

ResponseModel attach_firewalls_to_vm(vm_id, payload)

Attach firewalls to a virtual machine

Attach firewalls to a virtual machine by providing the virtual machine ID in the path and the IDs of the firewalls in the request body; any firewalls not included will be detached.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.attach_firewalls_to_vm_payload import AttachFirewallsToVMPayload
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.AttachFirewallsToVMPayload() # AttachFirewallsToVMPayload | 

    try:
        # Attach firewalls to a virtual machine
        api_response = api_instance.attach_firewalls_to_vm(vm_id, payload)
        print("The response of VirtualMachineApi->attach_firewalls_to_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->attach_firewalls_to_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload AttachFirewallsToVMPayload

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

check_vm_name_availability

NameAvailableModel check_vm_name_availability(name, count=count)

Fetch virtual machine name availability

Check if a Virtual Machine name is available

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.name_available_model import NameAvailableModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    name = 'name_example' # str | 
    count = 'count_example' # str | Nr of instances to handle (optional, default: 1) (optional)

    try:
        # Fetch virtual machine name availability
        api_response = api_instance.check_vm_name_availability(name, count=count)
        print("The response of VirtualMachineApi->check_vm_name_availability:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->check_vm_name_availability: %s\n" % e)

Parameters

Name Type Description Notes
name str
count str Nr of instances to handle (optional, default: 1) [optional]

Return type

NameAvailableModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_firewall_rule_for_vm

SecurityGroupRule create_firewall_rule_for_vm(vm_id, payload)

Add firewall rule to virtual machine

Creates a firewall rule for a virtual machine. Include the virtual machine ID in the path, and provide the firewall rule configuration in the request body, as detailed below. For additional information on firewall rules, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.create_security_rule_payload import CreateSecurityRulePayload
from hyperstack.models.security_group_rule import SecurityGroupRule
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.CreateSecurityRulePayload() # CreateSecurityRulePayload | 

    try:
        # Add firewall rule to virtual machine
        api_response = api_instance.create_firewall_rule_for_vm(vm_id, payload)
        print("The response of VirtualMachineApi->create_firewall_rule_for_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->create_firewall_rule_for_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload CreateSecurityRulePayload

Return type

SecurityGroupRule

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The firewall rule has been successfully added to the virtual machine. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
409 Conflict -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_snapshot_for_vm

CreateSnapshotResponse create_snapshot_for_vm(vm_id, payload)

Create snapshot from a virtual machine

Create snapshots of a virtual machine by providing the virtual machine ID in the path

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.create_snapshot_payload import CreateSnapshotPayload
from hyperstack.models.create_snapshot_response import CreateSnapshotResponse
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.CreateSnapshotPayload() # CreateSnapshotPayload | 

    try:
        # Create snapshot from a virtual machine
        api_response = api_instance.create_snapshot_for_vm(vm_id, payload)
        print("The response of VirtualMachineApi->create_snapshot_for_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->create_snapshot_for_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload CreateSnapshotPayload

Return type

CreateSnapshotResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Success -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_vms

CreateInstancesResponse create_vms(payload)

Create virtual machines

Creates one or more virtual machines with the specified custom configuration and features provided in the request body. For more information about the virtual machine features offered by Infrahub, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.create_instances_payload import CreateInstancesPayload
from hyperstack.models.create_instances_response import CreateInstancesResponse
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    payload = hyperstack.CreateInstancesPayload() # CreateInstancesPayload | 

    try:
        # Create virtual machines
        api_response = api_instance.create_vms(payload)
        print("The response of VirtualMachineApi->create_vms:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->create_vms: %s\n" % e)

Parameters

Name Type Description Notes
payload CreateInstancesPayload

Return type

CreateInstancesResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine(s) created successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_firewall_rule_for_vm

ResponseModel delete_firewall_rule_for_vm(vm_id, sg_rule_id)

Delete firewall rule from virtual machine

Deletes a firewall rule associated with a virtual machine. Provide the virtual machine ID and the firewall rule ID in the path to remove the specified rule from the specified virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    sg_rule_id = 56 # int | 

    try:
        # Delete firewall rule from virtual machine
        api_response = api_instance.delete_firewall_rule_for_vm(vm_id, sg_rule_id)
        print("The response of VirtualMachineApi->delete_firewall_rule_for_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->delete_firewall_rule_for_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
sg_rule_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The firewall rule has been successfully removed from the virtual machine. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_vm

ResponseModel delete_vm(vm_id)

Delete virtual machine

Permanently deletes a virtual machine. Provide the virtual machine ID in the path to delete the specified virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Delete virtual machine
        api_response = api_instance.delete_vm(vm_id)
        print("The response of VirtualMachineApi->delete_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->delete_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine deleted successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
409 Conflict -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_contract_vms

ContractInstancesResponse get_contract_vms(contract_id, page=page, page_size=page_size, search=search)

Retrieve virtual machines associated with a contract

Retrieves a list of virtual machines associated with a contract, providing details such as virtual machine name, timestamp, flavor name, and other relevant information. Please provide the ID of the relevant contract in the path.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.contract_instances_response import ContractInstancesResponse
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    contract_id = 56 # int | 
    page = 'page_example' # str | Page Number (optional)
    page_size = 'page_size_example' # str | Data Per Page (optional)
    search = 'search_example' # str | Search By Instance ID or Name (optional)

    try:
        # Retrieve virtual machines associated with a contract
        api_response = api_instance.get_contract_vms(contract_id, page=page, page_size=page_size, search=search)
        print("The response of VirtualMachineApi->get_contract_vms:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->get_contract_vms: %s\n" % e)

Parameters

Name Type Description Notes
contract_id int
page str Page Number [optional]
page_size str Data Per Page [optional]
search str Search By Instance ID or Name [optional]

Return type

ContractInstancesResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_vm

Instance get_vm(vm_id)

Retrieve virtual machine details

Retrieves the details of an existing virtual machine. Provide the virtual machine ID in the path, and Infrahub will return information about the corresponding VM.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.instance import Instance
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Retrieve virtual machine details
        api_response = api_instance.get_vm(vm_id)
        print("The response of VirtualMachineApi->get_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->get_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

Instance

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine details retrieved successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_vm_logs

GetInstanceLogsResponse get_vm_logs(vm_id, request_id)

Get virtual machine logs

Retrieve console logs for a virtual machine

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.get_instance_logs_response import GetInstanceLogsResponse
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    request_id = 56 # int | 

    try:
        # Get virtual machine logs
        api_response = api_instance.get_vm_logs(vm_id, request_id)
        print("The response of VirtualMachineApi->get_vm_logs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->get_vm_logs: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
request_id int

Return type

GetInstanceLogsResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Logs were successfully retrieved -
400 Bad Request -
401 Unauthorized -
404 Not Found -
405 Method Not Allowed -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_vm_metrics

MetricsFields get_vm_metrics(vm_id, duration=duration)

Retrieve virtual machine performance metrics

Retrieves performance metrics data for a virtual machine. Provide the virtual machine ID in the path to retrieve the following data for the specified virtual machine: CPU usage, memory usage (RAM), network.in, network.out, disk.read, and disk.write. The optional duration parameter can be used to specify the period for retrieving performance metrics; the default value will retrieve all available data. To learn more about virtual machine performance metrics, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.metrics_fields import MetricsFields
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    duration = 'duration_example' # str |  (optional)

    try:
        # Retrieve virtual machine performance metrics
        api_response = api_instance.get_vm_metrics(vm_id, duration=duration)
        print("The response of VirtualMachineApi->get_vm_metrics:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->get_vm_metrics: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
duration str [optional]

Return type

MetricsFields

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine performance metrics have been successfully retrieved. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
406 Not Acceptable -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hard_reboot_vm

ResponseModel hard_reboot_vm(vm_id)

Hard reboot virtual machine

Initiates a hard reboot for a virtual machine, simulating the process of unplugging and rebooting a physical machine. Provide the virtual machine ID in the path to execute a hard reboot for the specified virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Hard reboot virtual machine
        api_response = api_instance.hard_reboot_vm(vm_id)
        print("The response of VirtualMachineApi->hard_reboot_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->hard_reboot_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Hard reboot process has been successfully initiated. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hibernate_vm

ResponseModel hibernate_vm(vm_id, retain_ip=retain_ip)

Hibernate virtual machine

Initiates the hibernation of a virtual machine, saving its current state to disk before powering off. Provide the virtual machine ID in the path to specify the virtual machine to be hibernated.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    retain_ip = 'retain_ip_example' # str | false (optional)

    try:
        # Hibernate virtual machine
        api_response = api_instance.hibernate_vm(vm_id, retain_ip=retain_ip)
        print("The response of VirtualMachineApi->hibernate_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->hibernate_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
retain_ip str false [optional]

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Hibernation request for the virtual machine was successful. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_vms

Instances list_vms(page=page, page_size=page_size, search=search, environment=environment, exclude_firewalls=exclude_firewalls, exact_environment_match=exact_environment_match)

List virtual machines

Returns a list of your existing virtual machines, providing configuration details for each. The list is sorted by creation date, with the oldest virtual machines displayed first.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.instances import Instances
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    page = 56 # int |  (optional)
    page_size = 56 # int |  (optional)
    search = 'search_example' # str |  (optional)
    environment = 'environment_example' # str |  (optional)
    exclude_firewalls = [56] # List[int] | Comma-separated list of Security Group IDs to ignore instances attached (optional)
    exact_environment_match = False # bool | Flag to filter environment by exact match instead of partial match (optional) (default to False)

    try:
        # List virtual machines
        api_response = api_instance.list_vms(page=page, page_size=page_size, search=search, environment=environment, exclude_firewalls=exclude_firewalls, exact_environment_match=exact_environment_match)
        print("The response of VirtualMachineApi->list_vms:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->list_vms: %s\n" % e)

Parameters

Name Type Description Notes
page int [optional]
page_size int [optional]
search str [optional]
environment str [optional]
exclude_firewalls List[int] Comma-separated list of Security Group IDs to ignore instances attached [optional]
exact_environment_match bool Flag to filter environment by exact match instead of partial match [optional] [default to False]

Return type

Instances

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

request_vm_logs

RequestInstanceLogsResponse request_vm_logs(vm_id, payload)

Request virtual machine logs

Request console logs for a virtual machine

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.request_instance_logs_payload import RequestInstanceLogsPayload
from hyperstack.models.request_instance_logs_response import RequestInstanceLogsResponse
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.RequestInstanceLogsPayload() # RequestInstanceLogsPayload | 

    try:
        # Request virtual machine logs
        api_response = api_instance.request_vm_logs(vm_id, payload)
        print("The response of VirtualMachineApi->request_vm_logs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->request_vm_logs: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload RequestInstanceLogsPayload

Return type

RequestInstanceLogsResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Logs were successfully requested -
400 Bad Request -
401 Unauthorized -
404 Not Found -
405 Method Not Allowed -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

resize_vm

ResponseModel resize_vm(vm_id, payload)

Resize virtual machine

Updates the hardware configuration for an existing virtual machine. Include the virtual machine ID in the path and provide the new configuration, referred to as a flavor, in the body of the request. For additional information resizing, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.instance_resize_payload import InstanceResizePayload
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.InstanceResizePayload() # InstanceResizePayload | 

    try:
        # Resize virtual machine
        api_response = api_instance.resize_vm(vm_id, payload)
        print("The response of VirtualMachineApi->resize_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->resize_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int
payload InstanceResizePayload

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The resizing of the virtual machine configuration was successful. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
405 Method Not Allowed -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

restore_vm_from_hibernation

ResponseModel restore_vm_from_hibernation(vm_id)

Restore virtual machine from hibernation

Resumes a virtual machine from hibernation, bringing it back to an active state. Provide the virtual machine ID that you want to restore from hibernation.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Restore virtual machine from hibernation
        api_response = api_instance.restore_vm_from_hibernation(vm_id)
        print("The response of VirtualMachineApi->restore_vm_from_hibernation:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->restore_vm_from_hibernation: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The request to restore the virtual machine from hibernation was successful. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

start_vm

ResponseModel start_vm(vm_id)

Start virtual machine

Initiates the startup of a virtual machine. Provide the virtual machine ID in the path to initiate the starting of the specified virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Start virtual machine
        api_response = api_instance.start_vm(vm_id)
        print("The response of VirtualMachineApi->start_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->start_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine started successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

stop_vm

ResponseModel stop_vm(vm_id)

Stop virtual machine

Shuts down a virtual machine. Provide the virtual machine ID in the path to initiate the shutdown process for the specified virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.VirtualMachineApi(api_client)
    vm_id = 56 # int | 

    try:
        # Stop virtual machine
        api_response = api_instance.stop_vm(vm_id)
        print("The response of VirtualMachineApi->stop_vm:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VirtualMachineApi->stop_vm: %s\n" % e)

Parameters

Name Type Description Notes
vm_id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Virtual machine shut down successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]