NAME

Chef::REST::Client

VERSION

1.2

SYNOPSIS

use Chef::REST::Client;

my $obj = new Chef::REST::Client ( 'chef_client_name' => $chef_client_name , 'chef_client_privaate_key' => $private_key );

$obj->private_key( $private_key );
$obj->name( $chef_client_name );
$obj->roles('vagrant')->details;
$obj->roles('vagrant','environments')->details
$obj->roles->list;

$obj->search( 'secrets' , {  q => 'id:centrify', rows => 1 } )->details

$obj->environments(<env_name>,'cookbooks' , <cookbook_name>)->details;

$obj->environments(<env_name>,'cookbooks_versions'
                             ,{ 'method' => 'post'
                             , 'data' => { 'runlist' => [ 'ms-scribe'] }
                               }
                  );
$obj->roles(<role_name>)->details->override_attributes;
                

DESCRIPTION

This is the interface to the Chef server api methods listed on opscode documentation opscode Chef Api currently it provides implementation for only GET methods

METHODS

role( $role )

returns new Chef::REST::Client::role object used by other classes

roles ( @roles )

makes a GET request to the chef server for all the @roles and returns and Chef::REST::Client::roles object. you can directly get details for all the roles as $obj->role( 'role1', 'role2' )->details;

this inturn will return Chef::REST::Client::role

/roles

$obj->roles->list

/roles/<role_name>

$obj->roles(<role_name>)->details

$obj->roles(<role_name>)->details->run_list;

$obj->roles(<role_name>)->details->override_attributes;

runlist ( @$recipes )

returns new Chef::REST::Client::runlist object. it takes a list of recipies as parameter. used by other classes

sandboxes

returns new Chef::REST::Client::sandboxes object. $obj->sandboxes->list;

/sandboxes

$obj->sandboxes->list

/sandboxes/<id>

$obj->sandboxes(<id>)->details

returns new Chef::REST::Client::search

/search

$obj->search->listen

/search/<index>

$obj->search(<index>)->details

/search/ query id:centrify and get rows 1

$obj->search( 'secrets' , { q => 'id:centrify', rows => 1 } )->details

recipe

returns new Chef::REST::Client::recipe object. used by other classes

principals

returns new Chef::REST::Client::principals object. $obj->principals->details;

/principals

$obj->principals->list

/principals/<name>

$obj->principals(<name>)->details

node

returns new Chef::REST::Client::node object. $obj->node->details; used by other classes

nodes

returns new Chef::REST::Client::nodes object. $obj->nodes->list;

/nodes

$obj->nodes->listen

/nodes/<node_name>

$obj->nodes(<node_name>)->details

envrunlist

returns new Chef::REST::Client::envrunnlist object. used by other classes

environment

returns new Chef::REST::Client::environment object. used by other classes

environments

returns new Chef::REST::Client::environments object.

/environment/<env_name>

$obj->environments(<env_name>)->details;

/environment/<env_name>/cookbooks/<cookbook_name>

$obj->environments(<env_name>,'cookbooks' , <cookbook_name>)->details;

/environment/<env_name>/cookbooks

$obj->environments(<env_name>,'cookbooks')

POST /environments/<env_name>/cookbooks_versions

$obj->environments(<env_name>,'cookbooks_versions' ,{ 'method' => 'post' , 'data' => { 'runlist' => [ 'ms-scribe'] } } );

databag

returns new Chef::REST::Client::databag object.

data

returns new Chef::REST::Client::data object.

/data

$obj->data->list

/data/<var_name>

$obj->data( <var_name> )->details

cookbook

returns new Chef::REST::Client::cookbook object.

cookbooks

returns new Chef::REST::Client::cookbooks object.

/cookbooks

$obj->cookbooks->list

/cookbooks/<cookbook_name>

$obj->cookbooks(<cookbook_name>)->details

$obj->cookbooks(<cookbook_name> , '_latest' )->details->recipes;

$obj->cookbooks(<cookbook_name> , '_latest' )->details->attributes;

cookbook_version

returns new Chef::REST::Client::cookbook_version object. used by other classes

cookbook_versions

returns new Chef::REST::Client::cookbook_versions object. collection of Chef::REST::Client::cookbook_version

clients

returns new Chef::REST::Client::clients object.

/clients

$obj->clients->list

/clients/<client_name>/

$obj->clients(<client_name>)->details

attribute

returns new Chef::REST::Client::attribute object. used by other classes to structure data

attributes

returns new Chef::REST::Client::attributes object. collection of Chef::REST::Client::attribute

KNOWN BUGS

SUPPORT

open a github ticket or email comments to Bhavin Patel <bpatel10@nyit.edu>

COPYRIGHT AND LICENSE

This Software is free to use , licensed under : The Artisic License 2.0 (GPL Compatible)