Package com.woorea.openstack.keystone

Examples of com.woorea.openstack.keystone.Keystone


  protected String password;

  ConcurrentHashMap<String, Access> hashTenantAccess;

  public KeystoneTokenProvider(String endpoint, String username, String password) {
    this.keystone = new Keystone(endpoint);
    this.username = username;
    this.password = password;
    this.hashTenantAccess = new ConcurrentHashMap<String, Access>();
  }
View Full Code Here


  public static final String NOVA_ENDPOINT = "http://compute/v2";
 
  public static final String CEILOMETER_ENDPOINT = "";
 
  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

  /**
   * @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("admin")
        .execute();
   
    Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT);
View Full Code Here

import com.woorea.openstack.nova.api.ServersResource;
import com.woorea.openstack.nova.model.Servers;

public class NovaStopStartServer {
  public static void main(String[] args) throws InterruptedException {
    Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL);
    Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .withTenantName(ExamplesConfiguration.TENANT_NAME)
        .execute();

    //use the token in the following requests
    keystone.token(access.getToken().getId());

    Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId()));
    novaClient.token(access.getToken().getId());

    Servers servers = novaClient.servers().list(true).execute();
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()));
    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 with tenant
      Network network = new Network();
      access = keystone
          .tokens()
          .authenticate(
              new TokenAuthentication(access.getToken().getId()))
          .withTenantId("tenantId").execute();
      Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(
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()
        .withUsernamePassword(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()
          .withToken(access.getToken().getId())
          .withTenantId(tenants.getList().get(0).getId()).execute();

      // NovaClient novaClient = new
      // NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(),
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))
      .withTenantName("admin")
      .execute();

    User user = new User();
    user.setEmail("luis@woorea.es");
    user.setUsername("luis.gervaso");
    user.setPassword("password.0");
    user.setName("Luis");
    user.setEnabled(Boolean.TRUE);

    keystone = new Keystone("http://keystone.x.org/v2.0");
    keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));
    //keystone.enableLogging(Logger.getLogger("keystone"), 10000);
    user = keystone.users().create(user).execute();
    System.out.println(user);
    keystone.users().delete(user.getId()).execute();
  }
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()));
View Full Code Here

 
  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    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 = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();
     
      Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public"));
      swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));
   
      //swiftClient.execute(new DeleteContainer("navidad2"));
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 quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network",  null, "public"));
      quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

      Network networkQuery = new Network();
View Full Code Here

TOP

Related Classes of com.woorea.openstack.keystone.Keystone

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.