[英]Get service key in Cloud Foundry Java API
What I'd like, is to implement in Java, using CF API, something like cf service-keys (servicename)
and cf service-key (servicekeyname)
in regular CF commands. 我想要的是使用CF API在Java中实现,类似于常规CF命令中的
cf service-keys (servicename)
和cf service-key (servicekeyname)
。
I've been following this very simple tutorial and I'd like to do something like: service.getKeys()
or service.getKey("keyname")
but there are no such methods. 我一直在遵循这个非常简单的教程,我想做类似的事情:
service.getKeys()
或service.getKey("keyname")
但是没有这样的方法。 And I can't see any class that would help me do that. 而且我看不到任何可以帮助我做到这一点的课程。
Does anyone know the solution and would like to share with me? 有谁知道解决方案并想与我分享?
That documentation page you linked to is very out of date. 您链接到的文档页面已经过时。 It refers to 1.x versions of the CF Java Client, which is no longer maintained.
它指的是不再维护的CF Java Client 1.x版本。 The README for the 2.x CF Java Client is a better source of information.
2.x CF Java客户端的自述文件是更好的信息来源。
Follow the setup instructions in the CF Java Client v2 README to get a CloudFoundryOperations
object, then you should be able to do something like this: 按照CF Java客户端v2自述文件中的设置说明获取
CloudFoundryOperations
对象,然后您应该可以执行以下操作:
cloudFoundryOperations.services()
.listServiceKeys(ListServiceKeysRequest.builder()
.serviceInstanceName("service-instance-name")
.build())
.map(ServiceKey::getName)
.subscribe(System.out::println);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.