func()

in internal/scanners/pep.go [31:59]


func (s *PrivateEndpointScanner) ListResourcesWithPrivateEndpoints() (map[string]bool, error) {
	models.LogSubscriptionScan(s.config.SubscriptionID, "Private Endpoints")

	res := map[string]bool{}
	if s.hasPrivateEndpointFunc == nil {
		opt := armnetwork.PrivateEndpointsClientListBySubscriptionOptions{}

		pager := s.client.NewListBySubscriptionPager(&opt)

		for pager.More() {
			resp, err := pager.NextPage(s.config.Ctx)
			if err != nil {
				return nil, err
			}

			for _, v := range resp.Value {
				for _, c := range v.Properties.PrivateLinkServiceConnections {
					if len(*c.Properties.PrivateLinkServiceID) > 0 {
						res[*c.Properties.PrivateLinkServiceID] = true
					}
				}
			}
		}

		return res, nil
	}

	return s.hasPrivateEndpointFunc()
}