// Present creates a TXT record to fulfill the dns-01 challenge
161956
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	if d.config.Mode == "RAW" {
		msg := &messageRaw{
			Domain:  domain,
			Token:   token,
			KeyAuth: keyAuth,
		}

		err := d.doPost("/present", msg)
		if err != nil {
			return fmt.Errorf("httpreq: %v", err)
		}
		return nil
	}

	fqdn, value := dns01.GetRecord(domain, keyAuth)
	msg := &message{
		FQDN:  fqdn,
		Value: value,
	}

	err := d.doPost("/present", msg)
	if err != nil {
		return fmt.Errorf("httpreq: %v", err)
	}
	return nil
}
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
}
211632
func (c *NamedWorkItemsController) Show(ctx *app.ShowNamedWorkItemsContext) error {
	err := application.Transactional(c.db, func(appl application.Application) error {
		wiID, _, err := appl.WorkItems().LookupIDByNamedSpaceAndNumber(ctx, ctx.UserName, ctx.SpaceName, ctx.WiNumber)
		if err != nil {
			return errs.Wrapf(err, "Fail to load work item with number %v in %s/%s", ctx.WiNumber, ctx.UserName, ctx.SpaceName)
		}
		ctx.ResponseData.Header().Set("Location", rest.AbsoluteURL(ctx.Request, app.WorkitemHref(wiID)))
		return ctx.TemporaryRedirect()
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return nil
}
1084192
func (c *LabelController) Show(ctx *app.ShowLabelContext) error {
	var lbl *label.Label
	err := application.Transactional(c.db, func(appl application.Application) error {
		var err error
		lbl, err = appl.Labels().Load(ctx, ctx.LabelID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.OK(&app.LabelSingle{
		Data: ConvertLabel(ctx.Request, *lbl),
	})
}
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()
}
667221
func Show(w http.ResponseWriter, req *http.Request) {
	ctxt := fs.NewContext(req)
	tag := req.URL.Path[len("/qr/show/"):]
	png := strings.HasSuffix(tag, ".png")
	if png {
		tag = tag[:len(tag)-len(".png")]
	}
	if !isTagName(tag) {
		fmt.Fprintf(w, "Sorry, QR code not found\n")
		return
	}
	if req.FormValue("flag") == "1" {
		flag(w, req, tag, ctxt)
		return
	}
	data, _, err := ctxt.Read("qrsave/" + tag)
	if err != nil {
		fmt.Fprintf(w, "Sorry, QR code not found.\n")
		return
	}

	var m Image
	if err := json.Unmarshal(data, &m); err != nil {
		panic(err)
	}
	m.Tag = tag

	switch req.FormValue("size") {
	case "big":
		m.Scale *= 2
	case "small":
		m.Scale /= 2
	}

	if png {
		if err := m.Encode(req); err != nil {
			panic(err)
			return
		}
		w.Header().Set("Cache-Control", "public, max-age=3600")
		w.Write(m.Code.PNG())
		return
	}

	w.Header().Set("Cache-Control", "public, max-age=300")
	runTemplate(ctxt, w, "qr/permalink.html", &m)
}
543526
func (c *SpaceTemplateController) Show(ctx *app.ShowSpaceTemplateContext) error {
	res := &app.SpaceTemplateSingle{}
	err := application.Transactional(c.db, func(appl application.Application) error {
		st, err := appl.SpaceTemplates().Load(ctx, ctx.SpaceTemplateID)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":               err,
				"space_template_id": ctx.SpaceTemplateID,
			}, "failed to load space template")
			return err
		}
		return ctx.ConditionalRequest(*st, c.config.GetCacheControlSpaceTemplates, func() error {
			res.Data = ConvertSpaceTemplate(appl, ctx.Request, *st)
			return nil
		})
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.OK(res)
}
1094364
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

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

	domainName := dns01.UnFqdn(authZone)

	// get the subDomain
	subDomain := strings.TrimSuffix(dns01.UnFqdn(fqdn), "."+domainName)

	// use mutex to prevent race condition from GetInfo until SetDNSEntries
	d.dnsEntriesMu.Lock()
	defer d.dnsEntriesMu.Unlock()

	// get all DNS entries
	info, err := transipdomain.GetInfo(d.client, domainName)
	if err != nil {
		return fmt.Errorf("transip: error for %s in Present: %v", domain, err)
	}

	// include the new DNS entry
	dnsEntries := append(info.DNSEntries, transipdomain.DNSEntry{
		Name:    subDomain,
		TTL:     d.config.TTL,
		Type:    transipdomain.DNSEntryTypeTXT,
		Content: value,
	})

	// set the updated DNS entries
	err = transipdomain.SetDNSEntries(d.client, domainName, dnsEntries)
	if err != nil {
		return fmt.Errorf("transip: %v", err)
	}
	return nil
}
1109389
func (s tlsSniSolver) Present(domain, token, keyAuth string) error {
	cert, acmeDomain, err := acme.TLSSNI01ChallengeCert(keyAuth)
	if err != nil {
		return err
	}
	cacheCertificate(Certificate{
		Certificate: cert,
		Names:       []string{acmeDomain},
	})
	return nil
}
288664
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

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

	record, _, err := d.client.Records.Get(zone.Zone, dns01.UnFqdn(fqdn), "TXT")

	// Create a new record
	if err == rest.ErrRecordMissing || record == nil {
		log.Infof("Create a new record for [zone: %s, fqdn: %s, domain: %s]", zone.Zone, fqdn)

		record = dns.NewRecord(zone.Zone, dns01.UnFqdn(fqdn), "TXT")
		record.TTL = d.config.TTL
		record.Answers = []*dns.Answer{{Rdata: []string{value}}}

		_, err = d.client.Records.Create(record)
		if err != nil {
			return fmt.Errorf("ns1: failed to create record [zone: %q, fqdn: %q]: %v", zone.Zone, fqdn, err)
		}

		return nil
	}

	if err != nil {
		return fmt.Errorf("ns1: failed to get the existing record: %v", err)
	}

	// Update the existing records
	record.Answers = append(record.Answers, &dns.Answer{Rdata: []string{value}})

	log.Infof("Update an existing record for [zone: %s, fqdn: %s, domain: %s]", zone.Zone, fqdn, domain)

	_, err = d.client.Records.Update(record)
	if err != nil {
		return fmt.Errorf("ns1: failed to update record [zone: %q, fqdn: %q]: %v", zone.Zone, fqdn, err)
	}

	return nil
}
1169975
func (c *NamedspacesController) Show(ctx *app.ShowNamedspacesContext) error {
	if ctx.UserName == "" {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound("not found, userName=%v", ctx.UserName))
	}

	if ctx.SpaceName == "" {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound("not found, spaceName=%v", ctx.SpaceName))
	}

	var s *space.Space
	err := application.Transactional(c.db, func(appl application.Application) error {
		identity, err := loadKeyCloakIdentityByUserName(ctx, appl, ctx.UserName)
		if err != nil {
			return goa.ErrNotFound("not found, userName=%v", ctx.UserName)
		}
		s, err = appl.Spaces().LoadByOwnerAndName(ctx.Context, &identity.ID, &ctx.SpaceName)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	spaceData, err := ConvertSpaceFromModel(ctx.Request, *s, IncludeBacklogTotalCount(ctx.Context, c.db))
	if err != nil {
		return err
	}
	resp := app.SpaceSingle{
		Data: spaceData,
	}
	return ctx.OK(&resp)
}
58894
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	// Parse domain name
	authZone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain))
	if err != nil {
		return fmt.Errorf("ovh: could not determine zone for domain: '%s'. %s", domain, err)
	}

	authZone = dns01.UnFqdn(authZone)
	subDomain := d.extractRecordName(fqdn, authZone)

	reqURL := fmt.Sprintf("/domain/zone/%s/record", authZone)
	reqData := Record{FieldType: "TXT", SubDomain: subDomain, Target: value, TTL: d.config.TTL}

	// Create TXT record
	var respData Record
	err = d.client.Post(reqURL, reqData, &respData)
	if err != nil {
		return fmt.Errorf("ovh: error when call api to add record (%s): %v", reqURL, err)
	}

	// Apply the change
	reqURL = fmt.Sprintf("/domain/zone/%s/refresh", authZone)
	err = d.client.Post(reqURL, nil, nil)
	if err != nil {
		return fmt.Errorf("ovh: error when call api to refresh zone (%s): %v", reqURL, err)
	}

	d.recordIDsMu.Lock()
	d.recordIDs[fqdn] = respData.ID
	d.recordIDsMu.Unlock()

	return nil
}
1033758
func (s *StatusService) Show(id int64, params *StatusShowParams) (*Tweet, *http.Response, error) {
	if params == nil {
		params = &StatusShowParams{}
	}
	params.ID = id
	tweet := new(Tweet)
	apiError := new(APIError)
	resp, err := s.sling.New().Get("show.json").QueryStruct(params).Receive(tweet, apiError)
	return tweet, resp, relevantError(err, *apiError)
}
1161398
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

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

	id, err := d.client.GetDomainID(authZone)
	if err != nil {
		return fmt.Errorf("conoha: failed to get domain ID: %v", err)
	}

	record := internal.Record{
		Name: fqdn,
		Type: "TXT",
		Data: value,
		TTL:  d.config.TTL,
	}

	err = d.client.CreateRecord(id, record)
	if err != nil {
		return fmt.Errorf("conoha: failed to create record: %v", err)
	}

	return nil
}
363448
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)
	return d.addTXTRecord(fqdn, domain, value, d.config.TTL)
}
3318
func (c *FeaturesController) Show(ctx *app.ShowFeaturesContext) error {
	return proxy.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
}
186844
func (c *challengeHTTP) Present(domain, token, keyAuth string) error {
	return c.Store.SetHTTPChallengeToken(token, domain, []byte(keyAuth))
}