Package org.jclouds.domain

Examples of org.jclouds.domain.LoginCredentials


      @Override
      public Image apply(Image arg0) {
         if (arg0 == null)
            return null;
         LoginCredentials credentials = credsForImage.apply(arg0);
         return credentials != null ? ImageBuilder.fromImage(arg0).defaultCredentials(credentials).build() : arg0;
      }
View Full Code Here


public class DefaultCredentialsFromImageOrOverridingCredentials implements Function<Template, LoginCredentials> {

   @Override
   public LoginCredentials apply(Template template) {
      RunScriptOptions options = template.getOptions();
      LoginCredentials defaultCreds = template.getImage().getDefaultCredentials();
      return overrideDefaultCredentialsWithOptionsIfPresent(defaultCreds, options);
   }
View Full Code Here

         authenticateSudo = config.apply("jclouds.image.authenticate-sudo");
      if (authenticateSudo != null) {
         builder.authenticateSudo(Boolean.valueOf(authenticateSudo));
      }

      LoginCredentials creds = builder.build();
      if (creds != null)
         credentialStore.put("image", creds);
      return creds;
   }
View Full Code Here

            loginBuilder.user(loginUser);

         if (authenticateSudo != null) {
            loginBuilder.authenticateSudo(authenticateSudo);
         }
         LoginCredentials creds = loginBuilder.build();
         templateOptions.overrideLoginCredentials(creds);
      }
      if (locationId != null) {
         builder.locationId(locationId);
      }
View Full Code Here

   }

   @Test
   public void testRefreshUpdatesAtomicReferenceOnRecheckPendingAcceptsNewCredentials() {
      LoginCredentials creds = LoginCredentials.builder().user("user").password("password").build();
      NodeMetadata newNode = new NodeMetadataBuilder().id("myid").status(Status.UNRECOGNIZED).credentials(creds).build();

      LoginCredentials creds2 = LoginCredentials.builder().user("user").password("password2").build();

      NodeMetadata pending = new NodeMetadataBuilder().id("myid").status(Status.PENDING).credentials(creds2).build();
     
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);
View Full Code Here

@Test(groups = "unit", testName = "DefaultLoginCredentialsFromImageOrOverridingLoginCredentialsTest")
public class DefaultCredentialsFromImageOrOverridingCredentialsTest {
   private static final DefaultCredentialsFromImageOrOverridingCredentials fn = new DefaultCredentialsFromImageOrOverridingCredentials();

   public void testWhenLoginCredentialsNotPresentInImageOrTemplateOptionsReturnNull() {
      LoginCredentials expected = null;

      Image image = createMock(Image.class);
      Template template = createMock(Template.class);

      expect(template.getImage()).andReturn(image);
View Full Code Here

      TemplateOptions options = client.templateOptions().blockOnPort(22, 120);
      try {
         Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, options);
         NodeMetadata node = get(nodes, 0);
         LoginCredentials good = node.getCredentials();
         assert good.identity != null : nodes;
         assert good.credential != null : nodes;

         for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
               runningInGroup(group), "hostname",
View Full Code Here

   }

   public void testWhenCredentialsNotPresentAndJcloudsPropertyHasUserAndPasswordAndSudo() {
      @SuppressWarnings("unchecked")
      Map<String, Credentials> credstore = createMock(Map.class);
      LoginCredentials expected = LoginCredentials.builder().user("ubuntu").password("password").authenticateSudo(true)
            .build();

      ValueOfConfigurationKeyOrNull config = createMock(ValueOfConfigurationKeyOrNull.class);

      expect(credstore.containsKey("image")).andReturn(false);
View Full Code Here

   }

   public void testWhenCredentialsNotPresentAndProviderPropertyHasUserAndPasswordAndSudo() {
      @SuppressWarnings("unchecked")
      Map<String, Credentials> credstore = createMock(Map.class);
      LoginCredentials expected = LoginCredentials.builder().user("ubuntu").password("password").authenticateSudo(true)
            .build();

      ValueOfConfigurationKeyOrNull config = createMock(ValueOfConfigurationKeyOrNull.class);

      expect(credstore.containsKey("image")).andReturn(false);
View Full Code Here

      checkNotNull(name, "name should have %s encoded into it", group);
      checkNotNull(template, "template was null");
      checkNotNull(template.getOptions(), "template options was null");

      NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
      LoginCredentials fromNode = from.getCredentials();
      LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
      String credsKey = "node#" + from.getNodeId();
      if (creds != null) {
         credentialStore.put(credsKey, creds);
      } else {
         logger.trace("node(%s) creation did not return login credentials", from.getNodeId());
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LoginCredentials

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.