forked from datadrivers/terraform-provider-nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_source_security_user.go
59 lines (54 loc) · 1.59 KB
/
data_source_security_user.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package security
import (
"github.com/datadrivers/terraform-provider-nexus/internal/schema/common"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func DataSourceSecurityUser() *schema.Resource {
return &schema.Resource{
Description: "Use this data source to get a user data structure.",
Read: dataSourceSecurityUserRead,
Schema: map[string]*schema.Schema{
"id": common.DataSourceID,
"userid": {
Description: "The userid which is required for login",
Type: schema.TypeString,
Required: true,
},
"firstname": {
Description: "The first name of the user.",
Type: schema.TypeString,
Computed: true,
},
"lastname": {
Description: "The last name of the user.",
Type: schema.TypeString,
Computed: true,
},
"email": {
Description: "The email address associated with the user.",
Type: schema.TypeString,
Computed: true,
},
"roles": {
Description: "The roles which the user has been assigned within Nexus.",
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"status": {
Description: "The user's status, e.g. active or disabled.",
Type: schema.TypeString,
Computed: true,
},
"source": {
Description: "The user's source, e.g. default (local) or LDAP.",
Type: schema.TypeString,
Computed: true,
},
},
}
}
func dataSourceSecurityUserRead(d *schema.ResourceData, m interface{}) error {
d.SetId(d.Get("userid").(string))
return resourceSecurityUserRead(d, m)
}