mirror of
https://github.com/mudler/luet.git
synced 2025-09-10 11:39:35 +00:00
Update gomod and vendor
This commit is contained in:
30
vendor/github.com/moby/buildkit/session/secrets/secrets.go
generated
vendored
Normal file
30
vendor/github.com/moby/buildkit/session/secrets/secrets.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package secrets
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type SecretStore interface {
|
||||
GetSecret(context.Context, string) ([]byte, error)
|
||||
}
|
||||
|
||||
var ErrNotFound = errors.Errorf("not found")
|
||||
|
||||
func GetSecret(ctx context.Context, c session.Caller, id string) ([]byte, error) {
|
||||
client := NewSecretsClient(c.Conn())
|
||||
resp, err := client.GetSecret(ctx, &GetSecretRequest{
|
||||
ID: id,
|
||||
})
|
||||
if err != nil {
|
||||
if st, ok := status.FromError(errors.Cause(err)); ok && (st.Code() == codes.Unimplemented || st.Code() == codes.NotFound) {
|
||||
return nil, errors.Wrapf(ErrNotFound, "secret %s not found", id)
|
||||
}
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
return resp.Data, nil
|
||||
}
|
Reference in New Issue
Block a user