module Terraspace::Plugin
Public Instance Methods
config_classes()
click to toggle source
# File lib/terraspace/plugin.rb, line 19 def config_classes @@meta.map { |plugin, data| data[:config_class] }.compact end
find_with(options={})
click to toggle source
# File lib/terraspace/plugin.rb, line 70 def find_with(options={}) Finder.new.find_with(options) end
helper_classes()
click to toggle source
# File lib/terraspace/plugin.rb, line 23 def helper_classes @@meta.map { |plugin, data| data[:helper_class] }.compact end
klass(interface_class, options={})
click to toggle source
Example return:
TerraspacePluginAws::Interfaces::Backend TerraspacePluginAws::Interfaces::Expander TerraspacePluginGcp::Interfaces::Backend TerraspacePluginGcp::Interfaces::Expander
# File lib/terraspace/plugin.rb, line 64 def klass(interface_class, options={}) meta = find_with(options) return unless meta "TerraspacePlugin#{meta.plugin}::Interfaces::#{interface_class}" end
layer_classes()
click to toggle source
# File lib/terraspace/plugin.rb, line 27 def layer_classes @@meta.map { |plugin, data| data[:layer_class] }.compact end
meta()
click to toggle source
# File lib/terraspace/plugin.rb, line 15 def meta @@meta end
register(plugin, data)
click to toggle source
# File lib/terraspace/plugin.rb, line 53 def register(plugin, data) @@meta[plugin] = data end
resource_map()
click to toggle source
The resource map can be used to customized the mapping from the resource “first word” to the plugin.
resource map is in meta structure.
{ "long_cloud_plugin_name" => {resource_map: {"long_cloud_plugin_name" => "short_name"} }
This is use by Plugin::Finder#find_with_resource
Allows mapping of different values in case the terraspace plugin name doesnt match with the resource first word.
Generally we try to avoid this and the terraspace plugin name should match the resource “first word” when possible.
# File lib/terraspace/plugin.rb, line 46 def resource_map @@meta.inject({}) do |result, (plugin, data)| map = data[:resource_map] || {} result.merge(map.deep_stringify_keys) end end