Package com.woorea.openstack.base.client

Examples of com.woorea.openstack.base.client.OpenStackSimpleTokenProvider


        .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD))
        .withTenantName("admin")
        .execute();
   
    Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT);
    ceilometer.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

    /*
    List<Resource> resources = ceilometer.execute(new ResourceList().eq("resource_id", "23b55841eedd41e99d5f3f32149ca086"));
   
   
View Full Code Here


 
  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

            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(
          access.getServiceCatalog(), "network", null, "public"));
      quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access
          .getToken().getId()));
      NetworkForCreate netcreate = new NetworkForCreate();
      netcreate.setTenantId("tenantId");
      netcreate.setName("net2");
      netcreate.setAdminStateUp(true);
View Full Code Here

      // NovaClient novaClient = new
      // NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(),
      // "compute", null, "public"), access.getToken().getId());
      Nova nova = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat(tenants
          .getList().get(0).getId()));
      nova.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken()
          .getId()));
      // novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024);
      // create a new keypair
      // KeyPair keyPair =
      // novaClient.execute(KeyPairsExtension.createKeyPair("mykeypair"));
View Full Code Here

    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

    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"));
     
      swift.containers().create("navidad2").execute();
     
View Full Code Here

    // 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();
      networkQuery.setName("benn.cs");
      networkQuery.setAdminStateUp(true);
      /*
 
View Full Code Here

    // 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

TOP

Related Classes of com.woorea.openstack.base.client.OpenStackSimpleTokenProvider

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.