ByCloud Docs
GuidesCLIAPISDK

PHP SDK

Compute

Virtual machines, flavors, images, and keypairs

18 methods

GET

listFlavors()

List flavors

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

min_ram

integer

- Filter by minimum RAM (MB)

min_disk

integer

- Filter by minimum disk (GB)

min_vcpus

integer

- Filter by minimum vCPUs

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->listFlavors();
print_r($result);
GET

getFlavor()

Get flavor

Parameters

flavor_id

string

required

- Flavor ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->getFlavor([
'flavor_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listImages()

List images

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

tags

string

- Filter by tags (comma-separated)

visibility

string

- Filter by visibility

os_distro

string

- Filter by OS distribution

os_version

string

- Filter by OS version

architecture

string

- Filter by architecture

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->listImages();
print_r($result);
GET

getImage()

Get image

Parameters

image_id

string

required

- Image ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->getImage([
'image_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listInstances()

List instances

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

tags

string

- Filter by tags (comma-separated)

flavor_id

string

- Filter by flavor ID

image_id

string

- Filter by image ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->listInstances();
print_r($result);
POST

createInstance()

Create instance

Parameters

name

string

required
description

string

flavor_id

string

required

- Flavor ID

image_id

string

- Image ID (required if not booting from volume)

key_names

array

- SSH keypair names to authorize on the instance

security_groups

array

- Security group names or IDs

networks

array

- Networks to attach

assign_public_ip

boolean

- Assign a public IP address to the instance

volumes

array

- Volume attachments for boot from volume

metadata

object

tags

array

user_data

string

- Base64-encoded user data (cloud-init)

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->createInstance([
'name' => 'web-server-01',
'flavor_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

getInstance()

Get instance

Parameters

instance_id

string

required

- Instance ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->getInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
PATCH

updateInstance()

Update instance

Parameters

instance_id

string

required

- Instance ID

name

string

description

string

metadata

object

tags

array

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->updateInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
DELETE

deleteInstance()

Delete instance

Parameters

instance_id

string

required

- Instance ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->deleteInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

getInstanceConsole()

Get instance console

Parameters

instance_id

string

required

- Instance ID

type

string

- Console type

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->getInstanceConsole([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

rebootInstance()

Reboot instance

Parameters

instance_id

string

required

- Instance ID

type

string

- Reboot type

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->rebootInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

resizeInstance()

Resize instance

Parameters

instance_id

string

required

- Instance ID

flavor_id

string

required

- New flavor ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->resizeInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000',
'flavor_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

startInstance()

Start instance

Parameters

instance_id

string

required

- Instance ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->startInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
POST

stopInstance()

Stop instance

Parameters

instance_id

string

required

- Instance ID

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->stopInstance([
'instance_id' => '550e8400-e29b-41d4-a716-446655440000'
]);
print_r($result);
GET

listKeypairs()

List keypairs

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->listKeypairs();
print_r($result);
POST

createKeypair()

Create keypair

Parameters

name

string

required
public_key

string

- SSH public key (if not provided, a new keypair will be generated)

type

string

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->createKeypair([
'name' => 'my-keypair'
]);
print_r($result);
GET

getKeypair()

Get keypair

Parameters

keypair_name

string

required

- Keypair name

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->getKeypair([
'keypair_name' => 'example'
]);
print_r($result);
DELETE

deleteKeypair()

Delete keypair

Parameters

keypair_name

string

required

- Keypair name

Example

<?php
use ByCloud\SDK\ByCloud;
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);
$result = $client->compute->deleteKeypair([
'keypair_name' => 'example'
]);
print_r($result);