raventools / rightscaleapiclient
Rightscale API 1.5 客户端
v1.0.3
2017-10-09 16:55 UTC
Requires
- php: >=5.5
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2024-09-28 18:05:22 UTC
README
此库实现了Rightscale 1.5 API的PHP版本。目前它还不完整,但目标是模仿官方Rightscale Ruby库的功能
- Ruby API客户端:https://github.com/rightscale/right_api_client
- API文档:http://support.rightscale.com/12-Guides/RightScale_API_1.5
- API参考文档:http://reference.rightscale.com/api1.5/index.html
这是一个非官方库,并由Rightscale支持。
安装
推荐通过Composer进行安装。
composer.json
{
"require": {
"raventools/RightscaleAPIClient": "master"
}
}
然后需要Composer的自动加载器
require 'vendor/autoload.php';
示例
此客户端应该与官方Ruby API客户端以相同的方式工作,在设计理念等方面,请参阅https://github.com/rightscale/right_api_client
创建新客户端
$client = new RightscaleClient([
"account_id" => 1234,
"email" => "example@email.com",
"password" => "54321"
]);
列出特定资源可用的API方法
$methods = $client->api_methods();
$methods = $client->servers(["id"=>995905004])->api_methods();
列出部署
$resources = $client->deployments()->index();
获取带有标签"deploy:myapp=true"的实例列表
$resourcedetail = $client
->tags()
->by_tag([
"resource_type"=>"instances",
"tags"=>["deploy:myapp=true]"
]);