Package org.jclouds.ibm.smartcloud.domain

Examples of org.jclouds.ibm.smartcloud.domain.Key


   @Test
   public void testGetKey() throws Exception {
      Set<? extends Key> response = connection.listKeys();
      assertNotNull(response);
      if (response.size() > 0) {
         Key key = Iterables.get(response, 0);
         assertEquals(connection.getKey(key.getName()).getName(), key.getName());
      }
   }
View Full Code Here


      return "/key.json";
   }

   @Override
   public Key expected() {
      return new Key(true, ImmutableSet.<String> of("1"), "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...", "DEFAULT",
               new Date(1260428507510l));
   }
View Full Code Here

   @Override
   public Map<?, Future<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
            Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
      IBMSmartCloudTemplateOptions options = template.getOptions().as(IBMSmartCloudTemplateOptions.class);
      if (options.shouldAutomaticallyCreateKeyPair() && options.getKeyPair() == null) {
         Key key = createNewKey(group);
         options.keyPair(key.getName());
         credentialsMap.put(key.getName(), key.getKeyMaterial());
      }
      return super.execute(group, count, template, goodNodes, badNodes, customizationResponses);
   }
View Full Code Here

   @VisibleForTesting
   Key createNewKey(String group) {
      checkNotNull(group, "group");
      logger.debug(">> creating key group(%s)", group);
      Key key = null;
      while (key == null) {
         try {
            key = client.generateKeyPair(getNextName(group));
            logger.debug("<< created key(%s)", key.getName());
         } catch (IllegalStateException e) {

         }
      }
      return key;
View Full Code Here

   }

   @Override
   @Unwrap
   public Set<Key> expected() {
      return ImmutableSet.of(new Key(true, ImmutableSet.<String> of("1"), "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...",
               "DEFAULT", new Date(1260428507510l)), new Key(false, ImmutableSet.<String> of(),
               "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+", "BEAR", new Date(1260428507511l)));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.ibm.smartcloud.domain.Key

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.