buildsecurity

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BuildSecurityPathPrefix = "/twirp/buildsecurity.BuildSecurity/"

BuildSecurityPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var (
	SeverityEnum_name = map[int32]string{
		0: "SEVERITY_UNKNOWN",
		1: "SEVERITY_LOW",
		2: "SEVERITY_MEDIUM",
		3: "SEVERITY_HIGH",
		4: "SEVERITY_CRITICAL",
		5: "SEVERITY_MAX",
	}
	SeverityEnum_value = map[string]int32{
		"SEVERITY_UNKNOWN":  0,
		"SEVERITY_LOW":      1,
		"SEVERITY_MEDIUM":   2,
		"SEVERITY_HIGH":     3,
		"SEVERITY_CRITICAL": 4,
		"SEVERITY_MAX":      5,
	}
)

Enum value maps for SeverityEnum.

View Source
var (
	Result_TypeEnum_name = map[int32]string{
		0: "TYPE_UNKNOWN",
		1: "TYPE_TERRAFORM",
		2: "TYPE_CLOUDFORMATION",
		3: "TYPE_DOCKERFILE",
		4: "TYPE_KUBERNETES",
		5: "TYPE_YAML",
		6: "TYPE_HCL",
	}
	Result_TypeEnum_value = map[string]int32{
		"TYPE_UNKNOWN":        0,
		"TYPE_TERRAFORM":      1,
		"TYPE_CLOUDFORMATION": 2,
		"TYPE_DOCKERFILE":     3,
		"TYPE_KUBERNETES":     4,
		"TYPE_YAML":           5,
		"TYPE_HCL":            6,
	}
)

Enum value maps for Result_TypeEnum.

View Source
var File_buildsecurity_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type BuildSecurity

func NewBuildSecurityJSONClient

func NewBuildSecurityJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) BuildSecurity

NewBuildSecurityJSONClient creates a JSON client that implements the BuildSecurity interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewBuildSecurityProtobufClient

func NewBuildSecurityProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) BuildSecurity

NewBuildSecurityProtobufClient creates a Protobuf client that implements the BuildSecurity interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type CreateRepositoryReq

type CreateRepositoryReq struct {
	SCMID string `protobuf:"bytes,1,opt,name=SCMID,proto3" json:"SCMID,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRepositoryReq) Descriptor deprecated

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

Deprecated: Use CreateRepositoryReq.ProtoReflect.Descriptor instead.

func (*CreateRepositoryReq) GetName

func (x *CreateRepositoryReq) GetName() string

func (*CreateRepositoryReq) GetSCMID

func (x *CreateRepositoryReq) GetSCMID() string

func (*CreateRepositoryReq) ProtoMessage

func (*CreateRepositoryReq) ProtoMessage()

func (*CreateRepositoryReq) ProtoReflect

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

func (*CreateRepositoryReq) Reset

func (x *CreateRepositoryReq) Reset()

func (*CreateRepositoryReq) String

func (x *CreateRepositoryReq) String() string

type CreateRepositoryResp

type CreateRepositoryResp struct {
	RepositoryID string `protobuf:"bytes,1,opt,name=RepositoryID,proto3" json:"RepositoryID,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRepositoryResp) Descriptor deprecated

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

Deprecated: Use CreateRepositoryResp.ProtoReflect.Descriptor instead.

func (*CreateRepositoryResp) GetRepositoryID

func (x *CreateRepositoryResp) GetRepositoryID() string

func (*CreateRepositoryResp) ProtoMessage

func (*CreateRepositoryResp) ProtoMessage()

func (*CreateRepositoryResp) ProtoReflect

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

func (*CreateRepositoryResp) Reset

func (x *CreateRepositoryResp) Reset()

func (*CreateRepositoryResp) String

func (x *CreateRepositoryResp) String() string

type CreateScanReq

type CreateScanReq struct {
	RepositoryID string            `protobuf:"bytes,1,opt,name=RepositoryID,proto3" json:"RepositoryID,omitempty"`
	Branch       string            `protobuf:"bytes,2,opt,name=Branch,proto3" json:"Branch,omitempty"`
	User         string            `protobuf:"bytes,3,opt,name=User,proto3" json:"User,omitempty"`
	System       string            `protobuf:"bytes,4,opt,name=System,proto3" json:"System,omitempty"`
	Commit       string            `protobuf:"bytes,5,opt,name=Commit,proto3" json:"Commit,omitempty"`
	Results      []*Result         `protobuf:"bytes,7,rep,name=Results,proto3" json:"Results,omitempty"`
	Tags         map[string]string `` /* 149-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*CreateScanReq) Descriptor deprecated

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

Deprecated: Use CreateScanReq.ProtoReflect.Descriptor instead.

func (*CreateScanReq) GetBranch

func (x *CreateScanReq) GetBranch() string

func (*CreateScanReq) GetCommit

func (x *CreateScanReq) GetCommit() string

func (*CreateScanReq) GetRepositoryID

func (x *CreateScanReq) GetRepositoryID() string

func (*CreateScanReq) GetResults

func (x *CreateScanReq) GetResults() []*Result

func (*CreateScanReq) GetSystem

func (x *CreateScanReq) GetSystem() string

func (*CreateScanReq) GetTags

func (x *CreateScanReq) GetTags() map[string]string

func (*CreateScanReq) GetUser

func (x *CreateScanReq) GetUser() string

func (*CreateScanReq) ProtoMessage

func (*CreateScanReq) ProtoMessage()

func (*CreateScanReq) ProtoReflect

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

func (*CreateScanReq) Reset

func (x *CreateScanReq) Reset()

func (*CreateScanReq) String

func (x *CreateScanReq) String() string

type CreateScanResp

type CreateScanResp struct {
	ScanID string `protobuf:"bytes,1,opt,name=ScanID,proto3" json:"ScanID,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateScanResp) Descriptor deprecated

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

Deprecated: Use CreateScanResp.ProtoReflect.Descriptor instead.

func (*CreateScanResp) GetScanID

func (x *CreateScanResp) GetScanID() string

func (*CreateScanResp) ProtoMessage

func (*CreateScanResp) ProtoMessage()

func (*CreateScanResp) ProtoReflect

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

func (*CreateScanResp) Reset

func (x *CreateScanResp) Reset()

func (*CreateScanResp) String

func (x *CreateScanResp) String() string

type GetPoliciesReq

type GetPoliciesReq struct {
	RepositoryID string `protobuf:"bytes,1,opt,name=RepositoryID,proto3" json:"RepositoryID,omitempty"`
	Branch       string `protobuf:"bytes,2,opt,name=Branch,proto3" json:"Branch,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPoliciesReq) Descriptor deprecated

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

Deprecated: Use GetPoliciesReq.ProtoReflect.Descriptor instead.

func (*GetPoliciesReq) GetBranch added in v0.7.1

func (x *GetPoliciesReq) GetBranch() string

func (*GetPoliciesReq) GetRepositoryID

func (x *GetPoliciesReq) GetRepositoryID() string

func (*GetPoliciesReq) ProtoMessage

func (*GetPoliciesReq) ProtoMessage()

func (*GetPoliciesReq) ProtoReflect

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

func (*GetPoliciesReq) Reset

func (x *GetPoliciesReq) Reset()

func (*GetPoliciesReq) String

func (x *GetPoliciesReq) String() string

type GetPoliciesResp

type GetPoliciesResp struct {
	Policies []*Policy `protobuf:"bytes,1,rep,name=Policies,proto3" json:"Policies,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPoliciesResp) Descriptor deprecated

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

Deprecated: Use GetPoliciesResp.ProtoReflect.Descriptor instead.

func (*GetPoliciesResp) GetPolicies

func (x *GetPoliciesResp) GetPolicies() []*Policy

func (*GetPoliciesResp) ProtoMessage

func (*GetPoliciesResp) ProtoMessage()

func (*GetPoliciesResp) ProtoReflect

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

func (*GetPoliciesResp) Reset

func (x *GetPoliciesResp) Reset()

func (*GetPoliciesResp) String

func (x *GetPoliciesResp) String() string

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type LookupRepositoryReq

type LookupRepositoryReq struct {
	SCMID string `protobuf:"bytes,1,opt,name=SCMID,proto3" json:"SCMID,omitempty"`
	// contains filtered or unexported fields
}

func (*LookupRepositoryReq) Descriptor deprecated

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

Deprecated: Use LookupRepositoryReq.ProtoReflect.Descriptor instead.

func (*LookupRepositoryReq) GetSCMID

func (x *LookupRepositoryReq) GetSCMID() string

func (*LookupRepositoryReq) ProtoMessage

func (*LookupRepositoryReq) ProtoMessage()

func (*LookupRepositoryReq) ProtoReflect

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

func (*LookupRepositoryReq) Reset

func (x *LookupRepositoryReq) Reset()

func (*LookupRepositoryReq) String

func (x *LookupRepositoryReq) String() string

type LookupRepositoryResp

type LookupRepositoryResp struct {
	RepositoryID string `protobuf:"bytes,2,opt,name=RepositoryID,proto3" json:"RepositoryID,omitempty"`
	// contains filtered or unexported fields
}

func (*LookupRepositoryResp) Descriptor deprecated

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

Deprecated: Use LookupRepositoryResp.ProtoReflect.Descriptor instead.

func (*LookupRepositoryResp) GetRepositoryID

func (x *LookupRepositoryResp) GetRepositoryID() string

func (*LookupRepositoryResp) ProtoMessage

func (*LookupRepositoryResp) ProtoMessage()

func (*LookupRepositoryResp) ProtoReflect

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

func (*LookupRepositoryResp) Reset

func (x *LookupRepositoryResp) Reset()

func (*LookupRepositoryResp) String

func (x *LookupRepositoryResp) String() string

type Policy

type Policy struct {
	PolicyID string           `protobuf:"bytes,1,opt,name=PolicyID,proto3" json:"PolicyID,omitempty"`
	Enforced bool             `protobuf:"varint,2,opt,name=Enforced,proto3" json:"Enforced,omitempty"`
	Controls []*PolicyControl `protobuf:"bytes,3,rep,name=Controls,proto3" json:"Controls,omitempty"`
	// contains filtered or unexported fields
}

func (*Policy) Descriptor deprecated

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

Deprecated: Use Policy.ProtoReflect.Descriptor instead.

func (*Policy) GetControls

func (x *Policy) GetControls() []*PolicyControl

func (*Policy) GetEnforced added in v0.5.0

func (x *Policy) GetEnforced() bool

func (*Policy) GetPolicyID

func (x *Policy) GetPolicyID() string

func (*Policy) ProtoMessage

func (*Policy) ProtoMessage()

func (*Policy) ProtoReflect

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

func (*Policy) Reset

func (x *Policy) Reset()

func (*Policy) String

func (x *Policy) String() string

type PolicyControl

type PolicyControl struct {
	Provider string       `protobuf:"bytes,1,opt,name=Provider,proto3" json:"Provider,omitempty"`
	Service  string       `protobuf:"bytes,2,opt,name=Service,proto3" json:"Service,omitempty"`
	AVDIDs   []string     `protobuf:"bytes,3,rep,name=AVDIDs,proto3" json:"AVDIDs,omitempty"`
	Severity SeverityEnum `protobuf:"varint,4,opt,name=Severity,proto3,enum=buildsecurity.SeverityEnum" json:"Severity,omitempty"`
	// contains filtered or unexported fields
}

func (*PolicyControl) Descriptor deprecated

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

Deprecated: Use PolicyControl.ProtoReflect.Descriptor instead.

func (*PolicyControl) GetAVDIDs

func (x *PolicyControl) GetAVDIDs() []string

func (*PolicyControl) GetProvider

func (x *PolicyControl) GetProvider() string

func (*PolicyControl) GetService

func (x *PolicyControl) GetService() string

func (*PolicyControl) GetSeverity added in v0.5.0

func (x *PolicyControl) GetSeverity() SeverityEnum

func (*PolicyControl) ProtoMessage

func (*PolicyControl) ProtoMessage()

func (*PolicyControl) ProtoReflect

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

func (*PolicyControl) Reset

func (x *PolicyControl) Reset()

func (*PolicyControl) String

func (x *PolicyControl) String() string

type PolicyResult added in v0.9.0

type PolicyResult struct {
	PolicyID string `protobuf:"bytes,1,opt,name=PolicyID,proto3" json:"PolicyID,omitempty"`
	Enforced bool   `protobuf:"varint,2,opt,name=Enforced,proto3" json:"Enforced,omitempty"`
	Failed   bool   `protobuf:"varint,3,opt,name=Failed,proto3" json:"Failed,omitempty"`
	Reason   string `protobuf:"bytes,4,opt,name=Reason,proto3" json:"Reason,omitempty"`
	// contains filtered or unexported fields
}

func (*PolicyResult) Descriptor deprecated added in v0.9.0

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

Deprecated: Use PolicyResult.ProtoReflect.Descriptor instead.

func (*PolicyResult) GetEnforced added in v0.9.0

func (x *PolicyResult) GetEnforced() bool

func (*PolicyResult) GetFailed added in v0.9.0

func (x *PolicyResult) GetFailed() bool

func (*PolicyResult) GetPolicyID added in v0.9.0

func (x *PolicyResult) GetPolicyID() string

func (*PolicyResult) GetReason added in v0.9.0

func (x *PolicyResult) GetReason() string

func (*PolicyResult) ProtoMessage added in v0.9.0

func (*PolicyResult) ProtoMessage()

func (*PolicyResult) ProtoReflect added in v0.9.0

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

func (*PolicyResult) Reset added in v0.9.0

func (x *PolicyResult) Reset()

func (*PolicyResult) String added in v0.9.0

func (x *PolicyResult) String() string

type Result

type Result struct {
	AVDID         string          `protobuf:"bytes,1,opt,name=AVDID,proto3" json:"AVDID,omitempty"`
	Message       string          `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"`
	Type          Result_TypeEnum `protobuf:"varint,4,opt,name=Type,proto3,enum=buildsecurity.Result_TypeEnum" json:"Type,omitempty"`
	Severity      SeverityEnum    `protobuf:"varint,5,opt,name=Severity,proto3,enum=buildsecurity.SeverityEnum" json:"Severity,omitempty"`
	Title         string          `protobuf:"bytes,6,opt,name=Title,proto3" json:"Title,omitempty"`
	Filename      string          `protobuf:"bytes,7,opt,name=Filename,proto3" json:"Filename,omitempty"`
	StartLine     int32           `protobuf:"varint,8,opt,name=StartLine,proto3" json:"StartLine,omitempty"`
	EndLine       int32           `protobuf:"varint,9,opt,name=EndLine,proto3" json:"EndLine,omitempty"`
	Resource      string          `protobuf:"bytes,10,opt,name=Resource,proto3" json:"Resource,omitempty"`
	PolicyResults []*PolicyResult `protobuf:"bytes,11,rep,name=PolicyResults,proto3" json:"PolicyResults,omitempty"`
	// contains filtered or unexported fields
}

func (*Result) Descriptor deprecated

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

Deprecated: Use Result.ProtoReflect.Descriptor instead.

func (*Result) GetAVDID

func (x *Result) GetAVDID() string

func (*Result) GetEndLine

func (x *Result) GetEndLine() int32

func (*Result) GetFilename

func (x *Result) GetFilename() string

func (*Result) GetMessage

func (x *Result) GetMessage() string

func (*Result) GetPolicyResults added in v0.9.0

func (x *Result) GetPolicyResults() []*PolicyResult

func (*Result) GetResource

func (x *Result) GetResource() string

func (*Result) GetSeverity

func (x *Result) GetSeverity() SeverityEnum

func (*Result) GetStartLine

func (x *Result) GetStartLine() int32

func (*Result) GetTitle

func (x *Result) GetTitle() string

func (*Result) GetType

func (x *Result) GetType() Result_TypeEnum

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) ProtoReflect

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

func (*Result) Reset

func (x *Result) Reset()

func (*Result) String

func (x *Result) String() string

type Result_TypeEnum

type Result_TypeEnum int32
const (
	Result_TYPE_UNKNOWN        Result_TypeEnum = 0
	Result_TYPE_TERRAFORM      Result_TypeEnum = 1
	Result_TYPE_CLOUDFORMATION Result_TypeEnum = 2
	Result_TYPE_DOCKERFILE     Result_TypeEnum = 3
	Result_TYPE_KUBERNETES     Result_TypeEnum = 4
	Result_TYPE_YAML           Result_TypeEnum = 5
	Result_TYPE_HCL            Result_TypeEnum = 6
)

func (Result_TypeEnum) Descriptor

func (Result_TypeEnum) Enum

func (x Result_TypeEnum) Enum() *Result_TypeEnum

func (Result_TypeEnum) EnumDescriptor deprecated

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

Deprecated: Use Result_TypeEnum.Descriptor instead.

func (Result_TypeEnum) Number

func (Result_TypeEnum) String

func (x Result_TypeEnum) String() string

func (Result_TypeEnum) Type

type SeverityEnum added in v0.5.0

type SeverityEnum int32
const (
	SeverityEnum_SEVERITY_UNKNOWN  SeverityEnum = 0
	SeverityEnum_SEVERITY_LOW      SeverityEnum = 1
	SeverityEnum_SEVERITY_MEDIUM   SeverityEnum = 2
	SeverityEnum_SEVERITY_HIGH     SeverityEnum = 3
	SeverityEnum_SEVERITY_CRITICAL SeverityEnum = 4
	SeverityEnum_SEVERITY_MAX      SeverityEnum = 5
)

func (SeverityEnum) Descriptor added in v0.5.0

func (SeverityEnum) Enum added in v0.5.0

func (x SeverityEnum) Enum() *SeverityEnum

func (SeverityEnum) EnumDescriptor deprecated added in v0.5.0

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

Deprecated: Use SeverityEnum.Descriptor instead.

func (SeverityEnum) Number added in v0.5.0

func (SeverityEnum) String added in v0.5.0

func (x SeverityEnum) String() string

func (SeverityEnum) Type added in v0.5.0

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewBuildSecurityServer

func NewBuildSecurityServer(svc BuildSecurity, opts ...interface{}) TwirpServer

NewBuildSecurityServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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