class PrivilegesRequest extends AcknowledgedRequest<PrivilegesRequest> {

    private final Collection<String> roleNames;
    private final Collection<Privilege> privileges;

    @Nullable
    private final GrantedRolesChange grantedRolesChange;

    PrivilegesRequest(Collection<String> roleNames,
                      Collection<Privilege> privileges,
                      @Nullable GrantedRolesChange grantedRolesChange) {
        this.roleNames = roleNames;
        this.privileges = privileges;
        this.grantedRolesChange = grantedRolesChange;
    }

    Collection<String> roleNames() {
        return roleNames;
    }

    public Collection<Privilege> privileges() {
        return privileges;
    }

    @Nullable
    public GrantedRolesChange rolePrivilege() {
        return grantedRolesChange;
    }

    public PrivilegesRequest(StreamInput in) throws IOException {
        super(in);
        int roleNamesSize = in.readVInt();
        roleNames = new ArrayList<>(roleNamesSize);
        for (int i = 0; i < roleNamesSize; i++) {
            roleNames.add(in.readString());
        }
        int privilegesSize = in.readVInt();
        privileges = new ArrayList<>(privilegesSize);
        for (int i = 0; i < privilegesSize; i++) {
            privileges.add(new Privilege(in));
        }
        if (in.getVersion().onOrAfter(V_5_6_0)) {
            grantedRolesChange = in.readOptionalWriteable(GrantedRolesChange::new);
        } else {
            grantedRolesChange = null;
        }
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {<FILL_FUNCTION_BODY>}
}

        super.writeTo(out);
        out.writeVInt(roleNames.size());
        for (String roleName : roleNames) {
            out.writeString(roleName);
        }
        out.writeVInt(privileges.size());
        for (Privilege privilege : privileges) {
            privilege.writeTo(out);
        }
        if (out.getVersion().onOrAfter(V_5_6_0)) {
            out.writeOptionalWriteable(grantedRolesChange);
        }
    
<methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.common.unit.TimeValue ackTimeout() ,public final io.crate.role.PrivilegesRequest timeout(java.lang.String) ,public final io.crate.role.PrivilegesRequest timeout(io.crate.common.unit.TimeValue) ,public final io.crate.common.unit.TimeValue timeout() ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.io.IOException<variables>public static final io.crate.common.unit.TimeValue DEFAULT_ACK_TIMEOUT,protected io.crate.common.unit.TimeValue timeout