mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of https://github.com/tbatchelli/jclouds
* 'master' of https://github.com/tbatchelli/jclouds: GoGrid credential list might contain credentials that are not for computes. GoGrid's images might have their description null. Return empty string in this case.
This commit is contained in:
commit
934bf68b21
|
@ -89,6 +89,8 @@ public class ServerImage implements Comparable<ServerImage> {
|
|||
}
|
||||
|
||||
public String getDescription() {
|
||||
if (description == null)
|
||||
return "";
|
||||
return description;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ public class ParseServerNameToCredentialsMapFromJsonResponse implements
|
|||
|
||||
@Override
|
||||
public int compareTo(Password o) {
|
||||
return server.getName().compareTo(o.getServer().getName());
|
||||
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,103 +1,124 @@
|
|||
{
|
||||
"list": [
|
||||
{
|
||||
"password": "dig44sos",
|
||||
"object": "password",
|
||||
"username": "root",
|
||||
"server": {
|
||||
"object": "server",
|
||||
"isSandbox": false,
|
||||
{
|
||||
"password": "zot40ced",
|
||||
"object": "password",
|
||||
"username": "root",
|
||||
"server": {
|
||||
"isSandbox": false,
|
||||
"object": "server",
|
||||
"type": {
|
||||
"id": 1,
|
||||
"description": "Web or Application Server",
|
||||
"name": "Web Server",
|
||||
"object": "option"
|
||||
},
|
||||
"os": {
|
||||
"id": 17,
|
||||
"description": "CentOS 5.3 (64-bit)",
|
||||
"name": "CentOS 5.3 (64-bit)",
|
||||
"object": "option"
|
||||
},
|
||||
"image": {
|
||||
"type": {
|
||||
"object": "option",
|
||||
"id": 1,
|
||||
"description": "Web or Application Server",
|
||||
"name": "Web Server",
|
||||
"id": 1
|
||||
"object": "option"
|
||||
},
|
||||
"owner": {
|
||||
"id": -1,
|
||||
"name": "GoGrid",
|
||||
"object": "customer"
|
||||
},
|
||||
"updatedTime": 1257789076417,
|
||||
"isActive": true,
|
||||
"id": 1532,
|
||||
"isPublic": true,
|
||||
"name": "centos5.3_64_base",
|
||||
"billingtokens": [
|
||||
{
|
||||
"id": 47,
|
||||
"price": 0,
|
||||
"name": "CentOS 5.3 64bit",
|
||||
"object": "billingtoken"
|
||||
}
|
||||
],
|
||||
"object": "serverimage",
|
||||
"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
|
||||
},
|
||||
"image": {
|
||||
"type": {
|
||||
"object": "option",
|
||||
"description": "Web or Application Server",
|
||||
"name": "Web Server",
|
||||
"id": 1
|
||||
},
|
||||
"owner": {
|
||||
"object": "customer",
|
||||
"name": "Gear6",
|
||||
"id": 26443
|
||||
},
|
||||
"updatedTime": 1265675466171,
|
||||
"isActive": true,
|
||||
"id": 2500,
|
||||
"createdTime": 1265412834154,
|
||||
"isPublic": true,
|
||||
"billingtokens": [
|
||||
{
|
||||
"price": 0,
|
||||
"name": "CentOS 5.3 64bit",
|
||||
"id": 47
|
||||
},
|
||||
{
|
||||
"price": 60,
|
||||
"name": "Gear 6 Paid Version",
|
||||
"id": 76
|
||||
}
|
||||
],
|
||||
"object": "serverimage",
|
||||
"friendlyName": "gear6-memcache-server-2.3.6.2-x86_64",
|
||||
"os": {
|
||||
"object": "option",
|
||||
"description": "CentOS 5.3 (64-bit)",
|
||||
"name": "CentOS 5.3 (64-bit)",
|
||||
"id": 17
|
||||
},
|
||||
"price": 60,
|
||||
"description": "Gear6 Memcache Server 2.3.6.2 (64 bit)",
|
||||
"state": {
|
||||
"object": "option",
|
||||
"description": "Image is available for adds",
|
||||
"name": "Available",
|
||||
"id": 2
|
||||
},
|
||||
"location": "26443/GSI-7f498260-2b8a-43ef-aa77-5b403f8f739a.img",
|
||||
"name": "GSI-7f498260-2b8a-43ef-aa77-5b403f8f739a"
|
||||
"object": "option"
|
||||
},
|
||||
"price": 0,
|
||||
"description": "CentOS 5.3 (64-bit) w/ None",
|
||||
"state": {
|
||||
"object": "option",
|
||||
"description": "Server is in active state.",
|
||||
"name": "On",
|
||||
"id": 1
|
||||
"id": 2,
|
||||
"description": "Image is available for adds",
|
||||
"name": "Available",
|
||||
"object": "option"
|
||||
},
|
||||
"ram": {
|
||||
"object": "option",
|
||||
"description": "Server with 512MB RAM",
|
||||
"name": "512MB",
|
||||
"id": 1
|
||||
},
|
||||
"name": "gogrid-19",
|
||||
"ip": {
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"subnet": "204.51.240.176/255.255.255.240",
|
||||
"state": {
|
||||
"object": "option",
|
||||
"description": "IP is reserved or in use",
|
||||
"name": "Assigned",
|
||||
"id": 2
|
||||
},
|
||||
"ip": "204.51.240.189",
|
||||
"id": 1313090
|
||||
},
|
||||
"id": 77332
|
||||
"location": "gogrid/GSI-939ef909-84b8-4a2f-ad56-02ccd7da05ff.img",
|
||||
"name": "bogus",
|
||||
"architecture": {
|
||||
"id": 2,
|
||||
"description": "64 bit OS",
|
||||
"name": "64-bit",
|
||||
"object": "option"
|
||||
}
|
||||
},
|
||||
"id": 82647,
|
||||
"applicationtype": "os"
|
||||
}
|
||||
"state": {
|
||||
"id": 1,
|
||||
"description": "Server is in active state.",
|
||||
"name": "On",
|
||||
"object": "option"
|
||||
},
|
||||
"ram": {
|
||||
"id": 1,
|
||||
"description": "Server with 512MB RAM",
|
||||
"name": "512MB",
|
||||
"object": "option"
|
||||
},
|
||||
"name": "proxied-944",
|
||||
"ip": {
|
||||
"id": 1104200,
|
||||
"subnet": "173.1.155.16/255.255.255.240",
|
||||
"state": {
|
||||
"id": 2,
|
||||
"description": "IP is reserved or in use",
|
||||
"name": "Assigned",
|
||||
"object": "option"
|
||||
},
|
||||
"datacenter": {
|
||||
"id": 1,
|
||||
"description": "US West 1 Datacenter",
|
||||
"name": "US-West-1",
|
||||
"object": "option"
|
||||
},
|
||||
"object": "ip",
|
||||
"public": true,
|
||||
"ip": "173.1.155.19"
|
||||
},
|
||||
"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": {
|
||||
"total": 6,
|
||||
|
@ -107,4 +128,4 @@
|
|||
},
|
||||
"status": "success",
|
||||
"method": "/support/password/list"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue