// Present creates a TXT record using the specified parameters
// This will *not* create a subzone to contain the TXT record,
// so make sure the FQDN specified is within an extant zone.
774222
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	err := d.login()
	if err != nil {
		return err
	}

	viewID, err := d.lookupViewID(d.config.DNSView)
	if err != nil {
		return err
	}

	parentZoneID, name, err := d.lookupParentZoneID(viewID, fqdn)
	if err != nil {
		return err
	}

	queryArgs := map[string]string{
		"parentId": strconv.FormatUint(uint64(parentZoneID), 10),
	}

	body := bluecatEntity{
		Name:       name,
		Type:       "TXTRecord",
		Properties: fmt.Sprintf("ttl=%d|absoluteName=%s|txt=%s|", d.config.TTL, fqdn, value),
	}

	resp, err := d.sendRequest(http.MethodPost, "addEntity", body, queryArgs)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	addTxtBytes, _ := ioutil.ReadAll(resp.Body)
	addTxtResp := string(addTxtBytes)
	// addEntity responds only with body text containing the ID of the created record
	_, err = strconv.ParseUint(addTxtResp, 10, 64)
	if err != nil {
		return fmt.Errorf("bluecat: addEntity request failed: %s", addTxtResp)
	}

	err = d.deploy(parentZoneID)
	if err != nil {
		return err
	}

	return d.logout()
}
1191588
func (self *StateDB) Prepare(thash, bhash common.Hash, ti int) {
	self.thash = thash
	self.bhash = bhash
	self.txIndex = ti
}
1260395
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	zone, err := d.client.GetZone(fqdn)
	if err != nil {
		return fmt.Errorf("ClouDNS: %v", err)
	}

	err = d.client.AddTxtRecord(zone.Name, fqdn, value, d.config.TTL)
	if err != nil {
		return fmt.Errorf("ClouDNS: %v", err)
	}

	return nil
}
880586
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	authZone, err := dns01.FindZoneByFqdn(fqdn)
	if err != nil {
		return fmt.Errorf("dyn: %v", err)
	}

	err = d.login()
	if err != nil {
		return fmt.Errorf("dyn: %v", err)
	}

	data := map[string]interface{}{
		"rdata": map[string]string{
			"txtdata": value,
		},
		"ttl": strconv.Itoa(d.config.TTL),
	}

	resource := fmt.Sprintf("TXTRecord/%s/%s/", authZone, fqdn)
	_, err = d.sendRequest(http.MethodPost, resource, data)
	if err != nil {
		return fmt.Errorf("dyn: %v", err)
	}

	err = d.publish(authZone, "Added TXT record for ACME dns-01 challenge using lego client")
	if err != nil {
		return fmt.Errorf("dyn: %v", err)
	}

	return d.logout()
}
36883
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	zone, err := d.getZones(domain)
	if err != nil {
		return fmt.Errorf("stackpath: %v", err)
	}

	fqdn, value := dns01.GetRecord(domain, keyAuth)
	parts := strings.Split(fqdn, ".")

	record := Record{
		Name: parts[0],
		Type: "TXT",
		TTL:  d.config.TTL,
		Data: value,
	}

	return d.createZoneRecord(zone, record)
}
676492
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	// get the ZoneConfig for that domain
	zonesFind := ZoneConfigsFindRequest{
		Filter: Filter{
			Field: "zoneName",
			Value: d.config.ZoneName,
		},
		Limit: 1,
		Page:  1,
	}
	zonesFind.AuthToken = d.config.APIKey

	zoneConfig, err := d.getZone(zonesFind)
	if err != nil {
		return fmt.Errorf("hostingde: %v", err)
	}
	zoneConfig.Name = d.config.ZoneName

	rec := []DNSRecord{{
		Type:    "TXT",
		Name:    dns01.UnFqdn(fqdn),
		Content: value,
		TTL:     d.config.TTL,
	}}

	req := ZoneUpdateRequest{
		ZoneConfig:   *zoneConfig,
		RecordsToAdd: rec,
	}
	req.AuthToken = d.config.APIKey

	resp, err := d.updateZone(req)
	if err != nil {
		return fmt.Errorf("hostingde: %v", err)
	}

	for _, record := range resp.Response.Records {
		if record.Name == dns01.UnFqdn(fqdn) && record.Content == fmt.Sprintf(`"%s"`, value) {
			d.recordIDsMu.Lock()
			d.recordIDs[fqdn] = record.ID
			d.recordIDsMu.Unlock()
		}
	}

	if d.recordIDs[fqdn] == "" {
		return fmt.Errorf("hostingde: error getting ID of just created record, for domain %s", domain)
	}

	return nil
}
161850
func (i *ResolvedProductIter) Current() (*ResolvedProduct, error) {
	if i.err != nil {
		return nil, i.err
	}
	return &i.page[i.i], nil
}
427051
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	// generate request to dns.PatchDomainRecordsRequest
	recordOperation := dns.RecordOperation{
		Domain:      common.String(dns01.UnFqdn(fqdn)),
		Rdata:       common.String(value),
		Rtype:       common.String("TXT"),
		Ttl:         common.Int(d.config.TTL),
		IsProtected: common.Bool(false),
	}

	request := dns.PatchDomainRecordsRequest{
		CompartmentId: common.String(d.config.CompartmentID),
		ZoneNameOrId:  common.String(domain),
		Domain:        common.String(dns01.UnFqdn(fqdn)),
		PatchDomainRecordsDetails: dns.PatchDomainRecordsDetails{
			Items: []dns.RecordOperation{recordOperation},
		},
	}

	_, err := d.client.PatchDomainRecords(context.Background(), request)
	if err != nil {
		return fmt.Errorf("oraclecloud: %v", err)
	}

	return nil
}
471224
func (*DNSProviderManual) Present(domain, token, keyAuth string) error {
	fqdn, value := GetRecord(domain, keyAuth)

	authZone, err := FindZoneByFqdn(fqdn)
	if err != nil {
		return err
	}

	fmt.Printf("lego: Please create the following TXT record in your %s zone:\n", authZone)
	fmt.Printf(dnsTemplate+"\n", fqdn, DefaultTTL, value)
	fmt.Printf("lego: Press 'Enter' when you are done\n")

	_, err = bufio.NewReader(os.Stdin).ReadBytes('\n')

	return err
}
460084
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)
	zone, err := d.getHostedZoneInfo(fqdn)
	if err != nil {
		return err
	}

	createOpts := linodego.DomainRecordCreateOptions{
		Name:   dns01.UnFqdn(fqdn),
		Target: value,
		TTLSec: d.config.TTL,
		Type:   linodego.RecordTypeTXT,
	}

	_, err = d.client.CreateDomainRecord(context.Background(), zone.domainID, createOpts)
	return err
}
916089
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	hostedZoneID, err := d.getHostedZoneID(fqdn)
	if err != nil {
		return fmt.Errorf("route53: failed to determine hosted zone ID: %v", err)
	}

	records, err := d.getExistingRecordSets(hostedZoneID, fqdn)
	if err != nil {
		return fmt.Errorf("route53: %v", err)
	}

	realValue := `"` + value + `"`

	var found bool
	for _, record := range records {
		if aws.StringValue(record.Value) == realValue {
			found = true
		}
	}

	if !found {
		records = append(records, &route53.ResourceRecord{Value: aws.String(realValue)})
	}

	recordSet := &route53.ResourceRecordSet{
		Name:            aws.String(fqdn),
		Type:            aws.String("TXT"),
		TTL:             aws.Int64(int64(d.config.TTL)),
		ResourceRecords: records,
	}

	err = d.changeRecord(route53.ChangeActionUpsert, hostedZoneID, recordSet)
	if err != nil {
		return fmt.Errorf("route53: %v", err)
	}
	return nil
}
83405
func (q *Qbs) prepare(query string) (stmt *sql.Stmt, err error) {
	var ok bool
	if q.tx != nil {
		stmt, ok = q.txStmtMap[query]
		if ok {
			return
		}
		stmt, err = q.tx.Prepare(query)
		if err != nil {
			q.updateTxError(err)
			return
		}
		q.txStmtMap[query] = stmt
	} else {
		mu.RLock()
		stmt, ok = stmtMap[query]
		mu.RUnlock()
		if ok {
			return
		}

		stmt, err = db.Prepare(query + ";")
		if err != nil {
			q.updateTxError(err)
			return
		}
		mu.Lock()
		stmtMap[query] = stmt
		mu.Unlock()
	}
	return
}
1133507
func (c *StatusController) Show(ctx *app.ShowStatusContext) error {
	res := &app.Status{
		Commit:    Commit,
		BuildTime: BuildTime,
		StartTime: StartTime,
	}

	devMode := c.config.IsPostgresDeveloperModeEnabled()
	if devMode {
		res.DevMode = &devMode
	}

	dbErr := c.dbChecker.Ping()
	if dbErr != nil {
		log.Error(ctx, map[string]interface{}{
			"db_error": dbErr.Error(),
		}, "database configuration error")
		res.DatabaseStatus = fmt.Sprintf("Error: %s", dbErr.Error())
	} else {
		res.DatabaseStatus = "OK"
	}

	configErr := c.config.DefaultConfigurationError()
	if configErr != nil {
		log.Error(ctx, map[string]interface{}{
			"config_error": configErr.Error(),
		}, "configuration error")
		res.ConfigurationStatus = fmt.Sprintf("Error: %s", configErr.Error())
	} else {
		res.ConfigurationStatus = "OK"
	}

	if dbErr != nil || (configErr != nil && !devMode) {
		return ctx.ServiceUnavailable(res)
	}
	return ctx.OK(res)
}
1296990
func (topic *RelatedTopic) Show(prefix string) {
	topic.fshow(os.Stdout, prefix)
}
462169
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	apiHost, apiDomain := splitFqdn(fqdn)
	record := &zoneRecord{
		Domain: apiDomain,
		Host:   apiHost,
		Type:   "TXT",
		Rdata:  value,
		TTL:    strconv.Itoa(d.config.TTL),
		Prio:   "0",
	}

	recordID, err := d.addRecord(apiDomain, record)
	if err != nil {
		return fmt.Errorf("easydns: error adding zone record: %v", err)
	}

	key := getMapKey(fqdn, value)

	d.recordIDsMu.Lock()
	d.recordIDs[key] = recordID
	d.recordIDsMu.Unlock()

	return nil
}
488652
func (c *Conn) Prepare(query string) (driver.Stmt, error) {

	stmt := prepareStatement(c, query)

	return stmt, nil
}
1027435
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	_, zoneName, err := d.getHostedZone(domain)
	if err != nil {
		return fmt.Errorf("alicloud: %v", err)
	}

	recordAttributes := d.newTxtRecord(zoneName, fqdn, value)

	_, err = d.client.AddDomainRecord(recordAttributes)
	if err != nil {
		return fmt.Errorf("alicloud: API call failed: %v", err)
	}
	return nil
}