sns

package
v0.0.0-...-2731d20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2017 License: LGPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MESSAGE_TYPE_SUBSCRIPTION_CONFIRMATION = "SubscriptionConfirmation"
	MESSAGE_TYPE_UNSUBSCRIBE_CONFIRMATION  = "UnsubscribeConfirmation"
	MESSAGE_TYPE_NOTIFICATION              = "Notification"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPermissionResponse

type AddPermissionResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type Attribute

type Attribute struct {
	Key   string `xml:"key"`
	Value string `xml:"value"`
}

type ConfirmSubscriptionResponse

type ConfirmSubscriptionResponse struct {
	SubscriptionArn  string `xml:"ConfirmSubscriptionResult>SubscriptionArn"`
	ResponseMetadata aws.ResponseMetadata
}

type CreatePlatformApplicationResponse

type CreatePlatformApplicationResponse struct {
	PlatformApplicationArn string `xml:"CreatePlatformApplicationResult>PlatformApplicationArn"`
	ResponseMetadata       aws.ResponseMetadata
}

type CreatePlatformEndpointResponse

type CreatePlatformEndpointResponse struct {
	EndpointArn      string `xml:"CreatePlatformEndpointResult>EndpointArn"`
	ResponseMetadata aws.ResponseMetadata
}

type CreateTopicResponse

type CreateTopicResponse struct {
	Topic            Topic `xml:"CreateTopicResult"`
	ResponseMetadata aws.ResponseMetadata
}

type DeleteEndpointResponse

type DeleteEndpointResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type DeletePlatformApplicationResponse

type DeletePlatformApplicationResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type DeleteTopicResponse

type DeleteTopicResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type Endpoint

type Endpoint struct {
	EndpointArn string      `xml:"EndpointArn"`
	Attributes  []Attribute `xml:"Attributes>entry"`
}

type GetEndpointAttributesResponse

type GetEndpointAttributesResponse struct {
	Attributes       []Attribute `xml:"GetEndpointAttributesResult>Attributes>entry"`
	ResponseMetadata aws.ResponseMetadata
}

type GetPlatformApplicationAttributesResponse

type GetPlatformApplicationAttributesResponse struct {
	Attributes       []Attribute `xml:"GetPlatformApplicationAttributesResult>Attributes>entry"`
	ResponseMetadata aws.ResponseMetadata
}

type GetSubscriptionAttributesResponse

type GetSubscriptionAttributesResponse struct {
	Attributes       []Attribute `xml:"GetSubscriptionAttributesResult>Attributes>entry"`
	ResponseMetadata aws.ResponseMetadata
}

type GetTopicAttributesResponse

type GetTopicAttributesResponse struct {
	Attributes       []Attribute `xml:"GetTopicAttributesResult>Attributes>entry"`
	ResponseMetadata aws.ResponseMetadata
}

type HttpNotification

type HttpNotification struct {
	Type             string    `json:"Type"`
	MessageId        string    `json:"MessageId"`
	Token            string    `json:"Token" optional` // Only for subscribe and unsubscribe
	TopicArn         string    `json:"TopicArn"`
	Subject          string    `json:"Subject" optional` // Only for Notification
	Message          string    `json:"Message"`
	SubscribeURL     string    `json:"SubscribeURL" optional` // Only for subscribe and unsubscribe
	Timestamp        time.Time `json:"Timestamp"`
	SignatureVersion string    `json:"SignatureVersion"`
	Signature        string    `json:"Signature"`
	SigningCertURL   string    `json:"SigningCertURL"`
	UnsubscribeURL   string    `json:"UnsubscribeURL" optional` // Only for notifications
}

Json http notifications SNS posts those to your http url endpoint if http is selected as delivery method. http://docs.aws.amazon.com/sns/latest/dg/json-formats.html#http-subscription-confirmation-json http://docs.aws.amazon.com/sns/latest/dg/json-formats.html#http-notification-json http://docs.aws.amazon.com/sns/latest/dg/json-formats.html#http-unsubscribe-confirmation-json

type ListEndpointsByPlatformApplicationResponse

type ListEndpointsByPlatformApplicationResponse struct {
	NextToken        string     `xml:"ListEndpointsByPlatformApplicationResult>NextToken"`
	Endpoints        []Endpoint `xml:"ListEndpointsByPlatformApplicationResult>Endpoints>member"`
	ResponseMetadata aws.ResponseMetadata
}

type ListPlatformApplicationsResponse

type ListPlatformApplicationsResponse struct {
	NextToken            string                `xml:"ListPlatformApplicationsResult>NextToken"`
	PlatformApplications []PlatformApplication `xml:"ListPlatformApplicationsResult>PlatformApplications>member"`
	ResponseMetadata     aws.ResponseMetadata
}

type ListSubscriptionByTopicResponse

type ListSubscriptionByTopicResponse struct {
	NextToken        string         `xml:"ListSubscriptionsByTopicResult>NextToken"`
	Subscriptions    []Subscription `xml:"ListSubscriptionsByTopicResult>Subscriptions>member"`
	ResponseMetadata aws.ResponseMetadata
}

type ListSubscriptionsResponse

type ListSubscriptionsResponse struct {
	NextToken        string         `xml:"ListSubscriptionsResult>NextToken"`
	Subscriptions    []Subscription `xml:"ListSubscriptionsResult>Subscriptions>member"`
	ResponseMetadata aws.ResponseMetadata
}

type ListTopicsResponse

type ListTopicsResponse struct {
	NextToken        string  `xml:"ListTopicsResult>NextToken"`
	Topics           []Topic `xml:"ListTopicsResult>Topics>member"`
	ResponseMetadata aws.ResponseMetadata
	Error            aws.Error
}

type Permission

type Permission struct {
	ActionName string
	AccountId  string
}

type PlatformApplication

type PlatformApplication struct {
	Attributes             []Attribute `xml:"Attributes>entry"`
	PlatformApplicationArn string
}

type PlatformEndpointOptions

type PlatformEndpointOptions struct {
	Attributes             []Attribute
	PlatformApplicationArn string
	CustomUserData         string
	Token                  string
}

type PublishOptions

type PublishOptions struct {
	Message          string
	MessageStructure string
	Subject          string
	TopicArn         string
	TargetArn        string
}

type PublishResponse

type PublishResponse struct {
	MessageId        string `xml:"PublishResult>MessageId"`
	ResponseMetadata aws.ResponseMetadata
}

type RemovePermissionResponse

type RemovePermissionResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type SNS

type SNS struct {
	aws.Auth
	aws.Region
	// contains filtered or unexported fields
}

func New

func New(auth aws.Auth, region aws.Region) (*SNS, error)

func (*SNS) AddPermission

func (sns *SNS) AddPermission(label, topicArn string, permissions []Permission) (*AddPermissionResponse, error)

Adds a statement to a topic's access control policy, granting access for the specified AWS accounts to the specified actions.

func (*SNS) ConfirmSubscription

func (sns *SNS) ConfirmSubscription(topicArn, token, authenticateOnUnsubscribe string) (*ConfirmSubscriptionResponse, error)

Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an earlier Subscribe action. If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN). This call requires an AWS signature only when the AuthenticateOnUnsubscribe flag is set to "true".

func (*SNS) ConfirmSubscriptionFromHttp

func (sns *SNS) ConfirmSubscriptionFromHttp(notification *HttpNotification,
	authenticateOnUnsubscribe string) (*ConfirmSubscriptionResponse, error)

Verifies an endpoint owner's intent to receive messages by responding to json subscription notification or by re-subscribing after aving received an unsubscribed notification from an http post.

func (*SNS) CreatePlatformApplication

func (sns *SNS) CreatePlatformApplication(name, platform string, attributes []Attribute) (*CreatePlatformApplicationResponse, error)

Creates a platform application object for one of the supported push notification services, such as APNS and GCM, to which devices and mobile apps may register. You must specify PlatformPrincipal and PlatformCredential attributes when using the CreatePlatformApplication action.

func (*SNS) CreatePlatformEndpoint

func (sns *SNS) CreatePlatformEndpoint(options *PlatformEndpointOptions) (*CreatePlatformEndpointResponse, error)

Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM and APNS. CreatePlatformEndpoint requires the PlatformApplicationArn that is returned from CreatePlatformApplication. The EndpointArn that is returned when using CreatePlatformEndpoint can then be used by the Publish action to send a message to a mobile app or by the Subscribe action for subscription to a topic. The CreatePlatformEndpoint action is idempotent, so if the requester already owns an endpoint with the same device token and attributes, that endpoint's ARN is returned without creating a new endpoint.

func (*SNS) CreateTopic

func (sns *SNS) CreateTopic(name string) (*CreateTopicResponse, error)

Creates a topic to which notifications can be published. Users can create at most 3000 topics. This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.

func (*SNS) DeleteEndpoint

func (sns *SNS) DeleteEndpoint(endpointArn string) (*DeleteEndpointResponse, error)

Deletes the endpoint from Amazon SNS. This action is idempotent.

func (*SNS) DeletePlatformApplication

func (sns *SNS) DeletePlatformApplication(platformApplicationArn string) (*DeletePlatformApplicationResponse, error)

Deletes a platform application object for one of the supported push notification services, such as APNS and GCM

func (*SNS) DeleteTopic

func (sns *SNS) DeleteTopic(topicArn string) (*DeleteTopicResponse, error)

Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.

func (*SNS) GetEndpointAttributes

func (sns *SNS) GetEndpointAttributes(endpointArn string) (*GetEndpointAttributesResponse, error)

Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM and APNS

func (*SNS) GetPlatformApplicationAttributes

func (sns *SNS) GetPlatformApplicationAttributes(platformApplicationArn string) (*GetPlatformApplicationAttributesResponse, error)

Retrieves the attributes of the platform application object for the supported push notification services, such as APNS and GCM

func (*SNS) GetSubscriptionAttributes

func (sns *SNS) GetSubscriptionAttributes(subscriptionArn string) (*GetSubscriptionAttributesResponse, error)

Returns all of the properties of a subscription.

func (*SNS) GetTopicAttributes

func (sns *SNS) GetTopicAttributes(topicArn string) (*GetTopicAttributesResponse, error)

Returns all of the properties of a topic. Topic properties returned might differ based on the authorization of the user.

func (*SNS) ListAllEndpointsByPlatformApplication

func (sns *SNS) ListAllEndpointsByPlatformApplication(platformApplicationArn string) ([]Endpoint, error)

func (*SNS) ListAllPlatformApplications

func (sns *SNS) ListAllPlatformApplications() ([]PlatformApplication, error)

func (*SNS) ListAllSubscriptions

func (sns *SNS) ListAllSubscriptions() ([]Subscription, error)

func (*SNS) ListAllSubscriptionsByTopic

func (sns *SNS) ListAllSubscriptionsByTopic(topicArn string) ([]Subscription, error)

Returns a list of the all subscriptions to a specific topic.

func (*SNS) ListAllTopics

func (sns *SNS) ListAllTopics() ([]Topic, error)

func (*SNS) ListEndpointsByPlatformApplication

func (sns *SNS) ListEndpointsByPlatformApplication(platformApplicationArn, nextToken string) (*ListEndpointsByPlatformApplicationResponse, error)

Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM and APNS. The results for ListEndpointsByPlatformApplication are paginated and return a limited list of endpoints, up to 100. If additional records are available after the first page results, then a NextToken string will be returned. To receive the next page, you call ListEndpointsByPlatformApplication again using the NextToken string received from the previous call. When there are no more records to return, NextToken will be null.

func (*SNS) ListPlatformApplications

func (sns *SNS) ListPlatformApplications(nextToken string) (*ListPlatformApplicationsResponse, error)

Lists the platform application objects for the supported push notification services, such as APNS and GCM. The results for ListPlatformApplications are paginated and return a limited list of applications, up to 100. If additional records are available after the first page results, then a NextToken string will be returned. To receive the next page, you call ListPlatformApplications using the NextToken string received from the previous call. When there are no more records to return, NextToken will be null.

func (*SNS) ListSubscriptions

func (sns *SNS) ListSubscriptions(nextToken string) (*ListSubscriptionsResponse, error)

Returns a list of the requester's subscriptions. Each call returns a limited list of subscriptions, up to 100. If there are more subscriptions, a NextToken is also returned. Use the NextToken parameter in a new ListSubscriptions call to get further results.

func (*SNS) ListSubscriptionsByTopic

func (sns *SNS) ListSubscriptionsByTopic(topicArn, nextToken string) (*ListSubscriptionByTopicResponse, error)

Returns a list of the subscriptions to a specific topic. Each call returns a limited list of subscriptions, up to 100. If there are more subscriptions, a NextToken is also returned. Use the NextToken parameter in a new ListSubscriptionsByTopic call to get further results.

func (*SNS) ListTopics

func (sns *SNS) ListTopics(nextToken string) (*ListTopicsResponse, error)

Returns a list of the requester's topics. Each call returns a limited list of topics, up to 100. If there are more topics, a NextToken is also returned. Use the NextToken parameter in a new ListTopics call to get further results.

func (*SNS) Publish

func (sns *SNS) Publish(options *PublishOptions) (*PublishResponse, error)

Sends a message to all of a topic's subscribed endpoints. When a messageId is returned, the message has been saved and Amazon SNS will attempt to deliver it to the topic's subscribers shortly. The format of the outgoing message to each subscribed endpoint depends on the notification protocol selected. To use the Publish action for sending a message to a mobile endpoint, such as an app on a Kindle device or mobile phone, you must specify the EndpointArn.

func (*SNS) RemovePermission

func (sns *SNS) RemovePermission(label, topicArn string) (*RemovePermissionResponse, error)

Removes a statement from a topic's access control policy.

func (*SNS) SetEndpointAttributes

func (sns *SNS) SetEndpointAttributes(endpointArn string, attributes []Attribute) (*SetEndpointAttributesResponse, error)

Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM and APNS

func (*SNS) SetPlatformApplicationAttributes

func (sns *SNS) SetPlatformApplicationAttributes(platformApplicationArn string, attributes []Attribute) (*SetPlatformApplicationAttributesResponse, error)

Sets the attributes of the platform application object for the supported push notification services, such as APNS and GCM

func (*SNS) SetSubscriptionAttributes

func (sns *SNS) SetSubscriptionAttributes(subscriptionArn, attributeName, attributeValue string) (*SetSubscriptionAttributesResponse, error)

Allows a subscription owner to set an attribute of the topic to a new value.

func (*SNS) SetTopicAttributes

func (sns *SNS) SetTopicAttributes(topicArn, attributeName, attributeValue string) (*SetTopicAttributesResponse, error)

Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM and APNS.

func (*SNS) Subscribe

func (sns *SNS) Subscribe(topicArn, protocol, endpoint string) (*SubscribeResponse, error)

Prepares to subscribe an endpoint by sending the endpoint a confirmation message. To actually create a subscription, the endpoint owner must call the ConfirmSubscription action with the token from the confirmation message. Confirmation tokens are valid for three days.

func (*SNS) Unsubscribe

func (sns *SNS) Unsubscribe(subscriptionArn string) (*UnsubscribeResponse, error)

Deletes a subscription. If the subscription requires authentication for deletion, only the owner of the subscription or the topic's owner can unsubscribe, and an AWS signature is required. If the Unsubscribe call does not require authentication and the requester is not the subscription owner, a final cancellation message is delivered to the endpoint, so that the endpoint owner can easily resubscribe to the topic if the Unsubscribe request was unintended.

func (*SNS) UnsubscribeFromHttp

func (sns *SNS) UnsubscribeFromHttp(notification *HttpNotification,
	authenticateOnUnsubscribe string) (*UnsubscribeResponse, error)

type SetEndpointAttributesResponse

type SetEndpointAttributesResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type SetPlatformApplicationAttributesResponse

type SetPlatformApplicationAttributesResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type SetSubscriptionAttributesResponse

type SetSubscriptionAttributesResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type SetTopicAttributesResponse

type SetTopicAttributesResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

type SubscribeResponse

type SubscribeResponse struct {
	SubscriptionArn  string `xml:"SubscribeResult>SubscriptionArn"`
	ResponseMetadata aws.ResponseMetadata
}

type Subscription

type Subscription struct {
	Endpoint        string
	Owner           string
	Protocol        string
	SubscriptionArn string
	TopicArn        string
}

type Topic

type Topic struct {
	TopicArn string
}

type UnsubscribeResponse

type UnsubscribeResponse struct {
	ResponseMetadata aws.ResponseMetadata
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL