Package org.jclouds.domain

Examples of org.jclouds.domain.Credentials


      VAppTemplate template = createMock(VAppTemplate.class);
      expect(template.getDescription()).andReturn(description).atLeastOnce();
      replay(template);
      ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
               null, ImmutableMap.<String, Credentials> of(), ImmutableMap.<OsFamily, LoginCredentials> of());
      Credentials creds = converter.apply(template);
      assertEquals(creds.identity, "ecloud");
      assertEquals(creds.credential, "$Ep455l0ud!2");
      verify(template);
   }
View Full Code Here


      VAppTemplate template = createMock(VAppTemplate.class);
      expect(template.getDescription()).andReturn(description).atLeastOnce();
      replay(template);
      ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
               null, ImmutableMap.<String, Credentials> of(), ImmutableMap.<OsFamily, LoginCredentials> of());
      Credentials creds = converter.apply(template);
      assertEquals(creds.identity, "vpncubed");
      assertEquals(creds.credential, "vpncubed");
      verify(template);
   }
View Full Code Here

      this.creds = creds;
   }

   @Override
   public KeyStore get() {
      Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
      String cert = checkNotNull(currentCreds.identity, "credential supplier returned null identity (should be cert)");
      String keyStorePassword = checkNotNull(currentCreds.credential,
            "credential supplier returned null credential (should be keyStorePassword)");
      try {
         KeyStore keyStore = KeyStore.getInstance("PKCS12");
View Full Code Here

      this.creds = creds;
   }

   @Override
   public SSLContext get() {
      Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
      String keyStorePassword = checkNotNull(currentCreds.credential,
            "credential supplier returned null credential (should be keyStorePassword)");
      KeyManagerFactory kmf;
      try {
         kmf = KeyManagerFactory.getInstance("SunX509");
View Full Code Here

    protected void runScriptOnNode(Exchange exchange) throws CamelException {
        String script = exchange.getIn().getBody(String.class);
        String nodeId = getNodeId(exchange);
        String user = getUser(exchange);

        Credentials credentials = null;

        if (user != null) {
            credentials = new Credentials(user, null);
        }
        ExecResponse execResponse = null;

        if (credentials == null) {
            execResponse = computeService.runScriptOnNode(nodeId, script);
View Full Code Here

   * @param content
   * @return
   * @throws UnknownHostException
   */
  protected Cluster unserialize(ClusterSpec spec, String content) throws UnknownHostException {
    Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
    Set<Cluster.Instance> instances = Sets.newLinkedHashSet();

    for(String line : Splitter.on("\n").split(content)) {
      if (line.trim().equals("")) continue; /* ignore empty lines */
      Iterator<String> fields = Splitter.on("\t").split(line).iterator();
View Full Code Here

  public Credentials execute(Object resourceToAuthenticate) {
    if (System.getProperties().containsKey("whirr.login-user") &&
       !"".equals(System.getProperty("whirr.login-user").trim())) {
      List<String> creds = Lists.newArrayList(Splitter.on(':').split(System.getProperty("whirr.login-user")));
      if (creds.size() == 2)
         return new Credentials(creds.get(0), creds.get(1));
      return new Credentials(creds.get(0), null);
    } else {
       return super.execute(resourceToAuthenticate);
    }
  }
View Full Code Here

      StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec);
      ComputeService computeService = computeServiceContext.getComputeService();

      Credentials credentials = new Credentials(
          clusterSpec.getClusterUser(),
          clusterSpec.getPrivateKey());

      try {
        Map<String, ? extends NodeMetadata> nodesInCluster = getNodesForInstanceIdsInCluster(cluster, computeService);
View Full Code Here

  }

  public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(ClusterSpec spec,
        Predicate<NodeMetadata> condition, Statement statement) throws IOException, RunScriptOnNodesException {

    Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
    ComputeServiceContext context = getCompute().apply(spec);

    condition = Predicates.and(runningInGroup(spec.getClusterName()), condition);
    return context.getComputeService().runScriptOnNodesMatching(condition,
      statement, overrideCredentialsWith(credentials).wrapInInitScript(false).runAsRoot(false));
View Full Code Here

    return instances;
  }

  private Cluster.Instance toInstance(NodeMetadata metadata, Cluster cluster, ClusterSpec spec) {
    Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());

    Set<String> roles = Sets.newHashSet();
    try {
      if (cluster != null) {
        roles = cluster.getInstanceMatching(withIds(metadata.getId())).getRoles();
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Credentials

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.