File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
pkg/controller/atlasproject Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package atlasproject
33import (
44 "context"
55 "errors"
6+ "regexp"
67
78 "go.mongodb.org/atlas/mongodbatlas"
89
@@ -178,13 +179,27 @@ func (a atlasPE) InterfaceEndpointID() string {
178179 return a .PrivateEndpoints [0 ]
179180 }
180181
181- if len (a .EndpointGroupNames ) != 0 {
182- return a . EndpointGroupNames [ 0 ]
182+ if len (a .ServiceAttachmentNames ) != 0 {
183+ return parseInterfaceIDForGCP ( a . ServiceAttachmentNames )
183184 }
184185
185186 return ""
186187}
187188
189+ func parseInterfaceIDForGCP (serviceAttachmentNames []string ) string {
190+ if len (serviceAttachmentNames ) < 1 {
191+ return ""
192+ }
193+
194+ expr := regexp .MustCompile (`(\w+)-\d$` )
195+ matches := expr .FindStringSubmatch (serviceAttachmentNames [0 ])
196+ if len (matches ) < 2 {
197+ return ""
198+ }
199+
200+ return matches [1 ]
201+ }
202+
188203func getAllPrivateEndpoints (client mongodbatlas.Client , projectID string ) (result []atlasPE , err error ) {
189204 providers := []string {"AWS" , "AZURE" , "GCP" }
190205 for _ , provider := range providers {
You can’t perform that action at this time.
0 commit comments