Class: Aws::SNS::PlatformApplication

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb

Defined Under Namespace

Classes: Collection

Read-Only Attributes collapse

Actions collapse

Associations collapse

Instance Method Summary collapse

Constructor Details

#initialize(arn, options = {}) ⇒ PlatformApplication #initialize(options = {}) ⇒ PlatformApplication

Returns a new instance of PlatformApplication.

Overloads:



22
23
24
25
26
27
28
# File 'gems/aws-sdk-sns/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

Instance Method Details

#arnString

Returns:

  • (String)


33
34
35
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 33

def arn
  @arn
end

#attributesHash<String,String>

Attributes include the following:

  • AppleCertificateExpiryDate – The expiry date of the SSL certificate used to configure certificate-based authentication.

  • ApplePlatformTeamID – The Apple developer account ID used to configure token-based authentication.

  • ApplePlatformBundleID – The app identifier used to configure token-based authentication.

  • 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.

Returns:

  • (Hash<String,String>)


61
62
63
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 61

def attributes
  data[:attributes]
end

#clientClient

Returns:



68
69
70
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 68

def client
  @client
end

#create_platform_endpoint(options = {}) ⇒ PlatformEndpoint

Examples:

Request syntax with placeholder values


platformendpoint = platform_application.create_platform_endpoint({
  token: "String", # required
  custom_user_data: "String",
  attributes: {
    "String" => "String",
  },
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :token (required, String)

    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.

  • :custom_user_data (String)

    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.

  • :attributes (Hash<String,String>)

    For a list of attributes, see SetEndpointAttributes.

Returns:



129
130
131
132
133
134
135
136
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 129

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

#dataTypes::GetPlatformApplicationAttributesResponse



88
89
90
91
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 88

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



96
97
98
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 96

def data_loaded?
  !!@data
end

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


platform_application.delete()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (EmptyStructure)


143
144
145
146
147
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 143

def delete(options = {})
  options = options.merge(platform_application_arn: @arn)
  resp = @client.delete_platform_application(options)
  resp.data
end

#endpoints(options = {}) ⇒ PlatformEndpoint::Collection

Examples:

Request syntax with placeholder values


platform_application.endpoints()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 235

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

#loadself Also known as: reload

Loads, or reloads #data for the current Aws::SNS::PlatformApplication. Returns self making it possible to chain methods.

platform_application.reload.data

Returns:

  • (self)


78
79
80
81
82
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 78

def load
  resp = @client.get_platform_application_attributes(platform_application_arn: @arn)
  @data = resp.data
  self
end

#set_attributes(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


platform_application.set_attributes({
  attributes: { # required
    "String" => "String",
  },
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :attributes (required, Hash<String,String>)

    A map of the platform application attributes. Attributes in this map include the following:

    • PlatformCredential – The credential received from the notification service.

      • For ADM, PlatformCredentialis client secret.

      • For Apple Services using certificate credentials, PlatformCredential is private key.

      • For Apple Services using token credentials, PlatformCredential is signing key.

      • For GCM (Firebase Cloud Messaging), PlatformCredential is API key. ^

    • PlatformPrincipal – The principal received from the notification service.

      • For ADM, PlatformPrincipalis client id.

      • For Apple Services using certificate credentials, PlatformPrincipal is SSL certificate.

      • For Apple Services using token credentials, PlatformPrincipal is signing key ID.

      • For GCM (Firebase Cloud Messaging), there is no PlatformPrincipal. ^

    • 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.

    The following attributes only apply to APNs token-based authentication:

    • ApplePlatformTeamID – The identifier that's assigned to your Apple developer account team.

    • ApplePlatformBundleID – The bundle identifier that's assigned to your iOS app.

Returns:

  • (EmptyStructure)


222
223
224
225
226
# File 'gems/aws-sdk-sns/lib/aws-sdk-sns/platform_application.rb', line 222

def set_attributes(options = {})
  options = options.merge(platform_application_arn: @arn)
  resp = @client.set_platform_application_attributes(options)
  resp.data
end