feat(judgement): a target's owner is looked up from the connectors at decision time, and an unknown owner is a finding that sends the request to the default owner (#1991)

This commit is contained in:
sam committed 2026-11-16 09:49:33 +11:00
1 parent 4bc0d54341
commit a4a4e97f07
15 files changed
+498 -84

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ func newPolicies(db *sqlx.DB, log *slog.Logger, mux *http.ServeMux, guard func(h
// and change-request rules. A failed action tightens its class.
func newJudgement(db *sqlx.DB, log *slog.Logger, conns *connectors.Module, classes *judgement.Classes, policies *judgement.Policies, settings *governance.Module, heard judgement.Events) *judgement.Module {
guards := []judgement.Guard{
judgement.Impact{Lookup: judgement.NoTargetFacts{}},
judgement.Impact{Lookup: judgement.RecordedFacts{Source: conns, People: settings}, Defaults: settings},
judgement.Reversibility{},
judgement.Precedent{Classes: classes},
judgement.Provenance{Events: heard},
+187 -46
View File
@@ -210,7 +210,9 @@ type DescribeResponse struct {
Lookups []*LookupType `protobuf:"bytes,4,rep,name=lookups,proto3" json:"lookups,omitempty"`
Deliveries []*DeliveryType `protobuf:"bytes,5,rep,name=deliveries,proto3" json:"deliveries,omitempty"`
// listens says the connector serves Listen.
Listens bool `protobuf:"varint,6,opt,name=listens,proto3" json:"listens,omitempty"`
Listens bool `protobuf:"varint,6,opt,name=listens,proto3" json:"listens,omitempty"`
// target_facts says the connector serves TargetFacts.
TargetFacts bool `protobuf:"varint,7,opt,name=target_facts,json=targetFacts,proto3" json:"target_facts,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -287,6 +289,13 @@ func (x *DescribeResponse) GetListens() bool {
return false
}
func (x *DescribeResponse) GetTargetFacts() bool {
if x != nil {
return x.TargetFacts
}
return false
}
type EventType struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@@ -1302,6 +1311,123 @@ func (x *DeliverResponse) GetExternalId() string {
return ""
}
type TargetFactsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Target *Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TargetFactsRequest) Reset() {
*x = TargetFactsRequest{}
mi := &file_connector_v1_connector_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TargetFactsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TargetFactsRequest) ProtoMessage() {}
func (x *TargetFactsRequest) ProtoReflect() protoreflect.Message {
mi := &file_connector_v1_connector_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TargetFactsRequest.ProtoReflect.Descriptor instead.
func (*TargetFactsRequest) Descriptor() ([]byte, []int) {
return file_connector_v1_connector_proto_rawDescGZIP(), []int{21}
}
func (x *TargetFactsRequest) GetTarget() *Target {
if x != nil {
return x.Target
}
return nil
}
type TargetFactsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// found is false when the connector has no record of the target.
Found bool `protobuf:"varint,1,opt,name=found,proto3" json:"found,omitempty"`
// owner_identity is who answers for the target, as an identity on a channel
// or system, such as "servicenow:jdoe" or "email:jo@example.com".
OwnerIdentity string `protobuf:"bytes,2,opt,name=owner_identity,json=ownerIdentity,proto3" json:"owner_identity,omitempty"`
// data_class names what the target holds, such as "customer" or "temp".
DataClass string `protobuf:"bytes,3,opt,name=data_class,json=dataClass,proto3" json:"data_class,omitempty"`
// count is how many things the target stands for, zero when unknown.
Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TargetFactsResponse) Reset() {
*x = TargetFactsResponse{}
mi := &file_connector_v1_connector_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TargetFactsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TargetFactsResponse) ProtoMessage() {}
func (x *TargetFactsResponse) ProtoReflect() protoreflect.Message {
mi := &file_connector_v1_connector_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TargetFactsResponse.ProtoReflect.Descriptor instead.
func (*TargetFactsResponse) Descriptor() ([]byte, []int) {
return file_connector_v1_connector_proto_rawDescGZIP(), []int{22}
}
func (x *TargetFactsResponse) GetFound() bool {
if x != nil {
return x.Found
}
return false
}
func (x *TargetFactsResponse) GetOwnerIdentity() string {
if x != nil {
return x.OwnerIdentity
}
return ""
}
func (x *TargetFactsResponse) GetDataClass() string {
if x != nil {
return x.DataClass
}
return ""
}
func (x *TargetFactsResponse) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
type ListenRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// cursor is the last cursor the host stored, empty from the start.
@@ -1312,7 +1438,7 @@ type ListenRequest struct {
func (x *ListenRequest) Reset() {
*x = ListenRequest{}
mi := &file_connector_v1_connector_proto_msgTypes[21]
mi := &file_connector_v1_connector_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1324,7 +1450,7 @@ func (x *ListenRequest) String() string {
func (*ListenRequest) ProtoMessage() {}
func (x *ListenRequest) ProtoReflect() protoreflect.Message {
mi := &file_connector_v1_connector_proto_msgTypes[21]
mi := &file_connector_v1_connector_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1337,7 +1463,7 @@ func (x *ListenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListenRequest.ProtoReflect.Descriptor instead.
func (*ListenRequest) Descriptor() ([]byte, []int) {
return file_connector_v1_connector_proto_rawDescGZIP(), []int{21}
return file_connector_v1_connector_proto_rawDescGZIP(), []int{23}
}
func (x *ListenRequest) GetCursor() string {
@@ -1357,7 +1483,7 @@ type ListenResponse struct {
func (x *ListenResponse) Reset() {
*x = ListenResponse{}
mi := &file_connector_v1_connector_proto_msgTypes[22]
mi := &file_connector_v1_connector_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1369,7 +1495,7 @@ func (x *ListenResponse) String() string {
func (*ListenResponse) ProtoMessage() {}
func (x *ListenResponse) ProtoReflect() protoreflect.Message {
mi := &file_connector_v1_connector_proto_msgTypes[22]
mi := &file_connector_v1_connector_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1382,7 +1508,7 @@ func (x *ListenResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListenResponse.ProtoReflect.Descriptor instead.
func (*ListenResponse) Descriptor() ([]byte, []int) {
return file_connector_v1_connector_proto_rawDescGZIP(), []int{22}
return file_connector_v1_connector_proto_rawDescGZIP(), []int{24}
}
func (x *ListenResponse) GetEvents() []*Event {
@@ -1414,7 +1540,7 @@ const file_connector_v1_connector_proto_rawDesc = "" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x13\n" +
"\x11ConfigureResponse\"\x11\n" +
"\x0fDescribeRequest\"\x9d\x02\n" +
"\x0fDescribeRequest\"\xc0\x02\n" +
"\x10DescribeResponse\x12\x1a\n" +
"\bcontract\x18\x01 \x01(\tR\bcontract\x12/\n" +
"\x06events\x18\x02 \x03(\v2\x17.connector.v1.EventTypeR\x06events\x122\n" +
@@ -1423,7 +1549,8 @@ const file_connector_v1_connector_proto_rawDesc = "" +
"\n" +
"deliveries\x18\x05 \x03(\v2\x1a.connector.v1.DeliveryTypeR\n" +
"deliveries\x12\x18\n" +
"\alistens\x18\x06 \x01(\bR\alistens\"Y\n" +
"\alistens\x18\x06 \x01(\bR\alistens\x12!\n" +
"\ftarget_facts\x18\a \x01(\bR\vtargetFacts\"Y\n" +
"\tEventType\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12 \n" +
"\vdescription\x18\x02 \x01(\tR\vdescription\x12\x16\n" +
@@ -1499,7 +1626,15 @@ const file_connector_v1_connector_proto_rawDesc = "" +
"\x0fidempotency_key\x18\x03 \x01(\tR\x0eidempotencyKey\"2\n" +
"\x0fDeliverResponse\x12\x1f\n" +
"\vexternal_id\x18\x01 \x01(\tR\n" +
"externalId\"'\n" +
"externalId\"B\n" +
"\x12TargetFactsRequest\x12,\n" +
"\x06target\x18\x01 \x01(\v2\x14.connector.v1.TargetR\x06target\"\x87\x01\n" +
"\x13TargetFactsResponse\x12\x14\n" +
"\x05found\x18\x01 \x01(\bR\x05found\x12%\n" +
"\x0eowner_identity\x18\x02 \x01(\tR\rownerIdentity\x12\x1d\n" +
"\n" +
"data_class\x18\x03 \x01(\tR\tdataClass\x12\x14\n" +
"\x05count\x18\x04 \x01(\x05R\x05count\"'\n" +
"\rListenRequest\x12\x16\n" +
"\x06cursor\x18\x01 \x01(\tR\x06cursor\"U\n" +
"\x0eListenResponse\x12+\n" +
@@ -1509,7 +1644,7 @@ const file_connector_v1_connector_proto_rawDesc = "" +
"\x19REVERSIBILITY_UNSPECIFIED\x10\x00\x12&\n" +
"\"REVERSIBILITY_UNDONE_AUTOMATICALLY\x10\x01\x12\x1d\n" +
"\x19REVERSIBILITY_RECOVERABLE\x10\x02\x12\x1e\n" +
"\x1aREVERSIBILITY_IRREVERSIBLE\x10\x032\xce\x04\n" +
"\x1aREVERSIBILITY_IRREVERSIBLE\x10\x032\xa2\x05\n" +
"\x10ConnectorService\x12L\n" +
"\tConfigure\x12\x1e.connector.v1.ConfigureRequest\x1a\x1f.connector.v1.ConfigureResponse\x12I\n" +
"\bDescribe\x12\x1d.connector.v1.DescribeRequest\x1a\x1e.connector.v1.DescribeResponse\x12@\n" +
@@ -1518,7 +1653,8 @@ const file_connector_v1_connector_proto_rawDesc = "" +
"\x06Invoke\x12\x1b.connector.v1.InvokeRequest\x1a\x1c.connector.v1.InvokeResponse\x12C\n" +
"\x06Lookup\x12\x1b.connector.v1.LookupRequest\x1a\x1c.connector.v1.LookupResponse\x12F\n" +
"\aDeliver\x12\x1c.connector.v1.DeliverRequest\x1a\x1d.connector.v1.DeliverResponse\x12E\n" +
"\x06Listen\x12\x1b.connector.v1.ListenRequest\x1a\x1c.connector.v1.ListenResponse0\x01B\xc4\x01\n" +
"\x06Listen\x12\x1b.connector.v1.ListenRequest\x1a\x1c.connector.v1.ListenResponse0\x01\x12R\n" +
"\vTargetFacts\x12 .connector.v1.TargetFactsRequest\x1a!.connector.v1.TargetFactsResponseB\xc4\x01\n" +
"\x10com.connector.v1B\x0eConnectorProtoP\x01ZOgithub.com/samcharles93/archie-core/internal/contracts/connector/v1;connectorv1\xa2\x02\x03CXX\xaa\x02\fConnector.V1\xca\x02\fConnector\\V1\xe2\x02\x18Connector\\V1\\GPBMetadata\xea\x02\rConnector::V1b\x06proto3"
var (
@@ -1534,7 +1670,7 @@ func file_connector_v1_connector_proto_rawDescGZIP() []byte {
}
var file_connector_v1_connector_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_connector_v1_connector_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_connector_v1_connector_proto_msgTypes = make([]protoimpl.MessageInfo, 28)
var file_connector_v1_connector_proto_goTypes = []any{
(Reversibility)(0), // 0: connector.v1.Reversibility
(*ConfigureRequest)(nil), // 1: connector.v1.ConfigureRequest
@@ -1558,49 +1694,54 @@ var file_connector_v1_connector_proto_goTypes = []any{
(*LookupResponse)(nil), // 19: connector.v1.LookupResponse
(*DeliverRequest)(nil), // 20: connector.v1.DeliverRequest
(*DeliverResponse)(nil), // 21: connector.v1.DeliverResponse
(*ListenRequest)(nil), // 22: connector.v1.ListenRequest
(*ListenResponse)(nil), // 23: connector.v1.ListenResponse
nil, // 24: connector.v1.ConfigureRequest.SettingsEntry
nil, // 25: connector.v1.ConfigureRequest.SecretsEntry
nil, // 26: connector.v1.ParseRequest.HeadersEntry
(*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
(*TargetFactsRequest)(nil), // 22: connector.v1.TargetFactsRequest
(*TargetFactsResponse)(nil), // 23: connector.v1.TargetFactsResponse
(*ListenRequest)(nil), // 24: connector.v1.ListenRequest
(*ListenResponse)(nil), // 25: connector.v1.ListenResponse
nil, // 26: connector.v1.ConfigureRequest.SettingsEntry
nil, // 27: connector.v1.ConfigureRequest.SecretsEntry
nil, // 28: connector.v1.ParseRequest.HeadersEntry
(*timestamppb.Timestamp)(nil), // 29: google.protobuf.Timestamp
}
var file_connector_v1_connector_proto_depIdxs = []int32{
24, // 0: connector.v1.ConfigureRequest.settings:type_name -> connector.v1.ConfigureRequest.SettingsEntry
25, // 1: connector.v1.ConfigureRequest.secrets:type_name -> connector.v1.ConfigureRequest.SecretsEntry
26, // 0: connector.v1.ConfigureRequest.settings:type_name -> connector.v1.ConfigureRequest.SettingsEntry
27, // 1: connector.v1.ConfigureRequest.secrets:type_name -> connector.v1.ConfigureRequest.SecretsEntry
5, // 2: connector.v1.DescribeResponse.events:type_name -> connector.v1.EventType
6, // 3: connector.v1.DescribeResponse.actions:type_name -> connector.v1.ActionType
8, // 4: connector.v1.DescribeResponse.lookups:type_name -> connector.v1.LookupType
7, // 5: connector.v1.DescribeResponse.deliveries:type_name -> connector.v1.DeliveryType
9, // 6: connector.v1.ActionType.effect:type_name -> connector.v1.Effect
0, // 7: connector.v1.Effect.reversibility:type_name -> connector.v1.Reversibility
26, // 8: connector.v1.ParseRequest.headers:type_name -> connector.v1.ParseRequest.HeadersEntry
28, // 8: connector.v1.ParseRequest.headers:type_name -> connector.v1.ParseRequest.HeadersEntry
13, // 9: connector.v1.ParseResponse.events:type_name -> connector.v1.Event
27, // 10: connector.v1.Event.occurred_at:type_name -> google.protobuf.Timestamp
29, // 10: connector.v1.Event.occurred_at:type_name -> google.protobuf.Timestamp
10, // 11: connector.v1.ResolveResponse.target:type_name -> connector.v1.Target
9, // 12: connector.v1.ResolveResponse.effect:type_name -> connector.v1.Effect
13, // 13: connector.v1.ListenResponse.events:type_name -> connector.v1.Event
1, // 14: connector.v1.ConnectorService.Configure:input_type -> connector.v1.ConfigureRequest
3, // 15: connector.v1.ConnectorService.Describe:input_type -> connector.v1.DescribeRequest
11, // 16: connector.v1.ConnectorService.Parse:input_type -> connector.v1.ParseRequest
14, // 17: connector.v1.ConnectorService.Resolve:input_type -> connector.v1.ResolveRequest
16, // 18: connector.v1.ConnectorService.Invoke:input_type -> connector.v1.InvokeRequest
18, // 19: connector.v1.ConnectorService.Lookup:input_type -> connector.v1.LookupRequest
20, // 20: connector.v1.ConnectorService.Deliver:input_type -> connector.v1.DeliverRequest
22, // 21: connector.v1.ConnectorService.Listen:input_type -> connector.v1.ListenRequest
2, // 22: connector.v1.ConnectorService.Configure:output_type -> connector.v1.ConfigureResponse
4, // 23: connector.v1.ConnectorService.Describe:output_type -> connector.v1.DescribeResponse
12, // 24: connector.v1.ConnectorService.Parse:output_type -> connector.v1.ParseResponse
15, // 25: connector.v1.ConnectorService.Resolve:output_type -> connector.v1.ResolveResponse
17, // 26: connector.v1.ConnectorService.Invoke:output_type -> connector.v1.InvokeResponse
19, // 27: connector.v1.ConnectorService.Lookup:output_type -> connector.v1.LookupResponse
21, // 28: connector.v1.ConnectorService.Deliver:output_type -> connector.v1.DeliverResponse
23, // 29: connector.v1.ConnectorService.Listen:output_type -> connector.v1.ListenResponse
22, // [22:30] is the sub-list for method output_type
14, // [14:22] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
10, // 13: connector.v1.TargetFactsRequest.target:type_name -> connector.v1.Target
13, // 14: connector.v1.ListenResponse.events:type_name -> connector.v1.Event
1, // 15: connector.v1.ConnectorService.Configure:input_type -> connector.v1.ConfigureRequest
3, // 16: connector.v1.ConnectorService.Describe:input_type -> connector.v1.DescribeRequest
11, // 17: connector.v1.ConnectorService.Parse:input_type -> connector.v1.ParseRequest
14, // 18: connector.v1.ConnectorService.Resolve:input_type -> connector.v1.ResolveRequest
16, // 19: connector.v1.ConnectorService.Invoke:input_type -> connector.v1.InvokeRequest
18, // 20: connector.v1.ConnectorService.Lookup:input_type -> connector.v1.LookupRequest
20, // 21: connector.v1.ConnectorService.Deliver:input_type -> connector.v1.DeliverRequest
24, // 22: connector.v1.ConnectorService.Listen:input_type -> connector.v1.ListenRequest
22, // 23: connector.v1.ConnectorService.TargetFacts:input_type -> connector.v1.TargetFactsRequest
2, // 24: connector.v1.ConnectorService.Configure:output_type -> connector.v1.ConfigureResponse
4, // 25: connector.v1.ConnectorService.Describe:output_type -> connector.v1.DescribeResponse
12, // 26: connector.v1.ConnectorService.Parse:output_type -> connector.v1.ParseResponse
15, // 27: connector.v1.ConnectorService.Resolve:output_type -> connector.v1.ResolveResponse
17, // 28: connector.v1.ConnectorService.Invoke:output_type -> connector.v1.InvokeResponse
19, // 29: connector.v1.ConnectorService.Lookup:output_type -> connector.v1.LookupResponse
21, // 30: connector.v1.ConnectorService.Deliver:output_type -> connector.v1.DeliverResponse
25, // 31: connector.v1.ConnectorService.Listen:output_type -> connector.v1.ListenResponse
23, // 32: connector.v1.ConnectorService.TargetFacts:output_type -> connector.v1.TargetFactsResponse
24, // [24:33] is the sub-list for method output_type
15, // [15:24] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension extendee
0, // [0:15] is the sub-list for field type_name
}
func init() { file_connector_v1_connector_proto_init() }
@@ -1614,7 +1755,7 @@ func file_connector_v1_connector_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_connector_v1_connector_proto_rawDesc), len(file_connector_v1_connector_proto_rawDesc)),
NumEnums: 1,
NumMessages: 26,
NumMessages: 28,
NumExtensions: 0,
NumServices: 1,
},
@@ -19,14 +19,15 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
ConnectorService_Configure_FullMethodName = "/connector.v1.ConnectorService/Configure"
ConnectorService_Describe_FullMethodName = "/connector.v1.ConnectorService/Describe"
ConnectorService_Parse_FullMethodName = "/connector.v1.ConnectorService/Parse"
ConnectorService_Resolve_FullMethodName = "/connector.v1.ConnectorService/Resolve"
ConnectorService_Invoke_FullMethodName = "/connector.v1.ConnectorService/Invoke"
ConnectorService_Lookup_FullMethodName = "/connector.v1.ConnectorService/Lookup"
ConnectorService_Deliver_FullMethodName = "/connector.v1.ConnectorService/Deliver"
ConnectorService_Listen_FullMethodName = "/connector.v1.ConnectorService/Listen"
ConnectorService_Configure_FullMethodName = "/connector.v1.ConnectorService/Configure"
ConnectorService_Describe_FullMethodName = "/connector.v1.ConnectorService/Describe"
ConnectorService_Parse_FullMethodName = "/connector.v1.ConnectorService/Parse"
ConnectorService_Resolve_FullMethodName = "/connector.v1.ConnectorService/Resolve"
ConnectorService_Invoke_FullMethodName = "/connector.v1.ConnectorService/Invoke"
ConnectorService_Lookup_FullMethodName = "/connector.v1.ConnectorService/Lookup"
ConnectorService_Deliver_FullMethodName = "/connector.v1.ConnectorService/Deliver"
ConnectorService_Listen_FullMethodName = "/connector.v1.ConnectorService/Listen"
ConnectorService_TargetFacts_FullMethodName = "/connector.v1.ConnectorService/TargetFacts"
)
// ConnectorServiceClient is the client API for ConnectorService service.
@@ -65,6 +66,11 @@ type ConnectorServiceClient interface {
// carries the cursor to resume after its events, which the host keeps only
// once those events are stored.
Listen(ctx context.Context, in *ListenRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListenResponse], error)
// TargetFacts answers what the connector's system of record knows about a
// target, such as who owns it, at the moment an action on it is judged. The
// host asks only connectors that declare target_facts, and never stores the
// answer.
TargetFacts(ctx context.Context, in *TargetFactsRequest, opts ...grpc.CallOption) (*TargetFactsResponse, error)
}
type connectorServiceClient struct {
@@ -164,6 +170,16 @@ func (c *connectorServiceClient) Listen(ctx context.Context, in *ListenRequest,
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ConnectorService_ListenClient = grpc.ServerStreamingClient[ListenResponse]
func (c *connectorServiceClient) TargetFacts(ctx context.Context, in *TargetFactsRequest, opts ...grpc.CallOption) (*TargetFactsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(TargetFactsResponse)
err := c.cc.Invoke(ctx, ConnectorService_TargetFacts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ConnectorServiceServer is the server API for ConnectorService service.
// All implementations must embed UnimplementedConnectorServiceServer
// for forward compatibility.
@@ -200,6 +216,11 @@ type ConnectorServiceServer interface {
// carries the cursor to resume after its events, which the host keeps only
// once those events are stored.
Listen(*ListenRequest, grpc.ServerStreamingServer[ListenResponse]) error
// TargetFacts answers what the connector's system of record knows about a
// target, such as who owns it, at the moment an action on it is judged. The
// host asks only connectors that declare target_facts, and never stores the
// answer.
TargetFacts(context.Context, *TargetFactsRequest) (*TargetFactsResponse, error)
mustEmbedUnimplementedConnectorServiceServer()
}
@@ -234,6 +255,9 @@ func (UnimplementedConnectorServiceServer) Deliver(context.Context, *DeliverRequ
func (UnimplementedConnectorServiceServer) Listen(*ListenRequest, grpc.ServerStreamingServer[ListenResponse]) error {
return status.Error(codes.Unimplemented, "method Listen not implemented")
}
func (UnimplementedConnectorServiceServer) TargetFacts(context.Context, *TargetFactsRequest) (*TargetFactsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method TargetFacts not implemented")
}
func (UnimplementedConnectorServiceServer) mustEmbedUnimplementedConnectorServiceServer() {}
func (UnimplementedConnectorServiceServer) testEmbeddedByValue() {}
@@ -392,6 +416,24 @@ func _ConnectorService_Listen_Handler(srv interface{}, stream grpc.ServerStream)
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ConnectorService_ListenServer = grpc.ServerStreamingServer[ListenResponse]
func _ConnectorService_TargetFacts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TargetFactsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ConnectorServiceServer).TargetFacts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ConnectorService_TargetFacts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ConnectorServiceServer).TargetFacts(ctx, req.(*TargetFactsRequest))
}
return interceptor(ctx, in, info, handler)
}
// ConnectorService_ServiceDesc is the grpc.ServiceDesc for ConnectorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -427,6 +469,10 @@ var ConnectorService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Deliver",
Handler: _ConnectorService_Deliver_Handler,
},
{
MethodName: "TargetFacts",
Handler: _ConnectorService_TargetFacts_Handler,
},
},
Streams: []grpc.StreamDesc{
{