Class: Smash::CloudPowers::Resource

Inherits:
Object
  • Object
show all
Includes:
AwsResources, Creatable, Helpers, Zenv
Defined in:
lib/cloud_powers/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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?

Methods included from AwsResources

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

Methods included from Auth

creds, region

Methods included from Creatable

included

Constructor Details

#initialize(name:, client: nil, **config) ⇒ Resource

Usually this method is called by calling super in another class that inherits from this class. The initialize method follows the method signature for the active record-like pattern being followed throughout the code



33
34
35
36
37
38
39
40
41
# File 'lib/cloud_powers/resource.rb', line 33

def initialize(name:, client: nil, **config)
  @linked = false
  @saved = false
  @client = client
  @type = to_snake(self.class.name.split('::').last)
  @call_name = to_snake("#{name}_#{@type}")
  @name = name
  @tags = Array.new
end

Instance Attribute Details

#call_nameObject

the name this resource can be set and retrieved by



17
18
19
# File 'lib/cloud_powers/resource.rb', line 17

def call_name
  @call_name
end

#clientObject

client used to make HTTP requests to the cloud



15
16
17
# File 'lib/cloud_powers/resource.rb', line 15

def client
  @client
end

#linkedObject

whether or not a call has been made to the cloud to back this resource



21
22
23
# File 'lib/cloud_powers/resource.rb', line 21

def linked
  @linked
end

#nameObject

the given name for this resource



19
20
21
# File 'lib/cloud_powers/resource.rb', line 19

def name
  @name
end

#remote_idObject

the ID in the cloud; e.g. ARN for AWS, etc



23
24
25
# File 'lib/cloud_powers/resource.rb', line 23

def remote_id
  @remote_id
end

#tagsObject

tracking on the remote resource that maps to this resource



25
26
27
# File 'lib/cloud_powers/resource.rb', line 25

def tags
  @tags
end

#typeObject

the type of resource this was instantiated as



27
28
29
# File 'lib/cloud_powers/resource.rb', line 27

def type
  @type
end