forked from goamz/goamz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
platform.go
135 lines (101 loc) · 3.61 KB
/
platform.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
}