MCPcopy Index your code
hub / github.com/rilldata/rill / SudoUpdateAnnotations

Method SudoUpdateAnnotations

admin/server/projects.go:1818–1865  ·  view source on GitHub ↗

SudoUpdateTags updates the tags for a project in organization for superusers

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

Source from the content-addressed store, hash-verified

1816
1817// SudoUpdateTags updates the tags for a project in organization for superusers
1818func (s *Server) SudoUpdateAnnotations(ctx context.Context, req *adminv1.SudoUpdateAnnotationsRequest) (*adminv1.SudoUpdateAnnotationsResponse, error) {
1819 observability.AddRequestAttributes(ctx,
1820 attribute.String("args.org", req.Org),
1821 attribute.String("args.project", req.Project),
1822 attribute.Int("args.annotations", len(req.Annotations)),
1823 )
1824
1825 // Check the request is made by a superuser
1826 claims := auth.GetClaims(ctx)
1827 if !claims.Superuser(ctx) {
1828 return nil, status.Error(codes.PermissionDenied, "not authorized to update annotations")
1829 }
1830
1831 proj, err := s.admin.DB.FindProjectByName(ctx, req.Org, req.Project)
1832 if err != nil {
1833 return nil, err
1834 }
1835
1836 proj, err = s.admin.UpdateProject(ctx, proj, &database.UpdateProjectOptions{
1837 Name: proj.Name,
1838 Description: proj.Description,
1839 Public: proj.Public,
1840 DirectoryName: proj.DirectoryName,
1841 ArchiveAssetID: proj.ArchiveAssetID,
1842 GitRemote: proj.GitRemote,
1843 GithubInstallationID: proj.GithubInstallationID,
1844 GithubRepoID: proj.GithubRepoID,
1845 ManagedGitRepoID: proj.ManagedGitRepoID,
1846 ProdVersion: proj.ProdVersion,
1847 PrimaryBranch: proj.PrimaryBranch,
1848 Subpath: proj.Subpath,
1849 PrimaryDeploymentID: proj.PrimaryDeploymentID,
1850 ProdSlots: proj.ProdSlots,
1851 ProdTTLSeconds: proj.ProdTTLSeconds,
1852 DevSlots: proj.DevSlots,
1853 DevTTLSeconds: proj.DevTTLSeconds,
1854 OverrideDiskGB: proj.OverrideDiskGB,
1855 Provisioner: proj.Provisioner,
1856 Annotations: req.Annotations,
1857 })
1858 if err != nil {
1859 return nil, err
1860 }
1861
1862 return &adminv1.SudoUpdateAnnotationsResponse{
1863 Project: s.projToDTO(proj, req.Org),
1864 }, nil
1865}
1866
1867func (s *Server) CreateProjectWhitelistedDomain(ctx context.Context, req *adminv1.CreateProjectWhitelistedDomainRequest) (*adminv1.CreateProjectWhitelistedDomainResponse, error) {
1868 observability.AddRequestAttributes(ctx,

Callers

nothing calls this directly

Calls 8

projToDTOMethod · 0.95
AddRequestAttributesFunction · 0.92
GetClaimsFunction · 0.92
StringMethod · 0.65
SuperuserMethod · 0.65
FindProjectByNameMethod · 0.65
UpdateProjectMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected