-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for managing organization ip allow list entries (Fixes #1067) #1315
Add support for managing organization ip allow list entries (Fixes #1067) #1315
Conversation
@@ -91,6 +91,17 @@ func buildChecksumID(v []string) string { | |||
return fmt.Sprintf("%x", bs) | |||
} | |||
|
|||
func expandNestedSet(m map[string]interface{}, target string) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Moved from github/util_v4.go
because this isn't v4 api specific (as far as I can tell) and looked similar to the expandStringList
func that was here, too.
@@ -10,17 +11,6 @@ type PageInfo struct { | |||
HasNextPage bool | |||
} | |||
|
|||
func expandNestedSet(m map[string]interface{}, target string) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func githubv4IsNodeNotFoundError(err error) bool { | ||
return err != nil && strings.HasPrefix(err.Error(), "Could not resolve to a node with the global id") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Returns all IP allow list entries for an organization. | ||
* This util function is used by both data_source and resource elements. | ||
*/ | ||
func getOrganizationIpAllowListEntries(meta interface{}) ([]IpAllowListEntry, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was moved fromdata_source_github_organization_ip_allow_list.go
because I wanted to make use of this data in the resource.
My first attempt was having the resource call the datasource function but I felt that was too tightly coupled and a bit hacky.
Thanks @douglascayers |
Changes
github/config.go
nodeId
which is required with graphql (v4) api callsid
database id is primarily for rest (v3) api callsgithub/provider.go
andgithub/resource_github_organization_ip_allow_list.go
github_organization_ip_allow_list_entry
resource to read/create/update/delete ip allow list entriesgithub/util_v4.go
andgithub/util.go
util.go
github/util_v4_organization_ip_allow_list.go
github/data_source_github_organization_ip_allow_list.go
Tests
TODO
How to Test
TODO
Test Output
Usage
Example configuration: