//  delete a BigSwitch BCF Controller device
974984
func (s *BigSwitchBCFService) DeleteBigSwitchBcfDevice(p *DeleteBigSwitchBcfDeviceParams) (*DeleteBigSwitchBcfDeviceResponse, error) {
	resp, err := s.cs.newRequest("deleteBigSwitchBcfDevice", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteBigSwitchBcfDeviceResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
517865
func (self *qbsWrapped) Delete(id int64, pb PBundle) (interface{}, error) {
	return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) {
		return self.del.DeleteQbs(id, pb, tx)
	})
}
129178
func RemoveSocket(sessionID, steamID string) {
	socketsMu.Lock()
	defer socketsMu.Unlock()

	clients := steamIDSockets[steamID]
	for i, socket := range clients {
		if socket.ID == sessionID {
			clients[i] = clients[len(clients)-1]
			clients[len(clients)-1] = nil
			clients = clients[:len(clients)-1]
			break
		}
	}

	steamIDSockets[steamID] = clients

	if len(clients) == 0 {
		delete(steamIDSockets, steamID)
	}
}
808721
func (s *BigSwitchBCFService) AddBigSwitchBcfDevice(p *AddBigSwitchBcfDeviceParams) (*AddBigSwitchBcfDeviceResponse, error) {
	resp, err := s.cs.newRequest("addBigSwitchBcfDevice", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r AddBigSwitchBcfDeviceResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
903356
func (s *BrocadeVCSService) NewDeleteBrocadeVcsDeviceParams(vcsdeviceid string) *DeleteBrocadeVcsDeviceParams {
	p := &DeleteBrocadeVcsDeviceParams{}
	p.p = make(map[string]interface{})
	p.p["vcsdeviceid"] = vcsdeviceid
	return p
}
321250
func (dev *LinkLayerDevice) Remove() (err error) {
	defer errors.DeferredAnnotatef(&err, "cannot remove %s", dev)

	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			if err = dev.errNoOperationsIfMissing(); err != nil {
				return nil, err
			}
		}
		ops, err := removeLinkLayerDeviceOps(dev.st, dev.DocID(), dev.parentDocID())
		if err != nil {
			return nil, err
		}
		if dev.ProviderID() != "" {
			op := dev.st.networkEntityGlobalKeyRemoveOp("linklayerdevice", dev.ProviderID())
			ops = append(ops, op)
		}
		return ops, nil
	}
	return dev.st.db().Run(buildTxn)
}
25875
func (hub *Hub) remove(conn *Connection) {
	delete(hub.connections, conn)
	close(conn.send)
}
1019760
func removeFromScsiSubsystem(deviceName string, io ioHandler) {
	fileName := "/sys/block/" + deviceName + "/device/delete"
	klog.V(4).Infof("fc: remove device from scsi-subsystem: path: %s", fileName)
	data := []byte("1")
	io.WriteFile(fileName, data, 0666)
}
943534
func DeleteBgp(key string) error {
	collections.BgpMutex.Lock()
	obj := collections.Bgps[key]
	collections.BgpMutex.Unlock()
	if obj == nil {
		log.Errorf("Bgp %s not found", key)
		return errors.New("Bgp not found")
	}

	// Check if we handle this object
	if objCallbackHandler.BgpCb == nil {
		log.Errorf("No callback registered for Bgp object")
		return errors.New("Invalid object type")
	}

	// Perform callback
	err := objCallbackHandler.BgpCb.BgpDelete(obj)
	if err != nil {
		log.Errorf("BgpDelete retruned error for: %+v. Err: %v", obj, err)
		return err
	}

	// delete it from modeldb
	collections.BgpMutex.Lock()
	err = obj.Delete()
	collections.BgpMutex.Unlock()
	if err != nil {
		log.Errorf("Error deleting Bgp %s. Err: %v", obj.Key, err)
	}

	// delete it from cache
	collections.BgpMutex.Lock()
	delete(collections.Bgps, key)
	collections.BgpMutex.Unlock()

	return nil
}
196568
func DeleteBgp(stateDriver core.StateDriver, hostname string) error {
	log.Infof("Deleting bgp neighbor for {%v}", hostname)
	bgpState := &mastercfg.CfgBgpState{}
	bgpState.StateDriver = stateDriver
	err := bgpState.Read(hostname)
	if err != nil {
		log.Errorf("Error reading bgp config for hostname %s", hostname)
		return err
	}
	err = bgpState.Clear()
	if err != nil {
		log.Errorf("Error deleing Bgp config for hostname %s", hostname)
		return err
	}
	return nil

}
955106
func (uvm *UtilityVM) RemoveSCSI(hostPath string) (err error) {
	op := "uvm::RemoveSCSI"
	log := logrus.WithFields(logrus.Fields{
		logfields.UVMID: uvm.id,
		"host-path":     hostPath,
	})
	log.Debug(op + " - Begin Operation")
	defer func() {
		if err != nil {
			log.Data[logrus.ErrorKey] = err
			log.Error(op + " - End Operation - Error")
		} else {
			log.Debug(op + " - End Operation - Success")
		}
	}()

	uvm.m.Lock()
	defer uvm.m.Unlock()

	if uvm.scsiControllerCount == 0 {
		return ErrNoSCSIControllers
	}

	// Make sure is actually attached
	controller, lun, uvmPath, err := uvm.findSCSIAttachment(hostPath)
	if err != nil {
		return err
	}

	if uvm.scsiLocations[controller][lun].isLayer {
		uvm.scsiLocations[controller][lun].refCount--
		if uvm.scsiLocations[controller][lun].refCount > 0 {
			return nil
		}
	}

	if err := uvm.removeSCSI(hostPath, uvmPath, controller, lun); err != nil {
		return fmt.Errorf("failed to remove SCSI disk %s from container %s: %s", hostPath, uvm.id, err)

	}
	return nil
}
258252
func (s *RedisDeviceStore) Delete(appEUI types.AppEUI, devEUI types.DevEUI) error {
	key := s.key(appEUI, devEUI)

	deviceI, err := s.store.GetFields(key, "dev_addr")
	if err != nil {
		return err
	}

	device, ok := deviceI.(Device)
	if !ok {
		errors.New("Database did not return a Device")
	}

	if !device.DevAddr.IsEmpty() {
		if err := s.devAddrIndex.Remove(device.DevAddr.String(), key); err != nil {
			return err
		}
	}

	return s.store.Delete(key)
}
499568
func (util *fcUtil) detachFCDisk(io ioHandler, devicePath string) error {
	// Remove scsi device from the node.
	if !strings.HasPrefix(devicePath, "/dev/") {
		return fmt.Errorf("fc detach disk: invalid device name: %s", devicePath)
	}
	arr := strings.Split(devicePath, "/")
	dev := arr[len(arr)-1]
	removeFromScsiSubsystem(dev, io)
	return nil
}
625939
func (c *MemStore) RemoveController(name string) error {
	c.mu.Lock()
	defer c.mu.Unlock()

	if err := ValidateControllerName(name); err != nil {
		return err
	}
	names := set.NewStrings(name)
	if namedControllerDetails, ok := c.Controllers[name]; ok {
		for name, details := range c.Controllers {
			if details.ControllerUUID == namedControllerDetails.ControllerUUID {
				names.Add(name)
				if name == c.CurrentControllerName {
					c.CurrentControllerName = ""
				}
			}
		}
	}
	for _, name := range names.Values() {
		delete(c.Models, name)
		delete(c.Accounts, name)
		delete(c.BootstrapConfig, name)
		delete(c.Controllers, name)
		delete(c.CookieJars, name)
	}
	return nil
}
1111480
func (client *GCSBlobstore) Delete(dest string) error {
	if client.readOnly() {
		return ErrInvalidROWriteOperation
	}

	err := client.getObjectHandle(client.authenticatedGCS, dest).Delete(context.Background())
	if err == storage.ErrObjectNotExist {
		return nil
	}
	return err
}
259318
func (r Network_Interconnect_Tenant) DeleteConnection(receivedObject *datatypes.Network_Interconnect_Tenant) (resp bool, err error) {
	params := []interface{}{
		receivedObject,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Interconnect_Tenant", "deleteConnection", params, &r.Options, &resp)
	return
}
1129614
func (c *ClientsetCAStore) deleteSSHCredential(name string) error {
	client := c.clientset.SSHCredentials(c.namespace)
	err := client.Delete(name, &v1.DeleteOptions{})
	if err != nil {
		return fmt.Errorf("error deleting SSHCredential %q: %v", name, err)
	}
	return nil
}