Skip to content

Latest commit

 

History

History
270 lines (189 loc) · 9.43 KB

File metadata and controls

270 lines (189 loc) · 9.43 KB

hyperstack.VolumeAttachmentApi

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

Method HTTP request Description
attach_volumes_to_vm POST /core/virtual-machines/{vm_id}/attach-volumes Attach volumes to virtual machine
detach_volumes_from_vm POST /core/virtual-machines/{vm_id}/detach-volumes Detach volumes from virtual machine
update_volume_attachment PATCH /core/volume-attachments/{volume_attachment_id} Update a volume attachment

attach_volumes_to_vm

AttachVolumes attach_volumes_to_vm(vm_id, payload)

Attach volumes to virtual machine

Attaches one or more volumes to an existing virtual machine, expanding its storage capacity by 2PB per attached volume. Include the VM ID in the path and the volume IDs in the request body to attach the specified volumes. For more detailson volume attachment, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.attach_volumes import AttachVolumes
from hyperstack.models.attach_volumes_payload import AttachVolumesPayload
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.VolumeAttachmentApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.AttachVolumesPayload() # AttachVolumesPayload | 

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

Parameters

Name Type Description Notes
vm_id int
payload AttachVolumesPayload

Return type

AttachVolumes

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Volumes have been successfully attached to the virtual machine. -
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]

detach_volumes_from_vm

DetachVolumes detach_volumes_from_vm(vm_id, payload)

Detach volumes from virtual machine

Detaches one or more volumes attached to an existing virtual machine. Include the VM ID in the path and volume IDs in the request body to detach the specified volumes from the virtual machine.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.detach_volumes import DetachVolumes
from hyperstack.models.detach_volumes_payload import DetachVolumesPayload
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.VolumeAttachmentApi(api_client)
    vm_id = 56 # int | 
    payload = hyperstack.DetachVolumesPayload() # DetachVolumesPayload | 

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

Parameters

Name Type Description Notes
vm_id int
payload DetachVolumesPayload

Return type

DetachVolumes

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Volumes have been successfully detached from the virtual machine. -
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]

update_volume_attachment

AttachVolumes update_volume_attachment(volume_attachment_id, payload)

Update a volume attachment

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.attach_volumes import AttachVolumes
from hyperstack.models.update_volume_attachment_payload import UpdateVolumeAttachmentPayload
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.VolumeAttachmentApi(api_client)
    volume_attachment_id = 56 # int | 
    payload = hyperstack.UpdateVolumeAttachmentPayload() # UpdateVolumeAttachmentPayload | 

    try:
        # Update a volume attachment
        api_response = api_instance.update_volume_attachment(volume_attachment_id, payload)
        print("The response of VolumeAttachmentApi->update_volume_attachment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VolumeAttachmentApi->update_volume_attachment: %s\n" % e)

Parameters

Name Type Description Notes
volume_attachment_id int
payload UpdateVolumeAttachmentPayload

Return type

AttachVolumes

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Volume attachment has been updated -
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]