MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / ValidateReaderClient

Function ValidateReaderClient

pkg/credentials/azurekv/keyvault.go:192–208  ·  view source on GitHub ↗
(m *Manager, pathPrefix string)

Source from the content-addressed store, hash-verified

190}
191
192func ValidateReaderClient(m *Manager, pathPrefix string) error {
193 // try to retrieve a non-existing key
194 // if we get 404 means that we have permissions to read in that path
195 secretName := strings.Join([]string{pathPrefix, healthCheckNonExisting, uuid.NewString()}, "-")
196 _, err := m.client.GetSecret(context.Background(), secretName, "", nil)
197 var respErr *azcore.ResponseError
198 if err != nil {
199 if errors.As(err, &respErr) && respErr.StatusCode == 404 {
200 // Everything is ok
201 return nil
202 }
203
204 return fmt.Errorf("failed to get secret: %w", err)
205 }
206
207 return errors.New("expected error")
208}

Callers 2

newAzureKBManagerFunction · 0.92

Calls 1

GetSecretMethod · 0.65

Tested by 1