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.
@@ -1,185 +1,183 @@
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 Resource
8
+ module Aws::SNS
9
+ class Resource
11
10
 
12
- # @param options ({})
13
- # @option options [Client] :client
14
- def initialize(options = {})
15
- @client = options[:client] || Client.new(options)
16
- end
11
+ # @param options ({})
12
+ # @option options [Client] :client
13
+ def initialize(options = {})
14
+ @client = options[:client] || Client.new(options)
15
+ end
17
16
 
18
- # @return [Client]
19
- def client
20
- @client
21
- end
17
+ # @return [Client]
18
+ def client
19
+ @client
20
+ end
22
21
 
23
- # @!group Actions
22
+ # @!group Actions
24
23
 
25
- # @example Request syntax with placeholder values
26
- #
27
- # platformapplication = sns.create_platform_application({
28
- # name: "String", # required
29
- # platform: "String", # required
30
- # attributes: { # required
31
- # "String" => "String",
32
- # },
33
- # })
34
- # @param [Hash] options ({})
35
- # @option options [required, String] :name
36
- # Application names must be made up of only uppercase and lowercase
37
- # ASCII letters, numbers, underscores, hyphens, and periods, and must be
38
- # between 1 and 256 characters long.
39
- # @option options [required, String] :platform
40
- # The following platforms are supported: ADM (Amazon Device Messaging),
41
- # APNS (Apple Push Notification Service), APNS\_SANDBOX, and GCM (Google
42
- # Cloud Messaging).
43
- # @option options [required, Hash<String,String>] :attributes
44
- # For a list of attributes, see [SetPlatformApplicationAttributes][1]
45
- #
46
- #
47
- #
48
- # [1]: http://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html
49
- # @return [PlatformApplication]
50
- def create_platform_application(options = {})
51
- resp = @client.create_platform_application(options)
52
- PlatformApplication.new(
53
- arn: resp.data.platform_application_arn,
54
- client: @client
55
- )
56
- end
24
+ # @example Request syntax with placeholder values
25
+ #
26
+ # platformapplication = sns.create_platform_application({
27
+ # name: "String", # required
28
+ # platform: "String", # required
29
+ # attributes: { # required
30
+ # "String" => "String",
31
+ # },
32
+ # })
33
+ # @param [Hash] options ({})
34
+ # @option options [required, String] :name
35
+ # Application names must be made up of only uppercase and lowercase
36
+ # ASCII letters, numbers, underscores, hyphens, and periods, and must be
37
+ # between 1 and 256 characters long.
38
+ # @option options [required, String] :platform
39
+ # The following platforms are supported: ADM (Amazon Device Messaging),
40
+ # APNS (Apple Push Notification Service), APNS\_SANDBOX, and GCM (Google
41
+ # Cloud Messaging).
42
+ # @option options [required, Hash<String,String>] :attributes
43
+ # For a list of attributes, see [SetPlatformApplicationAttributes][1]
44
+ #
45
+ #
46
+ #
47
+ # [1]: http://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html
48
+ # @return [PlatformApplication]
49
+ def create_platform_application(options = {})
50
+ resp = @client.create_platform_application(options)
51
+ PlatformApplication.new(
52
+ arn: resp.data.platform_application_arn,
53
+ client: @client
54
+ )
55
+ end
57
56
 
58
- # @example Request syntax with placeholder values
59
- #
60
- # topic = sns.create_topic({
61
- # name: "topicName", # required
62
- # })
63
- # @param [Hash] options ({})
64
- # @option options [required, String] :name
65
- # The name of the topic you want to create.
66
- #
67
- # Constraints: Topic names must be made up of only uppercase and
68
- # lowercase ASCII letters, numbers, underscores, and hyphens, and must
69
- # be between 1 and 256 characters long.
70
- # @return [Topic]
71
- def create_topic(options = {})
72
- resp = @client.create_topic(options)
73
- Topic.new(
74
- arn: resp.data.topic_arn,
75
- client: @client
76
- )
77
- end
57
+ # @example Request syntax with placeholder values
58
+ #
59
+ # topic = sns.create_topic({
60
+ # name: "topicName", # required
61
+ # })
62
+ # @param [Hash] options ({})
63
+ # @option options [required, String] :name
64
+ # The name of the topic you want to create.
65
+ #
66
+ # Constraints: Topic names must be made up of only uppercase and
67
+ # lowercase ASCII letters, numbers, underscores, and hyphens, and must
68
+ # be between 1 and 256 characters long.
69
+ # @return [Topic]
70
+ def create_topic(options = {})
71
+ resp = @client.create_topic(options)
72
+ Topic.new(
73
+ arn: resp.data.topic_arn,
74
+ client: @client
75
+ )
76
+ end
78
77
 
79
- # @!group Associations
78
+ # @!group Associations
80
79
 
81
- # @param [String] arn
82
- # @return [PlatformApplication]
83
- def platform_application(arn)
84
- PlatformApplication.new(
85
- arn: arn,
86
- client: @client
87
- )
88
- end
80
+ # @param [String] arn
81
+ # @return [PlatformApplication]
82
+ def platform_application(arn)
83
+ PlatformApplication.new(
84
+ arn: arn,
85
+ client: @client
86
+ )
87
+ end
89
88
 
90
- # @example Request syntax with placeholder values
91
- #
92
- # platformapplications = sns.platform_applications()
93
- # @param [Hash] options ({})
94
- # @return [PlatformApplication::Collection]
95
- def platform_applications(options = {})
96
- batches = Enumerator.new do |y|
97
- resp = @client.list_platform_applications(options)
98
- resp.each_page do |page|
99
- batch = []
100
- page.data.platform_applications.each do |p|
101
- batch << PlatformApplication.new(
102
- arn: p.platform_application_arn,
103
- client: @client
104
- )
105
- end
106
- y.yield(batch)
89
+ # @example Request syntax with placeholder values
90
+ #
91
+ # sns.platform_applications()
92
+ # @param [Hash] options ({})
93
+ # @return [PlatformApplication::Collection]
94
+ def platform_applications(options = {})
95
+ batches = Enumerator.new do |y|
96
+ resp = @client.list_platform_applications(options)
97
+ resp.each_page do |page|
98
+ batch = []
99
+ page.data.platform_applications.each do |p|
100
+ batch << PlatformApplication.new(
101
+ arn: p.platform_application_arn,
102
+ client: @client
103
+ )
107
104
  end
105
+ y.yield(batch)
108
106
  end
109
- PlatformApplication::Collection.new(batches)
110
107
  end
108
+ PlatformApplication::Collection.new(batches)
109
+ end
111
110
 
112
- # @param [String] arn
113
- # @return [PlatformEndpoint]
114
- def platform_endpoint(arn)
115
- PlatformEndpoint.new(
116
- arn: arn,
117
- client: @client
118
- )
119
- end
111
+ # @param [String] arn
112
+ # @return [PlatformEndpoint]
113
+ def platform_endpoint(arn)
114
+ PlatformEndpoint.new(
115
+ arn: arn,
116
+ client: @client
117
+ )
118
+ end
120
119
 
121
- # @param [String] arn
122
- # @return [Subscription]
123
- def subscription(arn)
124
- Subscription.new(
125
- arn: arn,
126
- client: @client
127
- )
128
- end
120
+ # @param [String] arn
121
+ # @return [Subscription]
122
+ def subscription(arn)
123
+ Subscription.new(
124
+ arn: arn,
125
+ client: @client
126
+ )
127
+ end
129
128
 
130
- # @example Request syntax with placeholder values
131
- #
132
- # subscriptions = sns.subscriptions()
133
- # @param [Hash] options ({})
134
- # @return [Subscription::Collection]
135
- def subscriptions(options = {})
136
- batches = Enumerator.new do |y|
137
- resp = @client.list_subscriptions(options)
138
- resp.each_page do |page|
139
- batch = []
140
- page.data.subscriptions.each do |s|
141
- batch << Subscription.new(
142
- arn: s.subscription_arn,
143
- client: @client
144
- )
145
- end
146
- y.yield(batch)
129
+ # @example Request syntax with placeholder values
130
+ #
131
+ # sns.subscriptions()
132
+ # @param [Hash] options ({})
133
+ # @return [Subscription::Collection]
134
+ def subscriptions(options = {})
135
+ batches = Enumerator.new do |y|
136
+ resp = @client.list_subscriptions(options)
137
+ resp.each_page do |page|
138
+ batch = []
139
+ page.data.subscriptions.each do |s|
140
+ batch << Subscription.new(
141
+ arn: s.subscription_arn,
142
+ client: @client
143
+ )
147
144
  end
145
+ y.yield(batch)
148
146
  end
149
- Subscription::Collection.new(batches)
150
147
  end
148
+ Subscription::Collection.new(batches)
149
+ end
151
150
 
152
- # @param [String] arn
153
- # @return [Topic]
154
- def topic(arn)
155
- Topic.new(
156
- arn: arn,
157
- client: @client
158
- )
159
- end
151
+ # @param [String] arn
152
+ # @return [Topic]
153
+ def topic(arn)
154
+ Topic.new(
155
+ arn: arn,
156
+ client: @client
157
+ )
158
+ end
160
159
 
161
- # @example Request syntax with placeholder values
162
- #
163
- # topics = sns.topics()
164
- # @param [Hash] options ({})
165
- # @return [Topic::Collection]
166
- def topics(options = {})
167
- batches = Enumerator.new do |y|
168
- resp = @client.list_topics(options)
169
- resp.each_page do |page|
170
- batch = []
171
- page.data.topics.each do |t|
172
- batch << Topic.new(
173
- arn: t.topic_arn,
174
- client: @client
175
- )
176
- end
177
- y.yield(batch)
160
+ # @example Request syntax with placeholder values
161
+ #
162
+ # sns.topics()
163
+ # @param [Hash] options ({})
164
+ # @return [Topic::Collection]
165
+ def topics(options = {})
166
+ batches = Enumerator.new do |y|
167
+ resp = @client.list_topics(options)
168
+ resp.each_page do |page|
169
+ batch = []
170
+ page.data.topics.each do |t|
171
+ batch << Topic.new(
172
+ arn: t.topic_arn,
173
+ client: @client
174
+ )
178
175
  end
176
+ y.yield(batch)
179
177
  end
180
- Topic::Collection.new(batches)
181
178
  end
182
-
179
+ Topic::Collection.new(batches)
183
180
  end
181
+
184
182
  end
185
183
  end
@@ -1,149 +1,147 @@
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 Subscription
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 Subscription
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
- # A map of the subscription's attributes. Attributes in this map
35
- # include the following:
36
- #
37
- # * `SubscriptionArn` -- the subscription's ARN
38
- #
39
- # * `TopicArn` -- the topic ARN that the subscription is associated with
40
- #
41
- # * `Owner` -- the AWS account ID of the subscription's owner
42
- #
43
- # * `ConfirmationWasAuthenticated` -- true if the subscription
44
- # confirmation request was authenticated
45
- #
46
- # * `DeliveryPolicy` -- the JSON serialization of the subscription's
47
- # delivery policy
48
- #
49
- # * `EffectiveDeliveryPolicy` -- the JSON serialization of the effective
50
- # delivery policy that takes into account the topic delivery policy
51
- # and account system defaults
52
- # @return [Hash<String,String>]
53
- def attributes
54
- data.attributes
55
- end
33
+ # A map of the subscription's attributes. Attributes in this map
34
+ # include the following:
35
+ #
36
+ # * `SubscriptionArn` -- the subscription's ARN
37
+ #
38
+ # * `TopicArn` -- the topic ARN that the subscription is associated with
39
+ #
40
+ # * `Owner` -- the AWS account ID of the subscription's owner
41
+ #
42
+ # * `ConfirmationWasAuthenticated` -- true if the subscription
43
+ # confirmation request was authenticated
44
+ #
45
+ # * `DeliveryPolicy` -- the JSON serialization of the subscription's
46
+ # delivery policy
47
+ #
48
+ # * `EffectiveDeliveryPolicy` -- the JSON serialization of the effective
49
+ # delivery policy that takes into account the topic delivery policy
50
+ # and account system defaults
51
+ # @return [Hash<String,String>]
52
+ def attributes
53
+ data.attributes
54
+ end
56
55
 
57
- # @!endgroup
56
+ # @!endgroup
58
57
 
59
- # @return [Client]
60
- def client
61
- @client
62
- end
58
+ # @return [Client]
59
+ def client
60
+ @client
61
+ end
63
62
 
64
- # Loads, or reloads {#data} for the current {Subscription}.
65
- # Returns `self` making it possible to chain methods.
66
- #
67
- # subscription.reload.data
68
- #
69
- # @return [self]
70
- def load
71
- resp = @client.get_subscription_attributes(subscription_arn: @arn)
72
- @data = resp.data
73
- self
74
- end
75
- alias :reload :load
76
-
77
- # @return [Types::GetSubscriptionAttributesResponse]
78
- # Returns the data for this {Subscription}. Calls
79
- # {Client#get_subscription_attributes} if {#data_loaded?} is `false`.
80
- def data
81
- load unless @data
82
- @data
83
- end
63
+ # Loads, or reloads {#data} for the current {Subscription}.
64
+ # Returns `self` making it possible to chain methods.
65
+ #
66
+ # subscription.reload.data
67
+ #
68
+ # @return [self]
69
+ def load
70
+ resp = @client.get_subscription_attributes(subscription_arn: @arn)
71
+ @data = resp.data
72
+ self
73
+ end
74
+ alias :reload :load
75
+
76
+ # @return [Types::GetSubscriptionAttributesResponse]
77
+ # Returns the data for this {Subscription}. Calls
78
+ # {Client#get_subscription_attributes} if {#data_loaded?} is `false`.
79
+ def data
80
+ load unless @data
81
+ @data
82
+ end
84
83
 
85
- # @return [Boolean]
86
- # Returns `true` if this resource is loaded. Accessing attributes or
87
- # {#data} on an unloaded resource will trigger a call to {#load}.
88
- def data_loaded?
89
- !!@data
90
- end
84
+ # @return [Boolean]
85
+ # Returns `true` if this resource is loaded. Accessing attributes or
86
+ # {#data} on an unloaded resource will trigger a call to {#load}.
87
+ def data_loaded?
88
+ !!@data
89
+ end
91
90
 
92
- # @!group Actions
93
-
94
- # @example Request syntax with placeholder values
95
- #
96
- # subscription.delete()
97
- # @param [Hash] options ({})
98
- # @return [EmptyStructure]
99
- def delete(options = {})
100
- options = options.merge(subscription_arn: @arn)
101
- resp = @client.unsubscribe(options)
102
- resp.data
103
- end
91
+ # @!group Actions
92
+
93
+ # @example Request syntax with placeholder values
94
+ #
95
+ # subscription.delete()
96
+ # @param [Hash] options ({})
97
+ # @return [EmptyStructure]
98
+ def delete(options = {})
99
+ options = options.merge(subscription_arn: @arn)
100
+ resp = @client.unsubscribe(options)
101
+ resp.data
102
+ end
104
103
 
105
- # @example Request syntax with placeholder values
106
- #
107
- # subscription.set_attributes({
108
- # attribute_name: "attributeName", # required
109
- # attribute_value: "attributeValue",
110
- # })
111
- # @param [Hash] options ({})
112
- # @option options [required, String] :attribute_name
113
- # The name of the attribute you want to set. Only a subset of the
114
- # subscriptions attributes are mutable.
115
- #
116
- # Valid values: `DeliveryPolicy` \| `RawMessageDelivery`
117
- # @option options [String] :attribute_value
118
- # The new value for the attribute in JSON format.
119
- # @return [EmptyStructure]
120
- def set_attributes(options = {})
121
- options = options.merge(subscription_arn: @arn)
122
- resp = @client.set_subscription_attributes(options)
123
- resp.data
124
- end
104
+ # @example Request syntax with placeholder values
105
+ #
106
+ # subscription.set_attributes({
107
+ # attribute_name: "attributeName", # required
108
+ # attribute_value: "attributeValue",
109
+ # })
110
+ # @param [Hash] options ({})
111
+ # @option options [required, String] :attribute_name
112
+ # The name of the attribute you want to set. Only a subset of the
113
+ # subscriptions attributes are mutable.
114
+ #
115
+ # Valid values: `DeliveryPolicy` \| `RawMessageDelivery`
116
+ # @option options [String] :attribute_value
117
+ # The new value for the attribute in JSON format.
118
+ # @return [EmptyStructure]
119
+ def set_attributes(options = {})
120
+ options = options.merge(subscription_arn: @arn)
121
+ resp = @client.set_subscription_attributes(options)
122
+ resp.data
123
+ end
125
124
 
126
- # @deprecated
127
- # @api private
128
- def identifiers
129
- { arn: @arn }
130
- end
131
- deprecated(:identifiers)
132
-
133
- private
134
-
135
- def extract_arn(args, options)
136
- value = args[0] || options.delete(:arn)
137
- case value
138
- when String then value
139
- when nil then raise ArgumentError, "missing required option :arn"
140
- else
141
- msg = "expected :arn to be a String, got #{value.class}"
142
- raise ArgumentError, msg
143
- end
125
+ # @deprecated
126
+ # @api private
127
+ def identifiers
128
+ { arn: @arn }
129
+ end
130
+ deprecated(:identifiers)
131
+
132
+ private
133
+
134
+ def extract_arn(args, options)
135
+ value = args[0] || options.delete(:arn)
136
+ case value
137
+ when String then value
138
+ when nil then raise ArgumentError, "missing required option :arn"
139
+ else
140
+ msg = "expected :arn to be a String, got #{value.class}"
141
+ raise ArgumentError, msg
144
142
  end
145
-
146
- class Collection < Aws::Resources::Collection; end
147
143
  end
144
+
145
+ class Collection < Aws::Resources::Collection; end
148
146
  end
149
147
  end