From e51b4efaa9008ebeaf373b91deed654987489c79 Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Mon, 16 Dec 2024 11:50:46 -0700 Subject: [PATCH] remove unused method Signed-off-by: Meredith Lancaster --- pkg/cmd/attestation/api/client.go | 15 ++++++--------- pkg/cmd/attestation/api/mock_client.go | 11 +++-------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/pkg/cmd/attestation/api/client.go b/pkg/cmd/attestation/api/client.go index acc4a1014..47cff27ed 100644 --- a/pkg/cmd/attestation/api/client.go +++ b/pkg/cmd/attestation/api/client.go @@ -32,7 +32,6 @@ type apiClient interface { } type Client interface { - // FetchAttestationsWithSASURL(attestations []*Attestation) ([]*Attestation, error) GetByRepoAndDigest(repo, digest string, limit int) ([]*Attestation, error) GetByOwnerAndDigest(owner, digest string, limit int) ([]*Attestation, error) GetTrustDomain() (string, error) @@ -65,35 +64,33 @@ func (c *LiveClient) GetByRepoAndDigest(repo, digest string, limit int) ([]*Atte return nil, fmt.Errorf("failed to fetch attestation by repo and digest: %w", err) } - compressedBundles, err := c.fetchBundlesWithSASURL(attestations) + bundles, err := c.fetchBundlesWithSASURL(attestations) if err != nil { return nil, fmt.Errorf("failed to fetch attestation with SAS URL: %w", err) } - // decompress before returning - return compressedBundles, nil + return bundles, nil } -func (c *LiveClient) BuildOwnerAndDigestURL(owner, digest string) string { +func (c *LiveClient) buildOwnerAndDigestURL(owner, digest string) string { owner = strings.Trim(owner, "/") return fmt.Sprintf(GetAttestationByOwnerAndSubjectDigestPath, owner, digest) } // GetByOwnerAndDigest fetches attestation by owner and digest func (c *LiveClient) GetByOwnerAndDigest(owner, digest string, limit int) ([]*Attestation, error) { - url := c.BuildOwnerAndDigestURL(owner, digest) + url := c.buildOwnerAndDigestURL(owner, digest) attestations, err := c.getAttestations(url, owner, digest, limit) if err != nil { return nil, fmt.Errorf("failed to fetch attestation by repo and digest: %w", err) } - compressedBundles, err := c.fetchBundlesWithSASURL(attestations) + bundles, err := c.fetchBundlesWithSASURL(attestations) if err != nil { return nil, fmt.Errorf("failed to fetch attestation with SAS URL: %w", err) } - // decompress before returning - return compressedBundles, nil + return bundles, nil } // GetTrustDomain returns the current trust domain. If the default is used diff --git a/pkg/cmd/attestation/api/mock_client.go b/pkg/cmd/attestation/api/mock_client.go index 63dd3d244..bcb51c414 100644 --- a/pkg/cmd/attestation/api/mock_client.go +++ b/pkg/cmd/attestation/api/mock_client.go @@ -7,14 +7,9 @@ import ( ) type MockClient struct { - OnGetByRepoAndDigest func(repo, digest string, limit int) ([]*Attestation, error) - OnGetByOwnerAndDigest func(owner, digest string, limit int) ([]*Attestation, error) - OnGetTrustDomain func() (string, error) - OnFetchAttestationsWithSASURL func(attestations []*Attestation) ([]*Attestation, error) -} - -func (m MockClient) FetchAttestationsWithSASURL(attestations []*Attestation) ([]*Attestation, error) { - return nil, nil + OnGetByRepoAndDigest func(repo, digest string, limit int) ([]*Attestation, error) + OnGetByOwnerAndDigest func(owner, digest string, limit int) ([]*Attestation, error) + OnGetTrustDomain func() (string, error) } func (m MockClient) GetByRepoAndDigest(repo, digest string, limit int) ([]*Attestation, error) {