查询配置项列表中的系统参数
KooCLI支持多配置项,查询配置项列表中的系统参数的命令如下,查询结果支持以table,json或tsv格式输出,默认以json格式输出:
hcloud configure list
hcloud configure list { "localDea": "intl", "language": "cn", "offline": "false", "agreePrivacy": "true", "warning": "true", "current": "test", "profiles": [ { "name": "default", "mode": "AKSK", "accessKeyId": "********", "secretAccessKey": "****", "securityToken": "", "region": "cn-north-4", "projectId": "060576****************134588f135", "domainId": "", "skipSecureVerify": "false", "readTimeout": 10, "connectTimeout": 5, "retryCount": 0 }, { "name": "test", "mode": "AKSK", "accessKeyId": "********", "secretAccessKey": "****", "securityToken": "", "region": "cn-north-4", "projectId": "", "domainId": "", "skipSecureVerify": "false", "readTimeout": 10, "connectTimeout": 5, "retryCount": 0 } ] }
其中,敏感参数的值会被匿名化展示。
可以使用“--cli-query”对查询结果进行过滤。使用“--cli-query”时,默认以json格式输出,可同时使用“--cli-output”指定输出格式。例如以json格式输出,筛选每个配置项中的AK/SK:
hcloud configure list --cli-output=json --cli-query="profiles[].{Name:name,AK:accessKeyId,SK:secretAccessKey}" [ { "AK": "********", "Name": "default", "SK": "****" }, { "AK": "********", "Name": "test", "SK": "****" } ]
如需以table格式输出查询结果,命令中需要指定“--cli-output=table”,如下:
hcloud configure list --cli-output=table --cli-query="profiles[].[name,accessKeyId,secretAccessKey,projectId]"
如需以tsv格式输出查询结果,命令中需要指定“--cli-output=tsv”,如下:
hcloud configure list --cli-output=tsv --cli-query="profiles[0].[name,accessKeyId,secretAccessKey,projectId]"