Class | Chef::ApiClient
In: | lib/chef/api_client.rb
Parent: | Object

### Methods

admin cdb_destroy cdb_list cdb_load cdb_save create create_design_document create_keys destroy index_object_type json_create list load name new private_key public_key save to_hash to_json to_s

### Included Modules

Chef::Mixin::FromFile Chef::Mixin::ParamsValidate Chef::IndexQueue::Indexable

### Constants

DESIGN_DOCUMENT | = | { "version" => 1, "language" => "javascript", "views" => { "all" => { "map" => <<-EOJS function(doc) { if (doc.chef_type == "client") { emit(doc.name, doc); } } EOJS
INDEX_OBJECT_TYPE | = | 'client'.freeze

### Attributes

couchdb | [RW] |
couchdb_id | [RW] |
couchdb_rev | [RW] |

### Public Class methods

cdb_list(inflate=false, couchdb=nil)

List all the Chef::ApiClient objects in the CouchDB. If inflate is set to true, you will get the full list of all ApiClients, fully inflated.

cdb_load(name, couchdb=nil)

Load a client by name from CouchDB

@params [String] The name of the client to load @return [Chef::ApiClient] The resulting Chef::ApiClient object

create_design_document(couchdb=nil)

Set up our CouchDB design document

index_object_type()
json_create(o)
list(inflate=false)
load(name)

Load a client by name via the API

new(couchdb=nil)

Create a new Chef::ApiClient object.

### Public Instance methods

admin(arg=nil)

Gets or sets whether this client is an admin.

@params [Optional True/False] Should be true or false - default is false. @return [True/False] The current value

cdb_destroy()

Remove this client from the CouchDB

@params [String] The name of the client to delete @return [Chef::ApiClient] The last version of the object

cdb_save()

Save this client to the CouchDB

create()

Create the client via the REST API

create_keys()

Creates a new public/private key pair, and populates the public_key and private_key attributes.

@return [True]

destroy()

Remove this client via the REST API

name(arg=nil)

Gets or sets the client name.

@params [Optional String] The name must be alpha-numeric plus - and _. @return [String] The current value of the name.

private_key(arg=nil)

Gets or sets the private key.

@params [Optional String] The string representation of the private key. @return [String] The current value.

public_key(arg=nil)

Gets or sets the public key.

@params [Optional String] The string representation of the public key. @return [String] The current value.

save(new_key=false, validation=false)

Save this client via the REST API, returns a hash including the private key

to_hash()

The hash representation of the object. Includes the name and public_key, but never the private key.

@return [Hash]

to_json(*a)

The JSON representation of the object.

@return [String] the JSON string.

to_s()

As a string

[Validate]