如何使用 apache camel 创建 IAM 用户? [英] How to create an IAM User using apache camel?
问题描述
我有一个骆驼休息 api.我试图使用 apache camel 框架创建一个 IAM 用户.代码是这样的 ->
I have a camel rest api. I was trying to create an IAM User using apache camel framework. The code is like so ->
.post("iam-create-user")
.route()
.process(new Processor(){
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("CamelAwsIAMUsername", "new-user");
})
.to("aws2-iam://current-user?accessKey=insert&secretKey=insert&operation=createUser")
.endRest();
我收到此错误 java.lang.NullPointerException: null
.这样做的正确方法是什么?它在骆驼文档中显示使用像这样的 URL to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createUser")
.我们把什么作为 iamClient
?
I am getting this error java.lang.NullPointerException: null
. What is the correct way of doing this? It shows in the camel docs to use a URL like so to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createUser")
. What do we put as iamClient
?
推荐答案
示例中报告的 iamClient (#amazonIAMClient) 是 IAMClient 的一个实例,您需要使用绑定名称 amazonIAMClient 将其放入 Camel 注册表中.
The iamClient reported in the example (#amazonIAMClient) is an instance of IAMClient you'll need to put in the Camel registry with a bind name amazonIAMClient.
我认为您需要为此特定组件指定区域为 aws-global.
I think you need to specify region as aws-global for this particular component.
也许可以添加错误的完整堆栈跟踪.
Maybe add the full stack trace of your error.
这篇关于如何使用 apache camel 创建 IAM 用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!