xenolope / grizzwald
与 CoreOS fleet API 交互的客户端库
1.0.0
2015-08-11 18:39 UTC
Requires
- php: >5.5
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-09-07 16:00:01 UTC
README
《Grizz 在海军》 - Tracy Jordan, 30 Rock (S01E01: The Aftermath)
描述
Grizzwald 是一个简单的 PHP 库,用于与 CoreOS fleet API 交互,方便管理集群的单元文件。
安装
可以通过在您的 composer.json
中包含以下内容使用 Composer 安装此库
{ "require": { "xenolope/grizzwald": "~1.0" } }
使用方法
// Create a new instance of the client, passing in the base URL to your fleet instance $client = new FleetClient('http://172.16.1.100:49153'); // Get a list of all the machines in the cluster $machines = $client->listMachines(); // Returns an array of \Xenolope\Grizzwald\Entity\Machine objects // Get a list of all the unit states in the cluster $states = $client->listUnitStates(); // Returns an array of \Xenolope\Grizzwald\Entity\UnitState objects // Get a list of all the units in the cluster $units = $client->listUnits(); // Returns an array of \Xenolope\Grizzwald\Entity\Unit objects // Get a single unit from the cluster $unit = $client->getUnit('nginx.service'); // Returns a \Xenolope\Grizzwald\Entity\Unit object // Create a new unit on the cluster $unit = new Unit('nginx.service', [ new UnitOption('Service', 'ExecStart', '/usr/sbin/nginx') // One or more UnitOptions are required ], Unit::STATE_LAUNCHED); $client->createUnit($unit); // Modify an existing unit on the cluster $unit = new Unit('nginx.service', Unit::STATE_LOADED); $client->modifyUnit($unit); // Destroy a unit on the cluster $client->destroyUnit('nginx.service');
许可证
Grizzwald 在 MIT 许可证下发布;请参阅 LICENSE 获取更多信息。