ExAws v0.5.0 ExAws.SNS.Client behaviour
Defines an SNS Client
By default you can use ExAws.SNS
Usage
defmodule MyApp.SNS do
use ExAws.SNS.Client, otp_app: :my_otp_app
end
In your config:
config :my_otp_app, :ex_aws,
sns: [], # SNS config goes here
You can now use MyApp.SNS as the root module for the SNS API without needing to pass in a particular configuration. This enables different OTP apps to configure their AWS configurations separately.
The alignment with a particular OTP app while convenient is however entirely optional.
The following also works:
defmodule MyApp.SNS do
use ExAws.SNS.Client
def config_root do
Application.get_all_env(:my_aws_config_root)
end
end
ExAws now expects the config for that client to live under :my_aws_config_root
:
config :my_aws_config_root
sns: [] # SNS config goes here
Default config values can be found in ExAws.Config.
General notes
TODO
Examples
TODO
http://docs.aws.amazon.com/sns/latest/APIReference/API_Operations.html
Summary
Callbacks
Retrieves the root AWS config for this client
Create topic
Delete topic
Get topic attributes
List topics
Publish message to a target/topic ARN
Enables custom request handling
Set topic attributes
Types
message_attribute :: %{name: binary, data_type: :string | :number | :binary, value: {:string, binary} | {:binary, binary}}
publish_opts :: [message_attributes: [message_attribute], message_structure: :json, subject: binary, target_arn: binary, topic_arn: binary]
topic_arn :: binary
topic_attribute_name ::
:policy |
:display_name |
:delivery_policy
topic_name :: binary
Callbacks
Specs
create_topic(topic_name :: topic_name) :: ExAws.Request.response_t
Create topic
Specs
delete_topic(topic_arn :: topic_arn) :: ExAws.Request.response_t
Delete topic
Specs
get_topic_attributes(topic_arn :: topic_arn) :: ExAws.Request.response_t
Get topic attributes
Specs
publish(message :: binary, opts :: publish_opts) :: ExAws.Request.response_t
Publish message to a target/topic ARN
You must set either :target_arn or :topic_arn but not both via the options argument.
Do NOT assume that because your message is a JSON blob that you should set message_structure: to :json. This has a very specific meaning, please see http://docs.aws.amazon.com/sns/latest/api/API_Publish.html for details.
Specs
request(client_struct :: %{}, data :: %{}, action :: atom) :: term
Enables custom request handling.
By default this just forwards the request to the ExAws.SNS.Request.request/3
.
However, this can be overriden in your client to provide pre-request adjustments to headers, params, etc.
Specs
set_topic_attributes(attribute_name :: topic_attribute_name, attribute_value :: binary, topic_arn :: topic_arn) :: ExAws.Request.response_t
Set topic attributes