Class: Smash::CloudPowers::Synapse::Broadcast::Channel
- Inherits:
-
Struct
- Object
- Struct
- Smash::CloudPowers::Synapse::Broadcast::Channel
- Includes:
- Zenv
- Defined in:
- lib/cloud_powers/synapse/broadcast/broadcast.rb,
lib/cloud_powers/synapse/broadcast/channel.rb
Overview
A simple Struct to bind the name with the arn of the topic
Instance Attribute Summary collapse
-
#set_arn ⇒ Object
Returns the value of attribute set_arn.
-
#set_endpoint ⇒ Object
Returns the value of attribute set_endpoint.
-
#set_name ⇒ Object
Returns the value of attribute set_name.
-
#sns ⇒ Object
Returns the value of attribute sns.
Instance Method Summary collapse
-
#arn ⇒ Object
Prefers the given arn but it can make a best guess if none is given.
- #create_resource ⇒ Object
-
#initialize(name:, client: sns, **config) ⇒ Channel
constructor
A new instance of Channel.
-
#name ⇒ Object
Prefers the given name but it can parse the arn to find one.
- #remote_id ⇒ Object
Methods included from Zenv
#env_vars, #file_tree_search, #i_vars, #project_root, #project_root=, #system_vars, #zfind
Methods included from Helpers
#create_logger, #log_file, #logger
Methods included from PathHelp
#job_exist?, #job_home, #job_path, #job_require_path
Methods included from LogicHelp
#attr_map, #called_from, #instance_attr_accessor, #smart_retry, #update_message_body
Methods included from LangHelp
#deep_modify_keys_with, #find_and_remove, #format_error_message, #from_json, #modify_keys_with, #to_basic_hash, #to_camel, #to_hyph, #to_i_var, #to_pascal, #to_ruby_file_name, #to_snake, #valid_json?, #valid_url?
Constructor Details
#initialize(name:, client: sns, **config) ⇒ Channel
11 12 13 14 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 11 def initialize(name:, client: sns, **config) @sns = client super end |
Instance Attribute Details
#set_arn ⇒ Object
Returns the value of attribute set_arn
10 11 12 |
# File 'lib/cloud_powers/synapse/broadcast/broadcast.rb', line 10 def set_arn @set_arn end |
#set_endpoint ⇒ Object
Returns the value of attribute set_endpoint
10 11 12 |
# File 'lib/cloud_powers/synapse/broadcast/broadcast.rb', line 10 def set_endpoint @set_endpoint end |
#set_name ⇒ Object
Returns the value of attribute set_name
10 11 12 |
# File 'lib/cloud_powers/synapse/broadcast/broadcast.rb', line 10 def set_name @set_name end |
#sns ⇒ Object
Returns the value of attribute sns.
9 10 11 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 9 def sns @sns end |
Instance Method Details
#arn ⇒ Object
Prefers the given arn but it can make a best guess if none is given
Returns arn String - arn for this resource
20 21 22 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 20 def arn @remote_id || "arn:aws:sns:#{zfind(:region)}:#{zfind(:accound_number)}:#{name}" end |
#create_resource ⇒ Object
36 37 38 39 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 36 def create_resource @response = sns.create_topic(name: name) self end |
#name ⇒ Object
Prefers the given name but it can parse the arn to find one
Returns name String - name for this resource
32 33 34 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 32 def name @name || set_arn.split(':').last end |
#remote_id ⇒ Object
24 25 26 |
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 24 def remote_id @remote_id || arn end |