Package com.woorea.openstack.keystone.model

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


 
  public static void main(String[] args) {
    Keystone client = new Keystone(KEYSTONE_ENDPOINT);
    client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0"));
    client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute();
    Tenant tenant = client.tenants().create(new Tenant("new_api")).execute();
    System.out.println(tenant);
    System.out.println(client.tenants().list().execute());
    client.tenants().delete(tenant.getId()).execute();
  }
View Full Code Here


        new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .execute();

    access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute();

    Tenant tenant = new Tenant();
    tenant.setName("benn.cs");
    tenant.setDescription("benn.cs");
    tenant.setEnabled(true);
    //Get the adminURL client and use the token got above
    keystone = new Keystone("http://keystone.x.org/v2.0");
    keystone.token(access.getToken().getId());
    tenant = keystone.tenants().create(tenant).execute();
    System.out.println(tenant);
    keystone.tenants().delete(tenant.getId());
  }
View Full Code Here

  }

  @Override
  public void execute(Keystone keystone, CommandLine cmd) {
   
    Tenant tenant = new Tenant();
    tenant.setName(cmd.getOptionValue("name"));
    tenant.setDescription(cmd.getOptionValue("description"));
    if(cmd.getOptionValue("enabled") != null) {
      tenant.setEnabled(Boolean.TRUE);
    }
   
    tenant = keystone.tenants().create(tenant).execute();
   
    Table t = new Table(new TableModel<Tenant>(Arrays.asList(tenant)) {

      @Override
      public Column[] getHeaders() {
        return new Column[]{
          new Column("id", 32, Column.ALIGN_LEFT),
          new Column("name", 10, Column.ALIGN_LEFT),
          new Column("description", 32, Column.ALIGN_LEFT),
          new Column("enabled", 7, Column.ALIGN_LEFT)
        };
      }

      @Override
      public String[] getRow(Tenant tenant) {
        return new String[]{
          tenant.getId(),
          tenant.getName(),
          tenant.getDescription(),
          tenant.getEnabled().toString()
        };
      }
    });
    System.out.println(t.render());
  }
View Full Code Here

TOP

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

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.