Skip to content

Latest commit

 

History

History
110 lines (70 loc) · 3.36 KB

File metadata and controls

110 lines (70 loc) · 3.36 KB

HyperstackApi.FloatingIpApi

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

Method HTTP request Description
attachPublicIPToVM POST /core/virtual-machines/{vm_id}/attach-floatingip Attach public IP to virtual machine
detachPublicIPFromVM POST /core/virtual-machines/{vm_id}/detach-floatingip Detach public IP from virtual machine

attachPublicIPToVM

ResponseModel attachPublicIPToVM(vmId)

Attach public IP to virtual machine

Initiates the creation of a public IP address and attaches it to an existing virtual machine, making it accessible through the internet. Include the virtual machine ID in the path to attach a public IP to the specified VM. For more information on public IP addresses, click here.

Example

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.FloatingIpApi();
let vmId = 56; // Number | 
apiInstance.attachPublicIPToVM(vmId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
vmId Number

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

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

detachPublicIPFromVM

ResponseModel detachPublicIPFromVM(vmId)

Detach public IP from virtual machine

Removes a public IP address from an existing virtual machine, disabling internet accessibility to the VM. Include the virtual machine ID in the path to detach the public IP from the specified VM. For more information on public IP addresses, click here.

Example

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.FloatingIpApi();
let vmId = 56; // Number | 
apiInstance.detachPublicIPFromVM(vmId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
vmId Number

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

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