コード例 #1
0
function GetUsage($sdb, $usage, $bucket, $firstDay, $lastDay)
{
    // Create the query
    $query = "select StartTime, UsageValue " . " from " . BOOK_AWS_USAGE_DOMAIN . " where" . " Service='AmazonS3' and " . " StartTime >= '{$firstDay}' and " . " StartTime <= '{$lastDay}' and " . " Resource='{$bucket}' and " . " UsageType='{$usage}'";
    // Query for the data
    $res = $sdb->select($query);
    // Check the result
    if (!$res->isOK()) {
        return null;
    }
    // Build array of results
    $dailyUsage = array();
    foreach ($res->body->SelectResult->Item as $item) {
        $attrs = getItemAttributes($item);
        $startTime = substr($attrs['StartTime'], 0, 10);
        $usage = $attrs['UsageValue'];
        $dailyUsage[$startTime] = $usage;
    }
    return $dailyUsage;
}
コード例 #2
0
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'tarzan.class.php';
require_once 'book.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select * from " . CL_ITEM_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = $item->Name;
        // Get list of attributes
        $attrs = array_keys(getItemAttributes($item));
        // Delete the attributes
        $res2 = $sdb->delete_attributes(CL_ITEM_DOMAIN, $itemName, $attrs);
        if ($res2->isOK()) {
            print "Deleted item {$itemName}\n";
        } else {
            $error = $res2->body->Errors->Error->Message;
            print "Could not delete item: {$error}\n";
        }
    }
} else {
    $error = $res1->body->Errors->Error->Message;
    exit("Could not run query: {$error}\n");
}