antcool/easy-cloud-pods
Composer 安装命令:
composer require antcool/easy-cloud-pods
包简介
PHP SDK for Cloud Pods
README 文档
README
PHP SDK for Cloud Pods.
Overtrue! Respect!
文档链接
安装
$ composer require antcool/easy-cloud-pods -vvv
使用
需开启统一API入口, 查看文档
配置项
$config = [ 'default' => 'production', 'projects' => [ 'production' => [ 'api_gateway' => 'https://<ip_or_domain_of_apigatway>/api/s/', 'project_id' => '****', 'project_name' => null, 'auth_type' => 'password', // ak/sk 'user_name' => '****', 'user_password' => '****', 'key_id' => '****', 'secret' => '****', 'domain' => null, 'domain_name' => null, ], ], /** * 默认使用各 endpoint type 字段作为统一 API 入口请求时的服务类型路径 * 由于每个版本的路径会有不同, 当默认路径错误时, 可通过此配置覆盖 * compute_v2: compute_v2 * image: image/v1 * identity: identity/v3 */ 'endpoint_path' => [ 'image' => 'image/v1', 'identity' => 'identity/v3', ], 'debug' => true, 'runtime_path' => storage_path('cloud-pods'), 'http' => [ 'timeout' => 30, 'verify' => false, ], ];
创建实例
use AntCool\CloudPods\Application; $app = new Application(new Config(\config('cloudpods')); // use other project config $config = $app->getConfig()->useProject('project_name'); /** @var \AntCool\CloudPods\Kernel\Client $client */ $client = $app->getClient();
API 调用示范
\AntCool\CloudPods\Middleware\AccessTokenMiddleware 已经实现对 AuthToken 和 Endpoints 的自动处理
// 查看 Endpoints $client->getEndpoints(); // 获取支持的镜像 $client->withService('image')->getJson('images', ['limit' => 1000, 'details' => true]) // 实际请求 URL: https://<gateway>/api/s/image/v1/images?limit=1000&details=1 // 获取主机规格 $client->withService('compute_v2')->getJson('serverskus', ['limit' => 1000, 'details' => true]); // 创建秘钥对 $client->withService('compute_v2')->postJson('keypairs', [ 'count' => 1, 'keypair' => [ 'description' => 'description', 'name' => 'name', ], ]); // 创建虚拟机 $client->withService('compute_v2')->postJson('servers', $params); // 删除虚拟机 $client->withService('compute_v2')->deleteJson('servers/' . $id, [ 'OverridePendingDelete' => true, 'Purge' => true, 'DeleteSnapshots' => true, 'DeleteEip' => true, 'DeleteDisks' => true, ]); // 获取 monitor 监控服务 unified monitor 的查询接口签名 $app->getUtils()->unifiedMonitorSign($params);
Contributing
You can contribute in one of three ways:
- ...
- ...
License
MIT
antcool/easy-cloud-pods 适用场景与选型建议
antcool/easy-cloud-pods 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 antcool/easy-cloud-pods 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 antcool/easy-cloud-pods 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-11