Documentation

PlanService extends VultrService
in package

Plan service handler, for all plans endpoints.

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

Table of Contents

Constants

FILTER_ALL  = 'all'
FILTER_VBM  = 'vbm'
FILTER_VC2  = 'vc2'
FILTER_VCG  = 'vcg'
FILTER_VDC  = 'vdc'
FILTER_VHF  = 'vhf'
FILTER_VOC  = 'voc'
FILTER_VOCC  = 'voc-c'
FILTER_VOCG  = 'voc-g'
FILTER_VOCM  = 'voc-m'
FILTER_VOCS  = 'voc-s'
FILTER_WINDOWS  = 'windows'

Properties

$vultr  : VultrClient
$cache_plans  : array<string|int, mixed>|null
$client  : VultrClientHandler

Methods

__construct()  : mixed
cachePlans()  : void
Query and cache all plans from the vultr api.
getBMPlans()  : array<string|int, BMPlan>
Get baremetal plans that are available at vultr.
getPlan()  : VPSPlan|BMPlan|null
Get a specific plan vps or baremetal plan from the static cache.
getVPSPlans()  : array<string|int, VPSPlan>
Get vps plans that are available at vultr.
createObject()  : ModelInterface
deleteObject()  : void
getClientHandler()  : VultrClientHandler
getListObjects()  : array<string|int, ModelInterface>
getObject()  : ModelInterface
getVultrClient()  : VultrClient
list()  : array<string|int, mixed>
patchObject()  : void
getReadableClassType()  : string
setPlanLocations()  : void

Constants

FILTER_WINDOWS

public mixed FILTER_WINDOWS = 'windows'

Properties

$cache_plans

private static array<string|int, mixed>|null $cache_plans = null

Methods

cachePlans()

Query and cache all plans from the vultr api.

public cachePlans([ $override = false ]) : void
Parameters
$override : = false
  • bool - Depending on whether to requery the plans.
Tags
throws
PlanException

getPlan()

Get a specific plan vps or baremetal plan from the static cache.

public getPlan( $id) : VPSPlan|BMPlan|null
Parameters
$id :
  • string - Ex vc2-1c-1gb - This can be a vps plan id or a baremetal plan id.
Tags
throws
PlanException
Return values
VPSPlan|BMPlan|null

getVPSPlans()

Get vps plans that are available at vultr.

public getVPSPlans([ $type = null ][,  $os = null ][,  &$options = null ]) : array<string|int, VPSPlan>
Parameters
$type : = null
  • string|null - FILTER_*
$os : = null
  • string|null - FILTER_WINDOWS
$options : = null
  • ListOptions - Interact via reference.
Tags
see
https://www.vultr.com/api/#operation/list-plans
throws
PlanException
Return values
array<string|int, VPSPlan>

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

setPlanLocations()

private setPlanLocations(array<string|int, mixed> &$plans) : void
Parameters
$plans : array<string|int, mixed>

        
On this page

Search results