cache

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const CachePathPrefix = "/twirp/trivy.cache.v1.Cache/"

CachePathPrefix 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 File_rpc_cache_service_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 ArtifactInfo added in v0.9.0

type ArtifactInfo struct {
	SchemaVersion   int32                  `protobuf:"varint,1,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
	Architecture    string                 `protobuf:"bytes,2,opt,name=architecture,proto3" json:"architecture,omitempty"`
	Created         *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created,proto3" json:"created,omitempty"`
	DockerVersion   string                 `protobuf:"bytes,4,opt,name=docker_version,json=dockerVersion,proto3" json:"docker_version,omitempty"`
	Os              string                 `protobuf:"bytes,5,opt,name=os,proto3" json:"os,omitempty"`
	HistoryPackages []*common.Package      `protobuf:"bytes,6,rep,name=history_packages,json=historyPackages,proto3" json:"history_packages,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use ArtifactInfo.ProtoReflect.Descriptor instead.

func (*ArtifactInfo) GetArchitecture added in v0.9.0

func (x *ArtifactInfo) GetArchitecture() string

func (*ArtifactInfo) GetCreated added in v0.9.0

func (x *ArtifactInfo) GetCreated() *timestamppb.Timestamp

func (*ArtifactInfo) GetDockerVersion added in v0.9.0

func (x *ArtifactInfo) GetDockerVersion() string

func (*ArtifactInfo) GetHistoryPackages added in v0.9.0

func (x *ArtifactInfo) GetHistoryPackages() []*common.Package

func (*ArtifactInfo) GetOs added in v0.9.0

func (x *ArtifactInfo) GetOs() string

func (*ArtifactInfo) GetSchemaVersion added in v0.9.0

func (x *ArtifactInfo) GetSchemaVersion() int32

func (*ArtifactInfo) ProtoMessage added in v0.9.0

func (*ArtifactInfo) ProtoMessage()

func (*ArtifactInfo) ProtoReflect added in v0.19.0

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

func (*ArtifactInfo) Reset added in v0.9.0

func (x *ArtifactInfo) Reset()

func (*ArtifactInfo) String added in v0.9.0

func (x *ArtifactInfo) String() string

type BlobInfo added in v0.9.0

type BlobInfo struct {
	SchemaVersion     int32                      `protobuf:"varint,1,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
	Os                *common.OS                 `protobuf:"bytes,2,opt,name=os,proto3" json:"os,omitempty"`
	PackageInfos      []*common.PackageInfo      `protobuf:"bytes,3,rep,name=package_infos,json=packageInfos,proto3" json:"package_infos,omitempty"`
	Applications      []*common.Application      `protobuf:"bytes,4,rep,name=applications,proto3" json:"applications,omitempty"`
	Misconfigurations []*common.Misconfiguration `protobuf:"bytes,9,rep,name=misconfigurations,proto3" json:"misconfigurations,omitempty"`
	OpaqueDirs        []string                   `protobuf:"bytes,5,rep,name=opaque_dirs,json=opaqueDirs,proto3" json:"opaque_dirs,omitempty"`
	WhiteoutFiles     []string                   `protobuf:"bytes,6,rep,name=whiteout_files,json=whiteoutFiles,proto3" json:"whiteout_files,omitempty"`
	Digest            string                     `protobuf:"bytes,7,opt,name=digest,proto3" json:"digest,omitempty"`
	DiffId            string                     `protobuf:"bytes,8,opt,name=diff_id,json=diffId,proto3" json:"diff_id,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use BlobInfo.ProtoReflect.Descriptor instead.

func (*BlobInfo) GetApplications added in v0.9.0

func (x *BlobInfo) GetApplications() []*common.Application

func (*BlobInfo) GetDiffId added in v0.9.0

func (x *BlobInfo) GetDiffId() string

func (*BlobInfo) GetDigest added in v0.9.0

func (x *BlobInfo) GetDigest() string

func (*BlobInfo) GetMisconfigurations added in v0.19.0

func (x *BlobInfo) GetMisconfigurations() []*common.Misconfiguration

func (*BlobInfo) GetOpaqueDirs added in v0.9.0

func (x *BlobInfo) GetOpaqueDirs() []string

func (*BlobInfo) GetOs added in v0.9.0

func (x *BlobInfo) GetOs() *common.OS

func (*BlobInfo) GetPackageInfos added in v0.9.0

func (x *BlobInfo) GetPackageInfos() []*common.PackageInfo

func (*BlobInfo) GetSchemaVersion added in v0.9.0

func (x *BlobInfo) GetSchemaVersion() int32

func (*BlobInfo) GetWhiteoutFiles added in v0.9.0

func (x *BlobInfo) GetWhiteoutFiles() []string

func (*BlobInfo) ProtoMessage added in v0.9.0

func (*BlobInfo) ProtoMessage()

func (*BlobInfo) ProtoReflect added in v0.19.0

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

func (*BlobInfo) Reset added in v0.9.0

func (x *BlobInfo) Reset()

func (*BlobInfo) String added in v0.9.0

func (x *BlobInfo) String() string

type Cache

func NewCacheJSONClient

func NewCacheJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Cache

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

func NewCacheProtobufClient

func NewCacheProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Cache

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

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 MissingBlobsRequest added in v0.9.0

type MissingBlobsRequest struct {
	ArtifactId string   `protobuf:"bytes,1,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"`
	BlobIds    []string `protobuf:"bytes,2,rep,name=blob_ids,json=blobIds,proto3" json:"blob_ids,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use MissingBlobsRequest.ProtoReflect.Descriptor instead.

func (*MissingBlobsRequest) GetArtifactId added in v0.9.0

func (x *MissingBlobsRequest) GetArtifactId() string

func (*MissingBlobsRequest) GetBlobIds added in v0.9.0

func (x *MissingBlobsRequest) GetBlobIds() []string

func (*MissingBlobsRequest) ProtoMessage added in v0.9.0

func (*MissingBlobsRequest) ProtoMessage()

func (*MissingBlobsRequest) ProtoReflect added in v0.19.0

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

func (*MissingBlobsRequest) Reset added in v0.9.0

func (x *MissingBlobsRequest) Reset()

func (*MissingBlobsRequest) String added in v0.9.0

func (x *MissingBlobsRequest) String() string

type MissingBlobsResponse added in v0.9.0

type MissingBlobsResponse struct {
	MissingArtifact bool     `protobuf:"varint,1,opt,name=missing_artifact,json=missingArtifact,proto3" json:"missing_artifact,omitempty"`
	MissingBlobIds  []string `protobuf:"bytes,2,rep,name=missing_blob_ids,json=missingBlobIds,proto3" json:"missing_blob_ids,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use MissingBlobsResponse.ProtoReflect.Descriptor instead.

func (*MissingBlobsResponse) GetMissingArtifact added in v0.9.0

func (x *MissingBlobsResponse) GetMissingArtifact() bool

func (*MissingBlobsResponse) GetMissingBlobIds added in v0.9.0

func (x *MissingBlobsResponse) GetMissingBlobIds() []string

func (*MissingBlobsResponse) ProtoMessage added in v0.9.0

func (*MissingBlobsResponse) ProtoMessage()

func (*MissingBlobsResponse) ProtoReflect added in v0.19.0

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

func (*MissingBlobsResponse) Reset added in v0.9.0

func (x *MissingBlobsResponse) Reset()

func (*MissingBlobsResponse) String added in v0.9.0

func (x *MissingBlobsResponse) String() string

type PutArtifactRequest added in v0.9.0

type PutArtifactRequest struct {
	ArtifactId   string        `protobuf:"bytes,1,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"`
	ArtifactInfo *ArtifactInfo `protobuf:"bytes,2,opt,name=artifact_info,json=artifactInfo,proto3" json:"artifact_info,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use PutArtifactRequest.ProtoReflect.Descriptor instead.

func (*PutArtifactRequest) GetArtifactId added in v0.9.0

func (x *PutArtifactRequest) GetArtifactId() string

func (*PutArtifactRequest) GetArtifactInfo added in v0.9.0

func (x *PutArtifactRequest) GetArtifactInfo() *ArtifactInfo

func (*PutArtifactRequest) ProtoMessage added in v0.9.0

func (*PutArtifactRequest) ProtoMessage()

func (*PutArtifactRequest) ProtoReflect added in v0.19.0

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

func (*PutArtifactRequest) Reset added in v0.9.0

func (x *PutArtifactRequest) Reset()

func (*PutArtifactRequest) String added in v0.9.0

func (x *PutArtifactRequest) String() string

type PutBlobRequest added in v0.9.0

type PutBlobRequest struct {
	DiffId   string    `protobuf:"bytes,1,opt,name=diff_id,json=diffId,proto3" json:"diff_id,omitempty"`
	BlobInfo *BlobInfo `protobuf:"bytes,3,opt,name=blob_info,json=blobInfo,proto3" json:"blob_info,omitempty"`
	// contains filtered or unexported fields
}

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

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

Deprecated: Use PutBlobRequest.ProtoReflect.Descriptor instead.

func (*PutBlobRequest) GetBlobInfo added in v0.9.0

func (x *PutBlobRequest) GetBlobInfo() *BlobInfo

func (*PutBlobRequest) GetDiffId added in v0.9.0

func (x *PutBlobRequest) GetDiffId() string

func (*PutBlobRequest) ProtoMessage added in v0.9.0

func (*PutBlobRequest) ProtoMessage()

func (*PutBlobRequest) ProtoReflect added in v0.19.0

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

func (*PutBlobRequest) Reset added in v0.9.0

func (x *PutBlobRequest) Reset()

func (*PutBlobRequest) String added in v0.9.0

func (x *PutBlobRequest) String() string

type PutResponse

type PutResponse struct {
	Os   *common.OS `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
	Eosl bool       `protobuf:"varint,2,opt,name=eosl,proto3" json:"eosl,omitempty"`
	// contains filtered or unexported fields
}

func (*PutResponse) Descriptor deprecated

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

Deprecated: Use PutResponse.ProtoReflect.Descriptor instead.

func (*PutResponse) GetEosl

func (x *PutResponse) GetEosl() bool

func (*PutResponse) GetOs

func (x *PutResponse) GetOs() *common.OS

func (*PutResponse) ProtoMessage

func (*PutResponse) ProtoMessage()

func (*PutResponse) ProtoReflect added in v0.19.0

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

func (*PutResponse) Reset

func (x *PutResponse) Reset()

func (*PutResponse) String

func (x *PutResponse) String() string

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 NewCacheServer

func NewCacheServer(svc Cache, opts ...interface{}) TwirpServer

NewCacheServer 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