Overview
  • Namespace
  • Class

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CDN
      • Resource
    • CloudMonitoring
      • Collection
      • 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
      • Collection
      • Enum
      • Resource
    • Networking
      • Resource
    • ObjectStore
      • Constants
      • Enum
      • Exception
      • Resource
      • Upload
    • Orchestration
      • Resource
    • Queues
      • Collection
      • Exception
      • Resource
    • Volume
      • Resource

Classes

  • Flavor
  • Image
  • KeyPair
  • Network
  • Server
  • ServerMetadata
  • VolumeAttachment

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:bandwidth.


Located at OpenCloud/Compute/Resource/Server.php

Methods summary

public
# __construct( OpenCloud\Compute\Service $service, $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

$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
$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
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

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
  • 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
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
The name of the new image
$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
  • 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
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
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
  • 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
  • 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

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
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
The volume to remove
public
# volumeAttachment( $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

The path where the file will be stored on the target server (up to 255 characters)

$data
the file contents (max size set by provider)

Api

public
# console( $type = 'novnc' )

Returns a console connection Note: Where is this documented?

Returns a console connection Note: Where is this documented?

Codecoverageignore

public Guzzle\Http\Message\Response
# suspend( )

Suspend a server

Suspend a server

A suspend request suspend an instance, its VM state is stored on disk, all memory is written to disk, and the virtual machine is stopped. Suspending an instance is similar to placing a device in hibernation; memory and vCPUs become available to create other instances.

Returns

Guzzle\Http\Message\Response

Api

public Guzzle\Http\Message\Response
# resume( )

Resume a server

Resume a server

A resume request resumes a suspended instance, its VM state was stored on disk, all memory was written to disk, and the virtual machine was stopped. Resuming a suspended instance is similar to resuming a device from hibernation.

Returns

Guzzle\Http\Message\Response

Api

public object
# diagnostics( )

Get server diagnostics

Get server diagnostics

Gets basic usage data for a specified server.

Returns

object

Api

public Guzzle\Http\Message\Response
# start( )

Start a server

Start a server

Starts a stopped server and changes its status to ACTIVE.

Returns

Guzzle\Http\Message\Response

Api

public Guzzle\Http\Message\Response
# stop( )

Stop a server

Stop a server

Stops a running server and changes its status to STOPPED.

Returns

Guzzle\Http\Message\Response

Api

Methods inherited from OpenCloud\Common\Resource\PersistentResource

checkExtension(), createUrl(), delete(), id(), name(), refresh(), refreshFromLocationUrl(), region(), status(), update(), waitFor()

Methods inherited from OpenCloud\Common\Resource\BaseResource

findLink(), getClient(), getMetadata(), getParent(), getService(), getUrl(), jsonCollectionElement(), jsonCollectionName(), jsonName(), parseResponse(), resourceName(), setMetadata(), setParent(), setService(), url()

Methods inherited from OpenCloud\Common\Base

__call(), checkJsonError(), generateUuid(), getInstance(), getLogger(), hasLogger(), makeResourceIteratorOptions(), populate(), setLogger(), stripNamespace(), toCamel(), toUnderscores()

Constants summary

Constants inherited from OpenCloud\Common\Base

PATCH_CONTENT_TYPE

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 OpenCloud\Volume\Resource\Volume $volume

The bootable volume for this server.

The bootable volume for this server.

#
public boolean $volumeDeleteOnTermination

Whether to delete the bootable volume when the server is terminated (deleted).

Whether to delete the bootable volume when the server is terminated (deleted).

#
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|SecurityGroup)[] $security_groups

Security groups for this server. An array of either the names or SecurityGroup objects.

Security groups for this server. An array of either the names or SecurityGroup objects.

# 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.

#
public string $extendedStatus

Virtual machine status.

Virtual machine status.

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ext_status.html
#
public string $taskStatus

Status indicating a running task

Status indicating a running task

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ext_status.html
#
public integer $powerStatus

Power status of the VM

Power status of the VM

Link

http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ext_status.html
#
public string $availabilityZone

Availability zone of the VM

Availability zone of the VM

Link

http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-ext-az
#
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

#
API documentation generated by ApiGen