Add Access Graph protobuf file (#34373)

* Add Access Graph protobuf file

Added Access Graph proto file definitions. This GRPC service defines the schema Teleport will use to talk to Access Graph service.

* Regenerate proto

* Replace multiple sends command with a stream

* Move messages to separate proto files
Rename the service proto file to better describe its content.

* Address review comments

* Regenerate protos

* Add comment
This commit is contained in:
Jakub Nyckowski 2023-11-10 17:48:40 -05:00 committed by GitHub
parent 5406ddac47
commit 3e77e345ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1815 additions and 0 deletions

View file

@ -0,0 +1,655 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: accessgraph/v1alpha/access_graph_service.proto
package accessgraphv1alpha
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// QueryRequest is a request to query the access graph.
type QueryRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// query is a SQL query.
Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
}
func (x *QueryRequest) Reset() {
*x = QueryRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryRequest) ProtoMessage() {}
func (x *QueryRequest) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
func (*QueryRequest) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{0}
}
func (x *QueryRequest) GetQuery() string {
if x != nil {
return x.Query
}
return ""
}
// QueryResponse is a response to a query.
type QueryResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// nodes is a list of nodes returned by the query. The response may contain only nodes.
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
// edges is a list of edges returned by the query.
Edges []*Edge `protobuf:"bytes,2,rep,name=edges,proto3" json:"edges,omitempty"`
}
func (x *QueryResponse) Reset() {
*x = QueryResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryResponse) ProtoMessage() {}
func (x *QueryResponse) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.
func (*QueryResponse) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{1}
}
func (x *QueryResponse) GetNodes() []*Node {
if x != nil {
return x.Nodes
}
return nil
}
func (x *QueryResponse) GetEdges() []*Edge {
if x != nil {
return x.Edges
}
return nil
}
// GetFileRequest is a request to get a file.
type GetFileRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// filepath is a path to the file.
Filepath string `protobuf:"bytes,1,opt,name=filepath,proto3" json:"filepath,omitempty"`
}
func (x *GetFileRequest) Reset() {
*x = GetFileRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetFileRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFileRequest) ProtoMessage() {}
func (x *GetFileRequest) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetFileRequest.ProtoReflect.Descriptor instead.
func (*GetFileRequest) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{2}
}
func (x *GetFileRequest) GetFilepath() string {
if x != nil {
return x.Filepath
}
return ""
}
// GetFileResponse is a response to a file request.
type GetFileResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// data is a raw file content.
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *GetFileResponse) Reset() {
*x = GetFileResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetFileResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFileResponse) ProtoMessage() {}
func (x *GetFileResponse) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetFileResponse.ProtoReflect.Descriptor instead.
func (*GetFileResponse) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{3}
}
func (x *GetFileResponse) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
// EventsStreamRequest is a request to send commands to the access graph.
// This command is used to sync the access graph with the Teleport database state.
type EventsStreamRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// operation contains the desired operation
//
// Types that are assignable to Operation:
//
// *EventsStreamRequest_Sync
// *EventsStreamRequest_Upsert
// *EventsStreamRequest_Delete
Operation isEventsStreamRequest_Operation `protobuf_oneof:"operation"`
}
func (x *EventsStreamRequest) Reset() {
*x = EventsStreamRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EventsStreamRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EventsStreamRequest) ProtoMessage() {}
func (x *EventsStreamRequest) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EventsStreamRequest.ProtoReflect.Descriptor instead.
func (*EventsStreamRequest) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{4}
}
func (m *EventsStreamRequest) GetOperation() isEventsStreamRequest_Operation {
if m != nil {
return m.Operation
}
return nil
}
func (x *EventsStreamRequest) GetSync() *SyncOperation {
if x, ok := x.GetOperation().(*EventsStreamRequest_Sync); ok {
return x.Sync
}
return nil
}
func (x *EventsStreamRequest) GetUpsert() *ResourceList {
if x, ok := x.GetOperation().(*EventsStreamRequest_Upsert); ok {
return x.Upsert
}
return nil
}
func (x *EventsStreamRequest) GetDelete() *ResourceHeaderList {
if x, ok := x.GetOperation().(*EventsStreamRequest_Delete); ok {
return x.Delete
}
return nil
}
type isEventsStreamRequest_Operation interface {
isEventsStreamRequest_Operation()
}
type EventsStreamRequest_Sync struct {
// sync is a command to sync the access graph with the Teleport database state.
// it's issued once Teleport finishes syncing all resources with the database.
Sync *SyncOperation `protobuf:"bytes,1,opt,name=sync,proto3,oneof"`
}
type EventsStreamRequest_Upsert struct {
// upsert is a command to put a resource into the access graph or update it.
Upsert *ResourceList `protobuf:"bytes,2,opt,name=upsert,proto3,oneof"`
}
type EventsStreamRequest_Delete struct {
// delete is a command to delete a resource from the access graph when it's deleted from Teleport.
Delete *ResourceHeaderList `protobuf:"bytes,3,opt,name=delete,proto3,oneof"`
}
func (*EventsStreamRequest_Sync) isEventsStreamRequest_Operation() {}
func (*EventsStreamRequest_Upsert) isEventsStreamRequest_Operation() {}
func (*EventsStreamRequest_Delete) isEventsStreamRequest_Operation() {}
// SyncOperation is a command that Teleport sends to the access graph service
// at the end of the sync process.
type SyncOperation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SyncOperation) Reset() {
*x = SyncOperation{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SyncOperation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SyncOperation) ProtoMessage() {}
func (x *SyncOperation) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SyncOperation.ProtoReflect.Descriptor instead.
func (*SyncOperation) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{5}
}
// EventsStreamResponse is the response from EventsStream.
type EventsStreamResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *EventsStreamResponse) Reset() {
*x = EventsStreamResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EventsStreamResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EventsStreamResponse) ProtoMessage() {}
func (x *EventsStreamResponse) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EventsStreamResponse.ProtoReflect.Descriptor instead.
func (*EventsStreamResponse) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP(), []int{6}
}
var File_accessgraph_v1alpha_access_graph_service_proto protoreflect.FileDescriptor
var file_accessgraph_v1alpha_access_graph_service_proto_rawDesc = []byte{
0x0a, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x67, 0x72, 0x61,
0x70, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x1a, 0x1f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61,
0x70, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72,
0x61, 0x70, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x0c, 0x51,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71,
0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72,
0x79, 0x22, 0x71, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x19, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x05, 0x6e, 0x6f,
0x64, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68,
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x64, 0x67, 0x65, 0x52, 0x05, 0x65,
0x64, 0x67, 0x65, 0x73, 0x22, 0x2c, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61,
0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61,
0x74, 0x68, 0x22, 0x25, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xdc, 0x01, 0x0a, 0x13, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x38, 0x0a, 0x04, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x22, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x3b, 0x0a, 0x06, 0x75,
0x70, 0x73, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x63,
0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00,
0x52, 0x06, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x12, 0x41, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73,
0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4c, 0x69, 0x73,
0x74, 0x48, 0x00, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x79, 0x6e, 0x63,
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x32, 0xa1, 0x02, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x70,
0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72,
0x79, 0x12, 0x21, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61,
0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x46,
0x69, 0x6c, 0x65, 0x12, 0x23, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70,
0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73,
0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x47,
0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65,
0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x28,
0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31, 0x61,
0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73,
0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x28, 0x01, 0x42, 0x57, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61,
0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72,
0x61, 0x70, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x3b, 0x61, 0x63, 0x63, 0x65,
0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_accessgraph_v1alpha_access_graph_service_proto_rawDescOnce sync.Once
file_accessgraph_v1alpha_access_graph_service_proto_rawDescData = file_accessgraph_v1alpha_access_graph_service_proto_rawDesc
)
func file_accessgraph_v1alpha_access_graph_service_proto_rawDescGZIP() []byte {
file_accessgraph_v1alpha_access_graph_service_proto_rawDescOnce.Do(func() {
file_accessgraph_v1alpha_access_graph_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_accessgraph_v1alpha_access_graph_service_proto_rawDescData)
})
return file_accessgraph_v1alpha_access_graph_service_proto_rawDescData
}
var file_accessgraph_v1alpha_access_graph_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_accessgraph_v1alpha_access_graph_service_proto_goTypes = []interface{}{
(*QueryRequest)(nil), // 0: accessgraph.v1alpha.QueryRequest
(*QueryResponse)(nil), // 1: accessgraph.v1alpha.QueryResponse
(*GetFileRequest)(nil), // 2: accessgraph.v1alpha.GetFileRequest
(*GetFileResponse)(nil), // 3: accessgraph.v1alpha.GetFileResponse
(*EventsStreamRequest)(nil), // 4: accessgraph.v1alpha.EventsStreamRequest
(*SyncOperation)(nil), // 5: accessgraph.v1alpha.SyncOperation
(*EventsStreamResponse)(nil), // 6: accessgraph.v1alpha.EventsStreamResponse
(*Node)(nil), // 7: accessgraph.v1alpha.Node
(*Edge)(nil), // 8: accessgraph.v1alpha.Edge
(*ResourceList)(nil), // 9: accessgraph.v1alpha.ResourceList
(*ResourceHeaderList)(nil), // 10: accessgraph.v1alpha.ResourceHeaderList
}
var file_accessgraph_v1alpha_access_graph_service_proto_depIdxs = []int32{
7, // 0: accessgraph.v1alpha.QueryResponse.nodes:type_name -> accessgraph.v1alpha.Node
8, // 1: accessgraph.v1alpha.QueryResponse.edges:type_name -> accessgraph.v1alpha.Edge
5, // 2: accessgraph.v1alpha.EventsStreamRequest.sync:type_name -> accessgraph.v1alpha.SyncOperation
9, // 3: accessgraph.v1alpha.EventsStreamRequest.upsert:type_name -> accessgraph.v1alpha.ResourceList
10, // 4: accessgraph.v1alpha.EventsStreamRequest.delete:type_name -> accessgraph.v1alpha.ResourceHeaderList
0, // 5: accessgraph.v1alpha.AccessGraphService.Query:input_type -> accessgraph.v1alpha.QueryRequest
2, // 6: accessgraph.v1alpha.AccessGraphService.GetFile:input_type -> accessgraph.v1alpha.GetFileRequest
4, // 7: accessgraph.v1alpha.AccessGraphService.EventsStream:input_type -> accessgraph.v1alpha.EventsStreamRequest
1, // 8: accessgraph.v1alpha.AccessGraphService.Query:output_type -> accessgraph.v1alpha.QueryResponse
3, // 9: accessgraph.v1alpha.AccessGraphService.GetFile:output_type -> accessgraph.v1alpha.GetFileResponse
6, // 10: accessgraph.v1alpha.AccessGraphService.EventsStream:output_type -> accessgraph.v1alpha.EventsStreamResponse
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_accessgraph_v1alpha_access_graph_service_proto_init() }
func file_accessgraph_v1alpha_access_graph_service_proto_init() {
if File_accessgraph_v1alpha_access_graph_service_proto != nil {
return
}
file_accessgraph_v1alpha_graph_proto_init()
file_accessgraph_v1alpha_resources_proto_init()
if !protoimpl.UnsafeEnabled {
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetFileRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetFileResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EventsStreamRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncOperation); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EventsStreamResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_accessgraph_v1alpha_access_graph_service_proto_msgTypes[4].OneofWrappers = []interface{}{
(*EventsStreamRequest_Sync)(nil),
(*EventsStreamRequest_Upsert)(nil),
(*EventsStreamRequest_Delete)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_accessgraph_v1alpha_access_graph_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_accessgraph_v1alpha_access_graph_service_proto_goTypes,
DependencyIndexes: file_accessgraph_v1alpha_access_graph_service_proto_depIdxs,
MessageInfos: file_accessgraph_v1alpha_access_graph_service_proto_msgTypes,
}.Build()
File_accessgraph_v1alpha_access_graph_service_proto = out.File
file_accessgraph_v1alpha_access_graph_service_proto_rawDesc = nil
file_accessgraph_v1alpha_access_graph_service_proto_goTypes = nil
file_accessgraph_v1alpha_access_graph_service_proto_depIdxs = nil
}

View file

@ -0,0 +1,250 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: accessgraph/v1alpha/access_graph_service.proto
package accessgraphv1alpha
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
AccessGraphService_Query_FullMethodName = "/accessgraph.v1alpha.AccessGraphService/Query"
AccessGraphService_GetFile_FullMethodName = "/accessgraph.v1alpha.AccessGraphService/GetFile"
AccessGraphService_EventsStream_FullMethodName = "/accessgraph.v1alpha.AccessGraphService/EventsStream"
)
// AccessGraphServiceClient is the client API for AccessGraphService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AccessGraphServiceClient interface {
// Query queries the access graph.
// Currently only used by WebUI.
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
// GetFile gets a static UI file from the access graph container.
GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*GetFileResponse, error)
// EventsStream is a stream of commands to the access graph service.
// Teleport Auth server creates a stream to the access graph service
// and pushes all resources and following events to it.
// This stream is used to sync the access graph with the Teleport database state.
// Once Teleport finishes syncing the current state, it sends a sync command
// to the access graph service and resumes sending events.
EventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamClient, error)
}
type accessGraphServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAccessGraphServiceClient(cc grpc.ClientConnInterface) AccessGraphServiceClient {
return &accessGraphServiceClient{cc}
}
func (c *accessGraphServiceClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
out := new(QueryResponse)
err := c.cc.Invoke(ctx, AccessGraphService_Query_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accessGraphServiceClient) GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*GetFileResponse, error) {
out := new(GetFileResponse)
err := c.cc.Invoke(ctx, AccessGraphService_GetFile_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accessGraphServiceClient) EventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamClient, error) {
stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[0], AccessGraphService_EventsStream_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &accessGraphServiceEventsStreamClient{stream}
return x, nil
}
type AccessGraphService_EventsStreamClient interface {
Send(*EventsStreamRequest) error
CloseAndRecv() (*EventsStreamResponse, error)
grpc.ClientStream
}
type accessGraphServiceEventsStreamClient struct {
grpc.ClientStream
}
func (x *accessGraphServiceEventsStreamClient) Send(m *EventsStreamRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *accessGraphServiceEventsStreamClient) CloseAndRecv() (*EventsStreamResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(EventsStreamResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// AccessGraphServiceServer is the server API for AccessGraphService service.
// All implementations must embed UnimplementedAccessGraphServiceServer
// for forward compatibility
type AccessGraphServiceServer interface {
// Query queries the access graph.
// Currently only used by WebUI.
Query(context.Context, *QueryRequest) (*QueryResponse, error)
// GetFile gets a static UI file from the access graph container.
GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error)
// EventsStream is a stream of commands to the access graph service.
// Teleport Auth server creates a stream to the access graph service
// and pushes all resources and following events to it.
// This stream is used to sync the access graph with the Teleport database state.
// Once Teleport finishes syncing the current state, it sends a sync command
// to the access graph service and resumes sending events.
EventsStream(AccessGraphService_EventsStreamServer) error
mustEmbedUnimplementedAccessGraphServiceServer()
}
// UnimplementedAccessGraphServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAccessGraphServiceServer struct {
}
func (UnimplementedAccessGraphServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Query not implemented")
}
func (UnimplementedAccessGraphServiceServer) GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetFile not implemented")
}
func (UnimplementedAccessGraphServiceServer) EventsStream(AccessGraphService_EventsStreamServer) error {
return status.Errorf(codes.Unimplemented, "method EventsStream not implemented")
}
func (UnimplementedAccessGraphServiceServer) mustEmbedUnimplementedAccessGraphServiceServer() {}
// UnsafeAccessGraphServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AccessGraphServiceServer will
// result in compilation errors.
type UnsafeAccessGraphServiceServer interface {
mustEmbedUnimplementedAccessGraphServiceServer()
}
func RegisterAccessGraphServiceServer(s grpc.ServiceRegistrar, srv AccessGraphServiceServer) {
s.RegisterService(&AccessGraphService_ServiceDesc, srv)
}
func _AccessGraphService_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccessGraphServiceServer).Query(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccessGraphService_Query_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccessGraphServiceServer).Query(ctx, req.(*QueryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccessGraphService_GetFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccessGraphServiceServer).GetFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccessGraphService_GetFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccessGraphServiceServer).GetFile(ctx, req.(*GetFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccessGraphService_EventsStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(AccessGraphServiceServer).EventsStream(&accessGraphServiceEventsStreamServer{stream})
}
type AccessGraphService_EventsStreamServer interface {
SendAndClose(*EventsStreamResponse) error
Recv() (*EventsStreamRequest, error)
grpc.ServerStream
}
type accessGraphServiceEventsStreamServer struct {
grpc.ServerStream
}
func (x *accessGraphServiceEventsStreamServer) SendAndClose(m *EventsStreamResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *accessGraphServiceEventsStreamServer) Recv() (*EventsStreamRequest, error) {
m := new(EventsStreamRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// AccessGraphService_ServiceDesc is the grpc.ServiceDesc for AccessGraphService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AccessGraphService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "accessgraph.v1alpha.AccessGraphService",
HandlerType: (*AccessGraphServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Query",
Handler: _AccessGraphService_Query_Handler,
},
{
MethodName: "GetFile",
Handler: _AccessGraphService_GetFile_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "EventsStream",
Handler: _AccessGraphService_EventsStream_Handler,
ClientStreams: true,
},
},
Metadata: "accessgraph/v1alpha/access_graph_service.proto",
}

View file

@ -0,0 +1,328 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: accessgraph/v1alpha/graph.proto
package accessgraphv1alpha
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Node is a node in the access graph.
type Node struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// ID is the unique ID of the node.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Kind is the kind of the node, ex: "user", "user_group", "resource", etc.
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
// SubKind is the subkind of the node, ex: "ssh", "db", "k8s", etc.
SubKind string `protobuf:"bytes,3,opt,name=sub_kind,json=subKind,proto3" json:"sub_kind,omitempty"`
// Name is the name of the node.
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
// Labels is a set of labels for the resource.
Labels map[string]string `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Hostname is the hostname of the node.
Hostname string `protobuf:"bytes,6,opt,name=hostname,proto3" json:"hostname,omitempty"`
// Properties is a set of properties for the resource.
Properties map[string]string `protobuf:"bytes,7,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *Node) Reset() {
*x = Node{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_graph_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Node) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Node) ProtoMessage() {}
func (x *Node) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_graph_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Node.ProtoReflect.Descriptor instead.
func (*Node) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_graph_proto_rawDescGZIP(), []int{0}
}
func (x *Node) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Node) GetKind() string {
if x != nil {
return x.Kind
}
return ""
}
func (x *Node) GetSubKind() string {
if x != nil {
return x.SubKind
}
return ""
}
func (x *Node) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *Node) GetLabels() map[string]string {
if x != nil {
return x.Labels
}
return nil
}
func (x *Node) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *Node) GetProperties() map[string]string {
if x != nil {
return x.Properties
}
return nil
}
// Edge is an edge in the access graph.
type Edge struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// from is the ID of the node the edge is from.
From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
// to is the ID of the node the edge is to.
To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
// edge_type is the type of the edge, e.g. "member_of", "belongs_to", etc.
EdgeType string `protobuf:"bytes,3,opt,name=edge_type,json=edgeType,proto3" json:"edge_type,omitempty"`
}
func (x *Edge) Reset() {
*x = Edge{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_graph_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Edge) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Edge) ProtoMessage() {}
func (x *Edge) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_graph_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Edge.ProtoReflect.Descriptor instead.
func (*Edge) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_graph_proto_rawDescGZIP(), []int{1}
}
func (x *Edge) GetFrom() string {
if x != nil {
return x.From
}
return ""
}
func (x *Edge) GetTo() string {
if x != nil {
return x.To
}
return ""
}
func (x *Edge) GetEdgeType() string {
if x != nil {
return x.EdgeType
}
return ""
}
var File_accessgraph_v1alpha_graph_proto protoreflect.FileDescriptor
var file_accessgraph_v1alpha_graph_proto_rawDesc = []byte{
0x0a, 0x1f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0xf9, 0x02, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b,
0x69, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68,
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x4c, 0x61,
0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c,
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x49, 0x0a,
0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x29, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x50, 0x72, 0x6f,
0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x70, 0x72,
0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65,
0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0x47, 0x0a, 0x04, 0x45, 0x64, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72,
0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e,
0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x1b,
0x0a, 0x09, 0x65, 0x64, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x65, 0x64, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x57, 0x5a, 0x55, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x76, 0x69, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74,
0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x63,
0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x3b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x76, 0x31, 0x61,
0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_accessgraph_v1alpha_graph_proto_rawDescOnce sync.Once
file_accessgraph_v1alpha_graph_proto_rawDescData = file_accessgraph_v1alpha_graph_proto_rawDesc
)
func file_accessgraph_v1alpha_graph_proto_rawDescGZIP() []byte {
file_accessgraph_v1alpha_graph_proto_rawDescOnce.Do(func() {
file_accessgraph_v1alpha_graph_proto_rawDescData = protoimpl.X.CompressGZIP(file_accessgraph_v1alpha_graph_proto_rawDescData)
})
return file_accessgraph_v1alpha_graph_proto_rawDescData
}
var file_accessgraph_v1alpha_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_accessgraph_v1alpha_graph_proto_goTypes = []interface{}{
(*Node)(nil), // 0: accessgraph.v1alpha.Node
(*Edge)(nil), // 1: accessgraph.v1alpha.Edge
nil, // 2: accessgraph.v1alpha.Node.LabelsEntry
nil, // 3: accessgraph.v1alpha.Node.PropertiesEntry
}
var file_accessgraph_v1alpha_graph_proto_depIdxs = []int32{
2, // 0: accessgraph.v1alpha.Node.labels:type_name -> accessgraph.v1alpha.Node.LabelsEntry
3, // 1: accessgraph.v1alpha.Node.properties:type_name -> accessgraph.v1alpha.Node.PropertiesEntry
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_accessgraph_v1alpha_graph_proto_init() }
func file_accessgraph_v1alpha_graph_proto_init() {
if File_accessgraph_v1alpha_graph_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_accessgraph_v1alpha_graph_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Node); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_graph_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Edge); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_accessgraph_v1alpha_graph_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_accessgraph_v1alpha_graph_proto_goTypes,
DependencyIndexes: file_accessgraph_v1alpha_graph_proto_depIdxs,
MessageInfos: file_accessgraph_v1alpha_graph_proto_msgTypes,
}.Build()
File_accessgraph_v1alpha_graph_proto = out.File
file_accessgraph_v1alpha_graph_proto_rawDesc = nil
file_accessgraph_v1alpha_graph_proto_goTypes = nil
file_accessgraph_v1alpha_graph_proto_depIdxs = nil
}

View file

@ -0,0 +1,392 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: accessgraph/v1alpha/resources.proto
package accessgraphv1alpha
import (
types "github.com/gravitational/teleport/api/types"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// ResourceList is a list of resources to send to the access graph.
type ResourceList struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Resources []*ResourceEntry `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"`
}
func (x *ResourceList) Reset() {
*x = ResourceList{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResourceList) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResourceList) ProtoMessage() {}
func (x *ResourceList) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResourceList.ProtoReflect.Descriptor instead.
func (*ResourceList) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_resources_proto_rawDescGZIP(), []int{0}
}
func (x *ResourceList) GetResources() []*ResourceEntry {
if x != nil {
return x.Resources
}
return nil
}
// ResourceHeaderList is a list of resource headers to send to the access graph.
type ResourceHeaderList struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Resources []*types.ResourceHeader `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"`
}
func (x *ResourceHeaderList) Reset() {
*x = ResourceHeaderList{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResourceHeaderList) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResourceHeaderList) ProtoMessage() {}
func (x *ResourceHeaderList) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResourceHeaderList.ProtoReflect.Descriptor instead.
func (*ResourceHeaderList) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_resources_proto_rawDescGZIP(), []int{1}
}
func (x *ResourceHeaderList) GetResources() []*types.ResourceHeader {
if x != nil {
return x.Resources
}
return nil
}
// ResourceEntry is a wrapper for the supported resource types.
type ResourceEntry struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Resource:
//
// *ResourceEntry_User
// *ResourceEntry_Role
// *ResourceEntry_Server
// *ResourceEntry_AccessRequest
Resource isResourceEntry_Resource `protobuf_oneof:"resource"`
}
func (x *ResourceEntry) Reset() {
*x = ResourceEntry{}
if protoimpl.UnsafeEnabled {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResourceEntry) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResourceEntry) ProtoMessage() {}
func (x *ResourceEntry) ProtoReflect() protoreflect.Message {
mi := &file_accessgraph_v1alpha_resources_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResourceEntry.ProtoReflect.Descriptor instead.
func (*ResourceEntry) Descriptor() ([]byte, []int) {
return file_accessgraph_v1alpha_resources_proto_rawDescGZIP(), []int{2}
}
func (m *ResourceEntry) GetResource() isResourceEntry_Resource {
if m != nil {
return m.Resource
}
return nil
}
func (x *ResourceEntry) GetUser() *types.UserV2 {
if x, ok := x.GetResource().(*ResourceEntry_User); ok {
return x.User
}
return nil
}
func (x *ResourceEntry) GetRole() *types.RoleV6 {
if x, ok := x.GetResource().(*ResourceEntry_Role); ok {
return x.Role
}
return nil
}
func (x *ResourceEntry) GetServer() *types.ServerV2 {
if x, ok := x.GetResource().(*ResourceEntry_Server); ok {
return x.Server
}
return nil
}
func (x *ResourceEntry) GetAccessRequest() *types.AccessRequestV3 {
if x, ok := x.GetResource().(*ResourceEntry_AccessRequest); ok {
return x.AccessRequest
}
return nil
}
type isResourceEntry_Resource interface {
isResourceEntry_Resource()
}
type ResourceEntry_User struct {
// User is a user resource
User *types.UserV2 `protobuf:"bytes,1,opt,name=user,proto3,oneof"`
}
type ResourceEntry_Role struct {
// Role is a role resource
Role *types.RoleV6 `protobuf:"bytes,2,opt,name=role,proto3,oneof"`
}
type ResourceEntry_Server struct {
// Server is a node/server resource
Server *types.ServerV2 `protobuf:"bytes,3,opt,name=server,proto3,oneof"`
}
type ResourceEntry_AccessRequest struct {
// AccessRequest is a resource for access requests
AccessRequest *types.AccessRequestV3 `protobuf:"bytes,4,opt,name=access_request,json=accessRequest,proto3,oneof"`
}
func (*ResourceEntry_User) isResourceEntry_Resource() {}
func (*ResourceEntry_Role) isResourceEntry_Resource() {}
func (*ResourceEntry_Server) isResourceEntry_Resource() {}
func (*ResourceEntry_AccessRequest) isResourceEntry_Resource() {}
var File_accessgraph_v1alpha_resources_proto protoreflect.FileDescriptor
var file_accessgraph_v1alpha_resources_proto_rawDesc = []byte{
0x0a, 0x23, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61,
0x70, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x1a, 0x21, 0x74, 0x65, 0x6c, 0x65,
0x70, 0x6f, 0x72, 0x74, 0x2f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a,
0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x40, 0x0a,
0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x22, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22,
0x49, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52,
0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x0d, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x04,
0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x56, 0x32, 0x48, 0x00, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x12, 0x23, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x56, 0x36, 0x48, 0x00,
0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x32, 0x48, 0x00, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x12, 0x3f, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56,
0x33, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x57,
0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61,
0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f,
0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x76, 0x31, 0x61,
0x6c, 0x70, 0x68, 0x61, 0x3b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x67, 0x72, 0x61, 0x70, 0x68,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_accessgraph_v1alpha_resources_proto_rawDescOnce sync.Once
file_accessgraph_v1alpha_resources_proto_rawDescData = file_accessgraph_v1alpha_resources_proto_rawDesc
)
func file_accessgraph_v1alpha_resources_proto_rawDescGZIP() []byte {
file_accessgraph_v1alpha_resources_proto_rawDescOnce.Do(func() {
file_accessgraph_v1alpha_resources_proto_rawDescData = protoimpl.X.CompressGZIP(file_accessgraph_v1alpha_resources_proto_rawDescData)
})
return file_accessgraph_v1alpha_resources_proto_rawDescData
}
var file_accessgraph_v1alpha_resources_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_accessgraph_v1alpha_resources_proto_goTypes = []interface{}{
(*ResourceList)(nil), // 0: accessgraph.v1alpha.ResourceList
(*ResourceHeaderList)(nil), // 1: accessgraph.v1alpha.ResourceHeaderList
(*ResourceEntry)(nil), // 2: accessgraph.v1alpha.ResourceEntry
(*types.ResourceHeader)(nil), // 3: types.ResourceHeader
(*types.UserV2)(nil), // 4: types.UserV2
(*types.RoleV6)(nil), // 5: types.RoleV6
(*types.ServerV2)(nil), // 6: types.ServerV2
(*types.AccessRequestV3)(nil), // 7: types.AccessRequestV3
}
var file_accessgraph_v1alpha_resources_proto_depIdxs = []int32{
2, // 0: accessgraph.v1alpha.ResourceList.resources:type_name -> accessgraph.v1alpha.ResourceEntry
3, // 1: accessgraph.v1alpha.ResourceHeaderList.resources:type_name -> types.ResourceHeader
4, // 2: accessgraph.v1alpha.ResourceEntry.user:type_name -> types.UserV2
5, // 3: accessgraph.v1alpha.ResourceEntry.role:type_name -> types.RoleV6
6, // 4: accessgraph.v1alpha.ResourceEntry.server:type_name -> types.ServerV2
7, // 5: accessgraph.v1alpha.ResourceEntry.access_request:type_name -> types.AccessRequestV3
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_accessgraph_v1alpha_resources_proto_init() }
func file_accessgraph_v1alpha_resources_proto_init() {
if File_accessgraph_v1alpha_resources_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_accessgraph_v1alpha_resources_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourceList); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_resources_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourceHeaderList); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_accessgraph_v1alpha_resources_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourceEntry); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_accessgraph_v1alpha_resources_proto_msgTypes[2].OneofWrappers = []interface{}{
(*ResourceEntry_User)(nil),
(*ResourceEntry_Role)(nil),
(*ResourceEntry_Server)(nil),
(*ResourceEntry_AccessRequest)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_accessgraph_v1alpha_resources_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_accessgraph_v1alpha_resources_proto_goTypes,
DependencyIndexes: file_accessgraph_v1alpha_resources_proto_depIdxs,
MessageInfos: file_accessgraph_v1alpha_resources_proto_msgTypes,
}.Build()
File_accessgraph_v1alpha_resources_proto = out.File
file_accessgraph_v1alpha_resources_proto_rawDesc = nil
file_accessgraph_v1alpha_resources_proto_goTypes = nil
file_accessgraph_v1alpha_resources_proto_depIdxs = nil
}

View file

@ -0,0 +1,87 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package accessgraph.v1alpha;
import "accessgraph/v1alpha/graph.proto";
import "accessgraph/v1alpha/resources.proto";
option go_package = "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha;accessgraphv1alpha";
// AccessGraphService is a service for interacting the access graph service.
service AccessGraphService {
// Query queries the access graph.
// Currently only used by WebUI.
rpc Query(QueryRequest) returns (QueryResponse);
// GetFile gets a static UI file from the access graph container.
rpc GetFile(GetFileRequest) returns (GetFileResponse);
// EventsStream is a stream of commands to the access graph service.
// Teleport Auth server creates a stream to the access graph service
// and pushes all resources and following events to it.
// This stream is used to sync the access graph with the Teleport database state.
// Once Teleport finishes syncing the current state, it sends a sync command
// to the access graph service and resumes sending events.
rpc EventsStream(stream EventsStreamRequest) returns (EventsStreamResponse);
}
// QueryRequest is a request to query the access graph.
message QueryRequest {
// query is a SQL query.
string query = 1;
}
// QueryResponse is a response to a query.
message QueryResponse {
// nodes is a list of nodes returned by the query. The response may contain only nodes.
repeated Node nodes = 1;
// edges is a list of edges returned by the query.
repeated Edge edges = 2;
}
// GetFileRequest is a request to get a file.
message GetFileRequest {
// filepath is a path to the file.
string filepath = 1;
}
// GetFileResponse is a response to a file request.
message GetFileResponse {
// data is a raw file content.
bytes data = 1;
}
// EventsStreamRequest is a request to send commands to the access graph.
// This command is used to sync the access graph with the Teleport database state.
message EventsStreamRequest {
// operation contains the desired operation
oneof operation {
// sync is a command to sync the access graph with the Teleport database state.
// it's issued once Teleport finishes syncing all resources with the database.
SyncOperation sync = 1;
// upsert is a command to put a resource into the access graph or update it.
ResourceList upsert = 2;
// delete is a command to delete a resource from the access graph when it's deleted from Teleport.
ResourceHeaderList delete = 3;
}
}
// SyncOperation is a command that Teleport sends to the access graph service
// at the end of the sync process.
message SyncOperation {}
// EventsStreamResponse is the response from EventsStream.
message EventsStreamResponse {}

View file

@ -0,0 +1,47 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package accessgraph.v1alpha;
option go_package = "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha;accessgraphv1alpha";
// Node is a node in the access graph.
message Node {
// ID is the unique ID of the node.
string id = 1;
// Kind is the kind of the node, ex: "user", "user_group", "resource", etc.
string kind = 2;
// SubKind is the subkind of the node, ex: "ssh", "db", "k8s", etc.
string sub_kind = 3;
// Name is the name of the node.
string name = 4;
// Labels is a set of labels for the resource.
map<string, string> labels = 5;
// Hostname is the hostname of the node.
string hostname = 6;
// Properties is a set of properties for the resource.
map<string, string> properties = 7;
}
// Edge is an edge in the access graph.
message Edge {
// from is the ID of the node the edge is from.
string from = 1;
// to is the ID of the node the edge is to.
string to = 2;
// edge_type is the type of the edge, e.g. "member_of", "belongs_to", etc.
string edge_type = 3;
}

View file

@ -0,0 +1,45 @@
// Copyright 2023 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package accessgraph.v1alpha;
import "teleport/legacy/types/types.proto";
option go_package = "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha;accessgraphv1alpha";
// ResourceList is a list of resources to send to the access graph.
message ResourceList {
repeated ResourceEntry resources = 1;
}
// ResourceHeaderList is a list of resource headers to send to the access graph.
message ResourceHeaderList {
repeated types.ResourceHeader resources = 1;
}
// ResourceEntry is a wrapper for the supported resource types.
message ResourceEntry {
oneof resource {
// User is a user resource
types.UserV2 user = 1;
// Role is a role resource
types.RoleV6 role = 2;
// Server is a node/server resource
types.ServerV2 server = 3;
// AccessRequest is a resource for access requests
types.AccessRequestV3 access_request = 4;
}
}

7
proto/buf.lock Normal file
View file

@ -0,0 +1,7 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: gogo
repository: protobuf
commit: b03c65ea87cdc3521ede29f62fe3ce239267c1bc

View file

@ -1,4 +1,7 @@
version: v1
deps:
# gogo/protobuf v1.3.2, keep in sync with build.assets/Makefile.
- buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc
lint:
use:
- DEFAULT
@ -31,6 +34,7 @@ lint:
# https://github.com/twitchtv/twirp/issues/70#issuecomment-470367807
UNARY_RPC:
- teleport/lib/teleterm/v1/service.proto
- accessgraph/v1alpha/access_graph_service.proto
# TODO(ravicious): Fix protos and re-enable lib/teleterm lint rules below.
RPC_REQUEST_STANDARD_NAME:
- teleport/lib/teleterm/v1/service.proto