// ZoneNames returns the zones of m.
507980
func (m *Metrics) ZoneNames() []string {
	m.zoneMu.RLock()
	s := m.zoneNames
	m.zoneMu.RUnlock()
	return s
}
261537
func (m *Meta) BuildNames(c *packer.Core) []string {
	// TODO: test

	// Filter the "only"
	if len(m.CoreConfig.Only) > 0 {
		// Build a set of all the available names
		nameSet := make(map[string]struct{})
		for _, n := range c.BuildNames() {
			nameSet[n] = struct{}{}
		}

		// Build our result set which we pre-allocate some sane number
		result := make([]string, 0, len(m.CoreConfig.Only))
		for _, n := range m.CoreConfig.Only {
			if _, ok := nameSet[n]; ok {
				result = append(result, n)
			}
		}

		return result
	}

	// Filter the "except"
	if len(m.CoreConfig.Except) > 0 {
		// Build a set of the things we don't want
		nameSet := make(map[string]struct{})
		for _, n := range m.CoreConfig.Except {
			nameSet[n] = struct{}{}
		}

		// Build our result set which is the names of all builds except
		// those in the given set.
		names := c.BuildNames()
		result := make([]string, 0, len(names))
		for _, n := range names {
			if _, ok := nameSet[n]; !ok {
				result = append(result, n)
			}
		}
		return result
	}

	// We care about everything
	return c.BuildNames()
}
648816
func (z *Zones) Zones(name string) *file.Zone {
	z.RLock()
	zo := z.Z[name]
	z.RUnlock()
	return zo
}
27990
func (s *storeMemoizer) GraphNames(ctx context.Context, names chan<- string) error {
	return s.s.GraphNames(ctx, names)
}
831206
func (gc *Connection) AvailabilityZones(region string) ([]AvailabilityZone, error) {
	rawZones, err := gc.raw.ListAvailabilityZones(gc.projectID, region)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var zones []AvailabilityZone
	for _, rawZone := range rawZones {
		zones = append(zones, AvailabilityZone{rawZone})
	}
	return zones, nil
}
98904
func (p *propZone) GetZoneName() string {
	if p.Zone == nil {
		return ""
	}

	return p.Zone.GetName()
}
1021641
func (c *Client) TimeZones() ([]*models.TimeZone, error) {
	var err error
	var result []*models.TimeZone

	data, err := httpGet(geonamesURL + timeZonesURL)
	if err != nil {
		return nil, err
	}

	parse(data, 1, func(raw [][]byte) bool {
		if len(raw) != 5 {
			return true
		}

		gmtOffset, _ := strconv.ParseFloat(string(raw[2]), 64)
		dstOffset, _ := strconv.ParseFloat(string(raw[3]), 64)
		rawOffset, _ := strconv.ParseFloat(string(raw[4]), 64)

		result = append(result, &models.TimeZone{
			CountryIso2Code: string(raw[0]),
			TimeZoneID:      string(raw[1]),
			GmtOffset:       time.Duration(gmtOffset) * time.Hour,
			DstOffset:       time.Duration(dstOffset) * time.Hour,
			RawOffset:       time.Duration(rawOffset) * time.Hour,
		})

		return true
	})

	return result, nil
}
736668
func (z Zones) Matches(qname string) string {
	zone := ""
	for _, zname := range z {
		if dns.IsSubDomain(zname, qname) {
			// We want the *longest* matching zone, otherwise we may end up in a parent
			if len(zname) > len(zone) {
				zone = zname
			}
		}
	}
	return zone
}
7680
func (d *DNS) Zones() (dnsprovider.Zones, bool) {
	return &zones{
		client: d.client,
	}, true
}
362139
func Zone() (string, error) {
	zone, err := getTrimmed("instance/zone")
	// zone is of the form "projects/<projNum>/zones/<zoneName>".
	if err != nil {
		return "", err
	}
	return zone[strings.LastIndex(zone, "/")+1:], nil
}
986858
func (env *maasEnviron) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	env.availabilityZonesMutex.Lock()
	defer env.availabilityZonesMutex.Unlock()
	if env.availabilityZones == nil {
		var availabilityZones []common.AvailabilityZone
		var err error
		if env.usingMAAS2() {
			availabilityZones, err = env.availabilityZones2(ctx)
			if err != nil {
				return nil, errors.Trace(err)
			}
		} else {
			availabilityZones, err = env.availabilityZones1(ctx)
			if err != nil {
				return nil, errors.Trace(err)
			}
		}
		env.availabilityZones = availabilityZones
	}
	return env.availabilityZones, nil
}
601661
func (d *DNSProvider) getZoneRecords(name string, zone *Zone) ([]Record, error) {
	u := fmt.Sprintf("/zones/%s/records", zone.ID)
	req, err := d.newRequest(http.MethodGet, u, nil)
	if err != nil {
		return nil, err
	}

	query := req.URL.Query()
	query.Add("page_request.filter", fmt.Sprintf("name='%s' and type='TXT'", name))
	req.URL.RawQuery = query.Encode()

	var records Records
	err = d.do(req, &records)
	if err != nil {
		return nil, err
	}

	if len(records.Records) == 0 {
		return nil, fmt.Errorf("did not find record with name %s", name)
	}

	return records.Records, nil
}
1226565
func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) {
	response, err := client.DescribeZonesWithRaw(regionId)
	if err == nil {
		return response.Zones.Zone, nil
	}

	return []ZoneType{}, err
}
192709
func (api *API) ZoneSSLSettings(zoneID string) (ZoneSSLSetting, error) {
	uri := "/zones/" + zoneID + "/settings/ssl"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return ZoneSSLSetting{}, errors.Wrap(err, errMakeRequestError)
	}
	var r ZoneSSLSettingResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return ZoneSSLSetting{}, errors.Wrap(err, errUnmarshalError)
	}
	return r.Result, nil
}
400865
func (cache *addSubnetsCache) cacheZones(ctx context.ProviderCallContext) error {
	if cache.allZones != nil {
		// Already cached.
		logger.Tracef("using cached zones: %v", cache.allZones.SortedValues())
		return nil
	}

	allZones, err := AllZones(ctx, cache.api)
	if err != nil {
		return errors.Annotate(err, "given Zones cannot be validated")
	}
	cache.allZones = set.NewStrings()
	cache.availableZones = set.NewStrings()
	for _, zone := range allZones.Results {
		// AllZones() does not use the Error result field, so no
		// need to check it here.
		if cache.allZones.Contains(zone.Name) {
			logger.Warningf("ignoring duplicated zone %q", zone.Name)
			continue
		}

		if zone.Available {
			cache.availableZones.Add(zone.Name)
		}
		cache.allZones.Add(zone.Name)
	}
	logger.Tracef(
		"%d known and %d available zones cached: %v",
		cache.allZones.Size(), cache.availableZones.Size(), cache.allZones.SortedValues(),
	)
	if cache.allZones.IsEmpty() {
		cache.allZones = nil
		// Cached an empty list.
		return errors.Errorf("no zones defined")
	}
	return nil
}
657882
func (p *IndexFiles) MeasurementNames() [][]byte {
	itr := p.MeasurementIterator()
	if itr == nil {
		return nil
	}

	var names [][]byte
	for e := itr.Next(); e != nil; e = itr.Next() {
		names = append(names, bytesutil.Clone(e.Name()))
	}
	sort.Sort(byteSlices(names))
	return names
}
876991
func (r *Registry) Names() []string {
	keys := []string{}
	for key := range r.registrants {
		keys = append(keys, key)
	}
	sort.Strings(keys)
	return keys
}