use of com.yahoo.rdl.Array in project athenz by yahoo.
the class SignUtils method asStruct.
private static Struct asStruct(ServiceIdentity service) {
// all of our fields are in canonical order based
// on their attribute name
Struct struct = new Struct();
appendObject(struct, ATTR_DESCRIPTION, service.getDescription());
appendObject(struct, ATTR_EXECUTABLE, service.getExecutable());
appendObject(struct, ATTR_GROUP, service.getGroup());
appendList(struct, ATTR_HOSTS, service.getHosts());
appendObject(struct, ATTR_MODIFIED, service.getModified());
appendObject(struct, ATTR_NAME, service.getName());
appendObject(struct, ATTR_PROVIDER_ENDPOINT, service.getProviderEndpoint());
List<PublicKeyEntry> publicKeys = service.getPublicKeys();
Array publicKeysArray = new Array();
if (publicKeys != null) {
for (PublicKeyEntry publicKey : publicKeys) {
Struct structPublicKey = new Struct();
appendObject(structPublicKey, ATTR_ID, publicKey.getId());
appendObject(structPublicKey, ATTR_KEY, publicKey.getKey());
publicKeysArray.add(structPublicKey);
}
}
appendArray(struct, ATTR_PUBLIC_KEYS, publicKeysArray);
appendObject(struct, ATTR_USER, service.getUser());
return struct;
}
Aggregations