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, Storage::Bucket, Storage::Local, Synapse::Broadcast::Channel, 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.
-
#meta ⇒ Object
metadata, i.e.
-
#name ⇒ Object
the given name for this resource.
-
#remote_id ⇒ Object
the ID in the cloud; e.g.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#type ⇒ Object
the type of resource this was instantiated as.
Instance Method Summary collapse
-
#initialize(name:, **config) ⇒ Resource
constructor
Usually this method is called by calling
super
in another class that inherits from this class.
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, #sns, #sqs
Methods included from Auth
Methods included from Creatable
Constructor Details
#initialize(name:, **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
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cloud_powers/resource.rb', line 35 def initialize(name:, **config) @project_root = config[:project_root] @linked = false @saved = false @client = config[:client] @type = to_snake(config[:named_type] || config[:type] || self.class.name.split('::').last) @call_name = to_snake("#{name}_#{@type}") @name = name @meta = Array.new # TODO: create a Meta resource and use it here @tags = @meta logger.debug '@tags will be deprecated in V2. Please use @meta' 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 |
#meta ⇒ Object
metadata, i.e. tracking on the remote resource that maps to this resource
23 24 25 |
# File 'lib/cloud_powers/resource.rb', line 23 def @meta 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
25 26 27 |
# File 'lib/cloud_powers/resource.rb', line 25 def remote_id @remote_id end |
#tags ⇒ Object
Returns the value of attribute tags.
27 28 29 |
# File 'lib/cloud_powers/resource.rb', line 27 def @tags end |
#type ⇒ Object
the type of resource this was instantiated as
29 30 31 |
# File 'lib/cloud_powers/resource.rb', line 29 def type @type end |