// Domains retrieves the list of child Domains of the Domain
15464
func (o *Domain) Domains(info *bambou.FetchingInfo) (DomainsList, *bambou.Error) {

	var list DomainsList
	err := bambou.CurrentSession().FetchChildren(o, DomainIdentity, &list, info)
	return list, err
}
831210
func (inv *Investigate) RelatedDomains(domain string) ([]RelatedDomain, error) {
	var resp RelatedDomainList
	err := inv.GetParse(fmt.Sprintf(urls["related"], domain), &resp)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
208768
func (z *Zone) Domains(zoneInfo Info) (domains []*domain.InfoBase, err error) {
	if zoneInfo.UUID == nil {
		return nil, fmt.Errorf("can not get domains on a zone %s without an id", zoneInfo.Name)
	}
	_, err = z.Get(fmt.Sprintf("/zones/%s/domains", zoneInfo.UUID), &domains)
	return

}
555524
func (env *maasEnviron) Domains(ctx context.ProviderCallContext) ([]string, error) {
	maasDomains, err := env.maasController.Domains()
	if err != nil {
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return nil, errors.Trace(err)
	}
	result := []string{}
	for _, domain := range maasDomains {
		result = append(result, domain.Name())
	}
	return result, nil
}
48099
func (o *Domain) AssignDomains(children DomainsList) *bambou.Error {

	list := []bambou.Identifiable{}
	for _, c := range children {
		list = append(list, c)
	}

	return bambou.CurrentSession().AssignChildren(o, list, DomainIdentity)
}
588064
func domainsFind(db *gorm.DB, scope scope) (*Domain, error) {
	var domain Domain
	return &domain, first(db, scope, &domain)
}
1320459
func (o *Domain) Statistics(info *bambou.FetchingInfo) (StatisticsList, *bambou.Error) {

	var list StatisticsList
	err := bambou.CurrentSession().FetchChildren(o, StatisticsIdentity, &list, info)
	return list, err
}
110968
func GetDomain(ctx sessionctx.Context) *Domain {
	v, ok := ctx.Value(domainKey).(*Domain)
	if !ok {
		return nil
	}
	return v
}
191605
func (c *CDN) DomainConfigs(domainName string, resp interface{}, configList ...ConfigName) (err error) {
	config := []string{}
	for _, val := range configList {
		config = append(config, string(val))
	}
	err = c.domainConfigs(domainName, resp, config...)
	return
}
56412
func (a *API) FindDomains(filter string) ([]Domain, error) {
	params := Params{}
	if filter != EmptyFilter {
		params["q"] = filter
	}

	dst := make([]Domain, 0)
	url := a.BuildURL("/v2/domain")
	err := a.Get(url, params, &dst)
	return dst, err
}
630518
func (Ctx *Context) ListDomain() (glist []Dominfo) {
	err := Ctx.CheckOpen()
	if err != nil {
		return
	}

	var nbDomain C.int
	clist := C.libxl_list_domain(Ctx.ctx, &nbDomain)
	defer C.libxl_dominfo_list_free(clist, nbDomain)

	if int(nbDomain) == 0 {
		return
	}

	gslice := (*[1 << 30]C.libxl_dominfo)(unsafe.Pointer(clist))[:nbDomain:nbDomain]
	for i := range gslice {
		info := gslice[i].toGo()
		glist = append(glist, *info)
	}

	return
}
207006
func (s *CreateAppInput) SetDomains(v []*string) *CreateAppInput {
	s.Domains = v
	return s
}
234837
func (o *DomainTemplate) DomainFIPAclTemplates(info *bambou.FetchingInfo) (DomainFIPAclTemplatesList, *bambou.Error) {

	var list DomainFIPAclTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, DomainFIPAclTemplateIdentity, &list, info)
	return list, err
}
962817
func withSubdomains(subdomains []string, gen chain) chain {
	if len(subdomains) == 0 {
		return gen
	}
	return func(records ...string) {
		var (
			recordLen = len(records)
			tmp       = make([]string, recordLen*len(subdomains))
			offset    = 0
		)
		for s := range subdomains {
			if subdomains[s] == domainNone {
				copy(tmp[offset:], records)
			} else {
				for i := range records {
					tmp[offset+i] = records[i] + "." + subdomains[s]
				}
			}
			offset += recordLen
		}
		gen(tmp...)
	}
}
406813
func (app *App) Domain(domain string) *Router {
	app.domainListLock.Lock()
	if app.domains[domain] == nil {
		app.domains[domain] = &Router{
			router: newRouter(),
			app:    app,
		}
	}
	app.domainListLock.Unlock()
	return app.domains[domain]
}
150491
func (c *Client) GetDNSDomains() (domains []DNSDomain, err error) {
	if err := c.get(`dns/list`, &domains); err != nil {
		return nil, err
	}
	sort.Sort(dnsdomains(domains))
	return domains, nil
}
1022658
func (s *DomainsService) List() ([]Domain, *Response, error) {
	path := domainAction("List")
	returnedDomains := domainListWrapper{}

	payload := newPayLoad(s.client.CommonParams)
	res, err := s.client.post(path, payload, &returnedDomains)
	if err != nil {
		return []Domain{}, res, err
	}

	domains := []Domain{}

	if returnedDomains.Status.Code != "1" {
		return domains, nil, fmt.Errorf("Could not get domains: %s", returnedDomains.Status.Message)
	}

	for _, domain := range returnedDomains.Domains {
		domains = append(domains, domain)
	}

	return domains, res, nil
}