Examples of Access


Examples of com.mozilla.grouperfish.model.Access

    public void testDocuments() {
        assertNotNull(scope(NS).documents());
    }

    public void testMaxLength() {
        Access access = new DummyAccess(Operation.CREATE, "dummy.example.com");
        assertTrue(0 < scope(NS).maxLength(DocumentsResource.class, access));
    }
View Full Code Here

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

    this.password = password;
    this.hashTenantAccess = new ConcurrentHashMap<String, Access>();
  }

  public Access getAccessByTenant(String tenantName) {
    Access access = hashTenantAccess.get(tenantName);
    if (access == null) {
      access = keystone.tokens().authenticate(new UsernamePassword(username, password))
        .withTenantName(tenantName)
        .execute();
      hashTenantAccess.put(tenantName, access);
View Full Code Here

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("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

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

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();
    if(servers.getList().size() > 0) {

      // Server has to be in activated state.
View Full Code Here

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

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

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 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(),
      // "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

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

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)).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);
     
      Images images = novaClient.images().list(true).execute();
      for(Image image : images) {
        System.out.println(image);
View Full Code Here

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

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

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 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
TOP
Copyright © 2018 www.massapi.com. 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.