-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample_ninefold2.php
31 lines (23 loc) · 1.33 KB
/
example_ninefold2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require('CloudStack/cloudStack.php');
$apiUrl = 'https://api.ninefold.com/compute/v2.0'; //Ninefold's API Point
$api_key = 'yourkey';
$api_secret = 'yoursecret';
$ninefold = new cloudStack($apiUrl, $api_key, $api_secret);
//You can ask the wrapper to only return the signed request so you can do what you like with it or test it out
$ninefold->return_signed_only = true;
//It is set to true, so all subsequent $ninefold-> actions will return a URL only and not actually cURL the results for you.
//listProjects
$ninefold->execute_command('listProjects');
//List All my VMs in Ninefold 2 (Requires you pass projectid)
$ninefold->execute_command('listVirtualMachines', array('projectid' =>'<yourProjectID>'));
//Execute Command - The wrapper has a lot of functions already prebuilt, but you can use this to extend it dynamically and let the wrapper handle the signing and execution.
$ninefold->execute_command('updateVirtualMachine', array('id' => 1));
//Execute Command Method compared with Defined Method
/** Creating a Volume **/
$ninefold->createVolume('My New Volume');
$ninefold->execute_command('createVolume', array('name' => 'My New Volume'));
/** Both above commands will do the exact same thing **/
//Forget what the wrapper can or can't do? Execute this or check cloudStack.php
listCloudStackMethods();
?>