Class: Smash::CloudPowers::Synapse::Broadcast::Channel

Inherits:
Resource
  • Object
show all
Defined in:
lib/cloud_powers/synapse/broadcast/channel.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#call_name, #client, #linked, #meta, #tags, #type

Instance Method Summary collapse

Methods included from Zenv

#env_vars, #i_vars, #lsof_cwd, #pid, #proc_cwd, #process_search, #project_root, #project_root=, #ps_cwd, #system_vars, #zfind, #zselect

Methods included from Helpers

#create_logger, #log_file, #logger

Methods included from PathHelp

#common_delimiter, #expand_path, #file_exists?, #file_search, #filename?, #job_exist?, #job_path, #job_require_path, #path_search, #paths_gcd, #paths_lcd, #to_path, #to_pathname, #to_realpath, #touch, #zlib_path

Methods included from LogicHelp

#attr_map, #called_from, #i_var_hash, #instance_attr_accessor, #smart_retry, #update_message_body, #wait_until

Methods included from LangHelp

#deep_modify_keys_with, #extract!, #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?

Methods included from AwsResources

#ec2, #image, #kinesis, #queue_poller, #region, #s3, #sqs

Methods included from Auth

creds, region

Methods included from Creatable

included

Constructor Details

#initialize(name:, client: sns, **config) ⇒ Channel

Returns a new instance of 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

#snsObject

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

#arnObject

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_resourceObject



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

#nameObject

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_idObject



24
25
26
# File 'lib/cloud_powers/synapse/broadcast/channel.rb', line 24

def remote_id
  @remote_id || arn
end