// Delete deletes resource by name
779104
func (d *ResourceCommand) Delete(client auth.ClientI) (err error) {
	if d.ref.Kind == "" || d.ref.Name == "" {
		return trace.BadParameter("provide a full resource name to delete, for example:\n$ tctl rm cluster/east\n")
	}

	switch d.ref.Kind {
	case services.KindNode:
		if err = client.DeleteNode(defaults.Namespace, d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("node %v has been deleted\n", d.ref.Name)
	case services.KindUser:
		if err = client.DeleteUser(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("user %v has been deleted\n", d.ref.Name)
	case services.KindSAMLConnector:
		if err = client.DeleteSAMLConnector(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("SAML Connector %v has been deleted\n", d.ref.Name)
	case services.KindOIDCConnector:
		if err = client.DeleteOIDCConnector(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("OIDC Connector %v has been deleted\n", d.ref.Name)
	case services.KindGithubConnector:
		if err = client.DeleteGithubConnector(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("github connector %q has been deleted\n", d.ref.Name)
	case services.KindReverseTunnel:
		if err := client.DeleteReverseTunnel(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("reverse tunnel %v has been deleted\n", d.ref.Name)
	case services.KindTrustedCluster:
		if err = client.DeleteTrustedCluster(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("trusted cluster %q has been deleted\n", d.ref.Name)
	case services.KindRemoteCluster:
		if err = client.DeleteRemoteCluster(d.ref.Name); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("remote cluster %q has been deleted\n", d.ref.Name)
	default:
		return trace.BadParameter("deleting resources of type %q is not supported", d.ref.Kind)
	}
	return nil
}
1003334
func (c *FakeSamples) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(samplesResource, c.ns, name), &v1alpha1.Sample{})

	return err
}
596009
func (s *Store) Delete(ctx context.Context, name string) error {
	name = s.prefix + name
	out.Debug(ctx, "consul.Delete(%s)", name)
	_, err := s.api.KV().Delete(name, nil)
	return err
}
182455
func (c *FakeStatefulSets) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{})

	return err
}
499274
func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &v1beta2.Deployment{})

	return err
}
788018
func Delete(urlStr string, resourceType string, id string) (*http.Response, error) {
	request, err := DeleteRequest(urlStr, resourceType, id)
	if err != nil {
		return nil, err
	}

	_, response, err := Do(request, jsh.ObjectMode)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1369221
func (c *FakeApplications) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &v1alpha1.Application{})

	return err
}
112810
func (c *FakeProjects) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(projectsResource, name), &project.Project{})
	return err
}
39578
func (c *FakeFischers) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(fischersResource, name), &v1alpha1.Fischer{})
	return err
}
412206
func (e *events) Delete(name string) error {
	return e.client.Delete().
		NamespaceIfScoped(e.namespace, len(e.namespace) > 0).
		Resource("events").
		Name(name).
		Do().
		Error()
}
813265
func (c *FakeStorageClasses) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(storageclassesResource, name), &storagev1.StorageClass{})
	return err
}
393694
func (s *resourceServiceImpl) Delete(ctx context.Context, resourceID string) error {

	err := s.ExecuteInTransaction(func() error {
		return s.delete(ctx, resourceID, make(map[string]bool))
	})

	return err
}
1272256
func (e *ApiClientService) Delete(name string) (err error) {
	err = e.client.magicRequestDecoder("DELETE", "clients/"+name, nil, nil)
	return
}
625268
func (es *EnvironmentsService) Delete(ctx context.Context, name string) (string, *APIResponse, error) {
	return es.client.deleteAction(ctx, "admin/environments/"+name, apiV2)
}
534999
func (s *ServicesService) Delete(idOrName string) (*http.Response, error) {
	return s.DeleteWithContext(context.TODO(), idOrName)
}
410533
func (c *FakeLimitRanges) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(limitrangesResource, c.ns, name), &corev1.LimitRange{})

	return err
}
1353326
func (as *AgentServer) Delete(ctx context.Context, deleteRequest *pb.DeleteDatasetShardRequest) (*pb.DeleteDatasetShardResponse, error) {

	log.Println("deleting", deleteRequest.Name)
	as.storageBackend.DeleteNamedDatasetShard(deleteRequest.Name)
	as.inMemoryChannels.Cleanup(deleteRequest.Name)

	return &pb.DeleteDatasetShardResponse{}, nil
}