diff options
Diffstat (limited to 'vendor/github.com/goamz/goamz/exp/sns')
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/Makefile | 21 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/README | 1 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/endpoint.go | 132 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/permissions.go | 51 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/platform.go | 135 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/responses_test.go | 317 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/sign.go | 72 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/sns.go | 113 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/sns_test.go | 455 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/subscription.go | 165 | ||||
-rw-r--r-- | vendor/github.com/goamz/goamz/exp/sns/topic.go | 104 |
11 files changed, 0 insertions, 1566 deletions
diff --git a/vendor/github.com/goamz/goamz/exp/sns/Makefile b/vendor/github.com/goamz/goamz/exp/sns/Makefile deleted file mode 100644 index 1e5b9da3b..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include $(GOROOT)/src/Make.inc - -TARG=launchpad.net/goamz/sns - -GOFILES=\ - sns.go\ - sign.go\ - -include $(GOROOT)/src/Make.pkg - -GOFMT=gofmt -BADFMT=$(shell $(GOFMT) -l $(GOFILES) 2> /dev/null) - -gofmt: $(BADFMT) - @for F in $(BADFMT); do $(GOFMT) -w $$F && echo $$F; done - -ifneq ($(BADFMT),) -ifneq ($(MAKECMDGOALS), gofmt) -#$(warning WARNING: make gofmt: $(BADFMT)) -endif -endif diff --git a/vendor/github.com/goamz/goamz/exp/sns/README b/vendor/github.com/goamz/goamz/exp/sns/README deleted file mode 100644 index 87770adb5..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/README +++ /dev/null @@ -1 +0,0 @@ -Amazon Simple Notification Service API for Golang. diff --git a/vendor/github.com/goamz/goamz/exp/sns/endpoint.go b/vendor/github.com/goamz/goamz/exp/sns/endpoint.go deleted file mode 100644 index c6e6e4433..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/endpoint.go +++ /dev/null @@ -1,132 +0,0 @@ -package sns - -import ( - "fmt" - "strconv" -) - -type DeleteEndpointResponse struct { - ResponseMetadata -} - -type GetEndpointAttributesResponse struct { - Attributes []AttributeEntry `xml:"GetEndpointAttributesResult>Attributes>entry"` - ResponseMetadata -} - -type PlatformEndpointOpt struct { - Attributes []AttributeEntry - PlatformApplicationArn string - CustomUserData string - Token string -} - -type CreatePlatformEndpointResponse struct { - EndpointArn string `xml:"CreatePlatformEndpointResult>EndpointArn"` - ResponseMetadata -} - -type PlatformEndpoints struct { - EndpointArn string `xml:"EndpointArn"` - Attributes []AttributeEntry `xml:"Attributes>entry"` -} - -type ListEndpointsByPlatformApplicationResponse struct { - Endpoints []PlatformEndpoints `xml:"ListEndpointsByPlatformApplicationResult>Endpoints>member"` - ResponseMetadata -} - -type SetEndpointAttributesOpt struct { - Attributes []AttributeEntry - EndpointArn string -} - -type SetEndpointAttributesResponse struct { - ResponseMetadata -} - -// DeleteEndpoint -// -// See http://goo.gl/9SlUD9 for more details. -func (sns *SNS) DeleteEndpoint(endpointArn string) (resp *DeleteEndpointResponse, err error) { - resp = &DeleteEndpointResponse{} - params := makeParams("DeleteEndpoint") - - params["EndpointArn"] = endpointArn - - err = sns.query(params, resp) - - return -} - -// GetEndpointAttributes -// -// See http://goo.gl/c8E5X1 for more details. -func (sns *SNS) GetEndpointAttributes(endpointArn string) (resp *GetEndpointAttributesResponse, err error) { - resp = &GetEndpointAttributesResponse{} - - params := makeParams("GetEndpointAttributes") - - params["EndpointArn"] = endpointArn - - err = sns.query(params, resp) - - return -} - -// CreatePlatformEndpoint -// -// See http://goo.gl/4tnngi for more details. -func (sns *SNS) CreatePlatformEndpoint(options *PlatformEndpointOpt) (resp *CreatePlatformEndpointResponse, err error) { - - resp = &CreatePlatformEndpointResponse{} - params := makeParams("CreatePlatformEndpoint") - - params["PlatformApplicationArn"] = options.PlatformApplicationArn - params["Token"] = options.Token - - if options.CustomUserData != "" { - params["CustomUserData"] = options.CustomUserData - } - - err = sns.query(params, resp) - - return -} - -// ListEndpointsByPlatformApplication -// -// See http://goo.gl/L7ioyR for more detail. -func (sns *SNS) ListEndpointsByPlatformApplication(platformApplicationArn, nextToken string) (resp *ListEndpointsByPlatformApplicationResponse, err error) { - resp = &ListEndpointsByPlatformApplicationResponse{} - - params := makeParams("ListEndpointsByPlatformApplication") - - params["PlatformApplicationArn"] = platformApplicationArn - - if nextToken != "" { - params["NextToken"] = nextToken - } - - err = sns.query(params, resp) - return - -} - -// SetEndpointAttributes -// -// See http://goo.gl/GTktCj for more detail. -func (sns *SNS) SetEndpointAttributes(options *SetEndpointAttributesOpt) (resp *SetEndpointAttributesResponse, err error) { - resp = &SetEndpointAttributesResponse{} - params := makeParams("SetEndpointAttributes") - - params["EndpointArn"] = options.EndpointArn - - for i, attr := range options.Attributes { - params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key - params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value - } - - err = sns.query(params, resp) - return -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/permissions.go b/vendor/github.com/goamz/goamz/exp/sns/permissions.go deleted file mode 100644 index e7c73629f..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/permissions.go +++ /dev/null @@ -1,51 +0,0 @@ -package sns - -import ( - "strconv" -) - -type Permission struct { - ActionName string - AccountId string -} - -type AddPermissionResponse struct { - ResponseMetadata -} - -// AddPermission -// -// See http://goo.gl/mbY4a for more details. -func (sns *SNS) AddPermission(permissions []Permission, Label, TopicArn string) (resp *AddPermissionResponse, err error) { - resp = &AddPermissionResponse{} - params := makeParams("AddPermission") - - for i, p := range permissions { - params["AWSAccountId.member."+strconv.Itoa(i+1)] = p.AccountId - params["ActionName.member."+strconv.Itoa(i+1)] = p.ActionName - } - - params["Label"] = Label - params["TopicArn"] = TopicArn - - err = sns.query(params, resp) - return -} - -type RemovePermissionResponse struct { - ResponseMetadata -} - -// RemovePermission -// -// See http://goo.gl/wGl5j for more details. -func (sns *SNS) RemovePermission(Label, TopicArn string) (resp *RemovePermissionResponse, err error) { - resp = &RemovePermissionResponse{} - params := makeParams("RemovePermission") - - params["Label"] = Label - params["TopicArn"] = TopicArn - - err = sns.query(params, resp) - return -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/platform.go b/vendor/github.com/goamz/goamz/exp/sns/platform.go deleted file mode 100644 index b650cdda7..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/platform.go +++ /dev/null @@ -1,135 +0,0 @@ -package sns - -import ( - "fmt" - "strconv" -) - -type CreatePlatformApplicationResponse struct { - PlatformApplicationArn string `xml:"CreatePlatformApplicationResult>PlatformApplicationArn"` - ResponseMetadata -} - -type PlatformApplicationOpt struct { - Attributes []AttributeEntry - Name string - Platform string -} - -type DeletePlatformApplicationResponse struct { - ResponseMetadata -} - -type GetPlatformApplicationAttributesResponse struct { - Attributes []AttributeEntry `xml:"GetPlatformApplicationAttributesResult>Attributes>entry"` - ResponseMetadata -} - -type SetPlatformApplicationAttributesOpt struct { - Attributes []AttributeEntry - PlatformApplicationArn string -} - -type SetPlatformApplicationAttributesResponse struct { - ResponseMetadata -} - -type PlatformApplication struct { - Attributes []AttributeEntry `xml:"Attributes>entry"` - PlatformApplicationArn string -} - -type ListPlatformApplicationsResponse struct { - NextToken string - PlatformApplications []PlatformApplication `xml:"ListPlatformApplicationsResult>PlatformApplications>member"` - ResponseMetadata -} - -// CreatePlatformApplication -// -// See http://goo.gl/Mbbl6Z for more details. - -func (sns *SNS) CreatePlatformApplication(options *PlatformApplicationOpt) (resp *CreatePlatformApplicationResponse, err error) { - resp = &CreatePlatformApplicationResponse{} - params := makeParams("CreatePlatformApplication") - - params["Platform"] = options.Platform - params["Name"] = options.Name - - for i, attr := range options.Attributes { - params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key - params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value - } - - err = sns.query(params, resp) - - return - -} - -// DeletePlatformApplication -// -// See http://goo.gl/6GB3DN for more details. -func (sns *SNS) DeletePlatformApplication(platformApplicationArn string) (resp *DeletePlatformApplicationResponse, err error) { - resp = &DeletePlatformApplicationResponse{} - - params := makeParams("DeletePlatformApplication") - - params["PlatformApplicationArn"] = platformApplicationArn - - err = sns.query(params, resp) - - return -} - -// GetPlatformApplicationAttributes -// -// See http://goo.gl/GswJ8I for more details. -func (sns *SNS) GetPlatformApplicationAttributes(platformApplicationArn, nextToken string) (resp *GetPlatformApplicationAttributesResponse, err error) { - resp = &GetPlatformApplicationAttributesResponse{} - - params := makeParams("GetPlatformApplicationAttributes") - - params["PlatformApplicationArn"] = platformApplicationArn - - if nextToken != "" { - params["NextToken"] = nextToken - } - - err = sns.query(params, resp) - - return -} - -// ListPlatformApplications -// -// See http://goo.gl/vQ3ooV for more detail. -func (sns *SNS) ListPlatformApplications(nextToken string) (resp *ListPlatformApplicationsResponse, err error) { - resp = &ListPlatformApplicationsResponse{} - params := makeParams("ListPlatformApplications") - - if nextToken != "" { - params["NextToken"] = nextToken - } - - err = sns.query(params, resp) - return -} - -// SetPlatformApplicationAttributes -// -// See http://goo.gl/RWnzzb for more detail. -func (sns *SNS) SetPlatformApplicationAttributes(options *SetPlatformApplicationAttributesOpt) (resp *SetPlatformApplicationAttributesResponse, err error) { - resp = &SetPlatformApplicationAttributesResponse{} - params := makeParams("SetPlatformApplicationAttributes") - - params["PlatformApplicationArn"] = options.PlatformApplicationArn - - for i, attr := range options.Attributes { - params[fmt.Sprintf("Attributes.entry.%s.key", strconv.Itoa(i+1))] = attr.Key - params[fmt.Sprintf("Attributes.entry.%s.value", strconv.Itoa(i+1))] = attr.Value - } - - err = sns.query(params, resp) - return -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/responses_test.go b/vendor/github.com/goamz/goamz/exp/sns/responses_test.go deleted file mode 100644 index 53a06429d..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/responses_test.go +++ /dev/null @@ -1,317 +0,0 @@ -package sns_test - -var TestListTopicsXmlOK = ` -<?xml version="1.0"?> -<ListTopicsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ListTopicsResult> - <Topics> - <member> - <TopicArn>arn:aws:sns:us-west-1:331995417492:Transcoding</TopicArn> - </member> - </Topics> - </ListTopicsResult> - <ResponseMetadata> - <RequestId>bd10b26c-e30e-11e0-ba29-93c3aca2f103</RequestId> - </ResponseMetadata> -</ListTopicsResponse> -` - -var TestCreateTopicXmlOK = ` -<?xml version="1.0"?> -<CreateTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <CreateTopicResult> - <TopicArn>arn:aws:sns:us-east-1:123456789012:My-Topic</TopicArn> - </CreateTopicResult> - <ResponseMetadata> - <RequestId>a8dec8b3-33a4-11df-8963-01868b7c937a</RequestId> - </ResponseMetadata> -</CreateTopicResponse> -` - -var TestDeleteTopicXmlOK = ` -<DeleteTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>f3aa9ac9-3c3d-11df-8235-9dab105e9c32</RequestId> - </ResponseMetadata> -</DeleteTopicResponse> -` - -var TestListSubscriptionsXmlOK = ` -<ListSubscriptionsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ListSubscriptionsResult> - <Subscriptions> - <member> - <TopicArn>arn:aws:sns:us-east-1:698519295917:My-Topic</TopicArn> - <Protocol>email</Protocol> - <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn> - <Owner>123456789012</Owner> - <Endpoint>example@amazon.com</Endpoint> - </member> - </Subscriptions> - </ListSubscriptionsResult> - <ResponseMetadata> - <RequestId>384ac68d-3775-11df-8963-01868b7c937a</RequestId> - </ResponseMetadata> -</ListSubscriptionsResponse> -` - -var TestGetTopicAttributesXmlOK = ` -<GetTopicAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <GetTopicAttributesResult> - <Attributes> - <entry> - <key>Owner</key> - <value>123456789012</value> - </entry> - <entry> - <key>Policy</key> - <value>{"Version":"2008-10-17","Id":"us-east-1/698519295917/test__default_policy_ID","Statement" : [{"Effect":"Allow","Sid":"us-east-1/698519295917/test__default_statement_ID","Principal" : {"AWS": "*"},"Action":["SNS:GetTopicAttributes","SNS:SetTopicAttributes","SNS:AddPermission","SNS:RemovePermission","SNS:DeleteTopic","SNS:Subscribe","SNS:ListSubscriptionsByTopic","SNS:Publish","SNS:Receive"],"Resource":"arn:aws:sns:us-east-1:698519295917:test","Condition" : {"StringLike" : {"AWS:SourceArn": "arn:aws:*:*:698519295917:*"}}}]}</value> - </entry> - <entry> - <key>TopicArn</key> - <value>arn:aws:sns:us-east-1:123456789012:My-Topic</value> - </entry> - </Attributes> - </GetTopicAttributesResult> - <ResponseMetadata> - <RequestId>057f074c-33a7-11df-9540-99d0768312d3</RequestId> - </ResponseMetadata> -</GetTopicAttributesResponse> -` - -var TestPublishXmlOK = ` -<PublishResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <PublishResult> - <MessageId>94f20ce6-13c5-43a0-9a9e-ca52d816e90b</MessageId> - </PublishResult> - <ResponseMetadata> - <RequestId>f187a3c1-376f-11df-8963-01868b7c937a</RequestId> - </ResponseMetadata> -</PublishResponse> -` - -var TestSetTopicAttributesXmlOK = ` -<SetTopicAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>a8763b99-33a7-11df-a9b7-05d48da6f042</RequestId> - </ResponseMetadata> -</SetTopicAttributesResponse> -` - -var TestSubscribeXmlOK = ` -<SubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <SubscribeResult> - <SubscriptionArn>pending confirmation</SubscriptionArn> - </SubscribeResult> - <ResponseMetadata> - <RequestId>a169c740-3766-11df-8963-01868b7c937a</RequestId> - </ResponseMetadata> -</SubscribeResponse> -` - -var TestUnsubscribeXmlOK = ` -<UnsubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>18e0ac39-3776-11df-84c0-b93cc1666b84</RequestId> - </ResponseMetadata> -</UnsubscribeResponse> -` - -var TestConfirmSubscriptionXmlOK = ` -<ConfirmSubscriptionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ConfirmSubscriptionResult> - <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn> - </ConfirmSubscriptionResult> - <ResponseMetadata> - <RequestId>7a50221f-3774-11df-a9b7-05d48da6f042</RequestId> - </ResponseMetadata> -</ConfirmSubscriptionResponse> -` - -var TestAddPermissionXmlOK = ` -<AddPermissionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>6a213e4e-33a8-11df-9540-99d0768312d3</RequestId> - </ResponseMetadata> -</AddPermissionResponse> -` - -var TestRemovePermissionXmlOK = ` -<RemovePermissionResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>d170b150-33a8-11df-995a-2d6fbe836cc1</RequestId> - </ResponseMetadata> -</RemovePermissionResponse> -` - -var TestListSubscriptionsByTopicXmlOK = ` -<ListSubscriptionsByTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ListSubscriptionsByTopicResult> - <Subscriptions> - <member> - <TopicArn>arn:aws:sns:us-east-1:123456789012:My-Topic</TopicArn> - <Protocol>email</Protocol> - <SubscriptionArn>arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca</SubscriptionArn> - <Owner>123456789012</Owner> - <Endpoint>example@amazon.com</Endpoint> - </member> - </Subscriptions> - </ListSubscriptionsByTopicResult> - <ResponseMetadata> - <RequestId>b9275252-3774-11df-9540-99d0768312d3</RequestId> - </ResponseMetadata> -</ListSubscriptionsByTopicResponse> -` - -var TestCreatePlatformApplicationXmlOK = ` -<CreatePlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <CreatePlatformApplicationResult> - <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp</PlatformApplicationArn> - </CreatePlatformApplicationResult> - <ResponseMetadata> - <RequestId>b6f0e78b-e9d4-5a0e-b973-adc04e8a4ff9</RequestId> - </ResponseMetadata> -</CreatePlatformApplicationResponse> -` - -var TestCreatePlatformEndpointXmlOK = ` -<CreatePlatformEndpointResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <CreatePlatformEndpointResult> - <EndpointArn>arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3</EndpointArn> - </CreatePlatformEndpointResult> - <ResponseMetadata> - <RequestId>6613341d-3e15-53f7-bf3c-7e56994ba278</RequestId> - </ResponseMetadata> -</CreatePlatformEndpointResponse> -` - -var DeleteEndpointXmlOK = ` -<DeleteEndpointResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>c1d2b191-353c-5a5f-8969-fbdd3900afa8</RequestId> - </ResponseMetadata> -</DeleteEndpointResponse> -` - -var TestDeletePlatformApplicationXmlOK = ` -<DeletePlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>097dac18-7a77-5823-a8dd-e65476dcb037</RequestId> - </ResponseMetadata> -</DeletePlatformApplicationResponse> -` - -var TestGetEndpointAttributesXmlOK = ` -<GetEndpointAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <GetEndpointAttributesResult> - <Attributes> - <entry> - <key>Enabled</key> - <value>true</value> - </entry> - <entry> - <key>CustomUserData</key> - <value>UserId=01234567</value> - </entry> - <entry> - <key>Token</key> - <value>APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE</value> - </entry> - </Attributes> - </GetEndpointAttributesResult> - <ResponseMetadata> - <RequestId>6c725a19-a142-5b77-94f9-1055a9ea04e7</RequestId> - </ResponseMetadata> -</GetEndpointAttributesResponse> -` - -var TestGetPlatformApplicationAttributesXmlOK = ` -<GetPlatformApplicationAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <GetPlatformApplicationAttributesResult> - <Attributes> - <entry> - <key>AllowEndpointPolicies</key> - <value>false</value> - </entry> - </Attributes> - </GetPlatformApplicationAttributesResult> - <ResponseMetadata> - <RequestId>74848df2-87f6-55ed-890c-c7be80442462</RequestId> - </ResponseMetadata> -</GetPlatformApplicationAttributesResponse> -` - -var TestListEndpointsByPlatformApplicationXmlOK = ` -<ListEndpointsByPlatformApplicationResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ListEndpointsByPlatformApplicationResult> - <Endpoints> - <member> - <EndpointArn>arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3</EndpointArn> - <Attributes> - <entry> - <key>Enabled</key> - <value>true</value> - </entry> - <entry> - <key>CustomUserData</key> - <value>UserId=27576823</value> - </entry> - <entry> - <key>Token</key> - <value>APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE</value> - </entry> - </Attributes> - </member> - </Endpoints> - </ListEndpointsByPlatformApplicationResult> - <ResponseMetadata> - <RequestId>9a48768c-dac8-5a60-aec0-3cc27ea08d96</RequestId> - </ResponseMetadata> -</ListEndpointsByPlatformApplicationResponse> -` - -var TestListPlatformApplicationsXmlOK = ` -<ListPlatformApplicationsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ListPlatformApplicationsResult> - <PlatformApplications> - <member> - <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/APNS_SANDBOX/apnspushapp</PlatformApplicationArn> - <Attributes> - <entry> - <key>AllowEndpointPolicies</key> - <value>false</value> - </entry> - </Attributes> - </member> - <member> - <PlatformApplicationArn>arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp</PlatformApplicationArn> - <Attributes> - <entry> - <key>AllowEndpointPolicies</key> - <value>false</value> - </entry> - </Attributes> - </member> - </PlatformApplications> - </ListPlatformApplicationsResult> - <ResponseMetadata> - <RequestId>315a335e-85d8-52df-9349-791283cbb529</RequestId> - </ResponseMetadata> -</ListPlatformApplicationsResponse> -` - -var TestSetEndpointAttributesXmlOK = ` -<SetEndpointAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>2fe0bfc7-3e85-5ee5-a9e2-f58b35e85f6a</RequestId> - </ResponseMetadata> -</SetEndpointAttributesResponse> -` - -var TestSetPlatformApplicationAttributesXmlOK = ` -<SetPlatformApplicationAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> - <ResponseMetadata> - <RequestId>cf577bcc-b3dc-5463-88f1-3180b9412395</RequestId> - </ResponseMetadata> -</SetPlatformApplicationAttributesResponse> -` diff --git a/vendor/github.com/goamz/goamz/exp/sns/sign.go b/vendor/github.com/goamz/goamz/exp/sns/sign.go deleted file mode 100644 index 0c35f05ae..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/sign.go +++ /dev/null @@ -1,72 +0,0 @@ -package sns - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "github.com/goamz/goamz/aws" - "sort" - "strings" -) - -var b64 = base64.StdEncoding - -/* -func sign(auth aws.Auth, method, path string, params url.Values, headers http.Header) { - var host string - for k, v := range headers { - k = strings.ToLower(k) - switch k { - case "host": - host = v[0] - } - } - - params["AWSAccessKeyId"] = []string{auth.AccessKey} - params["SignatureVersion"] = []string{"2"} - params["SignatureMethod"] = []string{"HmacSHA256"} - if auth.Token() != "" { - params["SecurityToken"] = auth.Token() - } - - var sarry []string - for k, v := range params { - sarry = append(sarry, aws.Encode(k) + "=" + aws.Encode(v[0])) - } - - sort.StringSlice(sarry).Sort() - joined := strings.Join(sarry, "&") - - payload := strings.Join([]string{method, host, "/", joined}, "\n") - hash := hmac.NewSHA256([]byte(auth.SecretKey)) - hash.Write([]byte(payload)) - signature := make([]byte, b64.EncodedLen(hash.Size())) - b64.Encode(signature, hash.Sum()) - - params["Signature"] = []string{"AWS " + string(signature)} - println("Payload:", payload) - println("Signature:", strings.Join(params["Signature"], "|")) -}*/ - -func sign(auth aws.Auth, method, path string, params map[string]string, host string) { - params["AWSAccessKeyId"] = auth.AccessKey - if auth.Token() != "" { - params["SecurityToken"] = auth.Token() - } - params["SignatureVersion"] = "2" - params["SignatureMethod"] = "HmacSHA256" - - var sarray []string - for k, v := range params { - sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(v)) - } - sort.StringSlice(sarray).Sort() - joined := strings.Join(sarray, "&") - payload := method + "\n" + host + "\n" + path + "\n" + joined - hash := hmac.New(sha256.New, []byte(auth.SecretKey)) - hash.Write([]byte(payload)) - signature := make([]byte, b64.EncodedLen(hash.Size())) - b64.Encode(signature, hash.Sum(nil)) - - params["Signature"] = string(signature) -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/sns.go b/vendor/github.com/goamz/goamz/exp/sns/sns.go deleted file mode 100644 index 4d4622211..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/sns.go +++ /dev/null @@ -1,113 +0,0 @@ -// -// goamz - Go packages to interact with the Amazon Web Services. -// -// https://wiki.ubuntu.com/goamz -// -// Copyright (c) 2011 Memeo Inc. -// -// Written by Prudhvi Krishna Surapaneni <me@prudhvi.net> - -// This package is in an experimental state, and does not currently -// follow conventions and style of the rest of goamz or common -// Go conventions. It must be polished before it's considered a -// first-class package in goamz. -package sns - -// BUG(niemeyer): Package needs documentation. - -import ( - "encoding/xml" - "net/http" - "net/url" - "time" - - "github.com/goamz/goamz/aws" -) - -// The SNS type encapsulates operation with an SNS region. -type SNS struct { - aws.Auth - aws.Region - private byte // Reserve the right of using private data. -} - -type AttributeEntry struct { - Key string `xml:"key"` - Value string `xml:"value"` -} - -type ResponseMetadata struct { - RequestId string `xml:"ResponseMetadata>RequestId"` - BoxUsage float64 `xml:"ResponseMetadata>BoxUsage"` -} - -func New(auth aws.Auth, region aws.Region) *SNS { - return &SNS{auth, region, 0} -} - -func makeParams(action string) map[string]string { - params := make(map[string]string) - params["Action"] = action - return params -} - -type Error struct { - StatusCode int - Code string - Message string - RequestId string -} - -func (err *Error) Error() string { - return err.Message -} - -type xmlErrors struct { - RequestId string - Errors []Error `xml:"Errors>Error"` -} - -func (sns *SNS) query(params map[string]string, resp interface{}) error { - params["Timestamp"] = time.Now().UTC().Format(time.RFC3339) - u, err := url.Parse(sns.Region.SNSEndpoint) - if err != nil { - return err - } - - sign(sns.Auth, "GET", "/", params, u.Host) - u.RawQuery = multimap(params).Encode() - r, err := http.Get(u.String()) - if err != nil { - return err - } - defer r.Body.Close() - - if r.StatusCode != 200 { - return buildError(r) - } - err = xml.NewDecoder(r.Body).Decode(resp) - return err -} - -func buildError(r *http.Response) error { - errors := xmlErrors{} - xml.NewDecoder(r.Body).Decode(&errors) - var err Error - if len(errors.Errors) > 0 { - err = errors.Errors[0] - } - err.RequestId = errors.RequestId - err.StatusCode = r.StatusCode - if err.Message == "" { - err.Message = r.Status - } - return &err -} - -func multimap(p map[string]string) url.Values { - q := make(url.Values, len(p)) - for k, v := range p { - q[k] = []string{v} - } - return q -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/sns_test.go b/vendor/github.com/goamz/goamz/exp/sns/sns_test.go deleted file mode 100644 index 054db13d3..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/sns_test.go +++ /dev/null @@ -1,455 +0,0 @@ -package sns_test - -import ( - "testing" - - "github.com/goamz/goamz/aws" - "github.com/goamz/goamz/exp/sns" - "github.com/goamz/goamz/testutil" - . "gopkg.in/check.v1" -) - -func Test(t *testing.T) { - TestingT(t) -} - -var _ = Suite(&S{}) - -type S struct { - sns *sns.SNS -} - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - auth := aws.Auth{AccessKey: "abc", SecretKey: "123"} - s.sns = sns.New(auth, aws.Region{SNSEndpoint: testServer.URL}) -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func (s *S) TestListTopicsOK(c *C) { - testServer.Response(200, nil, TestListTopicsXmlOK) - - resp, err := s.sns.ListTopics(nil) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.Topics[0].SNS, Equals, s.sns) - c.Assert(resp.ResponseMetadata.RequestId, Equals, "bd10b26c-e30e-11e0-ba29-93c3aca2f103") - c.Assert(err, IsNil) -} - -func (s *S) TestCreateTopic(c *C) { - testServer.Response(200, nil, TestCreateTopicXmlOK) - - resp, err := s.sns.CreateTopic("My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.Topic.SNS, Equals, s.sns) - c.Assert(resp.Topic.TopicArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic") - c.Assert(resp.ResponseMetadata.RequestId, Equals, "a8dec8b3-33a4-11df-8963-01868b7c937a") - c.Assert(err, IsNil) -} - -func (s *S) TestDeleteTopic(c *C) { - testServer.Response(200, nil, TestDeleteTopicXmlOK) - - t := sns.Topic{s.sns, "arn:aws:sns:us-east-1:123456789012:My-Topic"} - resp, err := t.Delete() - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.ResponseMetadata.RequestId, Equals, "f3aa9ac9-3c3d-11df-8235-9dab105e9c32") - c.Assert(err, IsNil) -} - -func (s *S) TestListSubscriptions(c *C) { - testServer.Response(200, nil, TestListSubscriptionsXmlOK) - - resp, err := s.sns.ListSubscriptions(nil) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Subscriptions), Not(Equals), 0) - c.Assert(resp.Subscriptions[0].Protocol, Equals, "email") - c.Assert(resp.Subscriptions[0].Endpoint, Equals, "example@amazon.com") - c.Assert(resp.Subscriptions[0].SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca") - c.Assert(resp.Subscriptions[0].TopicArn, Equals, "arn:aws:sns:us-east-1:698519295917:My-Topic") - c.Assert(resp.Subscriptions[0].Owner, Equals, "123456789012") - c.Assert(err, IsNil) -} - -func (s *S) TestGetTopicAttributes(c *C) { - testServer.Response(200, nil, TestGetTopicAttributesXmlOK) - - resp, err := s.sns.GetTopicAttributes("arn:aws:sns:us-east-1:123456789012:My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Attributes), Not(Equals), 0) - c.Assert(resp.Attributes[0].Key, Equals, "Owner") - c.Assert(resp.Attributes[0].Value, Equals, "123456789012") - c.Assert(resp.Attributes[1].Key, Equals, "Policy") - c.Assert(resp.Attributes[1].Value, Equals, `{"Version":"2008-10-17","Id":"us-east-1/698519295917/test__default_policy_ID","Statement" : [{"Effect":"Allow","Sid":"us-east-1/698519295917/test__default_statement_ID","Principal" : {"AWS": "*"},"Action":["SNS:GetTopicAttributes","SNS:SetTopicAttributes","SNS:AddPermission","SNS:RemovePermission","SNS:DeleteTopic","SNS:Subscribe","SNS:ListSubscriptionsByTopic","SNS:Publish","SNS:Receive"],"Resource":"arn:aws:sns:us-east-1:698519295917:test","Condition" : {"StringLike" : {"AWS:SourceArn": "arn:aws:*:*:698519295917:*"}}}]}`) - c.Assert(resp.ResponseMetadata.RequestId, Equals, "057f074c-33a7-11df-9540-99d0768312d3") - c.Assert(err, IsNil) -} - -func (s *S) TestPublish(c *C) { - testServer.Response(200, nil, TestPublishXmlOK) - - pubOpt := &sns.PublishOpt{"foobar", "", "subject", "arn:aws:sns:us-east-1:123456789012:My-Topic"} - resp, err := s.sns.Publish(pubOpt) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.MessageId, Equals, "94f20ce6-13c5-43a0-9a9e-ca52d816e90b") - c.Assert(resp.ResponseMetadata.RequestId, Equals, "f187a3c1-376f-11df-8963-01868b7c937a") - c.Assert(err, IsNil) -} - -func (s *S) TestSetTopicAttributes(c *C) { - testServer.Response(200, nil, TestSetTopicAttributesXmlOK) - - resp, err := s.sns.SetTopicAttributes("DisplayName", "MyTopicName", "arn:aws:sns:us-east-1:123456789012:My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.ResponseMetadata.RequestId, Equals, "a8763b99-33a7-11df-a9b7-05d48da6f042") - c.Assert(err, IsNil) -} - -func (s *S) TestSubscribe(c *C) { - testServer.Response(200, nil, TestSubscribeXmlOK) - - resp, err := s.sns.Subscribe("example@amazon.com", "email", "arn:aws:sns:us-east-1:123456789012:My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.SubscriptionArn, Equals, "pending confirmation") - c.Assert(resp.ResponseMetadata.RequestId, Equals, "a169c740-3766-11df-8963-01868b7c937a") - c.Assert(err, IsNil) -} - -func (s *S) TestUnsubscribe(c *C) { - testServer.Response(200, nil, TestUnsubscribeXmlOK) - - resp, err := s.sns.Unsubscribe("arn:aws:sns:us-east-1:123456789012:My-Topic:a169c740-3766-11df-8963-01868b7c937a") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.ResponseMetadata.RequestId, Equals, "18e0ac39-3776-11df-84c0-b93cc1666b84") - c.Assert(err, IsNil) -} - -func (s *S) TestConfirmSubscription(c *C) { - testServer.Response(200, nil, TestConfirmSubscriptionXmlOK) - - opt := &sns.ConfirmSubscriptionOpt{"", "51b2ff3edb475b7d91550e0ab6edf0c1de2a34e6ebaf6", "arn:aws:sns:us-east-1:123456789012:My-Topic"} - resp, err := s.sns.ConfirmSubscription(opt) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca") - c.Assert(resp.ResponseMetadata.RequestId, Equals, "7a50221f-3774-11df-a9b7-05d48da6f042") - c.Assert(err, IsNil) -} - -func (s *S) TestAddPermission(c *C) { - testServer.Response(200, nil, TestAddPermissionXmlOK) - perm := make([]sns.Permission, 2) - perm[0].ActionName = "Publish" - perm[1].ActionName = "GetTopicAttributes" - perm[0].AccountId = "987654321000" - perm[1].AccountId = "876543210000" - - resp, err := s.sns.AddPermission(perm, "NewPermission", "arn:aws:sns:us-east-1:123456789012:My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "6a213e4e-33a8-11df-9540-99d0768312d3") - c.Assert(err, IsNil) -} - -func (s *S) TestRemovePermission(c *C) { - testServer.Response(200, nil, TestRemovePermissionXmlOK) - - resp, err := s.sns.RemovePermission("NewPermission", "arn:aws:sns:us-east-1:123456789012:My-Topic") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "d170b150-33a8-11df-995a-2d6fbe836cc1") - c.Assert(err, IsNil) -} - -func (s *S) TestListSubscriptionByTopic(c *C) { - testServer.Response(200, nil, TestListSubscriptionsByTopicXmlOK) - - opt := &sns.ListSubscriptionByTopicOpt{"", "arn:aws:sns:us-east-1:123456789012:My-Topic"} - resp, err := s.sns.ListSubscriptionByTopic(opt) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Subscriptions), Not(Equals), 0) - c.Assert(resp.Subscriptions[0].TopicArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic") - c.Assert(resp.Subscriptions[0].SubscriptionArn, Equals, "arn:aws:sns:us-east-1:123456789012:My-Topic:80289ba6-0fd4-4079-afb4-ce8c8260f0ca") - c.Assert(resp.Subscriptions[0].Owner, Equals, "123456789012") - c.Assert(resp.Subscriptions[0].Endpoint, Equals, "example@amazon.com") - c.Assert(resp.Subscriptions[0].Protocol, Equals, "email") - c.Assert(err, IsNil) -} - -func (s *S) TestCreatePlatformApplication(c *C) { - testServer.Response(200, nil, TestCreatePlatformApplicationXmlOK) - - attrs := []sns.AttributeEntry{ - sns.AttributeEntry{Key: "PlatformCredential", Value: "AIzaSyClE2lcV2zEKTLYYo645zfk2jhQPFeyxDo"}, - sns.AttributeEntry{Key: "PlatformPrincipal", Value: "There is no principal for GCM"}, - } - opt := &sns.PlatformApplicationOpt{Name: "gcmpushapp", Platform: "GCM", Attributes: attrs} - resp, err := s.sns.CreatePlatformApplication(opt) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp") - c.Assert(resp.RequestId, Equals, "b6f0e78b-e9d4-5a0e-b973-adc04e8a4ff9") - - c.Assert(err, IsNil) -} - -func (s *S) TestCreatePlatformEndpoint(c *C) { - testServer.Response(200, nil, TestCreatePlatformEndpointXmlOK) - - opt := &sns.PlatformEndpointOpt{PlatformApplicationArn: "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", - CustomUserData: "UserId=27576823", Token: "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE"} - - resp, err := s.sns.CreatePlatformEndpoint(opt) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.EndpointArn, Equals, "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3") - c.Assert(resp.RequestId, Equals, "6613341d-3e15-53f7-bf3c-7e56994ba278") - - c.Assert(err, IsNil) -} - -func (s *S) TestDeleteEndpoint(c *C) { - testServer.Response(200, nil, DeleteEndpointXmlOK) - - resp, err := s.sns.DeleteEndpoint("arn:aws:sns:us-west-2:123456789012:endpoint/GCM%/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "c1d2b191-353c-5a5f-8969-fbdd3900afa8") - - c.Assert(err, IsNil) -} - -func (s *S) TestDeletePlatformApplication(c *C) { - testServer.Response(200, nil, TestDeletePlatformApplicationXmlOK) - - resp, err := s.sns.DeletePlatformApplication("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "097dac18-7a77-5823-a8dd-e65476dcb037") - - c.Assert(err, IsNil) -} - -func (s *S) TestGetEndpointAttributes(c *C) { - testServer.Response(200, nil, TestGetEndpointAttributesXmlOK) - - resp, err := s.sns.GetEndpointAttributes("arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Attributes), Equals, 3) - c.Assert(resp.Attributes[0].Key, Equals, "Enabled") - c.Assert(resp.Attributes[0].Value, Equals, "true") - - c.Assert(resp.Attributes[1].Key, Equals, "CustomUserData") - c.Assert(resp.Attributes[1].Value, Equals, "UserId=01234567") - - c.Assert(resp.Attributes[2].Key, Equals, "Token") - c.Assert(resp.Attributes[2].Value, Equals, "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE") - - c.Assert(resp.RequestId, Equals, "6c725a19-a142-5b77-94f9-1055a9ea04e7") - - c.Assert(err, IsNil) -} - -func (s *S) TestGetPlatformApplicationAttributes(c *C) { - testServer.Response(200, nil, TestGetPlatformApplicationAttributesXmlOK) - - resp, err := s.sns.GetPlatformApplicationAttributes("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", "") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Attributes), Not(Equals), 0) - c.Assert(resp.Attributes[0].Key, Equals, "AllowEndpointPolicies") - c.Assert(resp.Attributes[0].Value, Equals, "false") - c.Assert(resp.RequestId, Equals, "74848df2-87f6-55ed-890c-c7be80442462") - - c.Assert(err, IsNil) -} - -func (s *S) TestListEndpointsByPlatformApplication(c *C) { - testServer.Response(200, nil, TestListEndpointsByPlatformApplicationXmlOK) - - resp, err := s.sns.ListEndpointsByPlatformApplication("arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", "") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.Endpoints), Not(Equals), 0) - c.Assert(resp.Endpoints[0].EndpointArn, Equals, "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3") - c.Assert(len(resp.Endpoints[0].Attributes), Equals, 3) - c.Assert(resp.Endpoints[0].Attributes[0].Key, Equals, "Enabled") - c.Assert(resp.Endpoints[0].Attributes[0].Value, Equals, "true") - c.Assert(resp.Endpoints[0].Attributes[1].Key, Equals, "CustomUserData") - c.Assert(resp.Endpoints[0].Attributes[1].Value, Equals, "UserId=27576823") - c.Assert(resp.Endpoints[0].Attributes[2].Key, Equals, "Token") - c.Assert(resp.Endpoints[0].Attributes[2].Value, Equals, "APA91bGi7fFachkC1xjlqT66VYEucGHochmf1VQAr9k...jsM0PKPxKhddCzx6paEsyay9Zn3D4wNUJb8m6HZrBEXAMPLE") - - c.Assert(resp.RequestId, Equals, "9a48768c-dac8-5a60-aec0-3cc27ea08d96") - - c.Assert(err, IsNil) -} - -func (s *S) TestListPlatformApplications(c *C) { - testServer.Response(200, nil, TestListPlatformApplicationsXmlOK) - - resp, err := s.sns.ListPlatformApplications("") - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(len(resp.PlatformApplications), Not(Equals), 0) - - c.Assert(resp.PlatformApplications[0].PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/APNS_SANDBOX/apnspushapp") - c.Assert(len(resp.PlatformApplications[0].Attributes), Equals, 1) - c.Assert(resp.PlatformApplications[0].Attributes[0].Key, Equals, "AllowEndpointPolicies") - c.Assert(resp.PlatformApplications[0].Attributes[0].Value, Equals, "false") - - c.Assert(resp.PlatformApplications[1].PlatformApplicationArn, Equals, "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp") - c.Assert(len(resp.PlatformApplications[1].Attributes), Equals, 1) - c.Assert(resp.PlatformApplications[1].Attributes[0].Key, Equals, "AllowEndpointPolicies") - c.Assert(resp.PlatformApplications[1].Attributes[0].Value, Equals, "false") - - c.Assert(resp.RequestId, Equals, "315a335e-85d8-52df-9349-791283cbb529") - - c.Assert(err, IsNil) -} - -func (s *S) TestSetEndpointAttributes(c *C) { - testServer.Response(200, nil, TestSetEndpointAttributesXmlOK) - - attrs := []sns.AttributeEntry{ - sns.AttributeEntry{Key: "CustomUserData", Value: "My custom userdata"}, - } - - opts := &sns.SetEndpointAttributesOpt{ - EndpointArn: "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3", - Attributes: attrs} - - resp, err := s.sns.SetEndpointAttributes(opts) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "2fe0bfc7-3e85-5ee5-a9e2-f58b35e85f6a") - - c.Assert(err, IsNil) -} - -func (s *S) TestSetPlatformApplicationAttributes(c *C) { - testServer.Response(200, nil, TestSetPlatformApplicationAttributesXmlOK) - - attrs := []sns.AttributeEntry{ - sns.AttributeEntry{Key: "EventEndpointCreated", Value: "arn:aws:sns:us-west-2:123456789012:topicarn"}, - } - - opts := &sns.SetPlatformApplicationAttributesOpt{ - PlatformApplicationArn: "arn:aws:sns:us-west-2:123456789012:app/GCM/gcmpushapp", - Attributes: attrs} - - resp, err := s.sns.SetPlatformApplicationAttributes(opts) - req := testServer.WaitRequest() - - c.Assert(req.Method, Equals, "GET") - c.Assert(req.URL.Path, Equals, "/") - c.Assert(req.Header["Date"], Not(Equals), "") - - c.Assert(resp.RequestId, Equals, "cf577bcc-b3dc-5463-88f1-3180b9412395") - - c.Assert(err, IsNil) -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/subscription.go b/vendor/github.com/goamz/goamz/exp/sns/subscription.go deleted file mode 100644 index cbfef8b2c..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/subscription.go +++ /dev/null @@ -1,165 +0,0 @@ -package sns - -type Subscription struct { - Endpoint string - Owner string - Protocol string - SubscriptionArn string - TopicArn string -} - -type ListSubscriptionsResp struct { - Subscriptions []Subscription `xml:"ListSubscriptionsResult>Subscriptions>member"` - NextToken string - ResponseMetadata -} - -type PublishOpt struct { - Message string - MessageStructure string - Subject string - TopicArn string - TargetArn string -} - -type PublishResp struct { - MessageId string `xml:"PublishResult>MessageId"` - ResponseMetadata -} - -type SubscribeResponse struct { - SubscriptionArn string `xml:"SubscribeResult>SubscriptionArn"` - ResponseMetadata -} - -type UnsubscribeResponse struct { - ResponseMetadata -} - -type ConfirmSubscriptionResponse struct { - SubscriptionArn string `xml:"ConfirmSubscriptionResult>SubscriptionArn"` - ResponseMetadata -} - -type ConfirmSubscriptionOpt struct { - AuthenticateOnUnsubscribe string - Token string - TopicArn string -} - -type ListSubscriptionByTopicResponse struct { - Subscriptions []Subscription `xml:"ListSubscriptionsByTopicResult>Subscriptions>member"` - ResponseMetadata -} - -type ListSubscriptionByTopicOpt struct { - NextToken string - TopicArn string -} - -// Publish -// -// See http://goo.gl/AY2D8 for more details. -func (sns *SNS) Publish(options *PublishOpt) (resp *PublishResp, err error) { - resp = &PublishResp{} - params := makeParams("Publish") - - if options.Subject != "" { - params["Subject"] = options.Subject - } - - if options.MessageStructure != "" { - params["MessageStructure"] = options.MessageStructure - } - - if options.Message != "" { - params["Message"] = options.Message - } - - if options.TopicArn != "" { - params["TopicArn"] = options.TopicArn - } - - if options.TargetArn != "" { - params["TargetArn"] = options.TargetArn - } - - err = sns.query(params, resp) - return -} - -// Subscribe -// -// See http://goo.gl/c3iGS for more details. -func (sns *SNS) Subscribe(Endpoint, Protocol, TopicArn string) (resp *SubscribeResponse, err error) { - resp = &SubscribeResponse{} - params := makeParams("Subscribe") - - params["Endpoint"] = Endpoint - params["Protocol"] = Protocol - params["TopicArn"] = TopicArn - - err = sns.query(params, resp) - return -} - -// Unsubscribe -// -// See http://goo.gl/4l5Ge for more details. -func (sns *SNS) Unsubscribe(SubscriptionArn string) (resp *UnsubscribeResponse, err error) { - resp = &UnsubscribeResponse{} - params := makeParams("Unsubscribe") - - params["SubscriptionArn"] = SubscriptionArn - - err = sns.query(params, resp) - return -} - -// ConfirmSubscription -// -// See http://goo.gl/3hXzH for more details. -func (sns *SNS) ConfirmSubscription(options *ConfirmSubscriptionOpt) (resp *ConfirmSubscriptionResponse, err error) { - resp = &ConfirmSubscriptionResponse{} - params := makeParams("ConfirmSubscription") - - if options.AuthenticateOnUnsubscribe != "" { - params["AuthenticateOnUnsubscribe"] = options.AuthenticateOnUnsubscribe - } - - params["Token"] = options.Token - params["TopicArn"] = options.TopicArn - - err = sns.query(params, resp) - return -} - -// ListSubscriptions -// -// See http://goo.gl/k3aGn for more details. -func (sns *SNS) ListSubscriptions(NextToken *string) (resp *ListSubscriptionsResp, err error) { - resp = &ListSubscriptionsResp{} - params := makeParams("ListSubscriptions") - if NextToken != nil { - params["NextToken"] = *NextToken - } - err = sns.query(params, resp) - return -} - -// ListSubscriptionByTopic -// -// See http://goo.gl/LaVcC for more details. -func (sns *SNS) ListSubscriptionByTopic(options *ListSubscriptionByTopicOpt) (resp *ListSubscriptionByTopicResponse, err error) { - resp = &ListSubscriptionByTopicResponse{} - params := makeParams("ListSbubscriptionByTopic") - - if options.NextToken != "" { - params["NextToken"] = options.NextToken - } - - params["TopicArn"] = options.TopicArn - - err = sns.query(params, resp) - return -} diff --git a/vendor/github.com/goamz/goamz/exp/sns/topic.go b/vendor/github.com/goamz/goamz/exp/sns/topic.go deleted file mode 100644 index 601325ec9..000000000 --- a/vendor/github.com/goamz/goamz/exp/sns/topic.go +++ /dev/null @@ -1,104 +0,0 @@ -package sns - -import ( - "errors" -) - -type Topic struct { - SNS *SNS - TopicArn string -} - -type ListTopicsResp struct { - Topics []Topic `xml:"ListTopicsResult>Topics>member"` - NextToken string - ResponseMetadata -} - -type CreateTopicResp struct { - Topic Topic `xml:"CreateTopicResult"` - ResponseMetadata -} - -type DeleteTopicResp struct { - ResponseMetadata -} - -type GetTopicAttributesResp struct { - Attributes []AttributeEntry `xml:"GetTopicAttributesResult>Attributes>entry"` - ResponseMetadata -} - -type SetTopicAttributesResponse struct { - ResponseMetadata -} - -// ListTopics -// -// See http://goo.gl/lfrMK for more details. -func (sns *SNS) ListTopics(NextToken *string) (resp *ListTopicsResp, err error) { - resp = &ListTopicsResp{} - params := makeParams("ListTopics") - if NextToken != nil { - params["NextToken"] = *NextToken - } - - err = sns.query(params, resp) - for i, _ := range resp.Topics { - resp.Topics[i].SNS = sns - } - return -} - -// CreateTopic -// -// See http://goo.gl/m9aAt for more details. -func (sns *SNS) CreateTopic(Name string) (resp *CreateTopicResp, err error) { - resp = &CreateTopicResp{} - params := makeParams("CreateTopic") - params["Name"] = Name - err = sns.query(params, resp) - resp.Topic.SNS = sns - return -} - -// Delete -// -// Helper function for deleting a topic -func (topic *Topic) Delete() (resp *DeleteTopicResp, err error) { - resp = &DeleteTopicResp{} - params := makeParams("DeleteTopic") - params["TopicArn"] = topic.TopicArn - err = topic.SNS.query(params, resp) - return -} - -// GetTopicAttributes -// -// See http://goo.gl/WXRoX for more details. -func (sns *SNS) GetTopicAttributes(TopicArn string) (resp *GetTopicAttributesResp, err error) { - resp = &GetTopicAttributesResp{} - params := makeParams("GetTopicAttributes") - params["TopicArn"] = TopicArn - err = sns.query(params, resp) - return -} - -// SetTopicAttributes -// -// See http://goo.gl/oVYW7 for more details. -func (sns *SNS) SetTopicAttributes(AttributeName, AttributeValue, TopicArn string) (resp *SetTopicAttributesResponse, err error) { - resp = &SetTopicAttributesResponse{} - params := makeParams("SetTopicAttributes") - - if AttributeName == "" || TopicArn == "" { - return nil, errors.New("Invalid Attribute Name or TopicArn") - } - - params["AttributeName"] = AttributeName - params["AttributeValue"] = AttributeValue - params["TopicArn"] = TopicArn - - err = sns.query(params, resp) - return -} |