Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#php-rackspace-clouddb - *work-in-progress*
#php-rackspace-clouddb

PHP Class for connecting applications to [Rackspace's Cloud Databases Service](http://www.rackspace.com/cloud/cloud_hosting_products/databases/)

Expand Down Expand Up @@ -95,4 +95,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 changes: 47 additions & 0 deletions example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/php -q
<?php
/**
* Simple command line script to show how to use the Rackspace CloudDB class.
*/
require_once('rackspace-clouddb.class.php');

const RACKSPACE_USERNAME = 'YOUR_USERNAME';
const RACKSPACE_API_KEY = 'YOUR_API_KEY';
const RACKSPACE_ACCOUNT_ID = 'YOUR_ACCOUNT_ID';
const RACKSPACE_INSTANCE_ID = 'AN_INSTANCE_ID';

$database = 'my-test-database';

// Connect to the Chicago datacenter
//$rcdb = new RackspaceCloudDB(RACKSPACE_USERNAME,RACKSPACE_API_KEY,RACKSPACE_ACCOUNT_ID,'ORD','US');
// Connect to the Dallas/Ft. Worth datacenter
//$rcdb = new RackspaceCloudDB(RACKSPACE_USERNAME,RACKSPACE_API_KEY,RACKSPACE_ACCOUNT_ID,'DFW','US');
// Connect to the London datacenter
$rcdb = new RackspaceCloudDB(RACKSPACE_USERNAME,RACKSPACE_API_KEY,RACKSPACE_ACCOUNT_ID,'LON','UK');

// List all instances
$responseObject = $rcdb->listInstances();

// List all database users in an instance
//$responseObject = $rcdb->listDatabaseInstanceUsers(RACKSPACE_INSTANCE_ID);

// List all flavors (hardware profiles)
//$responseObject = $rcdb->listFlavors();

// Create a new database (with the name defined in $database)
//$responseObject = $rcdb->createDatabase(RACKSPACE_INSTANCE_ID, $database);

// Create a new user ('john.smith' with the password 'p4ssw0rd')
//$responseObject = $rcdb->createUser(RACKSPACE_INSTANCE_ID,$database,'john.smith','p4assw0rd');

// Grant a user ('john.smith') access to a database
//$responseObject = $rcdb->grantUserAccess(RACKSPACE_INSTANCE_ID, $database, 'john.smith');

// Revoke a users access to a database
//$responseObject = $rcdb->revokeUserAccess(RACKSPACE_INSTANCE_ID, $database, 'john.smith');

// NB: Some operations (such as creating a database or a user) don't return a
// JSON response object unless there an error occurs.
echo '<pre>'.print_r($responseObject,true).'</pre>';

?>
Loading