MCPcopy Create free account
hub / github.com/cli/cli / GetByDigest

Method GetByDigest

pkg/cmd/attestation/api/client.go:89–102  ·  view source on GitHub ↗

GetByDigest fetches the attestation by digest and either owner or repo depending on which is provided

(params FetchParams)

Source from the content-addressed store, hash-verified

87// GetByDigest fetches the attestation by digest and either owner or repo
88// depending on which is provided
89func (c *LiveClient) GetByDigest(params FetchParams) ([]*Attestation, error) {
90 c.logger.VerbosePrintf("Fetching attestations for artifact digest %s\n\n", params.Digest)
91 attestations, err := c.getAttestations(params)
92 if err != nil {
93 return nil, err
94 }
95
96 bundles, err := c.fetchBundleFromAttestations(attestations)
97 if err != nil {
98 return nil, fmt.Errorf("failed to fetch bundle with URL: %w", err)
99 }
100
101 return bundles, nil
102}
103
104func (c *LiveClient) buildRequestURL(params FetchParams) (safeurl.SafeURL, error) {
105 if err := params.Validate(); err != nil {

Calls 4

getAttestationsMethod · 0.95
VerbosePrintfMethod · 0.80
ErrorfMethod · 0.65

Tested by 4

TestGetByDigest_ErrorFunction · 0.76