SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore(serviceaccount): remove deprecated nested role endpoints (#12591)
Vikrant Guptadca6aa497d73
diff --git a/docs/api/openapi.yml b/docs/api/openapi.ymlindex a9f62f7433..1b06632d1e 100644--- a/docs/api/openapi.yml+++ b/docs/api/openapi.yml@@ -8024,13 +8024,6 @@ components:- schemaVersion- spectype: object- ServiceaccounttypesDeprecatedPostableServiceAccountRole:- properties:- id:- type: string- required:- - id- type: objectServiceaccounttypesGettableFactorAPIKey:properties:createdAt:@@ -13262,117 +13255,6 @@ paths:summary: Gets service account rolestags:- serviceaccount- post:- deprecated: true- description: This endpoint assigns a role to a service account- operationId: CreateServiceAccountRoleDeprecated- parameters:- - in: path- name: id- required: true- schema:- type: string- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/ServiceaccounttypesDeprecatedPostableServiceAccountRole'- responses:- "201":- content:- application/json:- schema:- properties:- data:- $ref: '#/components/schemas/TypesIdentifiable'- status:- type: string- required:- - status- - data- type: object- description: Created- "400":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Bad Request- "401":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Unauthorized- "403":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Forbidden- "500":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Internal Server Error- security:- - api_key:- - serviceaccount:attach- - role:attach- - tokenizer:- - serviceaccount:attach- - role:attach- summary: Create service account role- tags:- - serviceaccount- /api/v1/service_accounts/{id}/roles/{rid}:- delete:- deprecated: true- description: This endpoint revokes a role from service account- operationId: DeleteServiceAccountRoleDeprecated- parameters:- - in: path- name: id- required: true- schema:- type: string- - in: path- name: rid- required: true- schema:- type: string- responses:- "204":- description: No Content- "401":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Unauthorized- "403":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Forbidden- "500":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Internal Server Error- security:- - api_key:- - serviceaccount:detach- - role:detach- - tokenizer:- - serviceaccount:detach- - role:detach- summary: Delete service account role- tags:- - serviceaccount/api/v1/service_accounts/me:get:deprecated: falsediff --git a/frontend/src/api/generated/services/serviceaccount/index.ts b/frontend/src/api/generated/services/serviceaccount/index.tsindex 93b128f979..1bd6ca2a47 100644--- a/frontend/src/api/generated/services/serviceaccount/index.ts+++ b/frontend/src/api/generated/services/serviceaccount/index.ts@@ -22,10 +22,7 @@ import type {CreateServiceAccountKey201,CreateServiceAccountKeyPathParameters,CreateServiceAccountRole201,- CreateServiceAccountRoleDeprecated201,- CreateServiceAccountRoleDeprecatedPathParameters,DeleteServiceAccountPathParameters,- DeleteServiceAccountRoleDeprecatedPathParameters,DeleteServiceAccountRolePathParameters,GetMyServiceAccount200,GetServiceAccount200,@@ -39,7 +36,6 @@ import type {ListServiceAccounts200,RenderErrorResponseDTO,RevokeServiceAccountKeyPathParameters,- ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO,ServiceaccounttypesPostableFactorAPIKeyDTO,ServiceaccounttypesPostableServiceAccountDTO,ServiceaccounttypesPostableServiceAccountRoleDTO,@@ -1253,194 +1249,6 @@ export const invalidateGetServiceAccountRoles = async (return queryClient;};-/**- * This endpoint assigns a role to a service account- * @deprecated- * @summary Create service account role- */-export const createServiceAccountRoleDeprecated = (- { id }: CreateServiceAccountRoleDeprecatedPathParameters,- serviceaccounttypesDeprecatedPostableServiceAccountRoleDTO?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>,- signal?: AbortSignal,-) => {- return GeneratedAPIInstance<CreateServiceAccountRoleDeprecated201>({- url: `/api/v1/service_accounts/${id}/roles`,- method: 'POST',- headers: { 'Content-Type': 'application/json' },- data: serviceaccounttypesDeprecatedPostableServiceAccountRoleDTO,- signal,- });-};--export const getCreateServiceAccountRoleDeprecatedMutationOptions = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>,- TError,- {- pathParams: CreateServiceAccountRoleDeprecatedPathParameters;- data?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>;- },- TContext- >;-}): UseMutationOptions<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>,- TError,- {- pathParams: CreateServiceAccountRoleDeprecatedPathParameters;- data?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>;- },- TContext-> => {- const mutationKey = ['createServiceAccountRoleDeprecated'];- const { mutation: mutationOptions } = options- ? options.mutation &&- 'mutationKey' in options.mutation &&- options.mutation.mutationKey- ? options- : { ...options, mutation: { ...options.mutation, mutationKey } }- : { mutation: { mutationKey } };-- const mutationFn: MutationFunction<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>,- {- pathParams: CreateServiceAccountRoleDeprecatedPathParameters;- data?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>;- }- > = (props) => {- const { pathParams, data } = props ?? {};-- return createServiceAccountRoleDeprecated(pathParams, data);- };-- return { mutationFn, ...mutationOptions };-};--export type CreateServiceAccountRoleDeprecatedMutationResult = NonNullable<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>->;-export type CreateServiceAccountRoleDeprecatedMutationBody =- | BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>- | undefined;-export type CreateServiceAccountRoleDeprecatedMutationError =- ErrorType<RenderErrorResponseDTO>;--/**- * @deprecated- * @summary Create service account role- */-export const useCreateServiceAccountRoleDeprecated = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>,- TError,- {- pathParams: CreateServiceAccountRoleDeprecatedPathParameters;- data?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>;- },- TContext- >;-}): UseMutationResult<- Awaited<ReturnType<typeof createServiceAccountRoleDeprecated>>,- TError,- {- pathParams: CreateServiceAccountRoleDeprecatedPathParameters;- data?: BodyType<ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO>;- },- TContext-> => {- return useMutation(- getCreateServiceAccountRoleDeprecatedMutationOptions(options),- );-};-/**- * This endpoint revokes a role from service account- * @deprecated- * @summary Delete service account role- */-export const deleteServiceAccountRoleDeprecated = (- { id, rid }: DeleteServiceAccountRoleDeprecatedPathParameters,- signal?: AbortSignal,-) => {- return GeneratedAPIInstance<void>({- url: `/api/v1/service_accounts/${id}/roles/${rid}`,- method: 'DELETE',- signal,- });-};--export const getDeleteServiceAccountRoleDeprecatedMutationOptions = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>,- TError,- { pathParams: DeleteServiceAccountRoleDeprecatedPathParameters },- TContext- >;-}): UseMutationOptions<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>,- TError,- { pathParams: DeleteServiceAccountRoleDeprecatedPathParameters },- TContext-> => {- const mutationKey = ['deleteServiceAccountRoleDeprecated'];- const { mutation: mutationOptions } = options- ? options.mutation &&- 'mutationKey' in options.mutation &&- options.mutation.mutationKey- ? options- : { ...options, mutation: { ...options.mutation, mutationKey } }- : { mutation: { mutationKey } };-- const mutationFn: MutationFunction<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>,- { pathParams: DeleteServiceAccountRoleDeprecatedPathParameters }- > = (props) => {- const { pathParams } = props ?? {};-- return deleteServiceAccountRoleDeprecated(pathParams);- };-- return { mutationFn, ...mutationOptions };-};--export type DeleteServiceAccountRoleDeprecatedMutationResult = NonNullable<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>->;--export type DeleteServiceAccountRoleDeprecatedMutationError =- ErrorType<RenderErrorResponseDTO>;--/**- * @deprecated- * @summary Delete service account role- */-export const useDeleteServiceAccountRoleDeprecated = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>,- TError,- { pathParams: DeleteServiceAccountRoleDeprecatedPathParameters },- TContext- >;-}): UseMutationResult<- Awaited<ReturnType<typeof deleteServiceAccountRoleDeprecated>>,- TError,- { pathParams: DeleteServiceAccountRoleDeprecatedPathParameters },- TContext-> => {- return useMutation(- getDeleteServiceAccountRoleDeprecatedMutationOptions(options),- );-};/*** This endpoint gets my service account* @summary Gets my service accountdiff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.tsindex 65ef281cb5..331e7ffabb 100644--- a/frontend/src/api/generated/services/sigNoz.schemas.ts+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts@@ -9092,13 +9092,6 @@ export interface SavedviewtypesUpdatableSavedViewDTO {spec: SavedviewtypesSavedViewSpecDTO;}-export interface ServiceaccounttypesDeprecatedPostableServiceAccountRoleDTO {- /**- * @type string- */- id: string;-}-export interface ServiceaccounttypesGettableFactorAPIKeyDTO {/*** @type string@@ -11020,21 +11013,6 @@ export type GetServiceAccountRoles200 = {status: string;};-export type CreateServiceAccountRoleDeprecatedPathParameters = {- id: string;-};-export type CreateServiceAccountRoleDeprecated201 = {- data: TypesIdentifiableDTO;- /**- * @type string- */- status: string;-};--export type DeleteServiceAccountRoleDeprecatedPathParameters = {- id: string;- rid: string;-};export type GetMyServiceAccount200 = {data: ServiceaccounttypesServiceAccountWithRolesDTO;/**diff --git a/pkg/apiserver/signozapiserver/serviceaccount.go b/pkg/apiserver/signozapiserver/serviceaccount.goindex 62671599fe..561caabae5 100644--- a/pkg/apiserver/signozapiserver/serviceaccount.go+++ b/pkg/apiserver/signozapiserver/serviceaccount.go@@ -138,66 +138,6 @@ func (provider *provider) addServiceAccountRoutes(router *mux.Router) error {return err}- if err := router.Handle("/api/v1/service_accounts/{id}/roles", handler.New(- provider.authzMiddleware.CheckResources(provider.serviceAccountHandler.SetRole, authtypes.SigNozAdminRoleName),- handler.OpenAPIDef{- ID: "CreateServiceAccountRoleDeprecated",- Tags: []string{"serviceaccount"},- Summary: "Create service account role",- Description: "This endpoint assigns a role to a service account",- Request: new(serviceaccounttypes.DeprecatedPostableServiceAccountRole),- RequestContentType: "",- Response: new(types.Identifiable),- ResponseContentType: "application/json",- SuccessStatusCode: http.StatusCreated,- ErrorStatusCodes: []int{http.StatusBadRequest},- Deprecated: true,- SecuritySchemes: newScopedSecuritySchemes([]string{coretypes.ResourceServiceAccount.Scope(coretypes.VerbAttach), coretypes.ResourceRole.Scope(coretypes.VerbAttach)}),- },- handler.WithResourceDefs(handler.AttachDetachSiblingResourceDef{- Verb: coretypes.VerbAttach,- Category: coretypes.ActionCategoryAccessControl,- SourceResource: coretypes.ResourceServiceAccount,- SourceIDs: coretypes.OneID(coretypes.PathParam("id")),- SourceSelector: coretypes.IDSelector,- TargetResource: coretypes.ResourceRole,- TargetIDs: coretypes.OneID(coretypes.BodyJSONPath("id")),- TargetSelector: provider.roleSelector,- }),- )).Methods(http.MethodPost).GetError(); err != nil {- return err- }-- if err := router.Handle("/api/v1/service_accounts/{id}/roles/{rid}", handler.New(- provider.authzMiddleware.CheckResources(provider.serviceAccountHandler.DeleteRole, authtypes.SigNozAdminRoleName),- handler.OpenAPIDef{- ID: "DeleteServiceAccountRoleDeprecated",- Tags: []string{"serviceaccount"},- Summary: "Delete service account role",- Description: "This endpoint revokes a role from service account",- Request: nil,- RequestContentType: "",- Response: nil,- ResponseContentType: "application/json",- SuccessStatusCode: http.StatusNoContent,- ErrorStatusCodes: []int{},- Deprecated: true,- SecuritySchemes: newScopedSecuritySchemes([]string{coretypes.ResourceServiceAccount.Scope(coretypes.VerbDetach), coretypes.ResourceRole.Scope(coretypes.VerbDetach)}),- },- handler.WithResourceDefs(handler.AttachDetachSiblingResourceDef{- Verb: coretypes.VerbDetach,- Category: coretypes.ActionCategoryAccessControl,- SourceResource: coretypes.ResourceServiceAccount,- SourceIDs: coretypes.OneID(coretypes.PathParam("id")),- SourceSelector: coretypes.IDSelector,- TargetResource: coretypes.ResourceRole,- TargetIDs: coretypes.OneID(coretypes.PathParam("rid")),- TargetSelector: provider.roleSelector,- }),- )).Methods(http.MethodDelete).GetError(); err != nil {- return err- }-if err := router.Handle("/api/v1/service_accounts/me", handler.New(provider.authzMiddleware.OpenAccess(provider.serviceAccountHandler.UpdateMe), handler.OpenAPIDef{ID: "UpdateMyServiceAccount",Tags: []string{"serviceaccount"},diff --git a/pkg/modules/serviceaccount/implserviceaccount/handler.go b/pkg/modules/serviceaccount/implserviceaccount/handler.goindex 37cb444dbe..9c1dfc7467 100644--- a/pkg/modules/serviceaccount/implserviceaccount/handler.go+++ b/pkg/modules/serviceaccount/implserviceaccount/handler.go@@ -214,64 +214,6 @@ func (handler *handler) UpdateMe(rw http.ResponseWriter, r *http.Request) {render.Success(rw, http.StatusNoContent, nil)}-func (handler *handler) SetRole(rw http.ResponseWriter, r *http.Request) {- ctx := r.Context()- claims, err := authtypes.ClaimsFromContext(ctx)- if err != nil {- render.Error(rw, err)- return- }-- id, err := valuer.NewUUID(mux.Vars(r)["id"])- if err != nil {- render.Error(rw, err)- return- }-- req := new(serviceaccounttypes.DeprecatedPostableServiceAccountRole)- if err := binding.JSON.BindBody(r.Body, req); err != nil {- render.Error(rw, err)- return- }-- _, err = handler.module.SetRole(ctx, valuer.MustNewUUID(claims.OrgID), id, req.ID)- if err != nil {- render.Error(rw, err)- return- }-- render.Success(rw, http.StatusNoContent, nil)-}--func (handler *handler) DeleteRole(rw http.ResponseWriter, r *http.Request) {- ctx := r.Context()- claims, err := authtypes.ClaimsFromContext(ctx)- if err != nil {- render.Error(rw, err)- return- }-- id, err := valuer.NewUUID(mux.Vars(r)["id"])- if err != nil {- render.Error(rw, err)- return- }-- roleID, err := valuer.NewUUID(mux.Vars(r)["rid"])- if err != nil {- render.Error(rw, err)- return- }-- err = handler.module.DeleteRole(ctx, valuer.MustNewUUID(claims.OrgID), id, roleID)- if err != nil {- render.Error(rw, err)- return- }-- render.Success(rw, http.StatusNoContent, nil)-}-func (handler *handler) CreateServiceAccountRole(rw http.ResponseWriter, r *http.Request) {ctx := r.Context()claims, err := authtypes.ClaimsFromContext(ctx)diff --git a/pkg/modules/serviceaccount/serviceaccount.go b/pkg/modules/serviceaccount/serviceaccount.goindex 828a570eba..b9bc838189 100644--- a/pkg/modules/serviceaccount/serviceaccount.go+++ b/pkg/modules/serviceaccount/serviceaccount.go@@ -94,10 +94,6 @@ type Handler interface {UpdateMe(http.ResponseWriter, *http.Request)- SetRole(http.ResponseWriter, *http.Request)-- DeleteRole(http.ResponseWriter, *http.Request)-CreateServiceAccountRole(http.ResponseWriter, *http.Request)GetServiceAccountRole(http.ResponseWriter, *http.Request)diff --git a/pkg/types/serviceaccounttypes/service_acccount.go b/pkg/types/serviceaccounttypes/service_acccount.goindex c1c03ff8f2..5809d64af1 100644--- a/pkg/types/serviceaccounttypes/service_acccount.go+++ b/pkg/types/serviceaccounttypes/service_acccount.go@@ -69,10 +69,6 @@ type PostableServiceAccount struct {Name string `json:"name" required:"true"`}-type DeprecatedPostableServiceAccountRole struct {- ID valuer.UUID `json:"id" required:"true"`-}-type PostableServiceAccountRole struct {ServiceAccountID valuer.UUID `json:"serviceAccountId" required:"true"`RoleID valuer.UUID `json:"roleId" required:"true"`