samuel4x4 / chefauth-guzzle-plugin
A guzzle (v3) plugin handling all authentication for Chef server API.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Type:symfony-bundle
Requires
- php: >=5.3.2
- guzzle/guzzle: ~3.9
This package is auto-updated.
Last update: 2025-01-14 03:39:18 UTC
README
A guzzle (v3) plugin handling all authentication for Chef server API.
requirements
- PHP 5.3
- Guzzle 3
installation
First you need Guzzle, offcourse.
Add the leaseweb/chefauth-guzzle-plugin
as a dependency to your project:
$ php composer.phar require "leaseweb/chefauth-guzzle-plugin":"1.0.0"
Composer will install the plugin to your project's vendor/leaseweb directory.
You are now ready to use the plugin.
usage
Create a new guzzle client pointing to your chef server:
// Supply your client name and location of the private key.
$chefAuthPlugin = new \LeaseWeb\ChefGuzzle\Plugin\ChefAuth\ChefAuthPlugin("client-name", "/tmp/client-name.pem");
// Create a new guzzle client
$client = new \Guzzle\Http\Client('https://manage.opscode.com');
$client->addSubscriber($chefAuthPlugin);
// Now you can make calls to the chef server
$response = $client->get('/organizations/my-organization/nodes')->send();
$nodes = $response->json();
Read more about guzzle here http://guzzle3.readthedocs.org/docs.html
license
MIT