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

Function ValidateWriterClient

pkg/credentials/azurekv/keyvault.go:172–185  ·  view source on GitHub ↗

ValidateWriterClient checks if the client is valid by writing and deleting a secret in the provided mount path.

(m *Manager, pathPrefix string)

Source from the content-addressed store, hash-verified

170// ValidateWriterClient checks if the client is valid by writing and deleting a secret
171// in the provided mount path.
172func ValidateWriterClient(m *Manager, pathPrefix string) error {
173 secretName := strings.Join([]string{pathPrefix, healthCheckSecret, uuid.NewString()}, "-")
174
175 ctx := context.Background()
176 if _, err := m.client.SetSecret(ctx, secretName, azsecrets.SetSecretParameters{Value: strPtr("")}, nil); err != nil {
177 return fmt.Errorf("failed to set secret: %w", err)
178 }
179
180 if _, err := m.client.DeleteSecret(ctx, secretName, nil); err != nil {
181 return fmt.Errorf("failed to delete secret: %w", err)
182 }
183
184 return nil
185}
186
187// string to pointer
188func strPtr(s string) *string {

Callers 2

newAzureKBManagerFunction · 0.92

Calls 3

strPtrFunction · 0.85
SetSecretMethod · 0.65
DeleteSecretMethod · 0.65

Tested by 1