lib/cloud_powers/resource.rb in cloud_powers-1.0.1 vs lib/cloud_powers/resource.rb in cloud_powers-1.1.0
- old
+ new
@@ -17,28 +17,32 @@
attr_accessor :call_name
# the given name for this resource
attr_accessor :name
# whether or not a call has been made to the cloud to back this resource
attr_accessor :linked
+ # metadata, i.e. tracking on the remote resource that maps to this resource
+ attr_accessor :meta
# the ID in the cloud; e.g. ARN for AWS, etc
attr_accessor :remote_id
- # tracking on the remote resource that maps to this resource
+ # @tags will be deprecated in V2. Please use @meta
attr_accessor :tags
# the type of resource this was instantiated as
attr_accessor :type
# 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
- def initialize(name:, client: nil, **config)
+ def initialize(name:, **config)
@linked = false
@saved = false
- @client = client
- @type = to_snake(self.class.name.split('::').last)
+ @client = config[:client]
+ @type = to_snake(config[:named_type] || config[:type] || self.class.name.split('::').last)
@call_name = to_snake("#{name}_#{@type}")
@name = name
- @tags = Array.new
+ @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
end
end
end