How to create an IAM User using apache camel?

北慕城南 提交于 2020-08-20 11:40:08

问题


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();

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?


回答1:


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.

I think you need to specify region as aws-global for this particular component.

Maybe add the full stack trace of your error.



来源:https://stackoverflow.com/questions/62942034/how-to-create-an-iam-user-using-apache-camel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!