get_attributes ( $domain_name, $item_name, $attribute_name, $opt )

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.

If you specify GetAttributes without any attribute names, all the attributes for the item are returned.

Access

public

Parameters

Parameter

Type

Required

Description

$domain_name

string

Required

The name of the domain in which to perform the operation.

$item_name

string

Required

The name of the base item which will contain the series of keypairs.

$attribute_name

string
array

Optional

The names of the attributes. Pass a string for a single value, or an indexed array for multiple values.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • ConsistentRead - boolean - Optional - True if strong consistency should be enforced when data is read from SimpleDB, meaning that any data previously written to SimpleDB will be returned. Without specifying this parameter, results will be eventually consistent, and you may not see data that was written immediately before your read.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This is useful for manually-managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Get attributes for an entire item.

// Instantiate
$sdb = new AmazonSDB();
$response = $sdb->get_attributes('example-domain', 'unit-test');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Get attributes for a specific attribute under an item.

// Instantiate
$sdb = new AmazonSDB();
$response = $sdb->get_attributes('example-domain', 'unit-test', 'key1');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/sdb.class.php | Toggle source view (15 lines) | View on GitHub

public function get_attributes($domain_name, $item_name, $attribute_name = null, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['DomainName'] = $domain_name;
    $opt['ItemName'] = $item_name;

    if ($attribute_name)
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'AttributeName' => (is_array($attribute_name) ? $attribute_name : array($attribute_name))
        )));
    }

    return $this->authenticate('GetAttributes', $opt, $this->hostname);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback