// DeleteServer deletes a new backend server.
356955
func (be *T) DeleteServer(beSrvKey engine.ServerKey) bool {
	be.mu.Lock()
	defer be.mu.Unlock()

	i := be.indexOfServer(beSrvKey.Id)
	if i == -1 {
		log.Warnf("Cannot delete missing server %v from backend %v", beSrvKey.Id, be.id)
		return false
	}
	be.cloneSrvCfgsIfSeen()
	lastIdx := len(be.srvs) - 1
	copy(be.srvs[i:], be.srvs[i+1:])
	be.srvs[lastIdx] = Srv{}
	be.srvs = be.srvs[:lastIdx]
	return true
}
1074338
func (c *Client) RenameServer(id, name string) error {
	values := url.Values{
		"SUBID": {id},
		"label": {name},
	}

	if err := c.post(`server/label_set`, values, nil); err != nil {
		return err
	}
	return nil
}
1025232
func (l *State) deleteService(id string) error {
	if id == "" {
		return fmt.Errorf("ServiceID missing")
	}

	req := structs.DeregisterRequest{
		Datacenter:   l.config.Datacenter,
		Node:         l.config.NodeName,
		ServiceID:    id,
		WriteRequest: structs.WriteRequest{Token: l.serviceToken(id)},
	}
	var out struct{}
	err := l.Delegate.RPC("Catalog.Deregister", &req, &out)
	switch {
	case err == nil || strings.Contains(err.Error(), "Unknown service"):
		delete(l.services, id)
		l.logger.Printf("[INFO] agent: Deregistered service %q", id)
		return nil

	case acl.IsErrPermissionDenied(err), acl.IsErrNotFound(err):
		// todo(fs): mark the service to be in sync to prevent excessive retrying before next full sync
		// todo(fs): some backoff strategy might be a better solution
		l.services[id].InSync = true
		l.logger.Printf("[WARN] agent: Service %q deregistration blocked by ACLs", id)
		metrics.IncrCounter([]string{"acl", "blocked", "service", "deregistration"}, 1)
		return nil

	default:
		l.logger.Printf("[WARN] agent: Deregistering service %q failed. %s", id, err)
		return err
	}
}
626227
func DeleteServiceCache(svc loadbalancer.L3n4AddrID) {
	var svcKey ServiceKey

	if !svc.IsIPv6() {
		svcKey = NewService4Key(svc.IP, svc.Port, 0)
	} else {
		svcKey = NewService6Key(svc.IP, svc.Port, 0)
	}

	cache.delete(svcKey)
}
1236931
func (p *ProxyLB) DeleteServer(ip string, port int) {
	p.Settings.ProxyLB.DeleteServer(ip, port)
}
474632
func (w *wizard) manageServers() {
	// List all the servers we can disconnect, along with an entry to connect a new one
	fmt.Println()

	servers := w.conf.servers()
	for i, server := range servers {
		fmt.Printf(" %d. Disconnect %s\n", i+1, server)
	}
	fmt.Printf(" %d. Connect another server\n", len(w.conf.Servers)+1)

	choice := w.readInt()
	if choice < 0 || choice > len(w.conf.Servers)+1 {
		log.Error("Invalid server choice, aborting")
		return
	}
	// If the user selected an existing server, drop it
	if choice <= len(w.conf.Servers) {
		server := servers[choice-1]
		client := w.servers[server]

		delete(w.servers, server)
		if client != nil {
			client.Close()
		}
		delete(w.conf.Servers, server)
		w.conf.flush()

		log.Info("Disconnected existing server", "server", server)
		w.networkStats()
		return
	}
	// If the user requested connecting a new server, do it
	if w.makeServer() != "" {
		w.networkStats()
	}
}
383432
func (i *Instance) SaveServer(s Server, ln net.Listener) {
	i.servers = append(i.servers, ServerListener{server: s, listener: ln})
}
273068
func DeleteServiceV2(svc loadbalancer.L3n4AddrID, releaseBackendID func(loadbalancer.BackendID)) error {
	var (
		backendKey BackendKey
		svcKey     ServiceKeyV2
	)

	mutex.Lock()
	defer mutex.Unlock()

	isIPv6 := svc.IsIPv6()

	log.WithField(logfields.ServiceName, svc).Debug("Deleting service")

	if isIPv6 {
		svcKey = NewService6KeyV2(svc.IP, svc.Port, u8proto.All, 0)
	} else {
		svcKey = NewService4KeyV2(svc.IP, svc.Port, u8proto.All, 0)
	}

	backendsToRemove, backendsCount, err := cache.removeServiceV2(svcKey)
	if err != nil {
		return err
	}

	for slot := 0; slot <= backendsCount; slot++ {
		svcKey.SetSlave(slot)
		if err := svcKey.MapDelete(); err != nil {
			return err
		}
	}

	if isIPv6 {
		backendKey = NewBackend6Key(0)
	} else {
		backendKey = NewBackend4Key(0)
	}

	for _, id := range backendsToRemove {
		backendKey.SetID(id)
		if err := deleteBackendLocked(backendKey); err != nil {
			return fmt.Errorf("Unable to delete backend with ID %d: %s", id, err)
		}
		releaseBackendID(id)
		log.WithField(logfields.BackendID, id).Debug("Deleted backend")
	}

	return nil
}
1296952
func (s *ProxyLBSetting) DeleteServer(ip string, port int) {
	var res []ProxyLBServer
	for i := range s.Servers {
		if s.Servers[i].IPAddress != ip || s.Servers[i].Port != port {
			res = append(res, s.Servers[i])
		}
	}

	s.Servers = res
}
211837
func (s *Wrapper) Delete(ctx context.Context, key []byte) error {
	return s.backend.Delete(ctx, key)
}
576389
func (api *API) DeleteServer(server_id string, args ...interface{}) (*Server, error) {
	result := new(Server)
	url := createUrl(api, serverPathSegment, server_id)

	var keep_ips, keep_hdds, is_true bool
	pm := make(map[string]interface{}, len(args))
	for i, p := range args {
		switch i {
		case 0:
			keep_ips, is_true = p.(bool)
			if !is_true {
				return nil, errors.New("1st parameter is keep_ips must be a bool")
			} else {
				pm["keep_ips"] = keep_ips
			}
		case 1:
			keep_hdds, is_true = p.(bool)
			if !is_true {
				return nil, errors.New("2nd parameter is keep_hdds must be a bool")
			} else {
				pm["keep_hdds"] = keep_hdds
			}
		}
	}

	url = appendQueryParams(url, pm)
	err := api.Client.Delete(url, nil, &result, http.StatusAccepted)
	if err != nil {
		return nil, err
	}
	result.api = api
	result.decodeRaws()
	return result, nil
}
540923
func NewServer(id, serverType string, frontend bool, metadata ...map[string]string) *Server {
	d := make(map[string]string)
	h, err := os.Hostname()
	if err != nil {
		logger.Log.Errorf("failed to get hostname: %s", err.Error())
	}
	if len(metadata) > 0 {
		d = metadata[0]
	}
	return &Server{
		ID:       id,
		Type:     serverType,
		Metadata: d,
		Frontend: frontend,
		Hostname: h,
	}
}
1357660
func (c *Client) DeleteService(i *DeleteServiceInput) error {
	if i.ID == "" {
		return ErrMissingID
	}

	path := fmt.Sprintf("/service/%s", i.ID)
	resp, err := c.Delete(path, nil)
	if err != nil {
		return err
	}

	var r *statusResp
	if err := decodeJSON(&r, resp.Body); err != nil {
		return err
	}
	if !r.Ok() {
		return fmt.Errorf("Not Ok")
	}
	return nil
}
1079596
func (h Osxkeychain) Delete(serverURL string) error {
	s, err := splitServer(serverURL)
	if err != nil {
		return err
	}
	defer freeServer(s)

	errMsg := C.keychain_delete(s)
	if errMsg != nil {
		defer C.free(unsafe.Pointer(errMsg))
		return errors.New(C.GoString(errMsg))
	}

	return nil
}
838692
func DeleteUnusedServers() {
	serverInfoIDs := []uint{}
	db.DB.Model(&gameserver.ServerRecord{}).Pluck("id", &serverInfoIDs)
	for _, id := range serverInfoIDs {
		lobby := &Lobby{}
		err := db.DB.Where("server_info_id = ?", id).First(lobby).Error

		if err != nil || lobby.State == Ended {
			db.DB.Model(&gameserver.ServerRecord{}).Where("id = ?", id).Delete(&gameserver.ServerRecord{})
		}
	}
}
1094049
func (api *GSLBAPI) DeleteGSLBServer(gslbName string, ip string) error {
	gslbItem, err := api.findOrCreateBy(gslbName)
	if err != nil {
		return err
	}
	gslbItem.Settings.GSLB.DeleteServer(ip)

	if gslbItem.HasGSLBServer() {
		_, err = api.updateGSLBServers(gslbItem)
		if err != nil {
			return err
		}

	} else {
		_, err = api.Delete(gslbItem.ID)
		if err != nil {
			return err
		}

	}
	return nil
}
210090
func (p *NetPlugin) DeleteServiceLB(servicename string, spec *core.ServiceSpec) error {
	p.Lock()
	defer p.Unlock()
	return p.NetworkDriver.DelSvcSpec(servicename, spec)
}