コード例 #1
0
/**
 * Domain Metadata Action Sample
 * The DomainMetadata operation returns some domain metadata values, such as the
 * number of items, attribute names and attribute values along with their sizes.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_DomainMetadata or array of parameters
 */
function invokeDomainMetadata(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->domainMetadata($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        DomainMetadataResponse\n";
        if ($response->isSetDomainMetadataResult()) {
            echo "            DomainMetadataResult\n";
            $domainMetadataResult = $response->getDomainMetadataResult();
            if ($domainMetadataResult->isSetItemCount()) {
                echo "                ItemCount\n";
                echo "                    " . $domainMetadataResult->getItemCount() . "\n";
            }
            if ($domainMetadataResult->isSetItemNamesSizeBytes()) {
                echo "                ItemNamesSizeBytes\n";
                echo "                    " . $domainMetadataResult->getItemNamesSizeBytes() . "\n";
            }
            if ($domainMetadataResult->isSetAttributeNameCount()) {
                echo "                AttributeNameCount\n";
                echo "                    " . $domainMetadataResult->getAttributeNameCount() . "\n";
            }
            if ($domainMetadataResult->isSetAttributeNamesSizeBytes()) {
                echo "                AttributeNamesSizeBytes\n";
                echo "                    " . $domainMetadataResult->getAttributeNamesSizeBytes() . "\n";
            }
            if ($domainMetadataResult->isSetAttributeValueCount()) {
                echo "                AttributeValueCount\n";
                echo "                    " . $domainMetadataResult->getAttributeValueCount() . "\n";
            }
            if ($domainMetadataResult->isSetAttributeValuesSizeBytes()) {
                echo "                AttributeValuesSizeBytes\n";
                echo "                    " . $domainMetadataResult->getAttributeValuesSizeBytes() . "\n";
            }
            if ($domainMetadataResult->isSetTimestamp()) {
                echo "                Timestamp\n";
                echo "                    " . $domainMetadataResult->getTimestamp() . "\n";
            }
        }
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
            if ($responseMetadata->isSetBoxUsage()) {
                echo "                BoxUsage\n";
                echo "                    " . $responseMetadata->getBoxUsage() . "\n";
            }
        }
    } catch (Amazon_SimpleDB_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}
コード例 #2
0
/**
 * Create Domain Action Sample
 * The CreateDomain operation 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 may take 10 or more seconds to complete.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_CreateDomain or array of parameters
 */
function invokeCreateDomain(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->createDomain($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        CreateDomainResponse\n";
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
            if ($responseMetadata->isSetBoxUsage()) {
                echo "                BoxUsage\n";
                echo "                    " . $responseMetadata->getBoxUsage() . "\n";
            }
        }
    } catch (Amazon_SimpleDB_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}
コード例 #3
0
/**
 * Select Action Sample
 * The Select operation returns a set of item names and associate attributes that match the
 * query expression. Select operations that run longer than 5 seconds will likely time-out
 * and return a time-out error response.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_Select or array of parameters
 */
function invokeSelect(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->select($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        SelectResponse\n";
        if ($response->isSetSelectResult()) {
            echo "            SelectResult\n";
            $selectResult = $response->getSelectResult();
            $itemList = $selectResult->getItem();
            foreach ($itemList as $item) {
                echo "                Item\n";
                if ($item->isSetName()) {
                    echo "                    Name\n";
                    echo "                        " . $item->getName() . "\n";
                }
                $attributeList = $item->getAttribute();
                foreach ($attributeList as $attribute) {
                    echo "                    Attribute\n";
                    if ($attribute->isSetName()) {
                        echo "                        Name\n";
                        echo "                            " . $attribute->getName() . "\n";
                    }
                    if ($attribute->isSetValue()) {
                        echo "                        Value\n";
                        echo "                            " . $attribute->getValue() . "\n";
                    }
                }
            }
            if ($selectResult->isSetNextToken()) {
                echo "                NextToken\n";
                echo "                    " . $selectResult->getNextToken() . "\n";
            }
        }
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
            if ($responseMetadata->isSetBoxUsage()) {
                echo "                BoxUsage\n";
                echo "                    " . $responseMetadata->getBoxUsage() . "\n";
            }
        }
    } catch (Amazon_SimpleDB_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}
コード例 #4
0
/**
 * List Domains Action Sample
 * The ListDomains operation 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.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_ListDomains or array of parameters
 */
function invokeListDomains(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->listDomains($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        ListDomainsResponse\n";
        if ($response->isSetListDomainsResult()) {
            echo "            ListDomainsResult\n";
            $listDomainsResult = $response->getListDomainsResult();
            $domainNameList = $listDomainsResult->getDomainName();
            foreach ($domainNameList as $domainName) {
                echo "                DomainName\n";
                echo "                    " . $domainName;
            }
            if ($listDomainsResult->isSetNextToken()) {
                echo "                NextToken\n";
                echo "                    " . $listDomainsResult->getNextToken() . "\n";
            }
        }
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
            if ($responseMetadata->isSetBoxUsage()) {
                echo "                BoxUsage\n";
                echo "                    " . $responseMetadata->getBoxUsage() . "\n";
            }
        }
    } catch (Amazon_SimpleDB_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}