// CleanUp removes a TXT record used for a previous DNS challenge.
770620
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	tlds, err := d.getTLDs()
	if err != nil {
		return fmt.Errorf("namecheap: %v", err)
	}

	ch, err := newChallenge(domain, keyAuth, tlds)
	if err != nil {
		return fmt.Errorf("namecheap: %v", err)
	}

	records, err := d.getHosts(ch.sld, ch.tld)
	if err != nil {
		return fmt.Errorf("namecheap: %v", err)
	}

	// Find the challenge TXT record and remove it if found.
	var found bool
	var newRecords []Record
	for _, h := range records {
		if h.Name == ch.key && h.Type == "TXT" {
			found = true
		} else {
			newRecords = append(newRecords, h)
		}
	}

	if !found {
		return nil
	}

	err = d.setHosts(ch.sld, ch.tld, newRecords)
	if err != nil {
		return fmt.Errorf("namecheap: %v", err)
	}
	return nil
}
839541
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, challenge := dns01.GetRecord(domain, keyAuth)

	key := getMapKey(fqdn, challenge)
	recordID, exists := d.recordIDs[key]
	if !exists {
		return nil
	}

	_, apiDomain := splitFqdn(fqdn)
	err := d.deleteRecord(apiDomain, recordID)

	d.recordIDsMu.Lock()
	defer delete(d.recordIDs, key)
	d.recordIDsMu.Unlock()

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

	return nil
}
1348792
func (ctx *AssertContext) Cleanup() {
	os.Remove(ctx.ConfigPath)
	os.Remove(ctx.ContentFile)

	if ctx.serviceAccountPath != "" {
		os.Remove(ctx.serviceAccountPath)
	}
	os.Unsetenv(GoogleAppCredentialsEnv)
}
822866
func (s *service) Cleanup(ctx context.Context) (*taskAPI.DeleteResponse, error) {
	return nil, errdefs.ErrNotImplemented
}
719672
func (b *Backend) Cleanup(ctx context.Context) {
	if b.Clean != nil {
		b.Clean(ctx)
	}
}
874609
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

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

	set, err := d.findTxtRecord(fqdn)
	if err != nil {
		return fmt.Errorf("pdns: %v", err)
	}
	if set == nil {
		return fmt.Errorf("pdns: no existing record found for %s", fqdn)
	}

	rrsets := rrSets{
		RRSets: []rrSet{
			{
				Name:       set.Name,
				Type:       set.Type,
				ChangeType: "DELETE",
			},
		},
	}
	body, err := json.Marshal(rrsets)
	if err != nil {
		return fmt.Errorf("pdns: %v", err)
	}

	_, err = d.sendRequest(http.MethodPatch, zone.URL, bytes.NewReader(body))
	if err != nil {
		return fmt.Errorf("pdns: %v", err)
	}
	return nil
}
322319
func (r *PrevRevisions) Cleanup() {
	r.mu.Lock()
	defer r.mu.Unlock()

	r.revisions = make(map[string]datasync.KeyVal)
}
386693
func (d *Driver) Cleanup() error {
	err := d.DeviceSet.Shutdown()

	if err2 := mount.Unmount(d.home); err == nil {
		err = err2
	}

	return err
}
1219608
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	// acquire lock and retrieve authZone
	d.inProgressMu.Lock()
	defer d.inProgressMu.Unlock()
	if _, ok := d.inProgressFQDNs[fqdn]; !ok {
		// if there is no cleanup information then just return
		return nil
	}

	fieldName := d.inProgressFQDNs[fqdn].fieldName
	authZone := d.inProgressFQDNs[fqdn].authZone
	delete(d.inProgressFQDNs, fqdn)

	// delete TXT record from authZone
	err := d.deleteTXTRecord(dns01.UnFqdn(authZone), fieldName)
	if err != nil {
		return fmt.Errorf("gandiv5: %v", err)
	}
	return nil
}
959274
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	ctx := context.Background()
	fqdn, _ := dns01.GetRecord(domain, keyAuth)
	zone, recordName, err := d.FindZoneAndRecordName(fqdn, domain)
	if err != nil {
		return err
	}

	recordID, err := d.FindExistingRecordID(zone, recordName)
	if err != nil {
		return err
	}

	if recordID != 0 {
		err = d.client.DeleteRecord(ctx, zone, recordID)
		if err != nil {
			return errors.New("Error while deleting DNS record: " + err.Error())
		}
	}

	return nil
}
871541
func (c *Challenge) CleanUp(authz acme.Authorization) error {
	log.Infof("[%s] acme: Cleaning DNS-01 challenge", challenge.GetTargetedDomain(authz))

	chlng, err := challenge.FindChallenge(challenge.DNS01, authz)
	if err != nil {
		return err
	}

	keyAuth, err := c.core.GetKeyAuthorization(chlng.Token)
	if err != nil {
		return err
	}

	return c.provider.CleanUp(authz.Identifier.Value, chlng.Token, keyAuth)
}
197206
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

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

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

	if len(records) == 0 {
		return nil
	}

	_, err = d.client.Changes.Create(d.config.Project, zone, &dns.Change{Deletions: records}).Do()
	if err != nil {
		return fmt.Errorf("googlecloud: %v", err)
	}
	return nil
}
197098
func (c *Client) cleanup() {
	// check if not cleanly connected and will is present
	if atomic.LoadUint32(&c.state) == clientConnected && c.will != nil {
		// publish message
		err := c.backend.Publish(c, c.will, nil)
		if err != nil {
			c.backend.Log(BackendError, c, nil, nil, err)
		}

		c.backend.Log(MessagePublished, c, nil, c.will, nil)
	}

	// remove client from the queue
	if atomic.LoadUint32(&c.state) >= clientConnected {
		err := c.backend.Terminate(c)
		if err != nil {
			c.backend.Log(BackendError, c, nil, nil, err)
		}
	}

	c.backend.Log(LostConnection, c, nil, nil, nil)
}
917499
func (c Client) Cleanup() error {
	//conn := c.Pool.Get()
	//defer conn.Close()
	//
	//cols := []string{
	//	db.Transmission, db.Notification,
	//}
	//
	//for _, col := range cols {
	//	err := unlinkCollection(conn, col)
	//	if err != nil {
	//		return err
	//	}
	//}
	err := c.CleanupOld(0)
	if err != nil {
		return err
	}
	return nil
}
603233
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	ctx := context.Background()
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

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

	relative := toRelativeRecord(fqdn, dns01.ToFqdn(zone))
	rsc := dns.NewRecordSetsClient(d.config.SubscriptionID)
	rsc.Authorizer = d.authorizer

	_, err = rsc.Delete(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, "")
	if err != nil {
		return fmt.Errorf("azure: %v", err)
	}
	return nil
}
10596
func (d *Driver) Cleanup() error {
	err := d.subvolDisableQuota()
	umountErr := mount.Unmount(d.home)

	// in case we have two errors, prefer the one from disableQuota()
	if err != nil {
		return err
	}

	if umountErr != nil {
		return umountErr
	}

	return nil
}
378177
func (r *Resident) cleanup() error {
	return errors.Annotatef(r.cleanupWorkers(), "cleaning up cache resident %d:", r.id)
}