MCPcopy Index your code
hub / github.com/cli/cli / GetByDigest

Method GetByDigest

pkg/cmd/attestation/api/client.go:88–101  ·  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

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

Calls 4

getAttestationsMethod · 0.95
VerbosePrintfMethod · 0.80
ErrorfMethod · 0.65

Tested by 4

TestGetByDigest_ErrorFunction · 0.76