common

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthzListToMap

func AuthzListToMap(paths []string) map[string][]string

AuthzListToMap converts a list of GA4GH resource-path strings (e.g. "/programs/org/projects/proj") to the wire-format org→projects map.

func AuthzMapFromScope

func AuthzMapFromScope(org, project string) map[string][]string

AuthzMapFromScope builds the wire-format authorizations map from an org and project. Empty project means org-wide access (value is empty slice).

func AuthzMapToList

func AuthzMapToList(authzMap map[string][]string) []string

AuthzMapToList converts the wire-format org→projects map back to a list of GA4GH resource-path strings for internal storage.

func BuildDrsObjWithPrefix

func BuildDrsObjWithPrefix(fileName string, checksum string, size int64, drsId string, bucket string, org string, project string, prefix string) (*drsapi.DrsObject, error)

BuildDrsObjWithPrefix builds a DRS object with an S3 access URL derived from the provided bucket, org, project, and storage prefix.

func ConvertToCandidate

func ConvertToCandidate(obj *drsapi.DrsObject) drsapi.DrsObjectCandidate

ConvertToCandidate converts a DRS object to a registration candidate, stripping server-assigned fields (Id, SelfUri, timestamps).

func DrsUUID

func DrsUUID(org, project, hash string) string

DrsUUID generates a deterministic UUID for a DRS object from org, project, and hash.

func NormalizeChecksum

func NormalizeChecksum(raw string) string

NormalizeChecksum trims whitespace and an optional sha256: prefix.

func NormalizeOid

func NormalizeOid(oid string) string

NormalizeOid strips an optional "sha256:" prefix, lowercases, and validates that the result is a 64-character hex string. Returns "" for invalid input.

func ResourcePath

func ResourcePath(org, project string) (string, error)

ResourcePath returns the GA4GH resource path for an org/project scope, e.g. "/programs/myorg/projects/myproject".

func StoragePrefix

func StoragePrefix(org, project string) string

StoragePrefix returns the storage path prefix for an org/project scope (no leading slash), e.g. "programs/myorg/projects/myproject".

Types

type ObjectBuilder

type ObjectBuilder struct {
	Bucket        string
	Project       string
	Organization  string
	StoragePrefix string
	PathStyle     string
}

ObjectBuilder constructs DRS objects for a given bucket and project scope.

func NewObjectBuilder

func NewObjectBuilder(bucket, project string) ObjectBuilder

NewObjectBuilder creates an ObjectBuilder for the given bucket and project.

func (ObjectBuilder) Build

func (b ObjectBuilder) Build(fileName string, checksum string, size int64, drsId string) (*drsapi.DrsObject, error)

Build constructs a DRS object with the given file metadata.

Jump to

Keyboard shortcuts

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