Class: Smash::CloudPowers::Resource
- Inherits:
-
Object
- Object
- Smash::CloudPowers::Resource
- Includes:
- AwsResources, Creatable, Helpers, Zenv
- Defined in:
- lib/cloud_powers/resource.rb
Direct Known Subclasses
Node::Instance, Synapse::Pipe::Stream, Synapse::Queue::Board, Synapse::Queue::Poller
Instance Attribute Summary collapse
-
#call_name ⇒ Object
the name this resource can be set and retrieved by.
-
#client ⇒ Object
client used to make HTTP requests to the cloud.
-
#linked ⇒ Object
whether or not a call has been made to the cloud to back this resource.
-
#name ⇒ Object
the given name for this resource.
-
#remote_id ⇒ Object
the ID in the cloud; e.g.
-
#tags ⇒ Object
tracking on the remote resource that maps to this resource.
-
#type ⇒ Object
the type of resource this was instantiated as.
Instance Method Summary collapse
-
#initialize(name:, client: nil, **config) ⇒ Resource
constructor
Usually this method is called by calling
superin another class that inherits from this class.
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
Methods included from Creatable
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_name ⇒ Object
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 |
#client ⇒ Object
client used to make HTTP requests to the cloud
15 16 17 |
# File 'lib/cloud_powers/resource.rb', line 15 def client @client end |
#linked ⇒ Object
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 |
#name ⇒ Object
the given name for this resource
19 20 21 |
# File 'lib/cloud_powers/resource.rb', line 19 def name @name end |
#remote_id ⇒ Object
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 |
#tags ⇒ Object
tracking on the remote resource that maps to this resource
25 26 27 |
# File 'lib/cloud_powers/resource.rb', line 25 def @tags end |
#type ⇒ Object
the type of resource this was instantiated as
27 28 29 |
# File 'lib/cloud_powers/resource.rb', line 27 def type @type end |