MCPcopy Index your code
hub / github.com/rilldata/rill / generateSignedDownloadURL

Method generateSignedDownloadURL

admin/server/assets.go:252–270  ·  view source on GitHub ↗

generateSignedDownloadURL generates a signed URL for downloading the asset.

(asset *database.Asset)

Source from the content-addressed store, hash-verified

250
251// generateSignedDownloadURL generates a signed URL for downloading the asset.
252func (s *Server) generateSignedDownloadURL(asset *database.Asset) (string, error) {
253 // asset.Path is of the form "gs://<bucket>/<path>"
254 u, err := url.Parse(asset.Path)
255 if err != nil {
256 return "", err
257 }
258
259 opts := &storage.SignedURLOptions{
260 Scheme: storage.SigningSchemeV4,
261 Method: "GET",
262 Expires: time.Now().Add(15 * time.Minute),
263 }
264
265 signedURL, err := s.admin.Assets.SignedURL(strings.TrimPrefix(u.Path, "/"), opts)
266 if err != nil {
267 return "", err
268 }
269 return signedURL, nil
270}
271
272// newGCSUploadHeaders returns a map of headers to be used when generating a signed URL for uploading an asset to GCS.
273// They are used to enforce a maximum asset size for uploads.

Callers 3

GetRepoMetaMethod · 0.95
pushAssetToGitMethod · 0.95
GetCloneCredentialsMethod · 0.95

Calls 2

ParseMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected