Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Enum
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • Flavor
  • Image
  • Network
  • Server
  • ServerMetadata
  • VolumeAttachment
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Server

A virtual machine (VM) instance in the Cloud Servers environment.

OpenCloud\Common\Base
Extended by OpenCloud\Common\Resource\BaseResource
Extended by OpenCloud\Common\Resource\PersistentResource
Extended by OpenCloud\Common\Resource\NovaResource
Extended by OpenCloud\Compute\Resource\Server implements OpenCloud\DNS\Resource\HasPtrRecordsInterface
Namespace: OpenCloud\Compute\Resource
Note: This implementation supports extension attributes OS-DCF:diskConfig, RAX-SERVER:bandwidth, rax-bandwidth:bandwith.
Located at OpenCloud/Compute/Resource/Server.php
Methods summary
public
# __construct( OpenCloud\Compute\Service $service, mixed $info = null )

Creates a new Server object and associates it with a Compute service

Creates a new Server object and associates it with a Compute service

Parameters

$service
mixed
$info * If NULL, an empty Server object is created * If an object, then a Server object is created from the data in the object * If a string, then it's treated as a Server ID and retrieved from the service The normal use case for SDK clients is to treat it as either NULL or an ID. The object value parameter is a special case used to construct a Server object from a ServerList element to avoid a secondary call to the Service.
$info
mixed
$data $data

Throws

ServerNotFound
if a 404 is returned
UnknownError
if another error status is reported

Overrides

OpenCloud\Common\Resource\BaseResource::__construct()
public string
# ip( integer $type = null )

Returns the primary external IP address of the server

Returns the primary external IP address of the server

This function is based upon the accessIPv4 and accessIPv6 values. By default, these are set to the public IP address of the server. However, these values can be modified by the user; this might happen, for example, if the server is behind a firewall and needs to be routed through a NAT device to be reached.

Parameters

$type
integer
$type the type of IP version (4 or 6) to return

Returns

string
IP address

Api

public Guzzle\Http\Message\Response
# create( array $params = array() )

Create a new resource

Create a new resource

Parameters

$params
array
$params

Returns

Guzzle\Http\Message\Response

Overrides

OpenCloud\Common\Resource\PersistentResource::create()
public
# rebuild( array $params = array() )

Rebuilds an existing server

Rebuilds an existing server

Parameters

$params
array
$params - an associative array of key/value pairs of attributes to set on the new server

Api

public Guzzle\Http\Message\Response
# reboot( string $type = null )

Reboots a server

Reboots a server

A "soft" reboot requests that the operating system reboot itself; a "hard" reboot is the equivalent of pulling the power plug and then turning it back on, with a possibility of data loss.

Parameters

$type
string
$type A particular reboot State. See Constants\ServerState for string values.

Returns

Guzzle\Http\Message\Response

Api

public boolean|OpenCloud\Compute\Resource\Image
# createImage( string $name, array $metadata = array() )

Creates a new image from a server

Creates a new image from a server

Parameters

$name
string
$name The name of the new image
$metadata
array
$metadata Optional metadata to be stored on the image

Returns

boolean|OpenCloud\Compute\Resource\Image
New Image instance on success; FALSE on failure

Throws

OpenCloud\Common\Exceptions\ImageError

Api

public mixed
# imageSchedule( mixed $retention = false )

Schedule daily image backups

Schedule daily image backups

Parameters

$retention
mixed
$retention - false (default) indicates you want to retrieve the image schedule. $retention <= 0 indicates you want to delete the current schedule. $retention > 0 indicates you want to schedule image backups and you would like to retain $retention backups.

Returns

mixed
an object or FALSE on error

Throws

OpenCloud\Common\Exceptions\ServerImageScheduleError
if an error is encountered

Api

public boolean
# resize( OpenCloud\Compute\Resource\Flavor $flavorRef )

Initiates the resize of a server

Initiates the resize of a server

Parameters

$flavorRef
OpenCloud\Compute\Resource\Flavor
$flavorRef a Flavor object indicating the new server size

Returns

boolean
TRUE on success; FALSE on failure

Api

public boolean
# resizeConfirm( )

confirms the resize of a server

confirms the resize of a server

Returns

boolean
TRUE on success; FALSE on failure

Api

public boolean
# resizeRevert( )

reverts the resize of a server

reverts the resize of a server

Returns

boolean
TRUE on success; FALSE on failure

Api

public boolean
# setPassword( string $newPassword )

Sets the root password on the server

Sets the root password on the server

Parameters

$newPassword
string
$newPassword The new root password for the server

Returns

boolean
TRUE on success; FALSE on failure

Api

public string
# rescue( )

Puts the server into rescue mode

Puts the server into rescue mode

Returns

string
the root password of the rescue server

Throws

OpenCloud\Common\Exceptions\ServerActionError
if the server has no ID (i.e., has not been created yet)

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/rescue_mode.html

Api

public HttpResponse
# unrescue( )

Takes the server out of RESCUE mode

Takes the server out of RESCUE mode

Returns

HttpResponse

Throws

OpenCloud\Common\Exceptions\ServerActionError
if the server has no ID (i.e., has not been created yet)

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/rescue_mode.html

Api

public OpenCloud\Compute\Resource\ServerMetadata
# metadata( string $key = null )

Retrieves the metadata associated with a Server.

Retrieves the metadata associated with a Server.

If a metadata item name is supplied, then only the single item is returned. Otherwise, the default is to return all metadata associated with a server.

Parameters

$key
string
$key - the (optional) name of the metadata item to return

Returns

OpenCloud\Compute\Resource\ServerMetadata
object

Throws

OpenCloud\Common\Exceptions\MetadataError

Api

public object
# ips( string $network = null )

Returns the IP address block for the Server or for a specific network.

Returns the IP address block for the Server or for a specific network.

Parameters

$network
string
$network - if supplied, then only the IP(s) for the specified network are returned. Otherwise, all IPs are returned.

Returns

object

Throws

OpenCloud\Common\Exceptions\ServerIpsError

Api

public
# attachVolume( OpenCloud\Volume\Resource\Volume $volume, string $device = 'auto' )

Attaches a volume to a server

Attaches a volume to a server

Requires the os-volumes extension. This is a synonym for VolumeAttachment::create()

Parameters

$volume
OpenCloud\Volume\Resource\Volume
$volume The volume to attach. If "auto" is specified (the default), then the first available device is used to mount the volume (for example, if the primary disk is on /dev/xvhda, then the new volume would be attached to /dev/xvhdb).
$device
string
$device the device to which to attach it

Api

public
# detachVolume( OpenCloud\Volume\Resource\Volume $volume )

Removes a volume attachment from a server

Removes a volume attachment from a server

Requires the os-volumes extension. This is a synonym for VolumeAttachment::delete()

Parameters

$volume
OpenCloud\Volume\Resource\Volume
$volume The volume to remove
public
# volumeAttachment( mixed $id = null )

Returns a VolumeAttachment object

Returns a VolumeAttachment object

public Collection
# volumeAttachmentList( )

Returns a Collection of VolumeAttachment objects

Returns a Collection of VolumeAttachment objects

Returns

Collection
public
# addFile( string $path, string $data )

Adds a "personality" file to be uploaded during create() or rebuild()

Adds a "personality" file to be uploaded during create() or rebuild()

Parameters

$path
string
$path The path where the file will be stored on the target server (up to 255 characters)
$data
string
$data the file contents (max size set by provider)

Api

public
# console( mixed $type = 'novnc' )

Returns a console connection Note: Where is this documented?

Returns a console connection Note: Where is this documented?

CodeCoverageIgnore

protected object
# createJson( )

Provides JSON for create request body

Provides JSON for create request body

Returns

object

Throws

RuntimeException

Overrides

OpenCloud\Common\Resource\PersistentResource::createJson()
protected
# updateJson( mixed $params = array() )

Provides JSON for update request body

Provides JSON for update request body

Overrides

OpenCloud\Common\Resource\PersistentResource::updateJson()
Methods inherited from OpenCloud\Common\Resource\NovaResource
action()
Methods inherited from OpenCloud\Common\Resource\PersistentResource
checkExtension(), delete(), getAlias(), noCreate(), noDelete(), noUpdate(), refresh(), refreshFromLocationUrl(), update(), waitFor()
Methods inherited from OpenCloud\Common\Resource\BaseResource
findLink(), getClient(), getMetadata(), getParent(), getService(), getUrl(), jsonCollectionElement(), jsonCollectionName(), jsonName(), parseResponse(), primaryKeyField(), resourceName(), setMetadata(), setParent(), setService()
Methods inherited from OpenCloud\Common\Base
__call(), checkJsonError(), generateUuid(), getInstance(), getJsonHeader(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()
Properties summary
public string $status
#

The server status. OpenCloud\Compute\Constants\ServerState for supported types.

The server status. OpenCloud\Compute\Constants\ServerState for supported types.

public string $updated
#

The time stamp for the last update.

The time stamp for the last update.

public string $hostId
#

The compute provisioning algorithm has an anti-affinity property that attempts to spread customer VMs across hosts. Under certain situations, VMs from the same customer might be placed on the same host. $hostId represents the host your server runs on and can be used to determine this scenario if it is relevant to your application.

The compute provisioning algorithm has an anti-affinity property that attempts to spread customer VMs across hosts. Under certain situations, VMs from the same customer might be placed on the same host. $hostId represents the host your server runs on and can be used to determine this scenario if it is relevant to your application.

public type $addresses
#

Public and private IP addresses for this server.

Public and private IP addresses for this server.

public array $links
#

Server links.

Server links.

public OpenCloud\Image\Resource\ImageInterface $image
#

The Image for this server.

The Image for this server.

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html
public type $flavor
#

The Flavor for this server.

The Flavor for this server.

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Flavors-d1e4188.html
public type $networks array()
#
public string $id
#

The server ID.

The server ID.

public string $user_id
#

The user ID.

The user ID.

public string $name
#

The server name.

The server name.

public string $created
#

The time stamp for the creation date.

The time stamp for the creation date.

public string $tenant_id
#

The tenant ID.

The tenant ID.

public string $accessIPv4
#

The public IP version 4 access address.

The public IP version 4 access address.

public string $accessIPv6
#

The public IP version 6 access address.

The public IP version 6 access address.

public integer $progress
#

The build completion progress, as a percentage. Value is from 0 to 100.

The build completion progress, as a percentage. Value is from 0 to 100.

public string $adminPass
#

The root password (only populated on server creation).

The root password (only populated on server creation).

public mixed $metadata
#

Metadata key and value pairs.

Metadata key and value pairs.

protected static string $json_name 'server'
#
protected static string $url_resource 'servers'
#
public string|object $keypair
#

Keypair or string representation of keypair name

Keypair or string representation of keypair name

public string $user_data
#

Cloud-init boot executable code

Cloud-init boot executable code

Properties inherited from OpenCloud\Common\Resource\BaseResource
$parent, $service
Properties inherited from OpenCloud\Common\Base
$aliases
PHP OpenCloud API API documentation generated by ApiGen 2.8.0