importer

package
v0.31.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 11

Documentation

Overview

Package importer is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Importer_Import_FullMethodName = "/aserto.directory.importer.v3.Importer/Import"
)

Variables

View Source
var (
	Opcode_name = map[int32]string{
		0: "OPCODE_UNKNOWN",
		1: "OPCODE_SET",
		2: "OPCODE_DELETE",
		3: "OPCODE_DELETE_WITH_RELATIONS",
	}
	Opcode_value = map[string]int32{
		"OPCODE_UNKNOWN":               0,
		"OPCODE_SET":                   1,
		"OPCODE_DELETE":                2,
		"OPCODE_DELETE_WITH_RELATIONS": 3,
	}
)

Enum value maps for Opcode.

View Source
var File_aserto_directory_importer_v3_importer_proto protoreflect.FileDescriptor
View Source
var Importer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "aserto.directory.importer.v3.Importer",
	HandlerType: (*ImporterServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Import",
			Handler:       _Importer_Import_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "aserto/directory/importer/v3/importer.proto",
}

Importer_ServiceDesc is the grpc.ServiceDesc for Importer service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterImporterHandler

func RegisterImporterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterImporterHandler registers the http handlers for service Importer to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterImporterHandlerClient

func RegisterImporterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ImporterClient) error

RegisterImporterHandlerClient registers the http handlers for service Importer to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ImporterClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ImporterClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ImporterClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterImporterHandlerFromEndpoint

func RegisterImporterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterImporterHandlerFromEndpoint is same as RegisterImporterHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterImporterHandlerServer

func RegisterImporterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ImporterServer) error

RegisterImporterHandlerServer registers the http handlers for service Importer to "mux". UnaryRPC :call ImporterServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterImporterHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterImporterServer

func RegisterImporterServer(s grpc.ServiceRegistrar, srv ImporterServer)

Types

type ImportCounter

type ImportCounter struct {

	// number of messages received
	Recv uint64 `protobuf:"varint,1,opt,name=recv,proto3" json:"recv,omitempty"`
	// number of messages with OPCODE_SET
	Set uint64 `protobuf:"varint,2,opt,name=set,proto3" json:"set,omitempty"`
	// number of messages with OPCODE_DELETE
	Delete uint64 `protobuf:"varint,3,opt,name=delete,proto3" json:"delete,omitempty"`
	// number of messages resulting in error
	Error uint64 `protobuf:"varint,4,opt,name=error,proto3" json:"error,omitempty"`
	// counter of type (object|relation)
	Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*ImportCounter) Descriptor deprecated

func (*ImportCounter) Descriptor() ([]byte, []int)

Deprecated: Use ImportCounter.ProtoReflect.Descriptor instead.

func (*ImportCounter) GetDelete

func (x *ImportCounter) GetDelete() uint64

func (*ImportCounter) GetError

func (x *ImportCounter) GetError() uint64

func (*ImportCounter) GetRecv

func (x *ImportCounter) GetRecv() uint64

func (*ImportCounter) GetSet

func (x *ImportCounter) GetSet() uint64

func (*ImportCounter) GetType added in v0.31.8

func (x *ImportCounter) GetType() string

func (*ImportCounter) ProtoMessage

func (*ImportCounter) ProtoMessage()

func (*ImportCounter) ProtoReflect

func (x *ImportCounter) ProtoReflect() protoreflect.Message

func (*ImportCounter) Reset

func (x *ImportCounter) Reset()

func (*ImportCounter) String

func (x *ImportCounter) String() string

type ImportRequest

type ImportRequest struct {

	// operation Opcode enum value
	OpCode Opcode `protobuf:"varint,1,opt,name=op_code,json=opCode,proto3,enum=aserto.directory.importer.v3.Opcode" json:"op_code,omitempty"`
	// Types that are assignable to Msg:
	//
	//	*ImportRequest_Object
	//	*ImportRequest_Relation
	Msg isImportRequest_Msg `protobuf_oneof:"msg"`
	// contains filtered or unexported fields
}

func (*ImportRequest) Descriptor deprecated

func (*ImportRequest) Descriptor() ([]byte, []int)

Deprecated: Use ImportRequest.ProtoReflect.Descriptor instead.

func (*ImportRequest) GetMsg

func (m *ImportRequest) GetMsg() isImportRequest_Msg

func (*ImportRequest) GetObject

func (x *ImportRequest) GetObject() *v3.Object

func (*ImportRequest) GetOpCode

func (x *ImportRequest) GetOpCode() Opcode

func (*ImportRequest) GetRelation

func (x *ImportRequest) GetRelation() *v3.Relation

func (*ImportRequest) ProtoMessage

func (*ImportRequest) ProtoMessage()

func (*ImportRequest) ProtoReflect

func (x *ImportRequest) ProtoReflect() protoreflect.Message

func (*ImportRequest) Reset

func (x *ImportRequest) Reset()

func (*ImportRequest) String

func (x *ImportRequest) String() string

type ImportRequest_Object

type ImportRequest_Object struct {
	// object import message
	Object *v3.Object `protobuf:"bytes,5,opt,name=object,proto3,oneof"`
}

type ImportRequest_Relation

type ImportRequest_Relation struct {
	// relation import message
	Relation *v3.Relation `protobuf:"bytes,6,opt,name=relation,proto3,oneof"`
}

type ImportResponse

type ImportResponse struct {

	// object import counter
	//
	// Deprecated: Marked as deprecated in aserto/directory/importer/v3/importer.proto.
	Object *ImportCounter `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"`
	// relation import counter
	//
	// Deprecated: Marked as deprecated in aserto/directory/importer/v3/importer.proto.
	Relation *ImportCounter `protobuf:"bytes,2,opt,name=relation,proto3" json:"relation,omitempty"`
	// Types that are assignable to Msg:
	//
	//	*ImportResponse_Status
	//	*ImportResponse_Counter
	Msg isImportResponse_Msg `protobuf_oneof:"msg"`
	// contains filtered or unexported fields
}

func (*ImportResponse) Descriptor deprecated

func (*ImportResponse) Descriptor() ([]byte, []int)

Deprecated: Use ImportResponse.ProtoReflect.Descriptor instead.

func (*ImportResponse) GetCounter added in v0.31.8

func (x *ImportResponse) GetCounter() *ImportCounter

func (*ImportResponse) GetMsg added in v0.31.8

func (m *ImportResponse) GetMsg() isImportResponse_Msg

func (*ImportResponse) GetObject deprecated

func (x *ImportResponse) GetObject() *ImportCounter

Deprecated: Marked as deprecated in aserto/directory/importer/v3/importer.proto.

func (*ImportResponse) GetRelation deprecated

func (x *ImportResponse) GetRelation() *ImportCounter

Deprecated: Marked as deprecated in aserto/directory/importer/v3/importer.proto.

func (*ImportResponse) GetStatus added in v0.31.7

func (x *ImportResponse) GetStatus() *ImportStatus

func (*ImportResponse) ProtoMessage

func (*ImportResponse) ProtoMessage()

func (*ImportResponse) ProtoReflect

func (x *ImportResponse) ProtoReflect() protoreflect.Message

func (*ImportResponse) Reset

func (x *ImportResponse) Reset()

func (*ImportResponse) String

func (x *ImportResponse) String() string

type ImportResponse_Counter added in v0.31.8

type ImportResponse_Counter struct {
	// import counter per type
	Counter *ImportCounter `protobuf:"bytes,5,opt,name=counter,proto3,oneof"`
}

type ImportResponse_Status added in v0.31.8

type ImportResponse_Status struct {
	// import status message
	Status *ImportStatus `protobuf:"bytes,4,opt,name=status,proto3,oneof"`
}

type ImportStatus added in v0.31.7

type ImportStatus struct {

	// gRPC status code (google.golang.org/grpc/codes)
	Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// gRPC status message (google.golang.org/grpc/status)
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// req contains the original import request message
	Req *ImportRequest `protobuf:"bytes,3,opt,name=req,proto3" json:"req,omitempty"`
	// contains filtered or unexported fields
}

func (*ImportStatus) Descriptor deprecated added in v0.31.7

func (*ImportStatus) Descriptor() ([]byte, []int)

Deprecated: Use ImportStatus.ProtoReflect.Descriptor instead.

func (*ImportStatus) GetCode added in v0.31.7

func (x *ImportStatus) GetCode() uint32

func (*ImportStatus) GetMsg added in v0.31.7

func (x *ImportStatus) GetMsg() string

func (*ImportStatus) GetReq added in v0.31.7

func (x *ImportStatus) GetReq() *ImportRequest

func (*ImportStatus) ProtoMessage added in v0.31.7

func (*ImportStatus) ProtoMessage()

func (*ImportStatus) ProtoReflect added in v0.31.7

func (x *ImportStatus) ProtoReflect() protoreflect.Message

func (*ImportStatus) Reset added in v0.31.7

func (x *ImportStatus) Reset()

func (*ImportStatus) String added in v0.31.7

func (x *ImportStatus) String() string

type ImporterClient

type ImporterClient interface {
	// import stream of objects and relations
	Import(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ImportRequest, ImportResponse], error)
}

ImporterClient is the client API for Importer 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.

func NewImporterClient

func NewImporterClient(cc grpc.ClientConnInterface) ImporterClient

type ImporterServer

type ImporterServer interface {
	// import stream of objects and relations
	Import(grpc.BidiStreamingServer[ImportRequest, ImportResponse]) error
}

ImporterServer is the server API for Importer service. All implementations should embed UnimplementedImporterServer for forward compatibility.

type Importer_ImportClient

type Importer_ImportClient = grpc.BidiStreamingClient[ImportRequest, ImportResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Importer_ImportServer

type Importer_ImportServer = grpc.BidiStreamingServer[ImportRequest, ImportResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Opcode

type Opcode int32
const (
	Opcode_OPCODE_UNKNOWN               Opcode = 0
	Opcode_OPCODE_SET                   Opcode = 1
	Opcode_OPCODE_DELETE                Opcode = 2
	Opcode_OPCODE_DELETE_WITH_RELATIONS Opcode = 3
)

func (Opcode) Descriptor

func (Opcode) Descriptor() protoreflect.EnumDescriptor

func (Opcode) Enum

func (x Opcode) Enum() *Opcode

func (Opcode) EnumDescriptor deprecated

func (Opcode) EnumDescriptor() ([]byte, []int)

Deprecated: Use Opcode.Descriptor instead.

func (Opcode) Number

func (x Opcode) Number() protoreflect.EnumNumber

func (Opcode) String

func (x Opcode) String() string

func (Opcode) Type

func (Opcode) Type() protoreflect.EnumType

type UnimplementedImporterServer

type UnimplementedImporterServer struct{}

UnimplementedImporterServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedImporterServer) Import

type UnsafeImporterServer

type UnsafeImporterServer interface {
	// contains filtered or unexported methods
}

UnsafeImporterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ImporterServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL