Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
* implemented getAttributes()
Browse files Browse the repository at this point in the history
  • Loading branch information
till committed Sep 8, 2010
1 parent dcd1c4d commit a8291ca
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/Services/Amazon/SNS/Topics.php
Expand Up @@ -60,6 +60,9 @@ class Services_Amazon_SNS_Topics extends Services_Amazon_SNS_Common
);

/**
* When you already created a topic, the API will return the ARN of the already
* created one. Otherwise, this works as expected.
*
* <code>
* http://sns.us-east-1.amazonaws.com/
* ?Name=My-Topic
Expand All @@ -69,6 +72,11 @@ class Services_Amazon_SNS_Topics extends Services_Amazon_SNS_Common
* &Timestamp=2010-03-31T12%3A00%3A00.000Z
* &AWSAccessKeyId=(AWS Access Key ID)
* &Signature=gfzIF53exFVdpSNb8AiwN3Lv%2FNYXh6S%2Br3yySK70oX4%3D
* </code>
*
* @param string $name The name of the topic.
*
* @return string The topic's ARN.
*/
public function add($name)
{
Expand All @@ -79,6 +87,8 @@ public function add($name)
}

/**
* Give other AWS accounts permissions to add public, etc. to a topic.
*
* <code>
* http://sns.us-east-1.amazonaws.com/
* ?TopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A123456789012%3AMy-Test
Expand Down Expand Up @@ -115,7 +125,7 @@ public function delete($arn)
}

/**
* List.
* ListTopics.
*
* @return array
*/
Expand All @@ -127,8 +137,14 @@ public function get()
return $this->parseResponse($response);
}

public function getAttributes()
public function getAttributes($arn)
{
$requestUrl = $this->createRequest(
array('Action' => 'GetTopicAttributes', 'TopicArn' => $arn)
);
$response = $this->makeRequest($requestUrl);

return $this->parseResponse($response);
}

public function setAttributes()
Expand Down Expand Up @@ -158,7 +174,14 @@ protected function responseParser(SimpleXMLElement $xml)
}
return $topics;
}
// var_dump($xml->ListTopicsResult->Topics);
if (isset($xml->GetTopicAttributesResult)) {
$attributes = array();
foreach ($xml->GetTopicAttributesResult->Attributes->entry as $entry) {
$attributes[(string) $entry->key] = (string) $entry->value;
}
return $attributes;
}
//var_dump($xml);
throw new Services_Amazon_SNS_Exception("Not yet implemented response parser.");
}
}

0 comments on commit a8291ca

Please sign in to comment.