samuel4x4 / chefauth-guzzle-plugin
一个处理Chef服务器API所有身份验证的Guzzle(v3)插件。
1.0.1
2015-03-24 22:05 UTC
Requires
- php: >=5.3.2
- guzzle/guzzle: ~3.9
This package is auto-updated.
Last update: 2024-09-14 03:00:33 UTC
README
一个处理Chef服务器API所有身份验证的Guzzle(v3)插件。
需求
- PHP 5.3
- Guzzle 3
安装
首先,您当然需要Guzzle。
将leaseweb/chefauth-guzzle-plugin
作为依赖项添加到您的项目中
$ php composer.phar require "leaseweb/chefauth-guzzle-plugin":"1.0.0"
Composer将插件安装到您的项目的vendor/leaseweb目录。
现在您可以使用该插件了。
使用方法
创建一个新的指向您的Chef服务器的Guzzle客户端
// 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();
有关Guzzle的更多信息,请参阅http://guzzle3.readthedocs.org/docs.html
许可证
MIT