aws-sdk-sns 1.0.0.rc1 → 1.0.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,14 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
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
- module SNS
10
- module Errors
8
+ module Aws::SNS
9
+ module Errors
11
10
 
12
- extend Aws::Errors::DynamicErrors
11
+ extend Aws::Errors::DynamicErrors
13
12
 
14
- # Raised when calling #load or #data on a resource class that can not be
15
- # loaded. This can happen when:
16
- #
17
- # * A resource class has identifiers, but no data attributes.
18
- # * Resource data is only available when making an API call that
19
- # enumerates all resources of that type.
20
- class ResourceNotLoadable < RuntimeError; end
21
- end
22
13
  end
23
14
  end
@@ -1,235 +1,233 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
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
- module SNS
10
- class PlatformApplication
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(arn, options = {})
15
- # @param [String] arn
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :arn
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @arn = extract_arn(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
8
+ module Aws::SNS
9
+ class PlatformApplication
10
+
11
+ extend Aws::Deprecations
12
+
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
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def arn
31
- @arn
32
- end
28
+ # @return [String]
29
+ def arn
30
+ @arn
31
+ end
33
32
 
34
- # Attributes include the following:
35
- #
36
- # * `EventEndpointCreated` -- Topic ARN to which EndpointCreated event
37
- # notifications should be sent.
38
- #
39
- # * `EventEndpointDeleted` -- Topic ARN to which EndpointDeleted event
40
- # notifications should be sent.
41
- #
42
- # * `EventEndpointUpdated` -- Topic ARN to which EndpointUpdate event
43
- # notifications should be sent.
44
- #
45
- # * `EventDeliveryFailure` -- Topic ARN to which DeliveryFailure event
46
- # notifications should be sent upon Direct Publish delivery failure
47
- # (permanent) to one of the application's endpoints.
48
- # @return [Hash<String,String>]
49
- def attributes
50
- data.attributes
51
- end
33
+ # Attributes include the following:
34
+ #
35
+ # * `EventEndpointCreated` -- Topic ARN to which EndpointCreated event
36
+ # notifications should be sent.
37
+ #
38
+ # * `EventEndpointDeleted` -- Topic ARN to which EndpointDeleted event
39
+ # notifications should be sent.
40
+ #
41
+ # * `EventEndpointUpdated` -- Topic ARN to which EndpointUpdate event
42
+ # notifications should be sent.
43
+ #
44
+ # * `EventDeliveryFailure` -- Topic ARN to which DeliveryFailure event
45
+ # notifications should be sent upon Direct Publish delivery failure
46
+ # (permanent) to one of the application's endpoints.
47
+ # @return [Hash<String,String>]
48
+ def attributes
49
+ data.attributes
50
+ end
52
51
 
53
- # @!endgroup
52
+ # @!endgroup
54
53
 
55
- # @return [Client]
56
- def client
57
- @client
58
- end
54
+ # @return [Client]
55
+ def client
56
+ @client
57
+ end
59
58
 
60
- # Loads, or reloads {#data} for the current {PlatformApplication}.
61
- # Returns `self` making it possible to chain methods.
62
- #
63
- # platform_application.reload.data
64
- #
65
- # @return [self]
66
- def load
67
- resp = @client.get_platform_application_attributes(platform_application_arn: @arn)
68
- @data = resp.data
69
- self
70
- end
71
- alias :reload :load
72
-
73
- # @return [Types::GetPlatformApplicationAttributesResponse]
74
- # Returns the data for this {PlatformApplication}. Calls
75
- # {Client#get_platform_application_attributes} if {#data_loaded?} is `false`.
76
- def data
77
- load unless @data
78
- @data
79
- end
59
+ # Loads, or reloads {#data} for the current {PlatformApplication}.
60
+ # Returns `self` making it possible to chain methods.
61
+ #
62
+ # platform_application.reload.data
63
+ #
64
+ # @return [self]
65
+ def load
66
+ resp = @client.get_platform_application_attributes(platform_application_arn: @arn)
67
+ @data = resp.data
68
+ self
69
+ end
70
+ alias :reload :load
71
+
72
+ # @return [Types::GetPlatformApplicationAttributesResponse]
73
+ # Returns the data for this {PlatformApplication}. Calls
74
+ # {Client#get_platform_application_attributes} if {#data_loaded?} is `false`.
75
+ def data
76
+ load unless @data
77
+ @data
78
+ end
80
79
 
81
- # @return [Boolean]
82
- # Returns `true` if this resource is loaded. Accessing attributes or
83
- # {#data} on an unloaded resource will trigger a call to {#load}.
84
- def data_loaded?
85
- !!@data
86
- end
80
+ # @return [Boolean]
81
+ # Returns `true` if this resource is loaded. Accessing attributes or
82
+ # {#data} on an unloaded resource will trigger a call to {#load}.
83
+ def data_loaded?
84
+ !!@data
85
+ end
87
86
 
88
- # @!group Actions
89
-
90
- # @example Request syntax with placeholder values
91
- #
92
- # platformendpoint = platform_application.create_platform_endpoint({
93
- # token: "String", # required
94
- # custom_user_data: "String",
95
- # attributes: {
96
- # "String" => "String",
97
- # },
98
- # })
99
- # @param [Hash] options ({})
100
- # @option options [required, String] :token
101
- # Unique identifier created by the notification service for an app on a
102
- # device. The specific name for Token will vary, depending on which
103
- # notification service is being used. For example, when using APNS as
104
- # the notification service, you need the device token. Alternatively,
105
- # when using GCM or ADM, the device token equivalent is called the
106
- # registration ID.
107
- # @option options [String] :custom_user_data
108
- # Arbitrary user data to associate with the endpoint. Amazon SNS does
109
- # not use this data. The data must be in UTF-8 format and less than 2KB.
110
- # @option options [Hash<String,String>] :attributes
111
- # For a list of attributes, see [SetEndpointAttributes][1].
112
- #
113
- #
114
- #
115
- # [1]: http://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html
116
- # @return [PlatformEndpoint]
117
- def create_platform_endpoint(options = {})
118
- options = options.merge(platform_application_arn: @arn)
119
- resp = @client.create_platform_endpoint(options)
120
- PlatformEndpoint.new(
121
- arn: resp.data.endpoint_arn,
122
- client: @client
123
- )
124
- end
87
+ # @!group Actions
88
+
89
+ # @example Request syntax with placeholder values
90
+ #
91
+ # platformendpoint = platform_application.create_platform_endpoint({
92
+ # token: "String", # required
93
+ # custom_user_data: "String",
94
+ # attributes: {
95
+ # "String" => "String",
96
+ # },
97
+ # })
98
+ # @param [Hash] options ({})
99
+ # @option options [required, String] :token
100
+ # Unique identifier created by the notification service for an app on a
101
+ # device. The specific name for Token will vary, depending on which
102
+ # notification service is being used. For example, when using APNS as
103
+ # the notification service, you need the device token. Alternatively,
104
+ # when using GCM or ADM, the device token equivalent is called the
105
+ # registration ID.
106
+ # @option options [String] :custom_user_data
107
+ # Arbitrary user data to associate with the endpoint. Amazon SNS does
108
+ # not use this data. The data must be in UTF-8 format and less than 2KB.
109
+ # @option options [Hash<String,String>] :attributes
110
+ # For a list of attributes, see [SetEndpointAttributes][1].
111
+ #
112
+ #
113
+ #
114
+ # [1]: http://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html
115
+ # @return [PlatformEndpoint]
116
+ def create_platform_endpoint(options = {})
117
+ options = options.merge(platform_application_arn: @arn)
118
+ resp = @client.create_platform_endpoint(options)
119
+ PlatformEndpoint.new(
120
+ arn: resp.data.endpoint_arn,
121
+ client: @client
122
+ )
123
+ end
125
124
 
126
- # @example Request syntax with placeholder values
127
- #
128
- # platform_application.delete()
129
- # @param [Hash] options ({})
130
- # @return [EmptyStructure]
131
- def delete(options = {})
132
- options = options.merge(platform_application_arn: @arn)
133
- resp = @client.delete_platform_application(options)
134
- resp.data
135
- end
125
+ # @example Request syntax with placeholder values
126
+ #
127
+ # platform_application.delete()
128
+ # @param [Hash] options ({})
129
+ # @return [EmptyStructure]
130
+ def delete(options = {})
131
+ options = options.merge(platform_application_arn: @arn)
132
+ resp = @client.delete_platform_application(options)
133
+ resp.data
134
+ end
136
135
 
137
- # @example Request syntax with placeholder values
138
- #
139
- # platform_application.set_attributes({
140
- # attributes: { # required
141
- # "String" => "String",
142
- # },
143
- # })
144
- # @param [Hash] options ({})
145
- # @option options [required, Hash<String,String>] :attributes
146
- # A map of the platform application attributes. Attributes in this map
147
- # include the following:
148
- #
149
- # * `PlatformCredential` -- The credential received from the
150
- # notification service. For APNS/APNS\_SANDBOX, PlatformCredential is
151
- # private key. For GCM, PlatformCredential is "API key". For ADM,
152
- # PlatformCredential is "client secret".
153
- #
154
- # * `PlatformPrincipal` -- The principal received from the notification
155
- # service. For APNS/APNS\_SANDBOX, PlatformPrincipal is SSL
156
- # certificate. For GCM, PlatformPrincipal is not applicable. For ADM,
157
- # PlatformPrincipal is "client id".
158
- #
159
- # * `EventEndpointCreated` -- Topic ARN to which EndpointCreated event
160
- # notifications should be sent.
161
- #
162
- # * `EventEndpointDeleted` -- Topic ARN to which EndpointDeleted event
163
- # notifications should be sent.
164
- #
165
- # * `EventEndpointUpdated` -- Topic ARN to which EndpointUpdate event
166
- # notifications should be sent.
167
- #
168
- # * `EventDeliveryFailure` -- Topic ARN to which DeliveryFailure event
169
- # notifications should be sent upon Direct Publish delivery failure
170
- # (permanent) to one of the application's endpoints.
171
- #
172
- # * `SuccessFeedbackRoleArn` -- IAM role ARN used to give Amazon SNS
173
- # write access to use CloudWatch Logs on your behalf.
174
- #
175
- # * `FailureFeedbackRoleArn` -- IAM role ARN used to give Amazon SNS
176
- # write access to use CloudWatch Logs on your behalf.
177
- #
178
- # * `SuccessFeedbackSampleRate` -- Sample rate percentage (0-100) of
179
- # successfully delivered messages.
180
- # @return [EmptyStructure]
181
- def set_attributes(options = {})
182
- options = options.merge(platform_application_arn: @arn)
183
- resp = @client.set_platform_application_attributes(options)
184
- resp.data
185
- end
136
+ # @example Request syntax with placeholder values
137
+ #
138
+ # platform_application.set_attributes({
139
+ # attributes: { # required
140
+ # "String" => "String",
141
+ # },
142
+ # })
143
+ # @param [Hash] options ({})
144
+ # @option options [required, Hash<String,String>] :attributes
145
+ # A map of the platform application attributes. Attributes in this map
146
+ # include the following:
147
+ #
148
+ # * `PlatformCredential` -- The credential received from the
149
+ # notification service. For APNS/APNS\_SANDBOX, PlatformCredential is
150
+ # private key. For GCM, PlatformCredential is "API key". For ADM,
151
+ # PlatformCredential is "client secret".
152
+ #
153
+ # * `PlatformPrincipal` -- The principal received from the notification
154
+ # service. For APNS/APNS\_SANDBOX, PlatformPrincipal is SSL
155
+ # certificate. For GCM, PlatformPrincipal is not applicable. For ADM,
156
+ # PlatformPrincipal is "client id".
157
+ #
158
+ # * `EventEndpointCreated` -- Topic ARN to which EndpointCreated event
159
+ # notifications should be sent.
160
+ #
161
+ # * `EventEndpointDeleted` -- Topic ARN to which EndpointDeleted event
162
+ # notifications should be sent.
163
+ #
164
+ # * `EventEndpointUpdated` -- Topic ARN to which EndpointUpdate event
165
+ # notifications should be sent.
166
+ #
167
+ # * `EventDeliveryFailure` -- Topic ARN to which DeliveryFailure event
168
+ # notifications should be sent upon Direct Publish delivery failure
169
+ # (permanent) to one of the application's endpoints.
170
+ #
171
+ # * `SuccessFeedbackRoleArn` -- IAM role ARN used to give Amazon SNS
172
+ # write access to use CloudWatch Logs on your behalf.
173
+ #
174
+ # * `FailureFeedbackRoleArn` -- IAM role ARN used to give Amazon SNS
175
+ # write access to use CloudWatch Logs on your behalf.
176
+ #
177
+ # * `SuccessFeedbackSampleRate` -- Sample rate percentage (0-100) of
178
+ # successfully delivered messages.
179
+ # @return [EmptyStructure]
180
+ def set_attributes(options = {})
181
+ options = options.merge(platform_application_arn: @arn)
182
+ resp = @client.set_platform_application_attributes(options)
183
+ resp.data
184
+ end
185
+
186
+ # @!group Associations
186
187
 
187
- # @!group Associations
188
-
189
- # @example Request syntax with placeholder values
190
- #
191
- # endpoints = platform_application.endpoints()
192
- # @param [Hash] options ({})
193
- # @return [PlatformEndpoint::Collection]
194
- def endpoints(options = {})
195
- batches = Enumerator.new do |y|
196
- options = options.merge(platform_application_arn: @arn)
197
- resp = @client.list_endpoints_by_platform_application(options)
198
- resp.each_page do |page|
199
- batch = []
200
- page.data.endpoints.each do |e|
201
- batch << PlatformEndpoint.new(
202
- arn: e.endpoint_arn,
203
- client: @client
204
- )
205
- end
206
- y.yield(batch)
188
+ # @example Request syntax with placeholder values
189
+ #
190
+ # platform_application.endpoints()
191
+ # @param [Hash] options ({})
192
+ # @return [PlatformEndpoint::Collection]
193
+ def endpoints(options = {})
194
+ batches = Enumerator.new do |y|
195
+ options = options.merge(platform_application_arn: @arn)
196
+ resp = @client.list_endpoints_by_platform_application(options)
197
+ resp.each_page do |page|
198
+ batch = []
199
+ page.data.endpoints.each do |e|
200
+ batch << PlatformEndpoint.new(
201
+ arn: e.endpoint_arn,
202
+ client: @client
203
+ )
207
204
  end
205
+ y.yield(batch)
208
206
  end
209
- PlatformEndpoint::Collection.new(batches)
210
207
  end
208
+ PlatformEndpoint::Collection.new(batches)
209
+ end
211
210
 
212
- # @deprecated
213
- # @api private
214
- def identifiers
215
- { arn: @arn }
216
- end
217
- deprecated(:identifiers)
218
-
219
- private
220
-
221
- def extract_arn(args, options)
222
- value = args[0] || options.delete(:arn)
223
- case value
224
- when String then value
225
- when nil then raise ArgumentError, "missing required option :arn"
226
- else
227
- msg = "expected :arn to be a String, got #{value.class}"
228
- raise ArgumentError, msg
229
- end
211
+ # @deprecated
212
+ # @api private
213
+ def identifiers
214
+ { arn: @arn }
215
+ end
216
+ deprecated(:identifiers)
217
+
218
+ private
219
+
220
+ def extract_arn(args, options)
221
+ value = args[0] || options.delete(:arn)
222
+ case value
223
+ when String then value
224
+ when nil then raise ArgumentError, "missing required option :arn"
225
+ else
226
+ msg = "expected :arn to be a String, got #{value.class}"
227
+ raise ArgumentError, msg
230
228
  end
231
-
232
- class Collection < Aws::Resources::Collection; end
233
229
  end
230
+
231
+ class Collection < Aws::Resources::Collection; end
234
232
  end
235
233
  end