// Deletes a cluster.
540384
func (s *ClusterService) DeleteCluster(p *DeleteClusterParams) (*DeleteClusterResponse, error) {
	resp, err := s.cs.newRequest("deleteCluster", p.toURLValues())
	if err != nil {
		return nil, err
	}

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

	return &r, nil
}
772253
func (s *Server) Delete(ctx context.Context, q *ClusterQuery) (*ClusterResponse, error) {
	if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionDelete, q.Server); err != nil {
		return nil, err
	}
	err := s.db.DeleteCluster(ctx, q.Server)
	return &ClusterResponse{}, err
}
1010179
func (a *AuthServer) DeleteRemoteCluster(clusterName string) error {
	// To make sure remote cluster exists - to protect against random
	// clusterName requests (e.g. when clusterName is set to local cluster name)
	_, err := a.Presence.GetRemoteCluster(clusterName)
	if err != nil {
		return trace.Wrap(err)
	}
	// delete cert authorities associated with the cluster
	err = a.DeleteCertAuthority(services.CertAuthID{
		Type:       services.HostCA,
		DomainName: clusterName,
	})
	if err != nil {
		// this method could have succeeded on the first call,
		// but then if the remote cluster resource could not be deleted
		// it would be impossible to delete the cluster after then
		if !trace.IsNotFound(err) {
			return trace.Wrap(err)
		}
	}
	// there should be no User CA in trusted clusters on the main cluster side
	// per standard automation but clean up just in case
	err = a.DeleteCertAuthority(services.CertAuthID{
		Type:       services.UserCA,
		DomainName: clusterName,
	})
	if err != nil {
		if !trace.IsNotFound(err) {
			return trace.Wrap(err)
		}
	}
	return a.Presence.DeleteRemoteCluster(clusterName)
}
813824
func (_m *ClusterServiceServer) Delete(_a0 context.Context, _a1 *cluster.ClusterQuery) (*cluster.ClusterResponse, error) {
	ret := _m.Called(_a0, _a1)

	var r0 *cluster.ClusterResponse
	if rf, ok := ret.Get(0).(func(context.Context, *cluster.ClusterQuery) *cluster.ClusterResponse); ok {
		r0 = rf(_a0, _a1)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*cluster.ClusterResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *cluster.ClusterQuery) error); ok {
		r1 = rf(_a0, _a1)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
946421
func (s *PresenceService) DeleteAllRemoteClusters() error {
	startKey := backend.Key(remoteClustersPrefix)
	err := s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
	return trace.Wrap(err)
}
312900
func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
	action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions)

	_, err := c.Fake.Invokes(action, &v1alpha2.ClusterList{})
	return err
}
565362
func (s *ObjectstoreServer) Delete(
	ctx context.Context,
	req *api.SdkObjectstoreDeleteRequest,
) (*api.SdkObjectstoreDeleteResponse, error) {
	if s.cluster() == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	err := s.cluster().ObjectStoreDelete(req.GetObjectstoreId())
	if err != nil && err != kvdb.ErrNotFound {
		return nil, status.Errorf(
			codes.Internal,
			"Failed to delete objectstore: %v",
			err.Error())
	}

	return &api.SdkObjectstoreDeleteResponse{}, nil
}
821649
func (self *DocumentBase) Delete() error {

	if self.Id.Valid() {

		self.SetDeleted(true)

		return self.Save()
	}

	return errors.New("Invalid object id")
}
495525
func (m *NullClusterRemove) Remove(arg0 []api.Node, arg1 bool) error {
	return ErrNotImplemented
}
332409
func (api *ServerAPI) DeleteWithDisk(id int64, disks []int64) (*sacloud.Server, error) {
	return api.request(func(res *sacloud.Response) error {
		return api.delete(id, map[string]interface{}{"WithDisk": disks}, res)
	})
}
1129381
func (c *Connection) ContainerDelete(container string) error {
	_, _, err := c.storage(RequestOpts{
		Container:  container,
		Operation:  "DELETE",
		ErrorMap:   ContainerErrorMap,
		NoResponse: true,
	})
	return err
}
836308
func (c *clusterName) erase() error {
	err := c.clusterConfigCache.DeleteClusterName()
	if err != nil {
		if !trace.IsNotFound(err) {
			return trace.Wrap(err)
		}
	}
	return nil
}
643929
func (p *cbPool) Delete(ptr unsafe.Pointer) {
	p.m.Lock()
	defer p.m.Unlock()
	p.checkPointer(ptr)
	id := *(*int)(ptr) - 1
	if id == -1 {
		panic("Attempt to delete nonexistent value from pool")
	}
	p.indices[id] = 0
	p.objects[id] = nil
	return
}
254675
func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &kops.Cluster{})

	return err
}
676459
func (c *Connection) ObjectDelete(container string, objectName string) error {
	_, _, err := c.storage(RequestOpts{
		Container:  container,
		ObjectName: objectName,
		Operation:  "DELETE",
		ErrorMap:   objectErrorMap,
	})
	return err
}
307726
func (c *openstackCloud) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
	grp := g.Raw.(*servergroups.ServerGroup)

	for _, id := range grp.Members {
		err := c.DeleteInstanceWithID(id)
		if err != nil {
			return fmt.Errorf("Could not delete instance %q: %v", id, err)
		}
	}

	ports, err := c.ListPorts(ports.ListOpts{})
	if err != nil {
		return fmt.Errorf("Could not list ports %v", err)
	}

	for _, port := range ports {
		if strings.Contains(port.Name, grp.Name) {
			err := c.DeletePort(port.ID)
			if err != nil {
				return fmt.Errorf("Could not delete port %q: %v", port.ID, err)
			}
		}
	}

	err = c.DeleteServerGroup(grp.ID)
	if err != nil {
		return fmt.Errorf("Could not server group %q: %v", grp.ID, err)
	}

	return nil
}
50174
func (u *UnschedulablePodsMap) delete(pod *v1.Pod) {
	podID := u.keyFunc(pod)
	if _, exists := u.podInfoMap[podID]; exists && u.metricRecorder != nil {
		u.metricRecorder.Dec()
	}
	delete(u.podInfoMap, podID)
}