Class: PoolParty::Resources::Sshkey

Inherits:
Resource show all
Defined in:
lib/poolparty/resources/sshkey.rb

Instance Attribute Summary

Attributes inherited from Resource

#poststring, #prestring

Instance Method Summary collapse

Methods inherited from Resource

#after_create, available_resources, #class_name_sym, #class_type_name, #cloud, custom_function, #custom_function, custom_functions, custom_functions_to_string, #disallowed_options, #duplicatable?, #get_modified_options, inherited, #is_a_resource?, #is_in_plugin?, #key, #loaded, #method_missing, #resource?, #resource_name, #services

Methods included from PoolParty::ResourcingDsl

#absent, #cancel, #cancelled?, #client_template_exists?, #client_templates_directory_exists?, #ensures, #get_client_or_gem_template, #ifnot, #is_absent, #is_present, #on_change, #present, #printed, #printed?, #render_template, #requires

Methods included from DependencyResolverResourceExtensions

#to_properties_hash

Methods inherited from PoolPartyBaseClass

add_has_and_does_not_have_methods_for, #add_resource, #add_service, #add_to_parent_if_parent_exists_and_is_a_service, #get_local_resource, #get_name_from_options_and_extra_options, #get_resource, #handle_option_values, #in_local_resources?, #is_a_resource?, #is_plugin?, #method_missing, #ordered_resources, #plugin_store, #resource, #resources, #run_in_context, #services, #store_in_local_resources

Methods included from DependencyResolverCloudExtensions

#to_properties_hash

Constructor Details

#initialize(opts = {}, extra_opts = {}, &block) ⇒ Sshkey

Returns a new instance of Sshkey.


6
7
8
9
10
# File 'lib/poolparty/resources/sshkey.rb', line 6

def initialize(opts={}, extra_opts={}, &block)
  super(opts, extra_opts, &block)
  @key = Key.new(keypath? ? keypath : nil)
  options[:key] = @key.content
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PoolParty::Resources::Resource

Instance Method Details

#enctype(i = nil) ⇒ Object


20
21
22
# File 'lib/poolparty/resources/sshkey.rb', line 20

def enctype(i=nil)
  i ? options[:type] = i : options[:type]
end

#name(i = nil) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/poolparty/resources/sshkey.rb', line 12

def name(i=nil)
  if i
    options[:name] = i
  else
    options[:name] ? options[:name] : ::File.basename(@key.full_filepath)
  end
end