Class: AWSCDK::SNS::Topic

Inherits:
TopicBase
  • Object
show all
Defined in:
sns/topic.rb

Overview

A new SNS topic.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props = nil) ⇒ Topic

Returns a new instance of Topic.

Parameters:



11
12
13
14
15
16
17
# File 'sns/topic.rb', line 11

def initialize(scope, id, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::SNS::TopicProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLlRvcGljUHJvcHMifQ==")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_topic_arn(scope, id, topic_arn) ⇒ AWSCDK::SNS::ITopic

Import an existing SNS topic provided an ARN.

Parameters:

  • scope (Constructs::Construct)

    The parent creating construct.

  • id (String)

    The construct's name.

  • topic_arn (String)

    topic ARN (i.e. arn:aws:sns:us-east-2:444455556666:MyTopic).

Returns:



70
71
72
73
74
75
# File 'sns/topic.rb', line 70

def self.from_topic_arn(scope, id, topic_arn)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(topic_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "topicArn")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_sns.Topic", "fromTopicArn", [scope, id, topic_arn])
end

.from_topic_attributes(scope, id, attrs) ⇒ AWSCDK::SNS::ITopic

Import an existing SNS topic provided a topic attributes.

Parameters:

  • scope (Constructs::Construct)

    The parent creating construct.

  • id (String)

    The construct's name.

  • attrs (AWSCDK::SNS::TopicAttributes)

    the attributes of the topic to import.

Returns:



83
84
85
86
87
88
89
# File 'sns/topic.rb', line 83

def self.from_topic_attributes(scope, id, attrs)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  attrs = attrs.is_a?(Hash) ? ::AWSCDK::SNS::TopicAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLlRvcGljQXR0cmlidXRlcyJ9")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_sns.Topic", "fromTopicAttributes", [scope, id, attrs])
end

.jsii_overridable_methodsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
# File 'sns/topic.rb', line 19

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :physical_name => { kind: :property, name: "physicalName", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :auto_create_policy => { kind: :property, name: "autoCreatePolicy", is_optional: false },
    :content_based_deduplication => { kind: :property, name: "contentBasedDeduplication", is_optional: false },
    :fifo => { kind: :property, name: "fifo", is_optional: false },
    :grants => { kind: :property, name: "grants", is_optional: false },
    :topic_arn => { kind: :property, name: "topicArn", is_optional: false },
    :topic_name => { kind: :property, name: "topicName", is_optional: false },
    :topic_ref => { kind: :property, name: "topicRef", is_optional: false },
    :master_key => { kind: :property, name: "masterKey", is_optional: true },
    :enforce_ssl => { kind: :property, name: "enforceSSL", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false },
    :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false },
    :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false },
    :add_ssl_policy => { kind: :method, name: "addSSLPolicy", is_optional: false },
    :add_subscription => { kind: :method, name: "addSubscription", is_optional: false },
    :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false },
    :bind_as_notification_rule_target => { kind: :method, name: "bindAsNotificationRuleTarget", is_optional: false },
    :create_ssl_policy_document => { kind: :method, name: "createSSLPolicyDocument", is_optional: false },
    :create_topic_policy => { kind: :method, name: "createTopicPolicy", is_optional: false },
    :grant_on_key => { kind: :method, name: "grantOnKey", is_optional: false },
    :grant_publish => { kind: :method, name: "grantPublish", is_optional: false },
    :grant_subscribe => { kind: :method, name: "grantSubscribe", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_number_of_messages_published => { kind: :method, name: "metricNumberOfMessagesPublished", is_optional: false },
    :metric_number_of_notifications_delivered => { kind: :method, name: "metricNumberOfNotificationsDelivered", is_optional: false },
    :metric_number_of_notifications_failed => { kind: :method, name: "metricNumberOfNotificationsFailed", is_optional: false },
    :metric_number_of_notifications_filtered_out => { kind: :method, name: "metricNumberOfNotificationsFilteredOut", is_optional: false },
    :metric_number_of_notifications_filtered_out_invalid_attributes => { kind: :method, name: "metricNumberOfNotificationsFilteredOutInvalidAttributes", is_optional: false },
    :metric_number_of_notifications_filtered_out_no_message_attributes => { kind: :method, name: "metricNumberOfNotificationsFilteredOutNoMessageAttributes", is_optional: false },
    :metric_publish_size => { kind: :method, name: "metricPublishSize", is_optional: false },
    :metric_sms_month_to_date_spent_usd => { kind: :method, name: "metricSMSMonthToDateSpentUSD", is_optional: false },
    :metric_sms_success_rate => { kind: :method, name: "metricSMSSuccessRate", is_optional: false },
    :add_logging_config => { kind: :method, name: "addLoggingConfig", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


211
212
213
# File 'sns/topic.rb', line 211

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_sns.Topic", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_logging_config(config) ⇒ void

This method returns an undefined value.

Adds a delivery status logging configuration to the topic.

Parameters:



525
526
527
528
529
# File 'sns/topic.rb', line 525

def add_logging_config(config)
  config = config.is_a?(Hash) ? ::AWSCDK::SNS::LoggingConfig.new(**config.transform_keys(&:to_sym)) : config
  Jsii::Type.check_type(config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLkxvZ2dpbmdDb25maWcifQ==")), "config")
  jsii_call_method("addLoggingConfig", [config])
end

#add_ssl_policyvoid

This method returns an undefined value.

Adds a SSL policy to the topic resource policy.



308
309
310
# File 'sns/topic.rb', line 308

def add_ssl_policy()
  jsii_call_method("addSSLPolicy", [])
end

#add_subscription(topic_subscription) ⇒ AWSCDK::SNS::Subscription

Subscribe some endpoint to this topic.

Parameters:

Returns:



316
317
318
319
# File 'sns/topic.rb', line 316

def add_subscription(topic_subscription)
  Jsii::Type.check_type(topic_subscription, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLklUb3BpY1N1YnNjcmlwdGlvbiJ9")), "topicSubscription")
  jsii_call_method("addSubscription", [topic_subscription])
end

#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult

Adds a statement to the IAM resource policy associated with this topic.

If this topic was created in this stack (new Topic), a topic policy will be automatically created upon the first call to add_to_resource_policy. However, if enforce_ssl is set to true, the policy has already been created before the first call to this method.

If the topic is imported (Topic.import), then this is a no-op.



332
333
334
335
# File 'sns/topic.rb', line 332

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [statement])
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Override the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters:



248
249
250
251
# File 'sns/topic.rb', line 248

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



265
266
267
268
# File 'sns/topic.rb', line 265

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#auto_create_policyBoolean

Controls automatic creation of policy objects.

Set by subclasses.

Returns:

  • (Boolean)


139
140
141
# File 'sns/topic.rb', line 139

def auto_create_policy()
  jsii_get_property("autoCreatePolicy")
end

#bind_as_notification_rule_target(_scope) ⇒ AWSCDK::CodeStarNotifications::NotificationRuleTargetConfig

Represents a notification target That allows SNS topic to associate with this rule target.

Parameters:

  • _scope (Constructs::Construct)

Returns:



341
342
343
344
# File 'sns/topic.rb', line 341

def bind_as_notification_rule_target(_scope)
  Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope")
  jsii_call_method("bindAsNotificationRuleTarget", [_scope])
end

#content_based_deduplicationBoolean

Enables content-based deduplication for FIFO topics.

Returns:

  • (Boolean)


146
147
148
# File 'sns/topic.rb', line 146

def content_based_deduplication()
  jsii_get_property("contentBasedDeduplication")
end

#create_ssl_policy_documentAWSCDK::IAM::PolicyStatement

Adds a statement to enforce encryption of data in transit when publishing to the topic.

For more information, see https://docs.aws.amazon.com/sns/latest/dg/sns-security-best-practices.html#enforce-encryption-data-in-transit.



351
352
353
# File 'sns/topic.rb', line 351

def create_ssl_policy_document()
  jsii_call_method("createSSLPolicyDocument", [])
end

#create_topic_policyvoid

This method returns an undefined value.

Creates a topic policy for this topic.



358
359
360
# File 'sns/topic.rb', line 358

def create_topic_policy()
  jsii_call_method("createTopicPolicy", [])
end

#enforce_sslBoolean?

Adds a statement to enforce encryption of data in transit when publishing to the topic.

Returns:

  • (Boolean, nil)


199
200
201
# File 'sns/topic.rb', line 199

def enforce_ssl()
  jsii_get_property("enforceSSL")
end

#enforce_ssl=(value) ⇒ Object



203
204
205
206
# File 'sns/topic.rb', line 203

def enforce_ssl=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enforceSSL") unless value.nil?
  jsii_set_property("enforceSSL", value)
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



109
110
111
# File 'sns/topic.rb', line 109

def env()
  jsii_get_property("env")
end

#fifoBoolean

Whether this topic is an Amazon SNS FIFO queue.

If false, this is a standard topic.

Returns:

  • (Boolean)


155
156
157
# File 'sns/topic.rb', line 155

def fifo()
  jsii_get_property("fifo")
end

#generate_physical_nameString

Returns:

  • (String)


271
272
273
# File 'sns/topic.rb', line 271

def generate_physical_name()
  jsii_call_method("generatePhysicalName", [])
end

#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arn_attr, but if the resource is referenced across environments, arn_components will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arn_components.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


285
286
287
288
289
290
# File 'sns/topic.rb', line 285

def get_resource_arn_attribute(arn_attr, arn_components)
  Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr")
  arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components
  Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents")
  jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components])
end

#get_resource_name_attribute(name_attr) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to name_attr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


300
301
302
303
# File 'sns/topic.rb', line 300

def get_resource_name_attribute(name_attr)
  Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr")
  jsii_call_method("getResourceNameAttribute", [name_attr])
end

#grant_on_key(grantee, *actions) ⇒ AWSCDK::IAM::GrantOnKeyResult

Gives permissions to a grantable entity to perform actions on the encryption key.

Parameters:

Returns:



367
368
369
370
371
372
373
# File 'sns/topic.rb', line 367

def grant_on_key(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grantOnKey", [grantee, *actions])
end

#grant_publish(grantee) ⇒ AWSCDK::IAM::Grant

Grant topic publishing permissions to the given identity.

The use of this method is discouraged. Please use grants.publish() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



383
384
385
386
# File 'sns/topic.rb', line 383

def grant_publish(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantPublish", [grantee])
end

#grant_subscribe(grantee) ⇒ AWSCDK::IAM::Grant

Grant topic subscribing permissions to the given identity.

The use of this method is discouraged. Please use grants.subscribe() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



396
397
398
399
# File 'sns/topic.rb', line 396

def grant_subscribe(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantSubscribe", [grantee])
end

#grantsAWSCDK::SNS::TopicGrants

Collection of grant methods for a Topic.



162
163
164
# File 'sns/topic.rb', line 162

def grants()
  jsii_get_property("grants")
end

#master_keyAWSCDK::KMS::IKey?

A KMS Key, either managed by this CDK app, or imported.

This property applies only to server-side encryption.

Returns:



192
193
194
# File 'sns/topic.rb', line 192

def master_key()
  jsii_get_property("masterKey")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this Topic.

Parameters:

Returns:



406
407
408
409
410
411
# File 'sns/topic.rb', line 406

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_number_of_messages_published(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages published to your Amazon SNS topics.

Sum over 5 minutes

Parameters:

Returns:



419
420
421
422
423
# File 'sns/topic.rb', line 419

def metric_number_of_messages_published(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfMessagesPublished", [props])
end

#metric_number_of_notifications_delivered(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.

Sum over 5 minutes

Parameters:

Returns:



431
432
433
434
435
# File 'sns/topic.rb', line 431

def metric_number_of_notifications_delivered(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfNotificationsDelivered", [props])
end

#metric_number_of_notifications_failed(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages that Amazon SNS failed to deliver.

Sum over 5 minutes

Parameters:

Returns:



443
444
445
446
447
# File 'sns/topic.rb', line 443

def metric_number_of_notifications_failed(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfNotificationsFailed", [props])
end

#metric_number_of_notifications_filtered_out(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages that were rejected by subscription filter policies.

Sum over 5 minutes

Parameters:

Returns:



455
456
457
458
459
# File 'sns/topic.rb', line 455

def metric_number_of_notifications_filtered_out(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfNotificationsFilteredOut", [props])
end

#metric_number_of_notifications_filtered_out_invalid_attributes(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid.

Sum over 5 minutes

Parameters:

Returns:



467
468
469
470
471
# File 'sns/topic.rb', line 467

def metric_number_of_notifications_filtered_out_invalid_attributes(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfNotificationsFilteredOutInvalidAttributes", [props])
end

#metric_number_of_notifications_filtered_out_no_message_attributes(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The number of messages that were rejected by subscription filter policies because the messages have no attributes.

Sum over 5 minutes

Parameters:

Returns:



479
480
481
482
483
# File 'sns/topic.rb', line 479

def metric_number_of_notifications_filtered_out_no_message_attributes(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricNumberOfNotificationsFilteredOutNoMessageAttributes", [props])
end

#metric_publish_size(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the size of messages published through this topic.

Average over 5 minutes

Parameters:

Returns:



491
492
493
494
495
# File 'sns/topic.rb', line 491

def metric_publish_size(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricPublishSize", [props])
end

#metric_sms_month_to_date_spent_usd(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The charges you have accrued since the start of the current calendar month for sending SMS messages.

Maximum over 5 minutes

Parameters:

Returns:



503
504
505
506
507
# File 'sns/topic.rb', line 503

def metric_sms_month_to_date_spent_usd(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSMSMonthToDateSpentUSD", [props])
end

#metric_sms_success_rate(props = nil) ⇒ AWSCDK::CloudWatch::Metric

The rate of successful SMS message deliveries.

Sum over 5 minutes

Parameters:

Returns:



515
516
517
518
519
# File 'sns/topic.rb', line 515

def metric_sms_success_rate(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSMSSuccessRate", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


94
95
96
# File 'sns/topic.rb', line 94

def node()
  jsii_get_property("node")
end

#physical_nameString

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

Returns:

  • (String)


123
124
125
# File 'sns/topic.rb', line 123

def physical_name()
  jsii_get_property("physicalName")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



130
131
132
# File 'sns/topic.rb', line 130

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


218
219
220
# File 'sns/topic.rb', line 218

def to_string()
  jsii_call_method("toString", [])
end

#topic_arnString

The ARN of the topic.

Returns:

  • (String)


169
170
171
# File 'sns/topic.rb', line 169

def topic_arn()
  jsii_get_property("topicArn")
end

#topic_nameString

The name of the topic.

Returns:

  • (String)


176
177
178
# File 'sns/topic.rb', line 176

def topic_name()
  jsii_get_property("topicName")
end

#topic_refAWSCDK::Interfaces::AWSSNS::TopicReference

A reference to a Topic resource.



183
184
185
# File 'sns/topic.rb', line 183

def topic_ref()
  jsii_get_property("topicRef")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


231
232
233
234
235
236
# File 'sns/topic.rb', line 231

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end