@@ -10,52 +10,39 @@ import (
1010
1111func dataSourceEnterpriseMember () * schema.Resource {
1212 return & schema.Resource {
13- Read : dataSourceEnterpriseMemberRead ,
13+ Description : "Retrieves informantion about a existing enterprise member." ,
14+ Read : dataSourceEnterpriseMemberRead ,
1415 Schema : map [string ]* schema.Schema {
1516 "enterprise" : {
16- Type : schema .TypeString ,
17- Required : true ,
17+ Description : "Name of the enterprise. [Check your enterprises](https://deploygate.com/enterprises)" ,
18+ Type : schema .TypeString ,
19+ Required : true ,
1820 },
1921 "users" : {
20- Type : schema .TypeSet ,
21- Computed : true ,
22+ Description : "Data of the enterprise users." ,
23+ Type : schema .TypeSet ,
24+ Computed : true ,
2225 Elem : & schema.Resource {
2326 Schema : map [string ]* schema.Schema {
2427 "type" : {
25- Type : schema .TypeString ,
26- Optional : true ,
28+ Description : "Type of the user that is user or tester." ,
29+ Type : schema .TypeString ,
30+ Optional : true ,
2731 },
2832 "name" : {
29- Type : schema .TypeString ,
30- Optional : true ,
33+ Description : "Name of the user" ,
34+ Type : schema .TypeString ,
35+ Optional : true ,
3136 },
3237 "icon_url" : {
33- Type : schema .TypeString ,
34- Optional : true ,
38+ Description : "Icon URL for user profile." ,
39+ Type : schema .TypeString ,
40+ Optional : true ,
3541 },
3642 "url" : {
37- Type : schema .TypeString ,
38- Optional : true ,
39- },
40- "full_name" : {
41- Type : schema .TypeString ,
42- Optional : true ,
43- },
44- "email" : {
45- Type : schema .TypeString ,
46- Optional : true ,
47- },
48- "role" : {
49- Type : schema .TypeString ,
50- Optional : true ,
51- },
52- "created_at" : {
53- Type : schema .TypeString ,
54- Optional : true ,
55- },
56- "last_access_at" : {
57- Type : schema .TypeString ,
58- Optional : true ,
43+ Description : "URL of the user account." ,
44+ Type : schema .TypeString ,
45+ Optional : true ,
5946 },
6047 },
6148 },
@@ -71,18 +58,20 @@ func dataSourceEnterpriseMemberRead(d *schema.ResourceData, meta interface{}) er
7158
7259 log .Printf ("[DEBUG] dataSourceEnterpriseMemberRead: %s" , enterprise )
7360
74- e := & go_deploygate.ListEnterpriseMembersRequest {
61+ req := & go_deploygate.ListEnterpriseMembersRequest {
7562 Enterprise : enterprise ,
7663 }
7764
78- rs , err := client .ListEnterpriseMembers (e )
65+ resp , err := client .ListEnterpriseMembers (req )
7966
8067 if err != nil {
8168 return err
8269 }
8370
71+ users := converEnterpriseMemberToMember (resp .Users )
72+
8473 d .SetId (fmt .Sprintf ("%s" , enterprise ))
85- d .Set ("users" , rs . Users )
74+ d .Set ("users" , users )
8675
8776 return nil
8877}
0 commit comments