// DestroyConsumedApplications removes a given set of consumed (remote) applications.
495306
func (api *APIBase) DestroyConsumedApplications(args params.DestroyConsumedApplicationsParams) (params.ErrorResults, error) {
	if err := api.checkCanWrite(); err != nil {
		return params.ErrorResults{}, err
	}
	if err := api.check.RemoveAllowed(); err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}
	results := make([]params.ErrorResult, len(args.Applications))
	for i, arg := range args.Applications {
		appTag, err := names.ParseApplicationTag(arg.ApplicationTag)
		if err != nil {
			results[i].Error = common.ServerError(err)
			continue
		}
		app, err := api.backend.RemoteApplication(appTag.Id())
		if err != nil {
			results[i].Error = common.ServerError(err)
			continue
		}
		// TODO (anastasiamac 2019-03-29) This may need to be forced too.
		// see https://bugs.launchpad.net/juju/+bug/1822050
		err = app.Destroy()
		if err != nil {
			results[i].Error = common.ServerError(err)
			continue
		}
	}
	return params.ErrorResults{results}, nil
}
1205879
func (v *azureVolumeSource) DestroyVolumes(ctx context.ProviderCallContext, volumeIds []string) ([]error, error) {
	if v.maybeStorageClient == nil {
		return v.destroyManagedDiskVolumes(ctx, volumeIds)
	}
	return v.destroyUnmanagedDiskVolumes(ctx, volumeIds)
}
818724
func (c *DefaultClient) UnsubscribeDeviceActivations(appID string, devID string) Token {
	return c.UnsubscribeDeviceEvents(appID, devID, types.ActivationEvent)
}
349523
func (instanceApi *InstanceApi) Destroy(id string, purge bool) (bool, error) {
	send, merr := json.Marshal(DestroyOptions{
		PurgeImmediately: purge,
	})
	if merr != nil {
		return false, merr
	}
	_, err := instanceApi.entityService.Delete(id, send, map[string]string{})
	return err == nil, err
}
275001
func (d *Domain) DestroyFlags(flags DomainDestroyFlags) error {
	var err C.virError
	result := C.virDomainDestroyFlagsWrapper(d.ptr, C.uint(flags), &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
631168
func (opts *TransactionDBOptions) Destroy() {
	C.rocksdb_transactiondb_options_destroy(opts.c)
	opts.c = nil
}
891838
func (a *Application) Destroy() (err error) {
	defer func() {
		logger.Tracef("Application(%s).Destroy() => %v", a.doc.Name, err)
		if err == nil {
			// This is a white lie; the document might actually be removed.
			a.doc.Life = Dying
		}
	}()
	return a.st.ApplyOperation(a.DestroyOperation())
}
313168
func (api *OffersAPI) DestroyOffers(args params.DestroyApplicationOffers) (params.ErrorResults, error) {
	return destroyOffers(api, args.OfferURLs, false)
}
811700
func (s *LicenseConfigurationUsage) SetConsumedLicenses(v int64) *LicenseConfigurationUsage {
	s.ConsumedLicenses = &v
	return s
}
1009729
func (m *MockRPCClient) DestroyRPCClient(contextID string) {
	m.ctrl.Call(m, "DestroyRPCClient", contextID)
}
216814
func (c *Client) DestroyOffers(force bool, offerURLs ...string) error {
	if len(offerURLs) == 0 {
		return nil
	}
	if force {
		if bestVer := c.BestAPIVersion(); bestVer < 2 {
			return errors.NotImplementedf("DestroyOffers() with force (need v2+, have v%d)", bestVer)
		}
	}
	args := params.DestroyApplicationOffers{
		Force:     force,
		OfferURLs: make([]string, len(offerURLs)),
	}
	for i, url := range offerURLs {
		if _, err := crossmodel.ParseOfferURL(url); err != nil {
			return errors.Trace(err)
		}
		args.OfferURLs[i] = url
	}

	var result params.ErrorResults
	err := c.facade.FacadeCall("DestroyOffers", args, &result)
	if err != nil {
		return errors.Trace(err)
	}
	if len(result.Results) != len(args.OfferURLs) {
		return errors.Errorf("expected %d results, got %d", len(args.OfferURLs), len(result.Results))
	}
	return result.Combine()
}
1112461
func (s *ConsumedLicenseSummary) SetConsumedLicenses(v int64) *ConsumedLicenseSummary {
	s.ConsumedLicenses = &v
	return s
}
594542
func (env *environ) Destroy(ctx callcontext.ProviderCallContext) error {
	return env.withSession(ctx, func(env *sessionEnviron) error {
		return env.Destroy(ctx)
	})
}
470400
func (s *Server) DestroyLogs(app string) error {
	// Get a read lock to ensure the storage adapater pointer can't be updated by another
	// goroutine in the time between we check if it's nil and the time we invoke .Destroy() upon
	// it.
	s.adapterMutex.RLock()
	defer s.adapterMutex.RUnlock()
	if s.storageAdapter == nil {
		return fmt.Errorf("Could not destroy logs for '%s'.  No storage adapter specified.", app)
	}
	return s.storageAdapter.Destroy(app)
}
929752
func (s *cinderVolumeSource) DestroyVolumes(ctx context.ProviderCallContext, volumeIds []string) ([]error, error) {
	return foreachVolume(ctx, s.storageAdapter, volumeIds, destroyVolume), nil
}
389045
func (_class HostCrashdumpClass) Destroy(sessionID SessionRef, self HostCrashdumpRef) (_err error) {
	_method := "host_crashdump.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertHostCrashdumpRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
957308
func (m *Model) removeApplication(ch RemoveApplication) error {
	defer m.doLocked()()

	app, ok := m.applications[ch.Name]
	if ok {
		if err := app.evict(); err != nil {
			return errors.Trace(err)
		}
		delete(m.applications, ch.Name)
	}
	return nil
}