Sha256: 89b29dd2084bfdc417a2c91fc69b3ebf0d6f239be423cd20ed55875dd4707b69

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

module Ridley
  # @author Jamie Winsor <reset@riotgames.com>
  #
  # @example listing all clients
  #   conn = Ridley.new(...)
  #   conn.client.all #=> [
  #     #<Ridley::ClientObject chef_id:'reset'>,
  #     #<Ridley::ClientObject chef_id:'reset-validator'>
  #   ]
  class ClientResource < Ridley::Resource
    set_resource_path "clients"
    represented_by Ridley::ClientObject

    # Retrieves a client from the remote connection matching the given chef_id
    # and regenerates it's private key. An instance of the updated object will
    # be returned and have a value set for the 'private_key' accessor.
    #
    # @param [String, #chef_id] chef_client
    #
    # @raise [Errors::ResourceNotFound]
    #   if a client with the given chef_id is not found
    #
    # @return [Ridley::ClientObject]
    def regenerate_key(chef_client)
      unless chef_client = find(chef_client)
        abort Errors::ResourceNotFound.new("client '#{chef_client}' not found")
      end

      chef_client.private_key = true
      update(chef_client)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ridley-1.0.0.rc2 lib/ridley/resources/client_resource.rb
ridley-1.0.0.rc1 lib/ridley/resources/client_resource.rb
ridley-0.12.4 lib/ridley/resources/client_resource.rb
ridley-0.12.3 lib/ridley/resources/client_resource.rb
ridley-0.12.2 lib/ridley/resources/client_resource.rb
ridley-0.12.1 lib/ridley/resources/client_resource.rb
ridley-0.12.0 lib/ridley/resources/client_resource.rb
ridley-0.11.2 lib/ridley/resources/client_resource.rb
ridley-0.12.0.rc1 lib/ridley/resources/client_resource.rb
ridley-0.11.1 lib/ridley/resources/client_resource.rb
ridley-0.11.0.rc1 lib/ridley/resources/client_resource.rb