// Present creates a TXT record to fulfill the dns-01 challenge
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
}
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
}
277620
func (i *ResourceIter) Current() (*Resource, error) {
	if i.err != nil {
		return nil, i.err
	}
	return &i.page[i.i], nil
}
818035
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
	}

	if _, err = d.client.CreateDomainResourceTXT(zone.domainID, dns01.UnFqdn(fqdn), value, d.config.TTL); err != nil {
		return err
	}

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

	u, err := d.buildQuery(cmdAddRecord, record, value)
	if err != nil {
		return fmt.Errorf("dreamhost: %v", err)
	}

	err = d.updateTxtRecord(u)
	if err != nil {
		return fmt.Errorf("dreamhost: %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)
}
1217029
func (result *Result) Show(prefix string) {
	result.fshow(os.Stdout, prefix)
}
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)
}
893363
func (d *DNS) AddRecord(record *DNSRecordSet) {
	var recordSet = d.Settings.DNS.ResourceRecordSets
	var isExist = false
	for i := range recordSet {
		if recordSet[i].Name == record.Name && recordSet[i].Type == record.Type && recordSet[i].RData == record.RData {
			d.Settings.DNS.ResourceRecordSets[i].TTL = record.TTL
			isExist = true
		}
	}

	if !isExist {
		d.Settings.DNS.ResourceRecordSets = append(d.Settings.DNS.ResourceRecordSets, *record)
	}

}
303976
func (c *SearchController) Show(ctx *app.ShowSearchContext) error {
	offset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)
	// TODO: Keep URL registeration central somehow.
	hostString := ctx.Request.Host
	if hostString == "" {
		hostString = c.configuration.GetHTTPAddress()
	}
	urlRegexString := fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/list/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForListWI, urlRegexString)
	urlRegexString = fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/board/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForBoardWI, urlRegexString)

	if ctx.FilterExpression != nil {
		var result []workitem.WorkItem
		var count int
		var ancestors link.AncestorList
		var childLinks link.WorkItemLinkList
		err := application.Transactional(c.db, func(appl application.Application) error {
			var err error
			result, count, ancestors, childLinks, err = appl.SearchItems().Filter(ctx.Context, *ctx.FilterExpression, ctx.FilterParentexists, &offset, &limit)
			if err != nil {
				cause := errs.Cause(err)
				switch cause.(type) {
				case errors.BadParameterError:
					return goa.ErrBadRequest(fmt.Sprintf("error listing work items for expression '%s': %s", *ctx.FilterExpression, err))
				default:
					log.Error(ctx, map[string]interface{}{
						"err":               err,
						"filter_expression": *ctx.FilterExpression,
					}, "unable to list the work items")
					return goa.ErrInternal(fmt.Sprintf("unable to list the work items: %s", err))
				}
			}
			return nil

		})
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		matchingWorkItemIDs := make(id.Slice, len(result))
		for i, wi := range result {
			matchingWorkItemIDs[i] = wi.ID
		}
		hasChildren := workItemIncludeHasChildren(ctx, c.db, childLinks)
		includeParent := includeParentWorkItem(ctx, ancestors, childLinks)
		// Load all work item types
		wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "failed to load work item types"))
		}

		wis, err := ConvertWorkItems(ctx.Request, wits, result, hasChildren, includeParent)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		response := app.SearchWorkItemList{
			Links: &app.PagingLinks{},
			Meta: &app.WorkItemListResponseMeta{
				TotalCount: count,
			},
			Data: wis,
		}
		err = c.enrichWorkItemList(ctx, ancestors, matchingWorkItemIDs, childLinks, &response, hasChildren) // append parentWI and ancestors (if not empty) in response
		if err != nil {
			return errs.Wrap(err, "failed to enrich work item list")
		}
		setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "filter[expression]="+*ctx.FilterExpression)

		// Sort "data" by name or ID if no title given
		var data WorkItemPtrSlice = response.Data
		sort.Sort(data)
		response.Data = data

		// Sort work items in the "included" array by ID or title
		var included WorkItemInterfaceSlice = response.Included
		sort.Sort(included)
		response.Included = included

		// build up list of sorted ancestor IDs from already sorted work items
		ancestorIDs := ancestors.GetDistinctAncestorIDs().ToMap()
		sortedAncestorIDs := make(id.Slice, len(ancestorIDs))
		i := 0
		for _, wi := range response.Data {
			if len(ancestorIDs) <= 0 {
				break
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		for _, ifObj := range response.Included {
			if len(ancestorIDs) <= 0 {
				break
			}
			var wi *app.WorkItem
			switch v := ifObj.(type) {
			case app.WorkItem:
				wi = &v
			case *app.WorkItem:
				wi = v
			default:
				continue
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		response.Meta.AncestorIDs = sortedAncestorIDs
		return ctx.OK(&response)
	}
	var result []workitem.WorkItem
	var count int
	err := application.Transactional(c.db, func(appl application.Application) error {
		if ctx.Q == nil || *ctx.Q == "" {
			return goa.ErrBadRequest("empty search query not allowed")
		}
		var err error
		result, count, err = appl.SearchItems().SearchFullText(ctx.Context, *ctx.Q, &offset, &limit, ctx.SpaceID)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":        err,
				"expression": *ctx.Q,
			}, "unable to list the work items")
			return errs.Wrapf(err, "unable to list the work items for expression: %s", *ctx.Q)
		}
		return nil
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wis, err := ConvertWorkItems(ctx.Request, wits, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	response := app.SearchWorkItemList{
		Links: &app.PagingLinks{},
		Meta:  &app.WorkItemListResponseMeta{TotalCount: count},
		Data:  wis,
	}
	setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "q="+*ctx.Q)
	return ctx.OK(&response)
}
597218
func (c *UsersController) Show(ctx *app.ShowUsersContext) error {
	return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}
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
}
369425
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)

	if d.config.TTL < minTTL {
		d.config.TTL = minTTL // 300 is gandi minimum value for ttl
	}

	// find authZone and Gandi zone_id for fqdn
	authZone, err := d.findZoneByFqdn(fqdn)
	if err != nil {
		return fmt.Errorf("gandi: findZoneByFqdn failure: %v", err)
	}

	zoneID, err := d.getZoneID(authZone)
	if err != nil {
		return fmt.Errorf("gandi: %v", err)
	}

	// determine name of TXT record
	if !strings.HasSuffix(
		strings.ToLower(fqdn), strings.ToLower("."+authZone)) {
		return fmt.Errorf("gandi: unexpected authZone %s for fqdn %s", authZone, fqdn)
	}
	name := fqdn[:len(fqdn)-len("."+authZone)]

	// acquire lock and check there is not a challenge already in
	// progress for this value of authZone
	d.inProgressMu.Lock()
	defer d.inProgressMu.Unlock()

	if _, ok := d.inProgressAuthZones[authZone]; ok {
		return fmt.Errorf("gandi: challenge already in progress for authZone %s", authZone)
	}

	// perform API actions to create and activate new gandi zone
	// containing the required TXT record
	newZoneName := fmt.Sprintf("%s [ACME Challenge %s]", dns01.UnFqdn(authZone), time.Now().Format(time.RFC822Z))

	newZoneID, err := d.cloneZone(zoneID, newZoneName)
	if err != nil {
		return err
	}

	newZoneVersion, err := d.newZoneVersion(newZoneID)
	if err != nil {
		return fmt.Errorf("gandi: %v", err)
	}

	err = d.addTXTRecord(newZoneID, newZoneVersion, name, value, d.config.TTL)
	if err != nil {
		return fmt.Errorf("gandi: %v", err)
	}

	err = d.setZoneVersion(newZoneID, newZoneVersion)
	if err != nil {
		return fmt.Errorf("gandi: %v", err)
	}

	err = d.setZone(authZone, newZoneID)
	if err != nil {
		return fmt.Errorf("gandi: %v", err)
	}

	// save data necessary for CleanUp
	d.inProgressFQDNs[fqdn] = inProgressInfo{
		zoneID:    zoneID,
		newZoneID: newZoneID,
		authZone:  authZone,
	}
	d.inProgressAuthZones[authZone] = struct{}{}

	return nil
}
218679
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("cloudflare: %v", err)
	}

	zoneID, err := d.client.ZoneIDByName(dns01.UnFqdn(authZone))
	if err != nil {
		return fmt.Errorf("cloudflare: failed to find zone %s: %v", authZone, err)
	}

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

	response, err := d.client.CreateDNSRecord(zoneID, dnsRecord)
	if err != nil {
		return fmt.Errorf("cloudflare: failed to create TXT record: %v", err)
	}

	if !response.Success {
		return fmt.Errorf("cloudflare: failed to create TXT record: %+v %+v", response.Errors, response.Messages)
	}

	log.Infof("cloudflare: new record for %s, ID %s", domain, response.Result.ID)

	return nil
}
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
}
1296990
func (topic *RelatedTopic) Show(prefix string) {
	topic.fshow(os.Stdout, prefix)
}
521934
func (d *DNSProvider) Present(domainName, token, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domainName, keyAuth)

	zone, err := dns01.FindZoneByFqdn(fqdn)
	if err != nil {
		return fmt.Errorf("netcup: failed to find DNSZone, %v", err)
	}

	sessionID, err := d.client.Login()
	if err != nil {
		return fmt.Errorf("netcup: %v", err)
	}

	defer func() {
		err = d.client.Logout(sessionID)
		if err != nil {
			log.Print("netcup: %v", err)
		}
	}()

	hostname := strings.Replace(fqdn, "."+zone, "", 1)
	record := internal.DNSRecord{
		Hostname:    hostname,
		RecordType:  "TXT",
		Destination: value,
		TTL:         d.config.TTL,
	}

	zone = dns01.UnFqdn(zone)

	records, err := d.client.GetDNSRecords(zone, sessionID)
	if err != nil {
		// skip no existing records
		log.Infof("no existing records, error ignored: %v", err)
	}

	records = append(records, record)

	err = d.client.UpdateDNSRecord(sessionID, zone, records)
	if err != nil {
		return fmt.Errorf("netcup: failed to add TXT-Record: %v", err)
	}

	return nil
}