artifactcontent

package
v0.0.0-...-4a11b79 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package artifactcontent can serve artifact content via plain HTTP securely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RBEConn

func RBEConn(ctx context.Context) (*grpc.ClientConn, error)

RBEConn creates a gRPC connection to RBE authenticated as self.

func RegisterRBEInstanceFlag

func RegisterRBEInstanceFlag(fs *flag.FlagSet, target *string)

RegisterRBEInstanceFlag registers -artifact-rbe-instance flag.

Types

type HostnameProvider

type HostnameProvider func(requestHost string) string

HostnameProvider returns a hostname to use in generated signed URLs.

As input it accepts `host` metadata value of the GetArtifacts etc. requests. It may be an empty string. HostnameProvider must return some host name in this case too.

type Server

type Server struct {
	// Use http:// (not https://) for generated URLs.
	InsecureURLs bool

	// Returns a hostname to use in generated signed URLs.
	HostnameProvider HostnameProvider

	// Reads a blob from RBE-CAS.
	ReadCASBlob func(ctx context.Context, req *bytestream.ReadRequest) (bytestream.ByteStream_ReadClient, error)

	// Full name of the RBE-CAS instance used to store artifacts,
	// e.g. "projects/luci-resultdb/instances/artifacts".
	RBECASInstanceName string
	// contains filtered or unexported fields
}

Server can serve artifact content, and generate signed URLs to the content.

func (*Server) GenerateSignedURL

func (s *Server) GenerateSignedURL(ctx context.Context, requestHost, artifactName string) (url string, expiration time.Time, err error)

GenerateSignedURL generates a signed HTTPS URL back to this server. The returned token works only with the same artifact name.

func (*Server) Init

func (s *Server) Init(ctx context.Context) error

Init initializes the server. It must be called before calling other methods.

func (*Server) InstallHandlers

func (s *Server) InstallHandlers(r *router.Router)

InstallHandlers installs handlers to serve artifact content.

May be called multiple times to install the handler into multiple virtual hosts.

Jump to

Keyboard shortcuts

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