Wednesday, April 17, 2013

Amazon SimpleDB listDomains() example c c++ objc


listDomains:

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 provided by the operation returns up to MaxNumberOfDomains more domain names with each successive operation call.
- (SimpleDBListDomainsResponse *)listDomains:(SimpleDBListDomainsRequest *)listDomainsRequest

Parameters

listDomainsRequest
Container for the necessary parameters to execute the ListDomains service method on AmazonSimpleDB.

Return Value

The response from the ListDomains service method, as returned by AmazonSimpleDB.
Example
{
   // Get domain lists.
    //
    int                                 setMaxNumberOfDomains = 10;
    NSMutableArray              *domains = nil;

    SimpleDBListDomainsRequest  *listDomainsRequest  = [[[SimpleDBListDomainsRequest alloc] init] autorelease];

    [listDomainsRequest setRequestEndpoint:AMAZON_SDB_US_EAST_1_ENDPOINT_SECURE];
    [listDomainsRequest setMaxNumberOfDomains:[NSNumber numberWithInt:maxNumberOfDomains]];
    
    // Call listDomains() on AWS SimpleDB
    //
    SimpleDBListDomainsResponse *listDomainsResponse = [[AmazonClientManager sdb] listDomains:listDomainsRequest];
    
    if(listDomainsResponse.error != nil)
    {
        NSLog(@"Error: %@", listDomainsResponse.error);
    }
    
    domains = [[[NSMutableArray alloc] initWithCapacity:[listDomainsResponse.domainNames count]] autorelease];
   
    for (NSString *name in listDomainsResponse.domainNames)
        [domains addObject:name];
    
    return domains;
}