README

rs_guzzle_client is a PHP Guzzle REST API client library for the RightScale API.
Support is available for v1.0 and v1.5 of the API. Not all API calls are covered, a table of supported calls can be found below.
Installation
Add rs_guzzle_client to the src/Guzzle/Rs directory of your Guzzle
installation:
cd /path/to/guzzle
git submodule add git://github.com/rgeyer/rs_guzzle_client.git ./src/Guzzle/Rs
You can now build a phar file containing guzzle-aws and the main guzzle framework:
cd /path/to/guzzle/build
phing phar
Now you just need to include guzzle.phar in your script. The phar file
will take care of autoloading Guzzle classes:
<?php
require_once 'guzzle.phar';
The example script for getting your servers:
<?php
require_once 'guzzle.phar';
$serviceBuilder = \Guzzle\Service\ServiceBuilder::factory(array(
'guzzle-rs-1_0' => array(
'class' => 'RGeyer\Guzzle\Rs\RightScaleClient',
'params' => array(
'acct_num' => '00000', // your rightscale account id
'email' => 'your@email.com',
'password' => 'yourPassword',
'version' => '1.0',
'curl.CURLOPT_SSL_VERIFYHOST' => false,
'curl.CURLOPT_SSL_VERIFYPEER' => false,
)
),
));
$client = $serviceBuilder->get('guzzle-rs-1_0');
$params = array();
$command = $client->getCommand('servers', $params);
API coverage
Below you will find the current controllers (and their commands) that are supported by the library. A quick legend for the completeness percentage.
100% - Implemented Commands, Full tests, Mock responses in the library
50% - Implemented Commands, Not tested or minimally tested, Mocks may or may not exist
0% - Not implemented
| Alert Spec Subjects |
| Command |
v1.0 |
v1.5 |
| create |
100% |
0% |
| Model |
0% |
0% |
| Alert Spec |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
100% |
| destroy |
50% |
100% |
| Model |
0% |
0% |
| Audit Entries |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| Model |
0% |
0% |
| Component EC2 EBS Volumes |
| Command |
v1.0 |
v1.5 |
| create |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| Servers |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
100% |
| destroy |
100% |
100% |
| launch |
N/A |
100% |
| start |
100% |
N/A (see launch above) |
| start_ebs |
100% |
N/A (see launch above) |
| terminate |
N/A |
100% |
| stop |
100% |
N/A (see terminate above) |
| stop_ebs |
100% |
N/A (see terminate above) |
| reboot |
100% |
N/A |
| run_script |
100% |
N/A |
| run_executable |
100% |
N/A |
| attach_volume |
100% |
N/A |
| settings |
100% |
N/A |
| get_sketchy_data |
100% |
N/A |
| current/show |
100% |
N/A |
| current/update |
100% |
N/A |
| current/settings |
100% |
N/A |
| alert_specs |
100% |
N/A |
| monitoring |
100% |
N/A |
| monitoring/graph-name |
100% |
N/A |
| Model |
100% |
20% (Lacks all reference commands/models) |
| Credentials |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| create |
100% |
0% |
| update |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| Deployments |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
100% |
| destroy |
100% |
100% |
| duplicate |
100% |
N/A |
| clone |
N/A |
100% |
| start_all |
100% |
N/A |
| stop_all |
100% |
N/A |
| Model |
100% |
100% |
| EC2 EBS Snapshots |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| create |
100% |
0% |
| update |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| EC2 EBS Volumes |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| create |
100% |
0% |
| update |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| EC2 Elastic IPs |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| create |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| Security Groups |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
N/A |
| destroy |
100% |
100% |
| Model |
100% |
100% |
| Security Group Rules |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| create |
N/A |
100% |
| destroy |
N/A |
100% |
| Model |
N/A |
100% |
| Server Arrays |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
100% |
| destroy |
100% |
100% |
| terminate_all |
100% |
N/A |
| multi_terminate |
N/A |
100% |
| launch |
100% |
100% |
| run_script_on_all |
50% |
N/A |
| multi_run_executable |
N/A |
100% |
| instances |
100% |
N/A |
| current_instances |
N/A |
100% |
| Model |
50% |
100% |
| EC2/Generic SSH Keys |
| Command |
v1.0 |
v1.5 |
| index |
N/A |
100% |
| show |
100% |
100% |
| create |
100% |
100% |
| destroy |
100% |
100% |
| Model |
100% |
100% |
| Macros |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| create |
100% |
0% |
| update |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| Multi Cloud Images |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
N/A |
100% |
| update |
N/A |
100% |
| clone |
N/A |
100% |
| commit |
N/A |
100% |
| destroy |
N/A |
100% |
| Model |
100% |
100% |
| MultiCloudImageSettings |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| create |
N/A |
100% |
| update |
N/A |
100% |
| destroy |
N/A |
100% |
| Model |
N/A |
100% |
| Right Scripts |
| Command |
v1.0 |
v1.5 |
| show |
100% |
0% |
| index |
100% |
0% |
| Model |
0% |
0% |
| S3 Bucket |
| Command |
v1.0 |
v1.5 |
| create |
100% |
0% |
| destroy |
100% |
0% |
| Model |
0% |
0% |
| Server Template |
| Command |
v1.0 |
v1.5 |
| show |
100% |
100% |
| index |
100% |
100% |
| create |
100% |
100% |
| update |
100% |
100% |
| destroy |
100% |
100% |
| executables |
100% |
N/A |
| alert_specs |
100% |
N/A |
| clone |
N/A |
100% |
| commit |
N/A |
100% |
| publish |
N/A |
100% |
| Model |
0% |
50% (Lacks all relationship commands/models) |
| SQS Queues |
| Command |
v1.0 |
v1.5 |
| show |
50% |
0% |
| index |
50% |
0% |
| create |
50% |
0% |
| destroy |
50% |
0% |
| Model |
0% |
0% |
| Statuses |
| Command |
v1.0 |
v1.5 |
| show |
50% |
0% |
| Model |
0% |
0% |
| Tags |
| Command |
v1.0 |
v1.5 |
| search |
100% |
N/A |
| set |
100% |
N/A |
| unset |
100% |
N/A |
| taggable_resources |
100% |
N/A |
| tags_by_resource |
N/A |
100% |
| tags_by_tag |
N/A |
100% |
| tags_multi_add |
N/A |
100% |
| tags_multi_delete |
N/A |
100% |
| Model |
0% |
0% |
| VPC DHCP Option |
| Command |
v1.0 |
v1.5 |
| show |
50% |
0% |
| index |
50% |
0% |
| create |
50% |
0% |
| update |
50% |
0% |
| destroy |
50% |
0% |
| Model |
0% |
0% |
| Clouds |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| Model |
N/A |
100% |
| Publications |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| import |
N/A |
100% |
| Model |
N/A |
100% |
| Instances |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| update |
N/A |
100% |
| launch |
N/A |
100% |
| multi_run_executable |
N/A |
100% |
| multi_terminate |
N/A |
100% |
| reboot |
N/A |
100% |
| run_executable |
N/A |
100% |
| set_custom_lodgement |
N/A |
N/A Deprecated for InstanceCustomLodgments#create |
| terminate |
N/A |
100% |
| Model |
0% |
0% |
| InstanceTypes |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| Model |
N/A |
100% |
| Datacenters |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| Model |
N/A |
100% |
| Inputs |
| Command |
v1.0 |
v1.5 |
| index |
N/A |
100% |
| multi_update |
N/A |
100% |
| Model |
N/A |
0% |
| Subnets |
| Command |
v1.0 |
v1.5 |
| show |
N/A |
100% |
| index |
N/A |
100% |
| update |
N/A |
100% |
| Model |
N/A |
100% |
TODO
- Allow the user to specify a logger.
- ModelBase "duplicate" and "clone" should both work on either Ec2 or Mc classes.
- Handle the HTTP 500 seek() null error
- Reduce (or eliminate) the need for the ServiceBuilder and ClientFactory
- ModelBase should assume that the API call for a relationship is the same as the relationship name, unless specified otherwise. I.E. relationship for 'cloud' would call command 'cloud' with an ID
- Refactor tagging functionality into ModelBase or an "IsTaggable" mixin class. See Model\Mc\Server for example of how not to do it
- Test optional/required parameters on concrete models. I.E. deployment[name] is an invalid parameter on create unless defined as required or optional, base is not sufficient.
- Tests should make sure that models which make command requests for relationships correctly overwrite the path for the command.