-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathuser_login.go
More file actions
54 lines (51 loc) · 1.5 KB
/
user_login.go
File metadata and controls
54 lines (51 loc) · 1.5 KB
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
45
46
47
48
49
50
51
52
53
54
package upcloud
import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/importer"
"github.com/1Password/shell-plugins/sdk/provision"
"github.com/1Password/shell-plugins/sdk/schema"
"github.com/1Password/shell-plugins/sdk/schema/credname"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)
func UserLogin() schema.CredentialType {
return schema.CredentialType{
Name: credname.UserLogin,
DocsURL: sdk.URL("https://upcloudltd.github.io/upcloud-cli/"),
ManagementURL: sdk.URL("https://hub.upcloud.com/people/accounts"),
Fields: []schema.CredentialField{
{
Name: fieldname.Username,
MarkdownDescription: "Username.",
Secret: false,
Optional: false,
Composition: &schema.ValueComposition{
Length: 20,
Charset: schema.Charset{
Uppercase: true,
Digits: true,
},
},
},
{
Name: fieldname.Password,
MarkdownDescription: "Password.",
Secret: true,
Optional: false,
Composition: &schema.ValueComposition{
Length: 36,
Charset: schema.Charset{
Lowercase: true,
Digits: true,
},
},
},
},
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryAll(
importer.TryEnvVarPair(defaultEnvVarMapping),
)}
}
var defaultEnvVarMapping = map[string]sdk.FieldName{
"UPCLOUD_USERNAME": fieldname.Username,
"UPCLOUD_PASSWORD": fieldname.Password,
}