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

Method getAPIGatewayVIPsPerRegion

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

Source from the content-addressed store, hash-verified

913}
914
915func (m *EndpointsModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) {
916 defer func() {
917 m.CommandCounter.DecrExecuting()
918 m.CommandCounter.IncrComplete()
919 wg.Done()
920
921 }()
922 semaphore <- struct{}{}
923 defer func() {
924 <-semaphore
925 }()
926 // m.CommandCounter.IncrTotal()
927 m.CommandCounter.DecrPending()
928 m.CommandCounter.IncrExecuting()
929
930 Items, err := sdk.CachedApiGatewayGetRestAPIs(m.APIGatewayClient, aws.ToString(m.Caller.Account), r)
931
932 if err != nil {
933 m.modLog.Error(err.Error())
934 m.CommandCounter.IncrError()
935 return
936 }
937
938 GetDomainNames, err := sdk.CachedApiGatewayGetDomainNames(m.APIGatewayClient, aws.ToString(m.Caller.Account), r)
939
940 if err != nil {
941 if errors.As(err, &oe) {
942 m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation()))
943 }
944 m.modLog.Error(err.Error())
945 m.CommandCounter.IncrError()
946 }
947
948 for _, item := range GetDomainNames {
949
950 domain := aws.ToString(item.DomainName)
951 GetBasePathMappings, err := sdk.CachedApiGatewayGetBasePathMappings(m.APIGatewayClient, aws.ToString(m.Caller.Account), r, item.DomainName)
952
953 if err != nil {
954 if errors.As(err, &oe) {
955 m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation()))
956 }
957 m.modLog.Error(err.Error())
958 m.CommandCounter.IncrError()
959 break
960 }
961
962 for _, mapping := range GetBasePathMappings {
963 stage := aws.ToString(mapping.Stage)
964 basePath := aws.ToString(mapping.BasePath)
965 if basePath == "(none)" {
966 basePath = "" // Empty string since '/' is already prepended
967 }
968
969 for _, api := range Items {
970 if api.Id != nil && aws.ToString(api.Id) == aws.ToString(mapping.RestApiId) {
971 endpoints := m.getEndpointsPerAPIGateway(r, api)
972 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