func newReference()

in lambda/s3/transport.go [91:106]


func newReference(s3uri *tarfile.S3Uri, ref reference.NamedTagged, sourceIndex int) (types.ImageReference, error) {
	if ref != nil && sourceIndex != -1 {
		return nil, errors.Errorf("Invalid s3: reference: cannot use both a tag and a source index")
	}
	if _, isDigest := ref.(reference.Canonical); isDigest {
		return nil, errors.Errorf("s3 doesn't support digest references: %s", ref.String())
	}
	if sourceIndex != -1 && sourceIndex < 0 {
		return nil, errors.Errorf("Invalid s3: reference: index @%d must not be negative", sourceIndex)
	}
	return &s3ArchiveReference{
		s3uri:       s3uri,
		ref:         ref,
		sourceIndex: sourceIndex,
	}, nil
}