使用predix-cli来简化cf-cli操作

PredixCN 2017-12-04 05:26:15


predix-cli
predix-cli提供了一个操作predix云端的简化版命令行接口. 它对cf-cli做了封装并且提供了将以往复杂的多个步骤合并成一步的单个命令的功能.

wiki
https://github.com/PredixDev/predix-cli/wiki

安装
下载

https://github.com/PredixDev/predix-cli/releases

Linux / Mac OS X

解压缩文件 'predix-cli.tar.gz'
进入解压缩目录执行 'sudo ./install'
Windows

解压缩 'predix-cli.tar.gz'
从解压缩目录的 bin/win64中复制文件到 PATH.
Make a symbolic short link spelled with px.exe pointing at predix.exe. e.g. mklink path-to-cli\px.exe path-to-cli\predix.exe
Autocompletion is not supported on Windows
功能介绍
在login的时候不需要记住endpoints的url了

在用cf-cli做login的时候我们需要手动输入api endpoint的url, 但predix-cli已经提供给我们不同的url了, 我们只需要从中选择我们需要使用的其中任意一个就可以了.

上下文相关的命令行参数提示功能

在用cf-cli的时候我们需要花大量时间来记住命令和一些命令行的参数, 以及我们创建了那些app和service, 而使用predix-cli我们不需要记住这些了. predix-cli提供了上下文敏感的命令和参数自动完成功能. 它可以自动查找相关的orgs, spaces, apps, services, service instances, services plans等等. 所以 当你创世创建任何服务或者关联任何服务到app的时候它会在你键入相关名字或者命令的时候给与提示.

简化版的服务创建

一个在服务目录中的典型服务在创建的时候需要你输入uaa issuer id并且你需要在client端手动的添加相关scope来访问它. 所以使用cf-cli的时候相应的创建服务的相关步骤应该为: 1. 手动键入trusted issuer id来创建service instance 2. 从cf env里面看相关服务的vcap properties来获取oauth scopes 3. 在uaa instance 中更新/添加对应step 2中查找到的scope

然而用prdix create-service 命令的话这几步可以简化成一步来实现:

NAME:
predix create-service - Create a service instance
USAGE:
predix create-service [command options] SERVICE PLAN SERVICE_INSTANCE <UAA_INSTANCE> <ASSET_INSTANCE> <TIMESERIES_INSTANCE> <ANALYTICS_CATALOG_INSTANCE>
OPTIONS:
--admin-secret SECRET, -a SECRET The admin client SECRET
--client-id CLIENT-ID, -c CLIENT-ID The CLIENT-ID to set scopes on
--client-secret CLIENT-SECRET, -s CLIENT-SECRET The CLIENT-SECRET for the specified client-id
--skip-ssl-validation Do not attempt to validate the target's SSL certificate
--ca-cert file Use the given CA certificate file to validate the target's SSL certificate
查询服务信息

你可以用predix service-info 命令来查询predix上你已经创建的service instance的属性信息, 并且predix-cli提供了一个标准的格式来显式它. (cf-cli是不支持此功能的) 你也可以指定app的名字用了查看与之绑定的所有service的属性信息:

NAME:
predix service-info - List info for a service instance
USAGE:
predix service-info APP_NAME SERVICE_INSTANCE

EXAMPLES:
predix service-info sample-app sample-uaa
{
"issuerId": ...,
"subdomain": ...,
"uri": ...,
"zone": {
"http-header-name": ...,
"http-header-value": ...
}
}

predix service-info sample-app sample-asset
{
"instanceId": ...,
"scriptEngine_uri": ...,
"uri": ...,
"zone": {
"http-header-name": ...,
"http-header-value": ...,
"oauth-scope": ...
}
}
UAA CLI

predix-cli也支持uaac命令的所有命令操作, 你可以用它来管理clients和users. 你并不需要像uaac那样输入一个uaa url来绑定uaa做管理而是直接绑定uaa instance本身就可以了:

NAME:
predix uaa - Manage Predix UAA instance
USAGE:
predix uaa command [command options] [arguments...]
COMMANDS:
login, l Login and target the specified Predix UAA instance
target, t Set or view the targeted Predix UAA instance and context
targets Display all Predix UAA targets and contexts
clients List client registrations on the targeted Predix UAA instance
client, cl Manage clients registered with the targeted Predix UAA instance
users List user accounts on the targeted Predix UAA instance
user, u Manage user accounts on the targeted Predix UAA instance
...全文
318 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

163

社区成员

发帖
与我相关
我的任务
社区描述
GE的Predix平台整合云计算可扩展性、大数据管理和高级分析技术来助力新一代的数字化企业。结合GE自己作为全球工业界领导者的经验,Predix云平台为开发高级工业应用程序提供可连接性、安全和高性能。
云计算大数据 技术论坛(原bbs)
社区管理员
  • GE Predix工业互联网开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧