class Aws::SNS::PlatformApplication
Public Class Methods
@overload def initialize(arn, options = {})
@param [String] arn @option options [Client] :client
@overload def initialize(options = {})
@option options [required, String] :arn @option options [Client] :client
# File lib/aws-sdk-sns/platform_application.rb, line 22 def initialize(*args) options = Hash === args.last ? args.pop.dup : {} @arn = extract_arn(args, options) @data = options.delete(:data) @client = options.delete(:client) || Client.new(options) @waiter_block_warned = false end
Public Instance Methods
@return [String]
# File lib/aws-sdk-sns/platform_application.rb, line 33 def arn @arn end
Attributes include the following:
-
`EventEndpointCreated` –
Topic
ARN to which EndpointCreated event notifications should be sent. -
`EventEndpointDeleted` –
Topic
ARN to which EndpointDeleted event notifications should be sent. -
`EventEndpointUpdated` –
Topic
ARN to which EndpointUpdate event notifications should be sent. -
`EventDeliveryFailure` –
Topic
ARN to which DeliveryFailure event notifications should be sent upon Direct Publish delivery failure (permanent) to one of the application's endpoints.
@return [Hash<String,String>]
# File lib/aws-sdk-sns/platform_application.rb, line 52 def attributes data[:attributes] end
@return [Client]
# File lib/aws-sdk-sns/platform_application.rb, line 59 def client @client end
@example Request syntax with placeholder values
platformendpoint = platform_application.create_platform_endpoint({ token: "String", # required custom_user_data: "String", attributes: { "String" => "String", }, })
@param [Hash] options ({}) @option options [required, String] :token
Unique identifier created by the notification service for an app on a device. The specific name for Token will vary, depending on which notification service is being used. For example, when using APNS as the notification service, you need the device token. Alternatively, when using GCM (Firebase Cloud Messaging) or ADM, the device token equivalent is called the registration ID.
@option options [String] :custom_user_data
Arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 format and less than 2KB.
@option options [Hash<String,String>] :attributes
For a list of attributes, see [SetEndpointAttributes][1]. [1]: https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html
@return [PlatformEndpoint]
# File lib/aws-sdk-sns/platform_application.rb, line 120 def create_platform_endpoint(options = {}) options = options.merge(platform_application_arn: @arn) resp = @client.create_platform_endpoint(options) PlatformEndpoint.new( arn: resp.data.endpoint_arn, client: @client ) end
@return [Types::GetPlatformApplicationAttributesResponse]
Returns the data for this {PlatformApplication}. Calls {Client#get_platform_application_attributes} if {#data_loaded?} is `false`.
# File lib/aws-sdk-sns/platform_application.rb, line 79 def data load unless @data @data end
@return [Boolean]
Returns `true` if this resource is loaded. Accessing attributes or {#data} on an unloaded resource will trigger a call to {#load}.
# File lib/aws-sdk-sns/platform_application.rb, line 87 def data_loaded? !!@data end
@example Request syntax with placeholder values
platform_application.delete()
@param [Hash] options ({}) @return [EmptyStructure]
# File lib/aws-sdk-sns/platform_application.rb, line 134 def delete(options = {}) options = options.merge(platform_application_arn: @arn) resp = @client.delete_platform_application(options) resp.data end
@example Request syntax with placeholder values
platform_application.endpoints()
@param [Hash] options ({}) @return [PlatformEndpoint::Collection]
# File lib/aws-sdk-sns/platform_application.rb, line 198 def endpoints(options = {}) batches = Enumerator.new do |y| options = options.merge(platform_application_arn: @arn) resp = @client.list_endpoints_by_platform_application(options) resp.each_page do |page| batch = [] page.data.endpoints.each do |e| batch << PlatformEndpoint.new( arn: e.endpoint_arn, client: @client ) end y.yield(batch) end end PlatformEndpoint::Collection.new(batches) end
@deprecated @api private
# File lib/aws-sdk-sns/platform_application.rb, line 218 def identifiers { arn: @arn } end
Loads, or reloads {#data} for the current {PlatformApplication}. Returns `self` making it possible to chain methods.
platform_application.reload.data
@return [self]
# File lib/aws-sdk-sns/platform_application.rb, line 69 def load resp = @client.get_platform_application_attributes(platform_application_arn: @arn) @data = resp.data self end
@example Request syntax with placeholder values
platform_application.set_attributes({ attributes: { # required "String" => "String", }, })
@param [Hash] options ({}) @option options [required, Hash<String,String>] :attributes
A map of the platform application attributes. Attributes in this map include the following: * `PlatformCredential` – The credential received from the notification service. For `APNS` and `APNS_SANDBOX`, `PlatformCredential` is `private key`. For `GCM` (Firebase Cloud Messaging), `PlatformCredential` is `API key`. For `ADM`, `PlatformCredential` is `client secret`. * `PlatformPrincipal` – The principal received from the notification service. For `APNS` and `APNS_SANDBOX`, `PlatformPrincipal` is `SSL certificate`. For `GCM` (Firebase Cloud Messaging), there is no `PlatformPrincipal`. For `ADM`, `PlatformPrincipal` is `client id`. * `EventEndpointCreated` – Topic ARN to which `EndpointCreated` event notifications are sent. * `EventEndpointDeleted` – Topic ARN to which `EndpointDeleted` event notifications are sent. * `EventEndpointUpdated` – Topic ARN to which `EndpointUpdate` event notifications are sent. * `EventDeliveryFailure` – Topic ARN to which `DeliveryFailure` event notifications are sent upon Direct Publish delivery failure (permanent) to one of the application's endpoints. * `SuccessFeedbackRoleArn` – IAM role ARN used to give Amazon SNS write access to use CloudWatch Logs on your behalf. * `FailureFeedbackRoleArn` – IAM role ARN used to give Amazon SNS write access to use CloudWatch Logs on your behalf. * `SuccessFeedbackSampleRate` – Sample rate percentage (0-100) of successfully delivered messages.
@return [EmptyStructure]
# File lib/aws-sdk-sns/platform_application.rb, line 185 def set_attributes(options = {}) options = options.merge(platform_application_arn: @arn) resp = @client.set_platform_application_attributes(options) resp.data end
Private Instance Methods
# File lib/aws-sdk-sns/platform_application.rb, line 225 def extract_arn(args, options) value = args[0] || options.delete(:arn) case value when String then value when nil then raise ArgumentError, "missing required option :arn" else msg = "expected :arn to be a String, got #{value.class}" raise ArgumentError, msg end end