// GetDomainInformation Get domain name information for a FQDN
977838
func (c *Client) GetDomainInformation(fqdn string) (*Data, error) {
	authZone, err := dns01.FindZoneByFqdn(fqdn)
	if err != nil {
		return nil, err
	}

	result, err := c.doRequest(http.MethodGet, "domain", nil)
	if err != nil {
		return nil, err
	}

	var domains []Data
	if len(result) > 0 {
		err = json.Unmarshal(result, &domains)
		if err != nil {
			return nil, fmt.Errorf("CloudXNS: domains unmarshaling error: %v", err)
		}
	}

	for _, data := range domains {
		if data.Domain == authZone {
			return &data, nil
		}
	}

	return nil, fmt.Errorf("CloudXNS: zone %s not found for domain %s", authZone, fqdn)
}
1182585
func (a *API) GetDomainConfig(domain int, key string) (string, error) {
	url := a.BuildURL("/v2/domain/%d/config/%s/", domain, key)
	return a.getTextPlain(url, Params{})
}
629654
func getMainDomain(domain string) string {
	domain = dns01.UnFqdn(domain)

	split := dns.Split(domain)
	if strings.HasSuffix(strings.ToLower(domain), "duckdns.org") {
		if len(split) < 3 {
			return ""
		}

		firstSubDomainIndex := split[len(split)-3]
		return domain[firstSubDomainIndex:]
	}

	return domain[split[len(split)-1]:]
}
1203237
func (c *Client) GetDomainByName(domainName string) (*Domain, error) {
	uri := fmt.Sprintf("/%s", domainName)
	req, err := c.newRequest(http.MethodGet, uri, nil)
	if err != nil {
		return nil, err
	}

	domain := &Domain{}
	resp, err := c.do(req, domain)
	if err != nil {
		switch {
		case resp.StatusCode == http.StatusNotFound && strings.Count(domainName, ".") > 1:
			// Look up for the next sub domain
			subIndex := strings.Index(domainName, ".")
			return c.GetDomainByName(domainName[subIndex+1:])
		default:
			return nil, err
		}
	}

	return domain, nil
}
512637
func (c *Client) GetDomain(authZone string) (*Domain, error) {
	domainName := authZone[0 : len(authZone)-1]
	resource := fmt.Sprintf("%s%s", "/dns/managed/name?domainname=", domainName)

	resp, err := c.sendRequest(http.MethodGet, resource, nil)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	domain := &Domain{}
	err = json.NewDecoder(resp.Body).Decode(&domain)
	if err != nil {
		return nil, err
	}

	return domain, nil
}
1013475
func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error) {
	var cnodeinfo C.virNodeInfo
	var err C.virError
	ret := C.virNodeGetInfoWrapper(C.virDomainGetConnect(d.ptr), &cnodeinfo, &err)
	if ret == -1 {
		return []bool{}, makeError(&err)
	}

	ncpus := cnodeinfo.nodes * cnodeinfo.sockets * cnodeinfo.cores * cnodeinfo.threads
	maplen := int((ncpus + 7) / 8)
	ccpumaps := make([]C.uchar, maplen)
	ret = C.virDomainGetEmulatorPinInfoWrapper(d.ptr, &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
	if ret == -1 {
		return []bool{}, makeError(&err)
	}

	cpumaps := make([]bool, ncpus)
	for i := 0; i < int(ncpus); i++ {
		byte := i / 8
		bit := i % 8
		cpumaps[i] = (ccpumaps[byte] & (1 << uint(bit))) != 0
	}

	return cpumaps, nil
}
458568
func (e *Enforcer) GetPermissionsForUserInDomain(user string, domain string) [][]string {
	return e.GetFilteredPolicy(0, user, domain)
}
370519
func (this *FcmClient) GetInfo(withDetails bool, instanceIdToken string) (*InstanceIdInfoResponse, error) {

	var request_url string = generateGetInfoUrl(instance_id_info_no_details_srv_url, instanceIdToken)

	if withDetails == true {
		request_url = generateGetInfoUrl(instance_id_info_with_details_srv_url, instanceIdToken)
	}

	request, err := http.NewRequest("GET", request_url, nil)
	request.Header.Set("Authorization", this.apiKeyHeader())
	request.Header.Set("Content-Type", "application/json")

	if err != nil {
		return nil, err
	}

	client := &http.Client{}
	response, err := client.Do(request)
	if err != nil {
		return nil, err
	}

	defer response.Body.Close()

	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return nil, err
	}

	infoResponse, err := parseGetInfo(body)
	if err != nil {
		return nil, err
	}

	return infoResponse, nil
}
278687
func GetDomain(store kv.Storage) (*domain.Domain, error) {
	return domap.Get(store)
}
1090068
func (r Dns_Domain_Registration) GetDomainRegistrationStatus() (resp datatypes.Dns_Domain_Registration_Status, err error) {
	err = r.Session.DoRequest("SoftLayer_Dns_Domain_Registration", "getDomainRegistrationStatus", nil, &r.Options, &resp)
	return
}
1081616
func (client *Client) GetDomains(ctx context.Context) ([]DNSDomain, error) {
	resp, err := client.dnsRequest(ctx, "/v1/domains", nil, "", "GET")
	if err != nil {
		return nil, err
	}

	var d []DNSDomainResponse
	if err := json.Unmarshal(resp, &d); err != nil {
		return nil, err
	}

	domains := make([]DNSDomain, len(d))
	for i := range d {
		domains[i] = *d[i].Domain
	}
	return domains, nil
}
1094431
func (api *Client) GetDomainEndpoint(id string, endpointID string) (*DomainEndpoint, error) {
	result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), &DomainEndpoint{})
	if err != nil {
		return nil, err
	}
	return result.(*DomainEndpoint), nil
}
603362
func (l *Locale) GetDomain() string {
	l.RLock()
	dom := l.defaultDomain
	l.RUnlock()
	return dom
}
520978
func (actor Actor) GetOrganizationDomains(orgGUID string) ([]Domain, Warnings, error) {
	var (
		allWarnings Warnings
		allDomains  []Domain
	)

	domains, warnings, err := actor.CloudControllerClient.GetSharedDomains()
	allWarnings = append(allWarnings, warnings...)

	if err != nil {
		return []Domain{}, allWarnings, err
	}
	for _, domain := range domains {
		allDomains = append(allDomains, Domain(domain))
	}

	domains, warnings, err = actor.CloudControllerClient.GetOrganizationPrivateDomains(orgGUID)
	allWarnings = append(allWarnings, warnings...)

	if err != nil {
		return []Domain{}, allWarnings, err
	}
	for _, domain := range domains {
		allDomains = append(allDomains, Domain(domain))
	}

	return allDomains, allWarnings, nil
}
743846
func (d *Domain) GetBlockJobInfo(disk string, flags DomainBlockJobInfoFlags) (*DomainBlockJobInfo, error) {
	cdisk := C.CString(disk)
	defer C.free(unsafe.Pointer(cdisk))

	var cinfo C.virDomainBlockJobInfo

	var err C.virError
	ret := C.virDomainGetBlockJobInfoWrapper(d.ptr, cdisk, &cinfo, C.uint(flags), &err)

	if ret == -1 {
		return nil, makeError(&err)
	}

	return &DomainBlockJobInfo{
		Type:      DomainBlockJobType(cinfo._type),
		Bandwidth: uint64(cinfo.bandwidth),
		Cur:       uint64(cinfo.cur),
		End:       uint64(cinfo.end),
	}, nil
}
1055752
func getDomainPerfEventsFieldInfo(params *DomainPerfEvents) map[string]typedParamsFieldInfo {
	return map[string]typedParamsFieldInfo{
		C.VIR_PERF_PARAM_CMT: typedParamsFieldInfo{
			set: &params.CmtSet,
			b:   &params.Cmt,
		},
		C.VIR_PERF_PARAM_MBMT: typedParamsFieldInfo{
			set: &params.MbmtSet,
			b:   &params.Mbmt,
		},
		C.VIR_PERF_PARAM_MBML: typedParamsFieldInfo{
			set: &params.MbmlSet,
			b:   &params.Mbml,
		},
		C.VIR_PERF_PARAM_CACHE_MISSES: typedParamsFieldInfo{
			set: &params.CacheMissesSet,
			b:   &params.CacheMisses,
		},
		C.VIR_PERF_PARAM_CACHE_REFERENCES: typedParamsFieldInfo{
			set: &params.CacheReferencesSet,
			b:   &params.CacheReferences,
		},
		C.VIR_PERF_PARAM_INSTRUCTIONS: typedParamsFieldInfo{
			set: &params.InstructionsSet,
			b:   &params.Instructions,
		},
		C.VIR_PERF_PARAM_CPU_CYCLES: typedParamsFieldInfo{
			set: &params.CpuCyclesSet,
			b:   &params.CpuCycles,
		},
		C.VIR_PERF_PARAM_BRANCH_INSTRUCTIONS: typedParamsFieldInfo{
			set: &params.BranchInstructionsSet,
			b:   &params.BranchInstructions,
		},
		C.VIR_PERF_PARAM_BRANCH_MISSES: typedParamsFieldInfo{
			set: &params.BranchMissesSet,
			b:   &params.BranchMisses,
		},
		C.VIR_PERF_PARAM_BUS_CYCLES: typedParamsFieldInfo{
			set: &params.BusCyclesSet,
			b:   &params.BusCycles,
		},
		C.VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND: typedParamsFieldInfo{
			set: &params.StalledCyclesFrontendSet,
			b:   &params.StalledCyclesFrontend,
		},
		C.VIR_PERF_PARAM_STALLED_CYCLES_BACKEND: typedParamsFieldInfo{
			set: &params.StalledCyclesBackendSet,
			b:   &params.StalledCyclesBackend,
		},
		C.VIR_PERF_PARAM_REF_CPU_CYCLES: typedParamsFieldInfo{
			set: &params.RefCpuCyclesSet,
			b:   &params.RefCpuCycles,
		},
		C.VIR_PERF_PARAM_CPU_CLOCK: typedParamsFieldInfo{
			set: &params.CpuClockSet,
			b:   &params.CpuClock,
		},
		C.VIR_PERF_PARAM_TASK_CLOCK: typedParamsFieldInfo{
			set: &params.TaskClockSet,
			b:   &params.TaskClock,
		},
		C.VIR_PERF_PARAM_PAGE_FAULTS: typedParamsFieldInfo{
			set: &params.PageFaultsSet,
			b:   &params.PageFaults,
		},
		C.VIR_PERF_PARAM_CONTEXT_SWITCHES: typedParamsFieldInfo{
			set: &params.ContextSwitchesSet,
			b:   &params.ContextSwitches,
		},
		C.VIR_PERF_PARAM_CPU_MIGRATIONS: typedParamsFieldInfo{
			set: &params.CpuMigrationsSet,
			b:   &params.CpuMigrations,
		},
		C.VIR_PERF_PARAM_PAGE_FAULTS_MIN: typedParamsFieldInfo{
			set: &params.PageFaultsMinSet,
			b:   &params.PageFaultsMin,
		},
		C.VIR_PERF_PARAM_PAGE_FAULTS_MAJ: typedParamsFieldInfo{
			set: &params.PageFaultsMajSet,
			b:   &params.PageFaultsMaj,
		},
		C.VIR_PERF_PARAM_ALIGNMENT_FAULTS: typedParamsFieldInfo{
			set: &params.AlignmentFaultsSet,
			b:   &params.AlignmentFaults,
		},
		C.VIR_PERF_PARAM_EMULATION_FAULTS: typedParamsFieldInfo{
			set: &params.EmulationFaultsSet,
			b:   &params.EmulationFaults,
		},
	}
}
257743
func (d *domainClient) GetFileInfo(ctx context.Context, args *GetFileInfoArgs) (reply *GetFileInfoReply, err error) {
	reply = new(GetFileInfoReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.getFileInfo", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.getFileInfo", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "GetFileInfo", Err: err}
	}
	return
}