-
Notifications
You must be signed in to change notification settings - Fork 0
/
credentials.go
44 lines (36 loc) · 1.24 KB
/
credentials.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2016 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package cloudsigma
import (
"github.com/juju/errors"
"github.com/juju/juju/cloud"
"github.com/juju/juju/environs"
)
type environProviderCredentials struct{}
const (
credAttrUsername = "username"
credAttrPassword = "password"
)
// CredentialSchemas is part of the environs.ProviderCredentials interface.
func (environProviderCredentials) CredentialSchemas() map[cloud.AuthType]cloud.CredentialSchema {
return map[cloud.AuthType]cloud.CredentialSchema{
cloud.UserPassAuthType: {{
"username", cloud.CredentialAttr{
Description: "account username",
},
}, {
"password", cloud.CredentialAttr{
Description: "account password",
Hidden: true,
},
}},
}
}
// DetectCredentials is part of the environs.ProviderCredentials interface.
func (environProviderCredentials) DetectCredentials() (*cloud.CloudCredential, error) {
return nil, errors.NotFoundf("credentials")
}
// FinalizeCredential is part of the environs.ProviderCredentials interface.
func (environProviderCredentials) FinalizeCredential(_ environs.FinalizeCredentialContext, args environs.FinalizeCredentialParams) (*cloud.Credential, error) {
return &args.Credential, nil
}