Skip to content
Merged
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
31 changes: 12 additions & 19 deletions samples/Database/create-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,31 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key, and
// * OS_REGION_NAME: OpenStack Cloud region where database configuations are created
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Create a configuration.
$configuration = $databaseService->configuration();
$configuration->create(array(
'name' => 'example-configuration-name',
'name' => 'example-configuration-name',
'description' => 'An example configuration',
'values' => array(
'values' => array(
'collation_server' => 'latin1_swedish_ci',
'connect_timeout' => 120
'connect_timeout' => 120
),
'datastore' => array(
'type' => '10000000-0000-0000-0000-000000000001',
'type' => '10000000-0000-0000-0000-000000000001',
'version' => '1379cc8b-4bc5-4c4a-9e9d-7a9ad27c0866'
)
));
Expand Down
34 changes: 11 additions & 23 deletions samples/Database/create-instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,24 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance,
// * OS_DB_INSTANCE_FLAVOR_ID: ID of flavor to use for database instance,
// * OS_DB_INSTANCE_NAME: Name of database instance, and
// * OS_DB_INSTANCE_SIZE: Size, in GB, of database instance volume
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Create a database instance.
$dbInstance = $databaseService->instance();
$dbInstance->create(array(
'name' => getenv('OS_DB_INSTANCE_NAME'),
'flavor' => $databaseService->flavor(getenv('OS_DB_INSTANCE_FLAVOR_ID')),
'volume' => array(
'size' => getenv('OS_DB_INSTANCE_SIZE')
)
'name' => '{name}',
'flavor' => $databaseService->flavor('{flavorId}'),
'volume' => array('size' => '{size}')
));
26 changes: 9 additions & 17 deletions samples/Database/delete-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,22 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance, and
// * OS_DB_CONFIGURATION_ID: ID of database configuration
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database configuration.
$configuration = $databaseService->configuration(getenv('OS_DB_CONFIGURATION_ID'));
$configuration = $databaseService->configuration('{configId}');

// 4. Delete it.
$configuration->delete();
26 changes: 9 additions & 17 deletions samples/Database/get-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,20 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance, and
// * OS_DB_CONFIGURATION_ID: ID of database configuration
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database configuration.
$configuration = $databaseService->configuration(getenv('OS_DB_CONFIGURATION_ID'));
$configuration = $databaseService->configuration('{configId}');
/** @var OpenCloud\Database\Resource\Configuration **/
29 changes: 10 additions & 19 deletions samples/Database/get-datastore-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,23 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance,
// * OS_DB_DATASTORE_ID: ID of database datastore, and
// * OS_DB_DATASTORE_VERSION_ID: Id of database datastore version
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database datastore.
$datastore = $databaseService->datastore(getenv('OS_DB_DATASTORE_ID'));
$datastore = $databaseService->datastore('{datastoreId}');

// 4. Retrieve the database datastore version.
$datastoreVersion = $datastore->version(getenv('OS_DB_DATASTORE_VERSION_ID'));
$datastoreVersion = $datastore->version('{datastoreVersionId}');
/** @var OpenCloud\Database\Resource\DatastoreVersion **/
26 changes: 9 additions & 17 deletions samples/Database/get-datastore.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,20 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance, and
// * OS_DB_DATASTORE_ID: ID of database datastore
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database datastore.
$datastore = $databaseService->datastore(getenv('OS_DB_DATASTORE_ID'));
$datastore = $databaseService->datastore('{datastoreId}');
/** @var OpenCloud\Database\Resource\Datastore **/
26 changes: 9 additions & 17 deletions samples/Database/get-instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,20 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance, and
// * OS_DB_INSTANCE_ID: ID of database instance
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database instance.
$instance = $databaseService->instance(getenv('OS_DB_INSTANCE_ID'));
$instance = $databaseService->instance('{instanceId}');
/** @var $instance OpenCloud\Database\Resource\Instance **/
26 changes: 9 additions & 17 deletions samples/Database/list-configuration-instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,22 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key,
// * OS_REGION_NAME: OpenStack Cloud region in which to create database instance, and
// * OS_DB_CONFIGURATION_ID: ID of database configuration
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{region}');

// 3. Retrieve the database configuration.
$configuration = $databaseService->configuration(getenv('OS_DB_CONFIGURATION_ID'));
$configuration = $databaseService->configuration('{configId}');

// 4. List instances using this configuration.
$instances = $configuration->instanceList();
Expand Down
23 changes: 8 additions & 15 deletions samples/Database/list-configurations.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,19 @@
* limitations under the License.
*/

//
// Pre-requisites:
// * Prior to running this script, you must setup the following environment variables:
// * OS_USERNAME: Your OpenStack Cloud Account Username,
// * RAX_API_KEY: Your Rackspace Cloud Account API Key, and
// * OS_REGION_NAME: OpenStack Cloud region where database configuations are created
//
require dirname(__DIR__) . '/../vendor/autoload.php';

require __DIR__ . '/../../vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => getenv('OS_USERNAME'),
'apiKey' => getenv('RAX_API_KEY')
// 1. Instantiate a Rackspace client. You can replace {authUrl} with
// Rackspace::US_IDENTITY_ENDPOINT or similar
$client = new Rackspace('{authUrl}', array(
'username' => '{username}',
'apiKey' => '{apiKey}',
));

// 2. Obtain a Databae service object from the client.
$region = getenv('OS_REGION_NAME');
$databaseService = $client->databaseService(null, $region);
// 2. Obtain a Database service object from the client.
$databaseService = $client->databaseService(null, '{dbId}');

// 3. List configurations.
$configurations = $databaseService->configurationList();
Expand Down
Loading