Skip to content

Commit

Permalink
Use common utils method in iam policy data source (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosbo authored Sep 11, 2017
1 parent 22865ce commit a42d59b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 1 addition & 14 deletions google/data_source_google_iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func dataSourceGoogleIamPolicyRead(d *schema.ResourceData, meta interface{}) err
binding := v.(map[string]interface{})
policy.Bindings[i] = &cloudresourcemanager.Binding{
Role: binding["role"].(string),
Members: dataSourceGoogleIamPolicyMembers(binding["members"].(*schema.Set)),
Members: convertStringSet(binding["members"].(*schema.Set)),
}
}

Expand All @@ -88,16 +88,3 @@ func dataSourceGoogleIamPolicyRead(d *schema.ResourceData, meta interface{}) err

return nil
}

// dataSourceGoogleIamPolicyMembers converts a set of members in a binding
// (a member is a principal, usually an e-mail address) into an array of
// string.
func dataSourceGoogleIamPolicyMembers(d *schema.Set) []string {
var members []string
members = make([]string, d.Len())

for i, v := range d.List() {
members[i] = v.(string)
}
return members
}
1 change: 1 addition & 0 deletions google/data_source_google_iam_policy_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package google

0 comments on commit a42d59b

Please sign in to comment.