Package com.woorea.openstack.keystone.model

Examples of com.woorea.openstack.keystone.model.Access


  /**
   * @param args
   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL);
    Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .withTenantName("demo")
        .execute();
   
    //use the token in the following requests
    keystone.token(access.getToken().getId());
     
    //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId());
    Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId()));
    novaClient.token(access.getToken().getId());
    //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024);
   
    Servers servers = novaClient.servers().list(true).execute();
    for(Server server : servers) {
      System.out.println(server);
View Full Code Here


   * @param args
   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL);
    // access with unscoped token
    Access access = keystone.tokens().authenticate(
        new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .execute();
    // use the token in the following requests
    keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

    Tenants tenants = keystone.tenants().list().execute();
    // try to exchange token using the first tenant
    if (tenants.getList().size() > 0) {
      // access with tenant
      access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();

      Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network",  null, "public"));
      quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

      Networks networks = quantum.networks().list().execute();
      for (Network network : networks) {
        System.out.println(network);
      }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL);
    Access access = keystone.tokens().authenticate(
        new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .execute();
   
    //use the token in the following requests
    keystone.token(access.getToken().getId());
   
    Tenants tenants = keystone.tenants().list().execute();
   
    //try to exchange token using the first tenant
    if(tenants.getList().size() > 0) {
     
      access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();
     
      //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId());
      Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId()));
      novaClient.token(access.getToken().getId());
      //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024);
     
      Flavors flavors = novaClient.flavors().list(true).execute();
      for(Flavor flavor : flavors) {
        System.out.println(flavor);
View Full Code Here

                ExamplesConfiguration.KEYSTONE_ENDPOINT,
                ExamplesConfiguration.KEYSTONE_USERNAME,
                ExamplesConfiguration.KEYSTONE_PASSWORD
        );

        Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME);

        String endpointURL = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "orchestration", null, "public");


        Heat heat = new Heat(endpointURL);
        heat.setTokenProvider(keystone
                .getProviderByTenant(ExamplesConfiguration.TENANT_NAME));
View Full Code Here

    KeystoneTokenProvider keystone = new KeystoneTokenProvider(
        ExamplesConfiguration.KEYSTONE_AUTH_URL,
        ExamplesConfiguration.KEYSTONE_USERNAME,
        ExamplesConfiguration.KEYSTONE_PASSWORD);

    Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME);

    Service glanceService = null;

    for (Service service : access.getServiceCatalog()) {
      if (service.getType().equals("image")) {
        glanceService = service;
        break;
      }
    }
View Full Code Here

   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(KEYSTONE_AUTH_URL);

    // access with unscoped token
    Access access = keystone
        .tokens()
        .authenticate()
        .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)
        .execute();

View Full Code Here

    Keystone keystone = new Keystone(props.getKeystoneHost() + ':'
        + props.getKeystonePort() + '/' + props.getOAuthVersion());
    Authentication authentication = new UsernamePassword(
        props.getKeystoneProxyUser(), props.getKeystoneProxyPass());

    Access access = keystone.tokens().authenticate(authentication)
        .execute();

    return access.getToken().getId();
  }
View Full Code Here

TOP

Related Classes of com.woorea.openstack.keystone.model.Access

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.