Documentation

InstanceService extends VultrService
in package

Instance service handler, for all instances endpoints.

Tags
see
https://www.vultr.com/api/#tag/instances

Table of Contents

Constants

FILTER_LABEL  = 'label'
FILTER_MAIN_IP  = 'main_ip'
FILTER_REGION  = 'region'

Properties

$vultr  : VultrClient
$client  : VultrClientHandler

Methods

__construct()  : mixed
attachIsoToInstance()  : IsoStatus
Attach an iso to an instance. This will cause a reboot.
attachVPC()  : void
Attach a vpc network to an instance.
createInstance()  : Instance
Create a new vps instance in a region with the desired plan and image.
createIPv4Address()  : InstanceIPv4Info
Create an ipv4 address and attach to the instance.
createReverseIPv4Address()  : void
createReverseIPv6Address()  : void
deleteInstance()  : void
Delete an instance on the account.
deleteIPv4Address()  : void
Delete and detach an ipv4 address from the instance.
deleteReverseIPv6Address()  : void
detachIsoFromInstance()  : IsoStatus
Detach an iso from an instance. This will cause a reboot.
detachVPC()  : void
Detach a vpc network from an instance.
getAvailableUpgrades()  : array<string|int, \Vultr\VultrPhp\Services\OperatingSystems\OperatingSystem|\Vultr\VultrPhp\Services\Applications\Application|\Vultr\VultrPhp\Services\Instances\VPSPlan>
Get available plan upgrades for an instance in the region.
getBackupSchedule()  : BackupSchedule
Get the backup schedule for an instance on the account.
getBandwidth()  : array<string|int, mixed>
Get bandwidth information about an instance.
getInstance()  : Instance
Retrieve a specific instance on the account.
getInstances()  : array<string|int, Instance>
Get vps instances on the account.
getIPv4Addresses()  : array<string|int, InstanceIPv4Info>
Get IPV4 Address information on the instance.
getIPv6Addresses()  : array<string|int, InstanceIPv6Info>
Get IPV6 address information on the instance.
getIsoStatus()  : IsoStatus
Get the iso mount status on an instance.
getNeighbors()  : array<string|int, mixed>
Get neighboring instances that live on the same host machine as this instance.
getReverseIPv6Addresses()  : array<string|int, InstanceReverseIPv6>
getUserData()  : string
Get the user data for an instance decoded from base64.
getVPCs()  : array<string|int, mixed>
Get a list of attach vpc's attached to this instance.
haltInstance()  : void
Halt a specific instance on the account.
haltInstances()  : void
Halt an array of instances on the account.
rebootInstance()  : void
Reboot a specific instance on the account.
rebootInstances()  : void
Reboot an array of instances on the account.
reinstallInstance()  : Instance
Reinstall an instance. This may take a few extra seconds to complete.
restoreInstance()  : void
Restore an instance.
setBackupSchedule()  : void
Set the backup schedule for an instance in UTC.
setDefaultIPv4ReverseDNSEntry()  : void
startInstance()  : void
Start a specific instance on the account.
startInstances()  : void
Start a group of instances on the account.
updateInstance()  : Instance
Update all information for an instance. All attributes are optional. If not set, the attributes will not be sent to the api.
createObject()  : ModelInterface
deleteObject()  : void
getClientHandler()  : VultrClientHandler
getListObjects()  : array<string|int, ModelInterface>
getObject()  : ModelInterface
getVultrClient()  : VultrClient
list()  : array<string|int, mixed>
patchObject()  : void
getReadableClassType()  : string
multipleInstancesAction()  : void
singleInstanceAction()  : void

Constants

Properties

Methods

getAvailableUpgrades()

Get available plan upgrades for an instance in the region.

public getAvailableUpgrades( $id[,  $type = 'all' ]) : array<string|int, \Vultr\VultrPhp\Services\OperatingSystems\OperatingSystem|\Vultr\VultrPhp\Services\Applications\Application|\Vultr\VultrPhp\Services\Instances\VPSPlan>
Parameters
$id :
  • string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
$type : = 'all'
  • string - filter based on upgrade types.
Tags
see
https://www.vultr.com/api/#operation/get-instance-upgrades
throws
InstanceException
Return values
array<string|int, \Vultr\VultrPhp\Services\OperatingSystems\OperatingSystem|\Vultr\VultrPhp\Services\Applications\Application|\Vultr\VultrPhp\Services\Instances\VPSPlan>

getBandwidth()

Get bandwidth information about an instance.

public getBandwidth( $id) : array<string|int, mixed>

The structure of the array will follow this format. ['2022-11-05' => ['incoming_bytes' => 234523452352, 'outgoing_bytes' => 132432423]]

Parameters
$id :
  • string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
Tags
see
https://www.vultr.com/api/#operation/get-instance-bandwidth
throws
InstanceException
throws
VultrException
Return values
array<string|int, mixed>

restoreInstance()

Restore an instance.

public restoreInstance( $id[,  $snapshot_id = null ][,  $backup_id = null ]) : void

$snapshot_id or $backup_id must be specified. But they both cannot be specified. The actual response from the api returns an object. But its pointless as you have already fed in the parameters and it feeds it them back to you. The status doesn't mean anything to act off from the response. While your instance is restoring use getInstance to view its status.

Parameters
$id :
  • string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
$snapshot_id : = null
  • string|null
$backup_id : = null
  • string|null
Tags
see
https://www.vultr.com/api/#operation/restore-instance
throws
InstanceException

createObject()

protected createObject( $uri,  $model,  $params) : ModelInterface
Parameters
$uri :
  • string - the url address to query after api.vultr.com/v2
$model :
  • ModelInterface - the object model that we are creating
$params :
  • array - The values that we will be sending. Refactor to use getUpdateParams/getUpdateArray?
Tags
throws
Child

of VultrServiceObject

Return values
ModelInterface

deleteObject()

protected deleteObject( $uri,  $model) : void
Parameters
$uri :
  • string - the url address to query after api.vultr.com/v2
$model :
  • ModelInterface - the object model that we are acting on deleting. This doesn't need to be a fully initialized object.
Tags
throws
Child

of VultrServiceObject

getListObjects()

protected getListObjects( $uri,  $model[,  &$options = null ][,  $params = null ]) : array<string|int, ModelInterface>
Parameters
$uri :
  • string - the url address to query after api.vultr.com/v2
$model :
  • ModelInterface - the object that will be mapped to the get response.
$options : = null
  • ListOptions - Pagination object
$params : = null
  • array - filter parameters.
Tags
throws
Child

of VultrServiceObject

Return values
array<string|int, ModelInterface>

getObject()

protected getObject( $uri,  $model) : ModelInterface
Parameters
$uri :
  • string - the url address to query after api.vultr.com/v2
$model :
  • ModelInterface - the object that will be mapped to the get response.
Tags
throws
Child

of VultrServiceObject

Return values
ModelInterface

list()

protected list(string $uri, ModelInterface $model, ListOptions &$options[, array<string|int, mixed>|null $params = null ]) : array<string|int, mixed>
Parameters
$uri : string
$model : ModelInterface
$options : ListOptions
$params : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

patchObject()

protected patchObject( $uri,  $model[, array<string|int, mixed>|null $params = null ]) : void
Parameters
$uri :
  • string - the url address to query after api.vultr.com/v2
$model :
  • ModelInterface - the object model that we are updating. This needs to be a fully initialized object.
$params : array<string|int, mixed>|null = null
Tags
throws
Child

of VultrServiceObject

multipleInstancesAction()

private multipleInstancesAction(string $action, array<string|int, mixed> $ids) : void
Parameters
$action : string
$ids : array<string|int, mixed>

singleInstanceAction()

private singleInstanceAction(string $action, string $id) : void
Parameters
$action : string
$id : string

        
On this page

Search results