Amazon SimpleDB Service (http://aws.amazon.com/simpledb)
2008.12.02
2006-2008 LifeNexus Digital, Inc., and contributors.
| Simplified BSD License | http://opensource.org/licenses/bsd-license.php |
| Tarzan | http://tarzan-aws.com |
| Amazon SDB | http://aws.amazon.com/simpledb |
Container for all Amazon SimpleDB-related methods. Inherits additional methods from TarzanCore.
TarzanCore
require_once('tarzan.class.php');
// Instantiate a new AmazonSDB object using the settings from the config.inc.php file.
$s3 = new AmazonSDB();
// Instantiate a new AmazonSDB object using these specific settings.
$s3 = new AmazonSDB($key, $secret_key);
public function __construct( $key = null, $secret_key = null )
The constructor
public
| key | string (Optional) Your Amazon API Key. If blank, it will look for the AWS_KEY constant. |
| secret_key | string (Optional) Your Amazon API Secret Key. If blank, it will look for the AWS_SECRET_KEY constant. |
boolean false if no valid values are set, otherwise true.
| Example Usage | http://tarzan-aws.com |
public function create_domain( $domain_name, $returnCurlHandle = null )
Creates a new domain. The domain name must be unique among the domains associated with the Access Key ID provided in the request. The CreateDomain operation might take 10 or more seconds to complete.
public
| domain_name | string (Required) The domain name to use for storing data. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function list_domains( $opt = null )
Lists all domains associated with the Access Key ID. It returns domain names up to the limit set by MaxNumberOfDomains. A NextToken is returned if there are more than MaxNumberOfDomains domains. Calling ListDomains successive times with the NextToken returns up to MaxNumberOfDomains more domain names each time.
public
| opt | array (Required) Associative array of parameters which can have the following keys: |
| MaxNumberOfDomains | integer (Optional) The maximum number of domain names you want returned. The range is 1 to 100. |
| NextToken | string (Optional) String that tells Amazon SimpleDB where to start the next list of domain names. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function delete_domain( $domain_name, $returnCurlHandle = null )
Deletes a domain. Any items (and their attributes) in the domain are deleted as well. The DeleteDomain operation might take 10 or more seconds to complete. Running DeleteDomain on a domain that does not exist or running the function multiple times using the same domain name will not result in an error response.
public
| domain_name | string (Required) The domain name to delete. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function domain_metadata( $domain_name, $returnCurlHandle = null )
Returns information about the domain, including when the domain was created, the number of items and attributes, and the size of attribute names and values.
public
| domain_name | string (Required) The domain name to use for retrieving metadata. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function put_attributes( $domain_name, $item_name, $keypairs, $replace = null, $returnCurlHandle = null )
Creates or replaces attributes in an item. You specify new attributes using a combination of the Attribute.X.Name and Attribute.X.Value parameters.
public
| domain_name | string (Required) The domain name to use for storing data. |
| item_name | string (Required) The name of the base item which will contain the series of keypairs. |
| keypairs | array (Required) Associative array of parameters which are treated as key-value and key-multivalue pairs (i.e. a key can have one or more values; think tags). |
| replace | boolean|array (Optional) Whether to replace a key-value pair if a matching key already exists. Supports either a boolean (which affects ALL key-value pairs) or an indexed array of key names (which affects only the keys specified). Defaults to boolean false. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function get_attributes( $domain_name, $item_name, $keys = null, $returnCurlHandle = null )
Returns all of the attributes associated with the item. Optionally, the attributes returned can be limited to one or more specified attribute name parameters. If the item does not exist on the replica that was accessed for this operation, an empty set is returned. The system does not return an error as it cannot guarantee the item does not exist on other replicas.
public
| domain_name | string (Required) The domain name to use for storing data. |
| item_name | string (Required) The name of the base item which will contain the series of keypairs. |
| keys | string|array (Optional) The name of the key (attribute) in the key-value pair that you want to return. Supports a string value (for single keys) or an indexed array (for multiple keys). |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function delete_attributes( $domain_name, $item_name, $keys = null, $returnCurlHandle = null )
Deletes one or more attributes associated with the item. If all attributes of an item are deleted, the item is deleted. If you specify DeleteAttributes without attributes or values, all the attributes for the item are deleted. DeleteAttributes is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response.
public
| domain_name | string (Required) The domain name to use for storing data. |
| item_name | string (Required) The name of the base item which will contain the series of keypairs. |
| keys | string|array (Optional) The name of the key (attribute) in the key-value pair that you want to delete. Supports a string value (for single keys), an indexed array (for multiple keys), or an associative array containing one or more key-value pairs (for deleting specific values). |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
public function query( $domain_name, $opt = null, $expression = null, $follow = null )
Returns a set of ItemNames that match the query expression. Query operations that run longer than 5 seconds will likely time-out and return a time-out error response. A Query with no QueryExpression matches all items in the domain.
The Query operation returns a list of ItemNames that match the query expression. The maximum number that can be returned by one query is determined by MaxNumberOfItems which can be set to number between 1 and 250, inclusive. The default value for MaxNumberOfItems is 100. If more than MaxNumberOfItems items match the query expression, a NextToken is also returned.
Submitting the query again with the NextToken will return the next set of items. To obtain all items matching the query expression, repeat until no NextToken is returned.
public
| domain_name | string (Required) The domain name to use for storing data. |
| opt | array (Optional) Associative array of parameters which can have the following keys: |
| expression | string (Optional) The SimpleDB query expression to use. |
| follow | boolean (Optional) Whether to take the next step and fetch the items that are returned. This enables very similar functionality to query_with_attributes(), except that the response is a bit different and it can return a larger data set. Defaults to false. |
| MaxNumberOfDomains | integer (Optional) The maximum number of domain names you want returned. The range is 1 to 100. |
| NextToken | string (Optional) String that tells Amazon SimpleDB where to start the next list of domain names. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object
| AWS Method | http://docs.amazonwebservices.com |
| Example Usage | http://tarzan-aws.com |
| Related | query_with_attributes() |
public function query_with_attributes( $domain_name, $opt = null, $expression = null )
The QueryWithAttributes operation returns a set of Attributes for ItemNames that match the query expression. QueryWithAttributes operations that run longer than 5 seconds will likely time-out and return a time-out error response. A QueryWithAttributes with no QueryExpression matches all items in the domain.
The total size of the response cannot exceed 1 MB in total size. Amazon SimpleDB automatically adjusts the number of items returned per page to enforce this limit. For example, even if you ask to retrieve 250 items, but each individual item is 100 kB in size, the system returns 10 items and an appropriate NextToken to get the next page of results.
public
| domain_name | string (Required) The domain name to use for storing data. |
| opt | array (Optional) Associative array of parameters which can have the following keys: |
| expression | string (Optional) The SimpleDB query expression to use. |
| AttributeName | string (Optional) The name of the attribute to return. To return multiple attributes, you can specify this request parameter multiple times. |
| MaxNumberOfDomains | integer (Optional) The maximum number of domain names you want returned. The range is 1 to 100. |
| NextToken | string (Optional) String that tells Amazon SimpleDB where to start the next list of domain names. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
TarzanHTTPResponse object