aws-sdk-sns 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-sns.rb +2 -2
- data/lib/aws-sdk-sns/client.rb +1547 -1308
- data/lib/aws-sdk-sns/client_api.rb +702 -704
- data/lib/aws-sdk-sns/errors.rb +4 -13
- data/lib/aws-sdk-sns/platform_application.rb +208 -210
- data/lib/aws-sdk-sns/platform_endpoint.rb +237 -239
- data/lib/aws-sdk-sns/resource.rb +152 -154
- data/lib/aws-sdk-sns/subscription.rb +127 -129
- data/lib/aws-sdk-sns/topic.rb +381 -383
- data/lib/aws-sdk-sns/types.rb +1531 -1287
- metadata +2 -2
data/lib/aws-sdk-sns/topic.rb
CHANGED
@@ -1,419 +1,417 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
4
|
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
5
|
#
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
|
-
module Aws
|
9
|
-
|
10
|
-
class Topic
|
8
|
+
module Aws::SNS
|
9
|
+
class Topic
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Deprecations
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
# @overload def initialize(arn, options = {})
|
14
|
+
# @param [String] arn
|
15
|
+
# @option options [Client] :client
|
16
|
+
# @overload def initialize(options = {})
|
17
|
+
# @option options [required, String] :arn
|
18
|
+
# @option options [Client] :client
|
19
|
+
def initialize(*args)
|
20
|
+
options = Hash === args.last ? args.pop.dup : {}
|
21
|
+
@arn = extract_arn(args, options)
|
22
|
+
@data = options.delete(:data)
|
23
|
+
@client = options.delete(:client) || Client.new(options)
|
24
|
+
end
|
26
25
|
|
27
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
# @return [String]
|
29
|
+
def arn
|
30
|
+
@arn
|
31
|
+
end
|
33
32
|
|
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
|
-
|
33
|
+
# A map of the topic's attributes. Attributes in this map include the
|
34
|
+
# following:
|
35
|
+
#
|
36
|
+
# * `TopicArn` -- the topic's ARN
|
37
|
+
#
|
38
|
+
# * `Owner` -- the AWS account ID of the topic's owner
|
39
|
+
#
|
40
|
+
# * `Policy` -- the JSON serialization of the topic's access control
|
41
|
+
# policy
|
42
|
+
#
|
43
|
+
# * `DisplayName` -- the human-readable name used in the "From" field
|
44
|
+
# for notifications to email and email-json endpoints
|
45
|
+
#
|
46
|
+
# * `SubscriptionsPending` -- the number of subscriptions pending
|
47
|
+
# confirmation on this topic
|
48
|
+
#
|
49
|
+
# * `SubscriptionsConfirmed` -- the number of confirmed subscriptions on
|
50
|
+
# this topic
|
51
|
+
#
|
52
|
+
# * `SubscriptionsDeleted` -- the number of deleted subscriptions on
|
53
|
+
# this topic
|
54
|
+
#
|
55
|
+
# * `DeliveryPolicy` -- the JSON serialization of the topic's delivery
|
56
|
+
# policy
|
57
|
+
#
|
58
|
+
# * `EffectiveDeliveryPolicy` -- the JSON serialization of the effective
|
59
|
+
# delivery policy that takes into account system defaults
|
60
|
+
# @return [Hash<String,String>]
|
61
|
+
def attributes
|
62
|
+
data.attributes
|
63
|
+
end
|
65
64
|
|
66
|
-
|
65
|
+
# @!endgroup
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
# @return [Client]
|
68
|
+
def client
|
69
|
+
@client
|
70
|
+
end
|
72
71
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
72
|
+
# Loads, or reloads {#data} for the current {Topic}.
|
73
|
+
# Returns `self` making it possible to chain methods.
|
74
|
+
#
|
75
|
+
# topic.reload.data
|
76
|
+
#
|
77
|
+
# @return [self]
|
78
|
+
def load
|
79
|
+
resp = @client.get_topic_attributes(topic_arn: @arn)
|
80
|
+
@data = resp.data
|
81
|
+
self
|
82
|
+
end
|
83
|
+
alias :reload :load
|
85
84
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
85
|
+
# @return [Types::GetTopicAttributesResponse]
|
86
|
+
# Returns the data for this {Topic}. Calls
|
87
|
+
# {Client#get_topic_attributes} if {#data_loaded?} is `false`.
|
88
|
+
def data
|
89
|
+
load unless @data
|
90
|
+
@data
|
91
|
+
end
|
93
92
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
93
|
+
# @return [Boolean]
|
94
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
95
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
96
|
+
def data_loaded?
|
97
|
+
!!@data
|
98
|
+
end
|
100
99
|
|
101
|
-
|
100
|
+
# @!group Actions
|
102
101
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
102
|
+
# @example Request syntax with placeholder values
|
103
|
+
#
|
104
|
+
# topic.add_permission({
|
105
|
+
# label: "label", # required
|
106
|
+
# aws_account_id: ["delegate"], # required
|
107
|
+
# action_name: ["action"], # required
|
108
|
+
# })
|
109
|
+
# @param [Hash] options ({})
|
110
|
+
# @option options [required, String] :label
|
111
|
+
# A unique identifier for the new policy statement.
|
112
|
+
# @option options [required, Array<String>] :aws_account_id
|
113
|
+
# The AWS account IDs of the users (principals) who will be given access
|
114
|
+
# to the specified actions. The users must have AWS accounts, but do not
|
115
|
+
# need to be signed up for this service.
|
116
|
+
# @option options [required, Array<String>] :action_name
|
117
|
+
# The action you want to allow for the specified principal(s).
|
118
|
+
#
|
119
|
+
# Valid values: any Amazon SNS action name.
|
120
|
+
# @return [EmptyStructure]
|
121
|
+
def add_permission(options = {})
|
122
|
+
options = options.merge(topic_arn: @arn)
|
123
|
+
resp = @client.add_permission(options)
|
124
|
+
resp.data
|
125
|
+
end
|
127
126
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
127
|
+
# @example Request syntax with placeholder values
|
128
|
+
#
|
129
|
+
# subscription = topic.confirm_subscription({
|
130
|
+
# token: "token", # required
|
131
|
+
# authenticate_on_unsubscribe: "authenticateOnUnsubscribe",
|
132
|
+
# })
|
133
|
+
# @param [Hash] options ({})
|
134
|
+
# @option options [required, String] :token
|
135
|
+
# Short-lived token sent to an endpoint during the `Subscribe` action.
|
136
|
+
# @option options [String] :authenticate_on_unsubscribe
|
137
|
+
# Disallows unauthenticated unsubscribes of the subscription. If the
|
138
|
+
# value of this parameter is `true` and the request has an AWS
|
139
|
+
# signature, then only the topic owner and the subscription owner can
|
140
|
+
# unsubscribe the endpoint. The unsubscribe action requires AWS
|
141
|
+
# authentication.
|
142
|
+
# @return [Subscription]
|
143
|
+
def confirm_subscription(options = {})
|
144
|
+
options = options.merge(topic_arn: @arn)
|
145
|
+
resp = @client.confirm_subscription(options)
|
146
|
+
Subscription.new(
|
147
|
+
arn: resp.data.subscription_arn,
|
148
|
+
client: @client
|
149
|
+
)
|
150
|
+
end
|
152
151
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
152
|
+
# @example Request syntax with placeholder values
|
153
|
+
#
|
154
|
+
# topic.delete()
|
155
|
+
# @param [Hash] options ({})
|
156
|
+
# @return [EmptyStructure]
|
157
|
+
def delete(options = {})
|
158
|
+
options = options.merge(topic_arn: @arn)
|
159
|
+
resp = @client.delete_topic(options)
|
160
|
+
resp.data
|
161
|
+
end
|
163
162
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
163
|
+
# @example Request syntax with placeholder values
|
164
|
+
#
|
165
|
+
# topic.publish({
|
166
|
+
# target_arn: "String",
|
167
|
+
# phone_number: "String",
|
168
|
+
# message: "message", # required
|
169
|
+
# subject: "subject",
|
170
|
+
# message_structure: "messageStructure",
|
171
|
+
# message_attributes: {
|
172
|
+
# "String" => {
|
173
|
+
# data_type: "String", # required
|
174
|
+
# string_value: "String",
|
175
|
+
# binary_value: "data",
|
176
|
+
# },
|
177
|
+
# },
|
178
|
+
# })
|
179
|
+
# @param [Hash] options ({})
|
180
|
+
# @option options [String] :target_arn
|
181
|
+
# Either TopicArn or EndpointArn, but not both.
|
182
|
+
#
|
183
|
+
# If you don't specify a value for the `TargetArn` parameter, you must
|
184
|
+
# specify a value for the `PhoneNumber` or `TopicArn` parameters.
|
185
|
+
# @option options [String] :phone_number
|
186
|
+
# The phone number to which you want to deliver an SMS message. Use
|
187
|
+
# E.164 format.
|
188
|
+
#
|
189
|
+
# If you don't specify a value for the `PhoneNumber` parameter, you
|
190
|
+
# must specify a value for the `TargetArn` or `TopicArn` parameters.
|
191
|
+
# @option options [required, String] :message
|
192
|
+
# The message you want to send to the topic.
|
193
|
+
#
|
194
|
+
# If you want to send the same message to all transport protocols,
|
195
|
+
# include the text of the message as a String value.
|
196
|
+
#
|
197
|
+
# If you want to send different messages for each transport protocol,
|
198
|
+
# set the value of the `MessageStructure` parameter to `json` and use a
|
199
|
+
# JSON object for the `Message` parameter.
|
200
|
+
#
|
201
|
+
# Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
|
202
|
+
# size (262144 bytes, not 262144 characters).
|
203
|
+
#
|
204
|
+
# JSON-specific constraints:
|
205
|
+
#
|
206
|
+
# * Keys in the JSON object that correspond to supported transport
|
207
|
+
# protocols must have simple JSON string values.
|
208
|
+
#
|
209
|
+
# * The values will be parsed (unescaped) before they are used in
|
210
|
+
# outgoing messages.
|
211
|
+
#
|
212
|
+
# * Outbound notifications are JSON encoded (meaning that the characters
|
213
|
+
# will be reescaped for sending).
|
214
|
+
#
|
215
|
+
# * Values have a minimum length of 0 (the empty string, "", is
|
216
|
+
# allowed).
|
217
|
+
#
|
218
|
+
# * Values have a maximum length bounded by the overall message size
|
219
|
+
# (so, including multiple protocols may limit message sizes).
|
220
|
+
#
|
221
|
+
# * Non-string values will cause the key to be ignored.
|
222
|
+
#
|
223
|
+
# * Keys that do not correspond to supported transport protocols are
|
224
|
+
# ignored.
|
225
|
+
#
|
226
|
+
# * Duplicate keys are not allowed.
|
227
|
+
#
|
228
|
+
# * Failure to parse or validate any key or value in the message will
|
229
|
+
# cause the `Publish` call to return an error (no partial delivery).
|
230
|
+
# @option options [String] :subject
|
231
|
+
# Optional parameter to be used as the "Subject" line when the message
|
232
|
+
# is delivered to email endpoints. This field will also be included, if
|
233
|
+
# present, in the standard JSON messages delivered to other endpoints.
|
234
|
+
#
|
235
|
+
# Constraints: Subjects must be ASCII text that begins with a letter,
|
236
|
+
# number, or punctuation mark; must not include line breaks or control
|
237
|
+
# characters; and must be less than 100 characters long.
|
238
|
+
# @option options [String] :message_structure
|
239
|
+
# Set `MessageStructure` to `json` if you want to send a different
|
240
|
+
# message for each protocol. For example, using one publish action, you
|
241
|
+
# can send a short message to your SMS subscribers and a longer message
|
242
|
+
# to your email subscribers. If you set `MessageStructure` to `json`,
|
243
|
+
# the value of the `Message` parameter must:
|
244
|
+
#
|
245
|
+
# * be a syntactically valid JSON object; and
|
246
|
+
#
|
247
|
+
# * contain at least a top-level JSON key of "default" with a value
|
248
|
+
# that is a string.
|
249
|
+
#
|
250
|
+
# You can define other top-level keys that define the message you want
|
251
|
+
# to send to a specific transport protocol (e.g., "http").
|
252
|
+
#
|
253
|
+
# For information about sending different messages for each protocol
|
254
|
+
# using the AWS Management Console, go to [Create Different Messages for
|
255
|
+
# Each Protocol][1] in the *Amazon Simple Notification Service Getting
|
256
|
+
# Started Guide*.
|
257
|
+
#
|
258
|
+
# Valid value: `json`
|
259
|
+
#
|
260
|
+
#
|
261
|
+
#
|
262
|
+
# [1]: http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol
|
263
|
+
# @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
|
264
|
+
# Message attributes for Publish action.
|
265
|
+
# @return [Types::PublishResponse]
|
266
|
+
def publish(options = {})
|
267
|
+
options = options.merge(topic_arn: @arn)
|
268
|
+
resp = @client.publish(options)
|
269
|
+
resp.data
|
270
|
+
end
|
272
271
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
272
|
+
# @example Request syntax with placeholder values
|
273
|
+
#
|
274
|
+
# topic.remove_permission({
|
275
|
+
# label: "label", # required
|
276
|
+
# })
|
277
|
+
# @param [Hash] options ({})
|
278
|
+
# @option options [required, String] :label
|
279
|
+
# The unique label of the statement you want to remove.
|
280
|
+
# @return [EmptyStructure]
|
281
|
+
def remove_permission(options = {})
|
282
|
+
options = options.merge(topic_arn: @arn)
|
283
|
+
resp = @client.remove_permission(options)
|
284
|
+
resp.data
|
285
|
+
end
|
287
286
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
287
|
+
# @example Request syntax with placeholder values
|
288
|
+
#
|
289
|
+
# topic.set_attributes({
|
290
|
+
# attribute_name: "attributeName", # required
|
291
|
+
# attribute_value: "attributeValue",
|
292
|
+
# })
|
293
|
+
# @param [Hash] options ({})
|
294
|
+
# @option options [required, String] :attribute_name
|
295
|
+
# The name of the attribute you want to set. Only a subset of the
|
296
|
+
# topic's attributes are mutable.
|
297
|
+
#
|
298
|
+
# Valid values: `Policy` \| `DisplayName` \| `DeliveryPolicy`
|
299
|
+
# @option options [String] :attribute_value
|
300
|
+
# The new value for the attribute.
|
301
|
+
# @return [EmptyStructure]
|
302
|
+
def set_attributes(options = {})
|
303
|
+
options = options.merge(topic_arn: @arn)
|
304
|
+
resp = @client.set_topic_attributes(options)
|
305
|
+
resp.data
|
306
|
+
end
|
308
307
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
308
|
+
# @example Request syntax with placeholder values
|
309
|
+
#
|
310
|
+
# subscription = topic.subscribe({
|
311
|
+
# protocol: "protocol", # required
|
312
|
+
# endpoint: "endpoint",
|
313
|
+
# })
|
314
|
+
# @param [Hash] options ({})
|
315
|
+
# @option options [required, String] :protocol
|
316
|
+
# The protocol you want to use. Supported protocols include:
|
317
|
+
#
|
318
|
+
# * `http` -- delivery of JSON-encoded message via HTTP POST
|
319
|
+
#
|
320
|
+
# * `https` -- delivery of JSON-encoded message via HTTPS POST
|
321
|
+
#
|
322
|
+
# * `email` -- delivery of message via SMTP
|
323
|
+
#
|
324
|
+
# * `email-json` -- delivery of JSON-encoded message via SMTP
|
325
|
+
#
|
326
|
+
# * `sms` -- delivery of message via SMS
|
327
|
+
#
|
328
|
+
# * `sqs` -- delivery of JSON-encoded message to an Amazon SQS queue
|
329
|
+
#
|
330
|
+
# * `application` -- delivery of JSON-encoded message to an EndpointArn
|
331
|
+
# for a mobile app and device.
|
332
|
+
#
|
333
|
+
# * `lambda` -- delivery of JSON-encoded message to an AWS Lambda
|
334
|
+
# function.
|
335
|
+
# @option options [String] :endpoint
|
336
|
+
# The endpoint that you want to receive notifications. Endpoints vary by
|
337
|
+
# protocol:
|
338
|
+
#
|
339
|
+
# * For the `http` protocol, the endpoint is an URL beginning with
|
340
|
+
# "http://"
|
341
|
+
#
|
342
|
+
# * For the `https` protocol, the endpoint is a URL beginning with
|
343
|
+
# "https://"
|
344
|
+
#
|
345
|
+
# * For the `email` protocol, the endpoint is an email address
|
346
|
+
#
|
347
|
+
# * For the `email-json` protocol, the endpoint is an email address
|
348
|
+
#
|
349
|
+
# * For the `sms` protocol, the endpoint is a phone number of an
|
350
|
+
# SMS-enabled device
|
351
|
+
#
|
352
|
+
# * For the `sqs` protocol, the endpoint is the ARN of an Amazon SQS
|
353
|
+
# queue
|
354
|
+
#
|
355
|
+
# * For the `application` protocol, the endpoint is the EndpointArn of a
|
356
|
+
# mobile app and device.
|
357
|
+
#
|
358
|
+
# * For the `lambda` protocol, the endpoint is the ARN of an AWS Lambda
|
359
|
+
# function.
|
360
|
+
# @return [Subscription]
|
361
|
+
def subscribe(options = {})
|
362
|
+
options = options.merge(topic_arn: @arn)
|
363
|
+
resp = @client.subscribe(options)
|
364
|
+
Subscription.new(
|
365
|
+
arn: resp.data.subscription_arn,
|
366
|
+
client: @client
|
367
|
+
)
|
368
|
+
end
|
370
369
|
|
371
|
-
|
370
|
+
# @!group Associations
|
372
371
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
end
|
390
|
-
y.yield(batch)
|
372
|
+
# @example Request syntax with placeholder values
|
373
|
+
#
|
374
|
+
# topic.subscriptions()
|
375
|
+
# @param [Hash] options ({})
|
376
|
+
# @return [Subscription::Collection]
|
377
|
+
def subscriptions(options = {})
|
378
|
+
batches = Enumerator.new do |y|
|
379
|
+
options = options.merge(topic_arn: @arn)
|
380
|
+
resp = @client.list_subscriptions_by_topic(options)
|
381
|
+
resp.each_page do |page|
|
382
|
+
batch = []
|
383
|
+
page.data.subscriptions.each do |s|
|
384
|
+
batch << Subscription.new(
|
385
|
+
arn: s.subscription_arn,
|
386
|
+
client: @client
|
387
|
+
)
|
391
388
|
end
|
389
|
+
y.yield(batch)
|
392
390
|
end
|
393
|
-
Subscription::Collection.new(batches)
|
394
391
|
end
|
392
|
+
Subscription::Collection.new(batches)
|
393
|
+
end
|
395
394
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
395
|
+
# @deprecated
|
396
|
+
# @api private
|
397
|
+
def identifiers
|
398
|
+
{ arn: @arn }
|
399
|
+
end
|
400
|
+
deprecated(:identifiers)
|
402
401
|
|
403
|
-
|
402
|
+
private
|
404
403
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
end
|
404
|
+
def extract_arn(args, options)
|
405
|
+
value = args[0] || options.delete(:arn)
|
406
|
+
case value
|
407
|
+
when String then value
|
408
|
+
when nil then raise ArgumentError, "missing required option :arn"
|
409
|
+
else
|
410
|
+
msg = "expected :arn to be a String, got #{value.class}"
|
411
|
+
raise ArgumentError, msg
|
414
412
|
end
|
415
|
-
|
416
|
-
class Collection < Aws::Resources::Collection; end
|
417
413
|
end
|
414
|
+
|
415
|
+
class Collection < Aws::Resources::Collection; end
|
418
416
|
end
|
419
417
|
end
|