Skip to content

Commit

Permalink
Add CredentialsType
Browse files Browse the repository at this point in the history
Co-authored-by: Nic Cope <[email protected]>
Signed-off-by: Clément Blaise <[email protected]>
  • Loading branch information
clementblaise and negz committed Jun 3, 2024
1 parent 18b5431 commit f3cde1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func GetCredential(req *v1beta1.RunFunctionRequest, name string) (resource.Crede

switch t := cred.GetSource().(type) {
case *v1beta1.Credentials_CredentialData:
return resource.Credential{Data: cred.GetCredentialData().GetData()}, nil
return resource.Credential{Type: resource.CredentialsTypeData, Data: cred.GetCredentialData().GetData()}, nil
default:
return resource.Credential{}, errors.Errorf("%s: not a supported credential source", t)
}
Expand Down
9 changes: 9 additions & 0 deletions resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ type Extra struct {
Resource *unstructured.Unstructured
}

// CredentialsType is the type of credentials
type CredentialsType string

const (
// CredentialsTypeData is a Credential which of type Data
CredentialsTypeData = "Data"
)

// Credential is a secret requested by a Function
type Credential struct {
Type CredentialsType
Data map[string][]byte
}

Expand Down

0 comments on commit f3cde1b

Please sign in to comment.