Search in sources :

Example 11 with Array

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;
}
Also used : PublicKeyEntry(com.yahoo.athenz.zms.PublicKeyEntry) Array(com.yahoo.rdl.Array) Struct(com.yahoo.rdl.Struct)

Aggregations

Array (com.yahoo.rdl.Array)11 Struct (com.yahoo.rdl.Struct)10 Assertion (com.yahoo.athenz.zms.Assertion)2 Policy (com.yahoo.athenz.zms.Policy)2 Group (com.yahoo.athenz.zms.Group)1 GroupMember (com.yahoo.athenz.zms.GroupMember)1 PublicKeyEntry (com.yahoo.athenz.zms.PublicKeyEntry)1 Role (com.yahoo.athenz.zms.Role)1 RoleMember (com.yahoo.athenz.zms.RoleMember)1 ServiceIdentity (com.yahoo.athenz.zms.ServiceIdentity)1 SignedPolicies (com.yahoo.athenz.zms.SignedPolicies)1