semgrepv2

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package semgrepv2 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Semgrep_Echo_FullMethodName      = "/scanoss.api.semgrep.v2.Semgrep/Echo"
	Semgrep_GetIssues_FullMethodName = "/scanoss.api.semgrep.v2.Semgrep/GetIssues"
)

Variables

View Source
var File_scanoss_api_semgrep_v2_scanoss_semgrep_proto protoreflect.FileDescriptor
View Source
var Semgrep_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "scanoss.api.semgrep.v2.Semgrep",
	HandlerType: (*SemgrepServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _Semgrep_Echo_Handler,
		},
		{
			MethodName: "GetIssues",
			Handler:    _Semgrep_GetIssues_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "scanoss/api/semgrep/v2/scanoss-semgrep.proto",
}

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

Functions

func RegisterSemgrepHandler

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

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

func RegisterSemgrepHandlerClient

func RegisterSemgrepHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SemgrepClient) error

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

func RegisterSemgrepHandlerFromEndpoint

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

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

func RegisterSemgrepHandlerServer

func RegisterSemgrepHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SemgrepServer) error

RegisterSemgrepHandlerServer registers the http handlers for service Semgrep to "mux". UnaryRPC :call SemgrepServer 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 RegisterSemgrepHandlerFromEndpoint instead.

func RegisterSemgrepServer

func RegisterSemgrepServer(s grpc.ServiceRegistrar, srv SemgrepServer)

Types

type SemgrepClient

type SemgrepClient interface {
	// Standard echo
	Echo(ctx context.Context, in *commonv2.EchoRequest, opts ...grpc.CallOption) (*commonv2.EchoResponse, error)
	// Get Potential issues  associated with a list of PURLs
	GetIssues(ctx context.Context, in *commonv2.PurlRequest, opts ...grpc.CallOption) (*SemgrepResponse, error)
}

SemgrepClient is the client API for Semgrep 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 NewSemgrepClient

func NewSemgrepClient(cc grpc.ClientConnInterface) SemgrepClient

type SemgrepResponse

type SemgrepResponse struct {

	// Cryptography details
	Purls []*SemgrepResponse_Purls `protobuf:"bytes,1,rep,name=purls,proto3" json:"purls,omitempty"`
	// Response status
	Status *commonv2.StatusResponse `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

Semgrep issue response data (JSON payload)

func (*SemgrepResponse) Descriptor deprecated

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

Deprecated: Use SemgrepResponse.ProtoReflect.Descriptor instead.

func (*SemgrepResponse) GetPurls

func (x *SemgrepResponse) GetPurls() []*SemgrepResponse_Purls

func (*SemgrepResponse) GetStatus

func (x *SemgrepResponse) GetStatus() *commonv2.StatusResponse

func (*SemgrepResponse) ProtoMessage

func (*SemgrepResponse) ProtoMessage()

func (*SemgrepResponse) ProtoReflect

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

func (*SemgrepResponse) Reset

func (x *SemgrepResponse) Reset()

func (*SemgrepResponse) String

func (x *SemgrepResponse) String() string

type SemgrepResponse_File

type SemgrepResponse_File struct {
	FileMD5 string                   `protobuf:"bytes,1,opt,name=fileMD5,proto3" json:"fileMD5,omitempty"`
	Path    string                   `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Issues  []*SemgrepResponse_Issue `protobuf:"bytes,3,rep,name=issues,proto3" json:"issues,omitempty"`
	// contains filtered or unexported fields
}

func (*SemgrepResponse_File) Descriptor deprecated

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

Deprecated: Use SemgrepResponse_File.ProtoReflect.Descriptor instead.

func (*SemgrepResponse_File) GetFileMD5

func (x *SemgrepResponse_File) GetFileMD5() string

func (*SemgrepResponse_File) GetIssues

func (x *SemgrepResponse_File) GetIssues() []*SemgrepResponse_Issue

func (*SemgrepResponse_File) GetPath

func (x *SemgrepResponse_File) GetPath() string

func (*SemgrepResponse_File) ProtoMessage

func (*SemgrepResponse_File) ProtoMessage()

func (*SemgrepResponse_File) ProtoReflect

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

func (*SemgrepResponse_File) Reset

func (x *SemgrepResponse_File) Reset()

func (*SemgrepResponse_File) String

func (x *SemgrepResponse_File) String() string

type SemgrepResponse_Issue

type SemgrepResponse_Issue struct {
	RuleID   string `protobuf:"bytes,1,opt,name=ruleID,proto3" json:"ruleID,omitempty"`
	From     string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"`
	To       string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"`
	Severity string `protobuf:"bytes,4,opt,name=severity,proto3" json:"severity,omitempty"`
	// contains filtered or unexported fields
}

func (*SemgrepResponse_Issue) Descriptor deprecated

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

Deprecated: Use SemgrepResponse_Issue.ProtoReflect.Descriptor instead.

func (*SemgrepResponse_Issue) GetFrom

func (x *SemgrepResponse_Issue) GetFrom() string

func (*SemgrepResponse_Issue) GetRuleID

func (x *SemgrepResponse_Issue) GetRuleID() string

func (*SemgrepResponse_Issue) GetSeverity

func (x *SemgrepResponse_Issue) GetSeverity() string

func (*SemgrepResponse_Issue) GetTo

func (x *SemgrepResponse_Issue) GetTo() string

func (*SemgrepResponse_Issue) ProtoMessage

func (*SemgrepResponse_Issue) ProtoMessage()

func (*SemgrepResponse_Issue) ProtoReflect

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

func (*SemgrepResponse_Issue) Reset

func (x *SemgrepResponse_Issue) Reset()

func (*SemgrepResponse_Issue) String

func (x *SemgrepResponse_Issue) String() string

type SemgrepResponse_Purls

type SemgrepResponse_Purls struct {
	Purl    string                  `protobuf:"bytes,1,opt,name=purl,proto3" json:"purl,omitempty"`
	Version string                  `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Files   []*SemgrepResponse_File `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"`
	// contains filtered or unexported fields
}

func (*SemgrepResponse_Purls) Descriptor deprecated

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

Deprecated: Use SemgrepResponse_Purls.ProtoReflect.Descriptor instead.

func (*SemgrepResponse_Purls) GetFiles

func (*SemgrepResponse_Purls) GetPurl

func (x *SemgrepResponse_Purls) GetPurl() string

func (*SemgrepResponse_Purls) GetVersion

func (x *SemgrepResponse_Purls) GetVersion() string

func (*SemgrepResponse_Purls) ProtoMessage

func (*SemgrepResponse_Purls) ProtoMessage()

func (*SemgrepResponse_Purls) ProtoReflect

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

func (*SemgrepResponse_Purls) Reset

func (x *SemgrepResponse_Purls) Reset()

func (*SemgrepResponse_Purls) String

func (x *SemgrepResponse_Purls) String() string

type SemgrepServer

type SemgrepServer interface {
	// Standard echo
	Echo(context.Context, *commonv2.EchoRequest) (*commonv2.EchoResponse, error)
	// Get Potential issues  associated with a list of PURLs
	GetIssues(context.Context, *commonv2.PurlRequest) (*SemgrepResponse, error)
	// contains filtered or unexported methods
}

SemgrepServer is the server API for Semgrep service. All implementations must embed UnimplementedSemgrepServer for forward compatibility

type UnimplementedSemgrepServer

type UnimplementedSemgrepServer struct {
}

UnimplementedSemgrepServer must be embedded to have forward compatible implementations.

func (UnimplementedSemgrepServer) Echo

func (UnimplementedSemgrepServer) GetIssues

type UnsafeSemgrepServer

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

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

Jump to

Keyboard shortcuts

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