MCPcopy Create free account
hub / github.com/BishopFox/cloudfox / getAPIGatewayv2VIPsPerRegion

Method getAPIGatewayv2VIPsPerRegion

aws/endpoints.go:1091–1174  ·  view source on GitHub ↗
(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint)

Source from the content-addressed store, hash-verified

1089}
1090
1091func (m *EndpointsModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) {
1092 defer func() {
1093 m.CommandCounter.DecrExecuting()
1094 m.CommandCounter.IncrComplete()
1095 wg.Done()
1096
1097 }()
1098 semaphore <- struct{}{}
1099 defer func() {
1100 <-semaphore
1101 }()
1102 // m.CommandCounter.IncrTotal()
1103 m.CommandCounter.DecrPending()
1104 m.CommandCounter.IncrExecuting()
1105
1106 Items, err := sdk.CachedAPIGatewayv2GetAPIs(m.APIGatewayv2Client, aws.ToString(m.Caller.Account), r)
1107
1108 if err != nil {
1109 m.modLog.Error(err.Error())
1110 m.CommandCounter.IncrError()
1111 return
1112 }
1113
1114 GetDomainNames, err := sdk.CachedAPIGatewayv2GetDomainNames(m.APIGatewayv2Client, aws.ToString(m.Caller.Account), r)
1115
1116 if err != nil {
1117 if errors.As(err, &oe) {
1118 m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation()))
1119 }
1120 m.modLog.Error(err.Error())
1121 m.CommandCounter.IncrError()
1122 }
1123
1124 for _, item := range GetDomainNames {
1125
1126 domain := aws.ToString(item.DomainName)
1127 GetApiMappings, err := sdk.CachedAPIGatewayv2GetApiMappings(m.APIGatewayv2Client, aws.ToString(m.Caller.Account), r, domain)
1128
1129 if err != nil {
1130 if errors.As(err, &oe) {
1131 m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation()))
1132 }
1133 m.modLog.Error(err.Error())
1134 m.CommandCounter.IncrError()
1135 break
1136 }
1137
1138 for _, mapping := range GetApiMappings {
1139 stage := aws.ToString(mapping.Stage)
1140 if stage == "$default" {
1141 stage = ""
1142 }
1143 path := aws.ToString(mapping.ApiMappingKey)
1144
1145 for _, api := range Items {
1146 if api.ApiId != nil && aws.ToString(api.ApiId) == aws.ToString(mapping.ApiId) {
1147 endpoints := m.getEndpointsPerAPIGatewayv2(r, api)
1148 for _, endpoint := range endpoints {

Callers 1

executeChecksMethod · 0.95

Calls 10

DecrExecutingMethod · 0.80
IncrCompleteMethod · 0.80
DecrPendingMethod · 0.80
IncrExecutingMethod · 0.80
ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected