mirror of https://github.com/apache/jclouds.git
GoGrid credential list might contain credentials that are not for computes.
This commit is contained in:
parent
084a383cf5
commit
b4417fcdd1
|
@ -99,6 +99,7 @@ public class ParseServerNameToCredentialsMapFromJsonResponse implements
|
|||
|
||||
@Override
|
||||
public int compareTo(Password o) {
|
||||
if (null == o.getServer() || null == server) return -1;
|
||||
return server.getName().compareTo(o.getServer().getName());
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +108,7 @@ public class ParseServerNameToCredentialsMapFromJsonResponse implements
|
|||
public Map<String, Credentials> apply(HttpResponse arg0) {
|
||||
Map<String, Credentials> serverNameToCredentials = Maps.newHashMap();
|
||||
for (Password password : json.apply(arg0).getList()) {
|
||||
if( null != password.getServer())
|
||||
serverNameToCredentials.put(password.getServer().getName(),
|
||||
new Credentials(password.getUserName(), password.getPassword()));
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ParseCredentialsFromJsonResponseTest {
|
|||
ParseCredentialsFromJsonResponse parser = i.getInstance(ParseCredentialsFromJsonResponse.class);
|
||||
Credentials creds = parser.apply(response);
|
||||
assertEquals(creds.identity, "root");
|
||||
assertEquals(creds.credential, "dig44sos");
|
||||
assertEquals(creds.credential, "zot40ced");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,102 +1,123 @@
|
|||
{
|
||||
"list": [
|
||||
{
|
||||
"password": "dig44sos",
|
||||
"password": "zot40ced",
|
||||
"object": "password",
|
||||
"username": "root",
|
||||
"server": {
|
||||
"object": "server",
|
||||
"isSandbox": false,
|
||||
"object": "server",
|
||||
"type": {
|
||||
"object": "option",
|
||||
"id": 1,
|
||||
"description": "Web or Application Server",
|
||||
"name": "Web Server",
|
||||
"id": 1
|
||||
"object": "option"
|
||||
},
|
||||
"os": {
|
||||
"object": "option",
|
||||
"id": 17,
|
||||
"description": "CentOS 5.3 (64-bit)",
|
||||
"name": "CentOS 5.3 (64-bit)",
|
||||
"id": 17
|
||||
"object": "option"
|
||||
},
|
||||
"image": {
|
||||
"type": {
|
||||
"object": "option",
|
||||
"id": 1,
|
||||
"description": "Web or Application Server",
|
||||
"name": "Web Server",
|
||||
"id": 1
|
||||
"object": "option"
|
||||
},
|
||||
"owner": {
|
||||
"object": "customer",
|
||||
"name": "Gear6",
|
||||
"id": 26443
|
||||
"id": -1,
|
||||
"name": "GoGrid",
|
||||
"object": "customer"
|
||||
},
|
||||
"updatedTime": 1265675466171,
|
||||
"updatedTime": 1257789076417,
|
||||
"isActive": true,
|
||||
"id": 2500,
|
||||
"createdTime": 1265412834154,
|
||||
"id": 1532,
|
||||
"isPublic": true,
|
||||
"name": "centos5.3_64_base",
|
||||
"billingtokens": [
|
||||
{
|
||||
"id": 47,
|
||||
"price": 0,
|
||||
"name": "CentOS 5.3 64bit",
|
||||
"id": 47
|
||||
},
|
||||
{
|
||||
"price": 60,
|
||||
"name": "Gear 6 Paid Version",
|
||||
"id": 76
|
||||
"object": "billingtoken"
|
||||
}
|
||||
],
|
||||
"object": "serverimage",
|
||||
"friendlyName": "gear6-memcache-server-2.3.6.2-x86_64",
|
||||
"friendlyName": "CentOS 5.3 (64-bit) w/ None",
|
||||
"os": {
|
||||
"object": "option",
|
||||
"id": 17,
|
||||
"description": "CentOS 5.3 (64-bit)",
|
||||
"name": "CentOS 5.3 (64-bit)",
|
||||
"id": 17
|
||||
"object": "option"
|
||||
},
|
||||
"price": 60,
|
||||
"description": "Gear6 Memcache Server 2.3.6.2 (64 bit)",
|
||||
"price": 0,
|
||||
"description": "CentOS 5.3 (64-bit) w/ None",
|
||||
"state": {
|
||||
"object": "option",
|
||||
"id": 2,
|
||||
"description": "Image is available for adds",
|
||||
"name": "Available",
|
||||
"id": 2
|
||||
"object": "option"
|
||||
},
|
||||
"location": "26443/GSI-7f498260-2b8a-43ef-aa77-5b403f8f739a.img",
|
||||
"name": "GSI-7f498260-2b8a-43ef-aa77-5b403f8f739a"
|
||||
"location": "gogrid/GSI-939ef909-84b8-4a2f-ad56-02ccd7da05ff.img",
|
||||
"name": "bogus",
|
||||
"architecture": {
|
||||
"id": 2,
|
||||
"description": "64 bit OS",
|
||||
"name": "64-bit",
|
||||
"object": "option"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"object": "option",
|
||||
"id": 1,
|
||||
"description": "Server is in active state.",
|
||||
"name": "On",
|
||||
"id": 1
|
||||
"object": "option"
|
||||
},
|
||||
"ram": {
|
||||
"object": "option",
|
||||
"id": 1,
|
||||
"description": "Server with 512MB RAM",
|
||||
"name": "512MB",
|
||||
"id": 1
|
||||
"object": "option"
|
||||
},
|
||||
"name": "gogrid-19",
|
||||
"name": "proxied-944",
|
||||
"ip": {
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
"id": 1104200,
|
||||
"subnet": "173.1.155.16/255.255.255.240",
|
||||
"state": {
|
||||
"object": "option",
|
||||
"id": 2,
|
||||
"description": "IP is reserved or in use",
|
||||
"name": "Assigned",
|
||||
"id": 2
|
||||
"object": "option"
|
||||
},
|
||||
"ip": "204.51.240.189",
|
||||
"id": 1313090
|
||||
"datacenter": {
|
||||
"id": 1,
|
||||
"description": "US West 1 Datacenter",
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"id": 77332
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"ip": "173.1.155.19"
|
||||
},
|
||||
"id": 82647,
|
||||
"datacenter": {
|
||||
"id": 1,
|
||||
"description": "US West 1 Datacenter",
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"id": 134551
|
||||
},
|
||||
"id": 142243,
|
||||
"applicationtype": "os"
|
||||
},
|
||||
{
|
||||
"id": 28000,
|
||||
"username": "22290",
|
||||
"applicationtype": "cloudstorage",
|
||||
"object": "password",
|
||||
"password": "200FMd2nDeomtfW."
|
||||
}
|
||||
],
|
||||
"summary": {
|
||||
|
|
Loading…
Reference in New Issue