rgeyer/guzzle-rs

Guzzle Client for RightScale API 1.0 and 1.5

v0.0.1 2012-08-11 00:14 UTC

This package is not auto-updated.

Last update: 2024-12-21 15:18:58 UTC


README

Build Status

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































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.