Ask Your Question
0

How to create openstack user using jcloud?

asked 2014-08-27 13:43:02 -0500

wisarn.p gravatar image

I am a new baby in both openstack and jclouds. Currently, I try to use jclouds to create new openstack user. I can create new user without any problem using dashboard. Using jclouds, is it possible to create new openstack user using jclouds? Also, is there any example codes for this operation using jclouds? I understand that I have to deal with keystone but I couldn't know how to deal with it. I also couldn't found any examples in official jclouds website.

Thx

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-09-02 15:07:50 -0500

Everett Toews gravatar image

updated 2014-09-04 16:07:15 -0500

You can see an example of how to do this at CreateTenantAndUser.java.

If you want to try running the example, see the README.

edit flag offensive delete link more

Comments

Thanks a lot for guiding me the example code. It really helps !!! Hope that people will try to contribute more jclouds example codes like this for several other operations

wisarn.p gravatar imagewisarn.p ( 2014-09-05 10:15:22 -0500 )edit
1

answered 2014-09-04 21:16:20 -0500

SGPJ gravatar image

updated 2014-09-04 21:16:56 -0500

Please see from line number 101: jclouds-examples / openstack / src / main / java / org / jclouds / examples / openstack / identity folder create user:-

 private void createUser(Tenant tenant) {
      System.out.format("  Create User%n");

      Optional<? extends UserAdminApi> userAdminApiExtension = keystoneApi.getUserAdminApi();

      if (userAdminApiExtension.isPresent()) {
         System.out.format("    UserAdminApi is present%n");

         UserAdminApi userAdminApi = userAdminApiExtension.get();
         CreateUserOptions userOptions = CreateUserOptions.Builder
               .tenant(tenant.getId())
               .email("new.email@example.com");
         User user = userAdminApi.create("newUser", "newPassword", userOptions);

         System.out.format("    %s%n", user);
      } else {
         System.out.format("    UserAdminApi is *not* present%n");
         System.exit(1);
      }
   }
edit flag offensive delete link more

Comments

Thanks a lot for suggestion. This works.

wisarn.p gravatar imagewisarn.p ( 2014-09-05 10:13:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-08-27 13:43:02 -0500

Seen: 376 times

Last updated: Sep 04 '14