InstanceService
extends VultrService
in package
Instance service handler, for all instances endpoints.
Tags
Table of Contents
Constants
- FILTER_LABEL = 'label'
- FILTER_MAIN_IP = 'main_ip'
- FILTER_REGION = 'region'
Properties
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
FILTER_LABEL
public
mixed
FILTER_LABEL
= 'label'
FILTER_MAIN_IP
public
mixed
FILTER_MAIN_IP
= 'main_ip'
FILTER_REGION
public
mixed
FILTER_REGION
= 'region'
Properties
$vultr
protected
VultrClient
$vultr
$client
private
VultrClientHandler
$client
Methods
__construct()
public
__construct(VultrClient $vultr, VultrClientHandler $client) : mixed
Parameters
- $vultr : VultrClient
- $client : VultrClientHandler
attachIsoToInstance()
Attach an iso to an instance. This will cause a reboot.
public
attachIsoToInstance( $id, $iso_id) : IsoStatus
Parameters
Tags
Return values
IsoStatusattachVPC()
Attach a vpc network to an instance.
public
attachVPC( $id, $vpc_id) : void
Parameters
- $id :
-
- string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $vpc_id :
-
- string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
Tags
createInstance()
Create a new vps instance in a region with the desired plan and image.
public
createInstance( $create) : Instance
Parameters
Tags
Return values
InstancecreateIPv4Address()
Create an ipv4 address and attach to the instance.
public
createIPv4Address( $id[, $reboot = true ]) : InstanceIPv4Info
Parameters
Tags
Return values
InstanceIPv4InfocreateReverseIPv4Address()
public
createReverseIPv4Address( $id, $ip, $reverse) : void
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $ip :
-
- string - Example: 127.0.0.1
- $reverse :
-
- string - Example: foo.example.com
Tags
createReverseIPv6Address()
public
createReverseIPv6Address( $id, $ipv6, $reverse) : void
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $ipv6 :
-
- string - Example: 2001:0db8:0005:6bb0:5400:2ff0:fee5:0002
- $reverse :
-
- string - Example: foo.example.com
Tags
deleteInstance()
Delete an instance on the account.
public
deleteInstance( $id) : void
Parameters
Tags
deleteIPv4Address()
Delete and detach an ipv4 address from the instance.
public
deleteIPv4Address( $id, $ip) : void
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $ip :
-
- string - Example: 127.0.0.1
Tags
deleteReverseIPv6Address()
public
deleteReverseIPv6Address( $id, $ipv6) : void
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $ipv6 :
-
- string - Example: 2001:0db8:0005:6bb0:5400:2ff0:fee5:0002
Tags
detachIsoFromInstance()
Detach an iso from an instance. This will cause a reboot.
public
detachIsoFromInstance( $id) : IsoStatus
Parameters
Tags
Return values
IsoStatusdetachVPC()
Detach a vpc network from an instance.
public
detachVPC( $id, $vpc_id) : void
Parameters
- $id :
-
- string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $vpc_id :
-
- string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
Tags
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
Return values
array<string|int, \Vultr\VultrPhp\Services\OperatingSystems\OperatingSystem|\Vultr\VultrPhp\Services\Applications\Application|\Vultr\VultrPhp\Services\Instances\VPSPlan>getBackupSchedule()
Get the backup schedule for an instance on the account.
public
getBackupSchedule( $id) : BackupSchedule
Parameters
Tags
Return values
BackupSchedulegetBandwidth()
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
Tags
Return values
array<string|int, mixed>getInstance()
Retrieve a specific instance on the account.
public
getInstance( $id) : Instance
Parameters
Tags
Return values
InstancegetInstances()
Get vps instances on the account.
public
getInstances([ $filters = null ][, &$options = null ]) : array<string|int, Instance>
Parameters
- $filters : = null
-
- array|null - ENUM(FILTER_LABEL, FILTER_MAIN_IP, FILTER_REGION)
- $options : = null
-
- ListOptions|null - Interact via reference.
Tags
Return values
array<string|int, Instance>getIPv4Addresses()
Get IPV4 Address information on the instance.
public
getIPv4Addresses( $id[, &$options = null ]) : array<string|int, InstanceIPv4Info>
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $options : = null
-
- ListOptions|null - Interact via reference.
Tags
Return values
array<string|int, InstanceIPv4Info>getIPv6Addresses()
Get IPV6 address information on the instance.
public
getIPv6Addresses( $id) : array<string|int, InstanceIPv6Info>
Parameters
Tags
Return values
array<string|int, InstanceIPv6Info>getIsoStatus()
Get the iso mount status on an instance.
public
getIsoStatus( $id) : IsoStatus
Parameters
Tags
Return values
IsoStatusgetNeighbors()
Get neighboring instances that live on the same host machine as this instance.
public
getNeighbors( $id) : array<string|int, mixed>
Parameters
Tags
Return values
array<string|int, mixed>getReverseIPv6Addresses()
public
getReverseIPv6Addresses( $id) : array<string|int, InstanceReverseIPv6>
Parameters
Tags
Return values
array<string|int, InstanceReverseIPv6>getUserData()
Get the user data for an instance decoded from base64.
public
getUserData( $id) : string
Parameters
Tags
Return values
stringgetVPCs()
Get a list of attach vpc's attached to this instance.
public
getVPCs( $id[, &$options = null ]) : array<string|int, mixed>
Parameters
- $id :
-
- string - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $options : = null
-
- ListOptions|null - Interact via reference.
Tags
Return values
array<string|int, mixed>haltInstance()
Halt a specific instance on the account.
public
haltInstance( $id) : void
Parameters
Tags
haltInstances()
Halt an array of instances on the account.
public
haltInstances( $ids) : void
Parameters
Tags
rebootInstance()
Reboot a specific instance on the account.
public
rebootInstance( $id) : void
Parameters
Tags
rebootInstances()
Reboot an array of instances on the account.
public
rebootInstances( $ids) : void
Parameters
- $ids :
-
- array - Example: ['cb676a46-66fd-4dfb-b839-443f2e6c0b60', 'cb676a46-22fd-4dfb-b839-443f2e6c0b60']
Tags
reinstallInstance()
Reinstall an instance. This may take a few extra seconds to complete.
public
reinstallInstance( $id[, string|null $hostname = null ]) : Instance
Parameters
Tags
Return values
InstancerestoreInstance()
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
setBackupSchedule()
Set the backup schedule for an instance in UTC.
public
setBackupSchedule( $id, $backup) : void
Parameters
Tags
setDefaultIPv4ReverseDNSEntry()
public
setDefaultIPv4ReverseDNSEntry( $id, $ip) : void
Parameters
- $id :
-
- string - Instance Id - Example: cb676a46-66fd-4dfb-b839-443f2e6c0b60
- $ip :
-
- string - Example: 127.0.0.1
Tags
startInstance()
Start a specific instance on the account.
public
startInstance( $id) : void
Parameters
Tags
startInstances()
Start a group of instances on the account.
public
startInstances( $ids) : void
Parameters
- $ids :
-
- array - Example: ['cb676a46-66fd-4dfb-b839-443f2e6c0b60', 'cb676a46-22fd-4dfb-b839-443f2e6c0b60']
Tags
updateInstance()
Update all information for an instance. All attributes are optional. If not set, the attributes will not be sent to the api.
public
updateInstance( $id, $update) : Instance
Parameters
Tags
Return values
InstancecreateObject()
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
Return values
ModelInterfacedeleteObject()
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
getClientHandler()
protected
getClientHandler() : VultrClientHandler
Return values
VultrClientHandlergetListObjects()
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
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
Return values
ModelInterfacegetVultrClient()
protected
getVultrClient() : VultrClient
Return values
VultrClientlist()
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
getReadableClassType()
private
getReadableClassType(ModelInterface $model) : string
Parameters
- $model : ModelInterface
Return values
stringmultipleInstancesAction()
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