diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 000000000..3f092f372 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1 @@ +sphinxcontrib-phpdomain diff --git a/doc/services/compute/flavors.rst b/doc/services/compute/flavors.rst index eeb447d3c..470ce8368 100644 --- a/doc/services/compute/flavors.rst +++ b/doc/services/compute/flavors.rst @@ -20,6 +20,8 @@ List flavors /** @param $flavor OpenCloud\Common\Resource\FlavorInterface */ } +`Get the executable PHP script for this example `_ + Detailed results ~~~~~~~~~~~~~~~~ diff --git a/doc/services/compute/images.rst b/doc/services/compute/images.rst index fb68af7f7..570790c04 100644 --- a/doc/services/compute/images.rst +++ b/doc/services/compute/images.rst @@ -23,6 +23,9 @@ Below is the simplest usage for retrieving a list of images: } +`Get the executable PHP script for this example `_ + + Detailed results ~~~~~~~~~~~~~~~~ diff --git a/doc/services/compute/keypairs.rst b/doc/services/compute/keypairs.rst index f7e67b113..823fcf5a2 100644 --- a/doc/services/compute/keypairs.rst +++ b/doc/services/compute/keypairs.rst @@ -21,6 +21,8 @@ value is automatically generated for you. $pubKey = $keypair->getPublicKey(); $priKey = $keypair->getPrivateKey(); +`Get the executable PHP script for this example `_ + Upload existing keypair ----------------------- @@ -41,6 +43,9 @@ filesystem. 'publicKey' => $content )); +`Get the executable PHP script for this example `_ + + List keypairs ------------- diff --git a/doc/services/compute/servers.rst b/doc/services/compute/servers.rst index 229e8e4ff..8a55ce57f 100644 --- a/doc/services/compute/servers.rst +++ b/doc/services/compute/servers.rst @@ -49,6 +49,9 @@ URL parameters for filtering servers | RAX-SI:image_schedule | If scheduled images enabled or not. If the value is TRUE, the list contains all servers that have an image schedule resource set on them. If the value is set to FALSE, the list contains all servers that do not have an image schedule. | bool | +--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+ +`Get the executable PHP script for this example `_ + + Create server ------------- @@ -59,19 +62,22 @@ Now we're ready to create our instance: .. code-block:: php - $server = $compute->server(); + $server = $compute->server(); - $server->create(array( - 'name' => 'My lovely server', - 'imageId' => '{imageId}', - 'flavorId' => '{flavorId}', - )); + $server->create(array( + 'name' => 'My lovely server', + 'imageId' => '{imageId}', + 'flavorId' => '{flavorId}', + )); It's always best to be defensive when executing functionality over HTTP; you can achieve this best by wrapping calls in a try/catch block. It allows you to debug your failed operations in a graceful and efficient manner. +`Get the executable PHP script for this example `_ + + Using a bootable volume ~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,6 +104,9 @@ you can achieve this best by wrapping calls in a try/catch block. It allows you to debug your failed operations in a graceful and efficient manner. +`Get the executable PHP script for this example `_ + + Create parameters ~~~~~~~~~~~~~~~~~ @@ -146,6 +155,8 @@ as usual, with one extra parameter: So, as you can see, you specify the **name** of an existing keypair that you previously created on the API. +`Get the executable PHP script for this example `_ + Creating a server with personality files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -176,6 +187,10 @@ attributes are detailed in the next section. 'name' => 'NEW SERVER NAME' )); + +`Get the executable PHP script for this example `_ + + Updatable attributes ~~~~~~~~~~~~~~~~~~~~ @@ -195,3 +210,5 @@ Delete server .. code-block:: php $server->delete(); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/identity/users.rst b/doc/services/identity/users.rst index b55236a74..944888902 100644 --- a/doc/services/identity/users.rst +++ b/doc/services/identity/users.rst @@ -34,6 +34,8 @@ List users // ... } +`Get the executable PHP script for this example `_ + Retrieve a user by username --------------------------- @@ -42,6 +44,8 @@ Retrieve a user by username $user = $service->getUser('jamie'); +`Get the executable PHP script for this example `_ + Retrieve a user by user ID -------------------------- @@ -52,6 +56,8 @@ Retrieve a user by user ID $user = $service->getUser('{userId}', UserConst::MODE_ID); +`Get the executable PHP script for this example `_ + Retrieve a user by email address -------------------------------- @@ -62,6 +68,8 @@ Retrieve a user by email address $user = $service->getUser('{emailAddress}', UserConst::MODE_EMAIL); +`Get the executable PHP script for this example `_ + Create user ----------- @@ -98,6 +106,8 @@ automatically generated and provided in the response. // show generated password echo $user->getPassword(); +`Get the executable PHP script for this example `_ + Update user ----------- @@ -129,6 +139,8 @@ Delete user $user->delete(); +`Get the executable PHP script for this example `_ + List credentials ---------------- @@ -159,3 +171,5 @@ you: $user->resetApiKey(); echo $user->getApiKey(); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/load-balancer/access.rst b/doc/services/load-balancer/access.rst index 4387dd8de..42cd68315 100644 --- a/doc/services/load-balancer/access.rst +++ b/doc/services/load-balancer/access.rst @@ -68,6 +68,11 @@ You can add network items to a load balancer's access list very easily: In the above example, we allowed access for 1 IP address, and used the "0.0.0.0" wildcard to blacklist all other traffic. +Get the executable PHP scripts for this example: + +* `Blacklist IP range `_ +* `Limit access to 1 IP `_ + Remove Network Item From Access List ------------------------------------ @@ -76,4 +81,4 @@ You an remove a network item from a load balancer's access list: .. code-block:: php - $networkItem->delete(); + $networkItem->delete(); diff --git a/doc/services/load-balancer/load-balancer.rst b/doc/services/load-balancer/load-balancer.rst index 7071794df..d7867755d 100644 --- a/doc/services/load-balancer/load-balancer.rst +++ b/doc/services/load-balancer/load-balancer.rst @@ -51,9 +51,11 @@ port number, before submitting to the API: For a full list of available `protocols <#protocols>`_ and `algorithms <#algorithms>`_ please see the sections below. +`Get the executable PHP script for this example `_ -List Load Balancer Details --------------------------- + +Get Load Balancer Details +------------------------- You can retrieve a single load balancer's details by using its ID: @@ -64,7 +66,7 @@ You can retrieve a single load balancer's details by using its ID: List Load Balancers -~~~~~~~~~~~~~~~~~~~ +------------------- You can retrieve a list of all your load balancers: @@ -76,6 +78,8 @@ You can retrieve a list of all your load balancers: /** @var $loadBalancer OpenCloud\LoadBalancer\Resource\LoadBalancer **/ } +`Get the executable PHP script for this example `_ + Update a Load Balancer ---------------------- @@ -121,6 +125,8 @@ When you no longer have a need for the load balancer, you can remove it: $loadBalancer->delete(); +`Get the executable PHP script for this example `_ + Protocols --------- @@ -159,7 +165,7 @@ You can programmatically list all supported load balancing algorithms: .. code-block:: php $algorithms = $service->algorithmList(); - + foreach ($algorithms as $algorithm) { /** @var $algorithm OpenCloud\LoadBalancer\Resource\Algorithm **/ } diff --git a/doc/services/load-balancer/ssl.rst b/doc/services/load-balancer/ssl.rst index 12b28a6af..413bdc612 100644 --- a/doc/services/load-balancer/ssl.rst +++ b/doc/services/load-balancer/ssl.rst @@ -43,6 +43,8 @@ For a full list, with explanations, of required and optional attributes, please consult the `official documentation `__ +`Get the executable PHP script for this example `_ + Delete configuration -------------------- diff --git a/doc/services/object-store/access.rst b/doc/services/object-store/access.rst index 62cb541ca..40fe61670 100644 --- a/doc/services/object-store/access.rst +++ b/doc/services/object-store/access.rst @@ -23,6 +23,11 @@ in a global state: The string argument of ``setTempUrlSecret()`` is optional - if left out, the SDK will generate a random hashed secret for you. +Get the executable PHP script for this example: + +* `Specify a URL secret `_ +* `Generate random URL secret `_ + Create a temporary URL ---------------------- @@ -32,14 +37,16 @@ your object. To allow GET access to your object for 1 minute: .. code-block:: php - $object->getTemporaryUrl(60, 'GET'); + $object->getTemporaryUrl(60, 'GET'); To allow PUT access for 1 hour: .. code-block:: php - $object->getTemporaryUrl(360, 'PUT'); + $object->getTemporaryUrl(360, 'PUT'); + +`Get the executable PHP script for this example `_ Hosting HTML sites on CDN diff --git a/doc/services/object-store/account.rst b/doc/services/object-store/account.rst index fb51c8855..50c17f1a8 100644 --- a/doc/services/object-store/account.rst +++ b/doc/services/object-store/account.rst @@ -29,6 +29,8 @@ Retrieve total container count $account->getContainerCount(); +`Get the executable PHP script for this example `_ + Retrieve total object count --------------------- @@ -37,6 +39,8 @@ Retrieve total object count $account->getObjectCount(); +`Get the executable PHP script for this example `_ + Retrieve total bytes used ------------------------- @@ -44,3 +48,5 @@ Retrieve total bytes used .. code-block:: php $account->getBytesUsed(); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/object-store/cdn.rst b/doc/services/object-store/cdn.rst index 5ad72b6cd..eb29bb27f 100644 --- a/doc/services/object-store/cdn.rst +++ b/doc/services/object-store/cdn.rst @@ -29,6 +29,8 @@ execute the method on: /** @var $cdnContainer OpenCloud\ObjectStore\Resource\CDNContainer */ } +`Get the executable PHP script for this example `_ + CDN-enable a container ---------------------- @@ -47,6 +49,8 @@ refetches and caches the object for the TTL period. $container->enableCdn(); +`Get the executable PHP script for this example `_ + CDN-disable a container ----------------------- @@ -55,6 +59,8 @@ CDN-disable a container $container->disableCdn(); +`Get the executable PHP script for this example `_ + Operations on CDN-enabled containers ------------------------------------ diff --git a/doc/services/object-store/containers.rst b/doc/services/object-store/containers.rst index 4b9c66ac3..a2f0485e8 100644 --- a/doc/services/object-store/containers.rst +++ b/doc/services/object-store/containers.rst @@ -22,6 +22,9 @@ Forward slashes are not currently permitted. (such as spaces or non-English characters), you must ensure they are encoded with `urlencode `_ before passing them in +`Get the executable PHP script for this example `_ + + List containers --------------- @@ -42,6 +45,8 @@ memcmp() function, regardless of text encoding. The list is limited to 10,000 containers at a time. To work with larger collections, please read the next section. +`Get the executable PHP script for this example `_ + Filtering large collections ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -82,6 +87,8 @@ To retrieve a certain container: /** @param $container OpenCloud\ObjectStore\Resource\Container */ $container = $service->getContainer('{containerName}'); +`Get the executable PHP script for this example `_ + Retrieve a container's name ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,6 +105,8 @@ Retrieve a container's object count $count = $container->getObjectCount(); +`Get the executable PHP script for this example `_ + Retrieve a container's total bytes used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -106,6 +115,8 @@ Retrieve a container's total bytes used $bytes = $container->getBytesUsed(); +`Get the executable PHP script for this example `_ + Delete container ---------------- @@ -129,6 +140,8 @@ before deleting it. This is done for you if you set the You can also `delete all objects <#deleting-all-objects-inside-a-container>`_ first, and then call ``delete``. +`Get the executable PHP script for this example `_ + Deleting all objects inside a container --------------------------------------- @@ -137,6 +150,8 @@ Deleting all objects inside a container $container->deleteAllObjects(); +`Get the executable PHP script for this example `_ + Create or update container metadata ----------------------------------- @@ -158,6 +173,8 @@ to the current metadata: 'Publisher' => 'Hogarth' )); +`Get the executable PHP script for this example `_ + Container quotas ---------------- @@ -184,6 +201,11 @@ And to retrieve them: echo $container->getCountQuota(); echo $container->getBytesQuota(); +Get the executable PHP scripts for this example: + +* `Set bytes quota `_ +* `Set count quota `_ + Access log delivery ------------------- diff --git a/doc/services/object-store/objects.rst b/doc/services/object-store/objects.rst index e38e0eb8b..0eb0ea836 100644 --- a/doc/services/object-store/objects.rst +++ b/doc/services/object-store/objects.rst @@ -43,6 +43,8 @@ its path: The resource handle will be automatically closed by Guzzle in its destructor, so there is no need to execute ``fclose``. +`Get the executable PHP script for this example `_ + Upload a single file (under 5GB) with metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -80,6 +82,8 @@ file handle resource, or a string representation of object content (a temporary resource will be created in memory), and the third is an array of additional headers. +`Get the executable PHP script for this example `_ + Batch upload multiple files (each under 5GB) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,6 +112,8 @@ also specify *either* a path key (to an existing file), or a ``body``. The ``body`` can either be a PHP resource or a string representation of the content you want to upload. +`Get the executable PHP script for this example `_ + Upload large files (over 5GB) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -142,6 +148,8 @@ In Swift terminology, the name for this process is *Dynamic Large Object (DLO)*. To find out more details, please consult the `official documentation `_. +`Get the executable PHP script for this example `_ + List objects in a container --------------------------- @@ -166,6 +174,8 @@ docs objectList(array('prefix' => 'logFile_')); +`Get the executable PHP script for this example `_ + Get object ---------- @@ -313,6 +323,8 @@ destination path: Where ``container_2`` is the name of the container, and ``new_object_name`` is the name of the object inside the container that does not exist yet. +`Get the executable PHP script for this example `_ + Get object metadata ------------------- @@ -346,6 +358,8 @@ You can also update to get the latest metadata: $object->retrieveMetadata(); +`Get the executable PHP script for this example `_ + Update object metadata ---------------------- @@ -386,6 +400,8 @@ you want to append values to your metadata, use the correct method: $object->saveMetadata($metadata); +`Get the executable PHP script for this example `_ + Extract archive --------------- @@ -406,6 +422,8 @@ the first argument). If you do this, the API will create the containers necessary to house the extracted files - this is done based on the filenames inside the archive. +`Get the executable PHP script for this example `_ + Delete object ------------- @@ -414,6 +432,8 @@ Delete object $object->delete(); +`Get the executable PHP script for this example `_ + Delete multiple objects ----------------------- @@ -425,3 +445,5 @@ Bulk delete a set of paths: $pathsToBeDeleted = array('/container_1/old_file', '/container_2/notes.txt', '/container_1/older_file.log'); $service->bulkDelete($pathsToBeDeleted); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/orchestration/stacks.rst-e b/doc/services/orchestration/stacks.rst-e deleted file mode 100644 index 29b6c4f7f..000000000 --- a/doc/services/orchestration/stacks.rst-e +++ /dev/null @@ -1,299 +0,0 @@ -Stacks -====== - -A stack is a running instance of a template. When a stack is created, -the `resources <#stack-resources>`__ specified in the template are -created. - - -Preview stack -------------- - -Before you create a stack from a template, you might want to see what -that stack will look like. This is called *previewing the stack*. - -This operation takes one parameter, an associative array, with the -following keys: - -+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| Name | Description | Data type | Required? | Default value | Example value | -+===================+=====================================================================================================================================================================================================================+=========================================================================================================================+=======================================+=================+=================================================================================================+ -| ``name`` | Name of the stack | String. Must start with an alphabetic character, and must contain only alphanumeric, ``_``, ``-`` or ``.`` characters | Yes | - | ``simple-lamp-setup`` | -+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``template`` | Template contents | String. JSON or YAML | No, if ``templateUrl`` is specified | ``null`` | ``heat_template_version: 2013-05-23\ndescription: LAMP server\n`` | -+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``templateUrl`` | URL of the template file | String. HTTP or HTTPS URL | No, if ``template`` is specified | ``null`` | ``https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml`` | -+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``parameters`` | Arguments to the template, based on the template's parameters. For example, see the parameters in `this template section `__ | Associative array | No | ``null`` | ``array('flavor_id' => 'general1-1')`` | -+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ - -Preview a stack from a template file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored on your local computer as a JSON or YAML -file, you can use it to preview a stack as shown in the following -example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack = $orchestrationService->previewStack(array( - 'name' => 'simple-lamp-setup', - 'template' => file_get_contents(__DIR__ . '/lamp.yml'), - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ) - )); - -`Get the executable PHP script for this example `_ - - -Preview a stack from a template URL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored as a JSON or YAML file in a remote location -accessible via HTTP or HTTPS, you can use it to preview a stack as shown -in the following example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack = $orchestrationService->previewStack(array( - 'name' => 'simple-lamp-setup', - 'templateUrl' => 'https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml', - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ) - )); - -`Get the executable PHP script for this example `_ - - -Create stack ------------- - -You can create a stack from a template. This operation takes one parameter, an -associative array, with the following keys: - -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| Name | Description | Data type | Required? | Default value | Example value | -+===================+====================================================================+==========================================================================================================================+=======================================+=================+=================================================================================================+ -| ``name`` | Name of the stack | String. Must start with an alphabetic character, and must contain only alphanumeric, ``_``, ``-`` or ``.`` characters. | Yes | - | ``simple-lamp-setup`` | -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``template`` | Template contents | String. JSON or YAML | No, if ``templateUrl`` is specified | ``null`` | ``heat_template_version: 2013-05-23\ndescription: LAMP server\n`` | -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``templateUrl`` | URL of template file | String. HTTP or HTTPS URL | No, if ``template`` is specified | ``null`` | ``https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml`` | -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``parameters`` | Arguments to the template, based on the template's parameters | Associative array | No | ``null`` | ``array('server_hostname' => 'web01')`` | -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ -| ``timeoutMins`` | Duration, in minutes, after which stack creation should time out | Integer | Yes | - | 5 | -+-------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-----------------+-------------------------------------------------------------------------------------------------+ - -Create a stack from a template file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored on your local computer as a JSON or YAML -file, you can use it to create a stack as shown in the following -example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack = $orchestrationService->createStack(array( - 'name' => 'simple-lamp-setup', - 'templateUrl' => 'https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml', - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ), - 'timeoutMins' => 5 - )); - -`Get the executable PHP script for this example `_ - - -Create a stack from a template URL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored as a JSON or YAML file in a remote location -accessible via HTTP or HTTPS, you can use it to create a stack as shown -in the following example: - -.. code-block:: php - - $stack = $orchestrationService->stack(); - $stack->create(array( - 'name' => 'simple-lamp-setup', - 'templateUrl' => 'https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml', - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ), - 'timeoutMins' => 5 - )); - -`Get the executable PHP script for this example `_ - -List stacks ------------ - -You can list all the stacks that you have created as shown in the -following example: - -.. code-block:: php - - $stacks = $orchestrationService->listStacks(); - foreach ($stacks as $stack) { - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - } - -`Get the executable PHP script for this example `_ - - -Get stack ---------- - -You can retrieve a specific stack using its name, as shown in the -following example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack = $orchestrationService->getStack('simple-lamp-setup'); - -`Get the executable PHP script for this example `_ - - -Get stack template ------------------- - -You can retrieve the template used to create a stack. Note that a JSON -string is returned, regardless of whether a JSON or YAML template was -used to create the stack. - -.. code-block:: php - - /** @var $stackTemplate string **/ - $stackTemplate = $stack->getTemplate(); - -`Get the executable PHP script for this example `_ - - -Update stack ------------- - -You can update a running stack. - -This operation takes one parameter, an associative array, with the -following keys: - -+-------------------+------------------------------------------------------------------+-----------------------------+---------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+ -| Name | Description | Data type | Required? | Default value | Example value | -+===================+==================================================================+=============================+=======================================+=================+=========================================================================================================+ -| ``template`` | Template contents | String. JSON or YAML | No, if ``templateUrl`` is specified | ``null`` | ``heat_template_version: 2013-05-23\ndescription: LAMP server\n`` | -+-------------------+------------------------------------------------------------------+-----------------------------+---------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+ -| ``templateUrl`` | URL of template file | String. HTTP or HTTPS URL | No, if ``template`` is specified | ``null`` | ``https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp-updated.yaml`` | -+-------------------+------------------------------------------------------------------+-----------------------------+---------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+ -| ``parameters`` | Arguments to the template, based on the template's parameters | Associative array | No | ``null`` | ``array('flavor_id' => 'general1-1')`` | -+-------------------+------------------------------------------------------------------+-----------------------------+---------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+ -| ``timeoutMins`` | Duration, in minutes, after which stack update should time out | Integer | Yes | - | 5 | -+-------------------+------------------------------------------------------------------+-----------------------------+---------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+ - - -Update a stack from a template file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored on your local computer as a JSON or YAML -file, you can use it to update a stack as shown in the following -example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack->update(array( - 'template' => file_get_contents(__DIR__ . '/lamp-updated.yml'), - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ), - 'timeoutMins' => 5 - )); - -`Get the executable PHP script for this example `_ - - -Update Stack from Template URL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If your template is stored as a JSON or YAML file in a remote location -accessible via HTTP or HTTPS, you can use it to update a stack as shown -in the following example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack->update(array( - 'templateUrl' => 'https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp-updated.yaml', - 'parameters' => array( - 'server_hostname' => 'web01', - 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' - ), - 'timeoutMins' => 5 - )); - -`Get the executable PHP script for this example `_ - - -Delete stack ------------- - -If you no longer need a stack and all its resources, you can delete the -stack *and* the resources as shown in the following example: - -.. code-block:: php - - $stack->delete(); - -`Get the executable PHP script for this example `_ - - -Abandon Stack -------------- - -.. note:: - - This operation returns data about the abandoned stack as a string. You can - use this data to recreate the stack by using the `adopt stack <#adopt-stack>`_ - operation. - -If you want to delete a stack but preserve all its resources, you can -abandon the stack as shown in the following example: - -.. code-block:: php - - /** @var $abandonStackData string **/ - $abandonStackData = $stack->abandon(); - file_put_contents(__DIR__ . '/sample_adopt_stack_data.json', $abandonStackData); - -`Get the executable PHP script for this example `_ - - -Adopt stack ------------ - -If you have data from an abandoned stack, you can re-create the stack as -shown in the following example: - -.. code-block:: php - - /** @var $stack OpenCloud\Orchestration\Resource\Stack **/ - $stack = $orchestrationService->adoptStack(array( - 'name' => 'simple-lamp-setup', - 'template' => file_get_contents(__DIR__ . '/lamp.yml'), - 'adoptStackData' => $abandonStackData, - 'timeoutMins' => 5 - )); - -`Get the executable PHP script for this example `_ diff --git a/doc/services/queues/claims.rst b/doc/services/queues/claims.rst index 7e375c8d3..1111cb9eb 100644 --- a/doc/services/queues/claims.rst +++ b/doc/services/queues/claims.rst @@ -67,6 +67,8 @@ limit parameter is optional. 'ttl' => 5 * Datetime::MINUTE )); +`Get the executable PHP script for this example `_ + Query claim ----------- diff --git a/doc/services/queues/messages.rst b/doc/services/queues/messages.rst index ea23caea3..3a5dee89d 100644 --- a/doc/services/queues/messages.rst +++ b/doc/services/queues/messages.rst @@ -50,6 +50,8 @@ Posting a single message 'ttl' => 2 * Datetime::DAY )); +`Get the executable PHP script for this example `_ + Post a batch of messages ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/services/queues/queues.rst b/doc/services/queues/queues.rst index 7958adfae..f324e3f3b 100644 --- a/doc/services/queues/queues.rst +++ b/doc/services/queues/queues.rst @@ -64,6 +64,8 @@ digits, underscores, and hyphens. $queue = $service->createQueue('new_queue'); +`Get the executable PHP script for this example `_ + Find queue details ------------------ @@ -122,3 +124,12 @@ in the queue, categorized by status. .. code-block:: php $queue->getStats(); + +Delete queue +------------ + +.. code-block:: php + + $queue->delete(); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/volume/snapshots.rst b/doc/services/volume/snapshots.rst index c2d8ef6cc..555824a9d 100644 --- a/doc/services/volume/snapshots.rst +++ b/doc/services/volume/snapshots.rst @@ -19,6 +19,8 @@ to create one: 'volume_id' => $volume->id )); +`Get the executable PHP script for this example `_ + List snapshots -------------- @@ -31,6 +33,8 @@ List snapshots /** @param $snapshot OpenCloud\Volume\Resource\Snapshot */ } +`Get the executable PHP script for this example `_ + To get details on a single snapshot ----------------------------------- @@ -39,6 +43,8 @@ To get details on a single snapshot $snapshot = $dallas->snapshot('{snapshotId}'); +`Get the executable PHP script for this example `_ + To delete a snapshot -------------------- @@ -46,3 +52,5 @@ To delete a snapshot .. code-block:: php $snapshot->delete(); + +`Get the executable PHP script for this example `_ diff --git a/doc/services/volume/volumes.rst b/doc/services/volume/volumes.rst index 6a35bb135..a84ed0421 100644 --- a/doc/services/volume/volumes.rst +++ b/doc/services/volume/volumes.rst @@ -19,6 +19,9 @@ parameters are optional: 'display_description' => 'Used for large object storage' )); +`Get the executable PHP script for this example `_ + + List volumes ------------ @@ -30,6 +33,8 @@ List volumes /** @param $volumeType OpenCloud\Volume\Resource\Volume */ } +`Get the executable PHP script for this example `_ + Get details on a single volume ------------------------------ @@ -42,6 +47,8 @@ information on the specified volume: $volume = $dallas->volume(''); echo $volume->size; +`Get the executable PHP script for this example `_ + To delete a volume ------------------ @@ -50,6 +57,8 @@ To delete a volume $volume->delete(); +`Get the executable PHP script for this example `_ + Attach a volume to a server --------------------------- diff --git a/samples/ObjectStore/list-cdn-containers.php b/samples/ObjectStore/list-cdn-containers.php new file mode 100644 index 000000000..a71a8bed9 --- /dev/null +++ b/samples/ObjectStore/list-cdn-containers.php @@ -0,0 +1,40 @@ + '{username}', + 'apiKey' => '{apiKey}', +)); + +// 2. Obtain an Object Store service object from the client. +$objectStoreService = $client->objectStoreService(null, '{region}'); + +// 3. Object a CDN service object +$cdnService = $objectStoreService->getCdnService(); + +// 4. Get container list. +$containers = $cdnService->listContainers(); + +foreach ($containers as $container) { + /** @var $container OpenCloud\ObjectStore\Resource\CDNContainer **/ +}