create_topic ( $name, $opt )

The CreateTopic action creates a topic to which notifications can be published. Users can create at most 25 topics. This action is idempotent, so if the requester already owns a topic with the specified name, that topic’s ARN will be returned without creating a new topic.

Access

public

Parameters

Parameter

Type

Required

Description

$name

string

Required

The name of the topic you want to create. Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, and hyphens, and must be between 1 and 256 characters long.

$opt

array

Optional

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

  • 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 toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Create a new topic in the (default) US-East region.

$sns = new AmazonSNS();

// Create a new topic
$response = $sns->create_topic('example-topic');

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

Related Methods

Source

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

public function create_topic($name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['Name'] = $name;
    
    return $this->authenticate('CreateTopic', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback