mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-04 11:52:53 +02:00
authorize: use query instead of sync for databroker data (#3377)
This commit is contained in:
parent
fd82cc7870
commit
f61e7efe73
24 changed files with 661 additions and 1008 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
structpb "google.golang.org/protobuf/types/known/structpb"
|
||||
|
||||
"github.com/pomerium/pomerium/pkg/grpcutil"
|
||||
"github.com/pomerium/pomerium/pkg/protoutil"
|
||||
|
@ -118,6 +119,27 @@ func (x *PutResponse) GetRecord() *Record {
|
|||
return records[0]
|
||||
}
|
||||
|
||||
// SetFilterByID sets the filter to an id.
|
||||
func (x *QueryRequest) SetFilterByID(id string) {
|
||||
x.Filter = &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"id": structpb.NewStringValue(id),
|
||||
}}
|
||||
}
|
||||
|
||||
// SetFilterByIDOrIndex sets the filter to an id or an index.
|
||||
func (x *QueryRequest) SetFilterByIDOrIndex(idOrIndex string) {
|
||||
x.Filter = &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"$or": structpb.NewListValue(&structpb.ListValue{Values: []*structpb.Value{
|
||||
structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"id": structpb.NewStringValue(idOrIndex),
|
||||
}}),
|
||||
structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"$index": structpb.NewStringValue(idOrIndex),
|
||||
}}),
|
||||
}}),
|
||||
}}
|
||||
}
|
||||
|
||||
// default is 4MB, but we'll do 1MB
|
||||
const maxMessageSize = 1024 * 1024 * 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue