feat(credentials): Add PasswordAttributes credential type (#6110)
This commit is contained in:
1 parent
d0050ad881
commit
5cf33fa8b3
5 files changed
+146
-37
No files matched your search
@@ -16,6 +16,7 @@ func init() {
|
||||
globals.RegisterPrefixToResourceInfo(globals.UsernamePasswordCredentialPrefix, resource.Credential, Domain, UsernamePasswordSubtype)
|
||||
globals.RegisterPrefixToResourceInfo(globals.UsernamePasswordDomainCredentialPrefix, resource.Credential, Domain, UsernamePasswordDomainSubtype)
|
||||
globals.RegisterPrefixToResourceInfo(globals.UsernamePasswordCredentialPreviousPrefix, resource.Credential, Domain, UsernamePasswordSubtype)
|
||||
globals.RegisterPrefixToResourceInfo(globals.PasswordCredentialPrefix, resource.Credential, Domain, PasswordSubtype)
|
||||
globals.RegisterPrefixToResourceInfo(globals.SshPrivateKeyCredentialPrefix, resource.Credential, Domain, SshPrivateKeySubtype)
|
||||
globals.RegisterPrefixToResourceInfo(globals.JsonCredentialPrefix, resource.Credential, Domain, JsonSubtype)
|
||||
}
|
||||
@@ -25,6 +26,8 @@ const (
|
||||
|
||||
UsernamePasswordDomainSubtype = globals.Subtype("username_password_domain")
|
||||
|
||||
PasswordSubtype = globals.Subtype("password")
|
||||
|
||||
SshPrivateKeySubtype = globals.Subtype("ssh_private_key")
|
||||
|
||||
JsonSubtype = globals.Subtype("json")
|
||||
@@ -48,6 +51,15 @@ func NewUsernamePasswordDomainCredentialId(ctx context.Context) (string, error)
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// PasswordCredentialId generates a new public ID for a password credential.
|
||||
func PasswordCredentialId(ctx context.Context) (string, error) {
|
||||
id, err := db.NewPublicId(ctx, globals.PasswordCredentialPrefix)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(ctx, err, "credential.PasswordCredentialId")
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// New SshPrivateKeyCredentialId generates a new public ID for an SSH private key credential.
|
||||
func NewSshPrivateKeyCredentialId(ctx context.Context) (string, error) {
|
||||
id, err := db.NewPublicId(ctx, globals.SshPrivateKeyCredentialPrefix)
|
||||
|
||||
Reference in new issue
Block a user