MCPcopy Create free account
hub / github.com/rilldata/rill / DeleteService

Method DeleteService

admin/server/service.go:402–429  ·  view source on GitHub ↗

DeleteService deletes a service account.

(ctx context.Context, req *adminv1.DeleteServiceRequest)

Source from the content-addressed store, hash-verified

400
401// DeleteService deletes a service account.
402func (s *Server) DeleteService(ctx context.Context, req *adminv1.DeleteServiceRequest) (*adminv1.DeleteServiceResponse, error) {
403 observability.AddRequestAttributes(ctx,
404 attribute.String("args.name", req.Name),
405 attribute.String("args.organization_name", req.Org),
406 )
407
408 org, err := s.admin.DB.FindOrganizationByName(ctx, req.Org)
409 if err != nil {
410 return nil, err
411 }
412
413 service, err := s.admin.DB.FindServiceByName(ctx, org.ID, req.Name)
414 if err != nil {
415 return nil, err
416 }
417
418 claims := auth.GetClaims(ctx)
419 if !claims.OrganizationPermissions(ctx, org.ID).ManageOrg {
420 return nil, status.Error(codes.PermissionDenied, "not allowed to delete service")
421 }
422
423 err = s.admin.DB.DeleteService(ctx, service.ID)
424 if err != nil {
425 return nil, err
426 }
427
428 return &adminv1.DeleteServiceResponse{}, nil
429}
430
431// ListServiceAuthTokens lists all auth tokens for a service account.
432func (s *Server) ListServiceAuthTokens(ctx context.Context, req *adminv1.ListServiceAuthTokensRequest) (*adminv1.ListServiceAuthTokensResponse, error) {

Callers

nothing calls this directly

Calls 8

AddRequestAttributesFunction · 0.92
GetClaimsFunction · 0.92
StringMethod · 0.65
FindServiceByNameMethod · 0.65
DeleteServiceMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected