(ctx context.Context, in *deleteAPIKeyInput)
| 165 | } |
| 166 | |
| 167 | func (s *Server) handleDeleteAPIKey(ctx context.Context, in *deleteAPIKeyInput) (*deleteAPIKeyOutput, error) { |
| 168 | user, err := s.requireAccountUser(ctx) |
| 169 | if err != nil { |
| 170 | return nil, err |
| 171 | } |
| 172 | if s.deps.DeleteAPIKey == nil { |
| 173 | return nil, NewError(http.StatusNotImplemented, "not_implemented", "API keys are not available on this deployment") |
| 174 | } |
| 175 | if err := s.deps.DeleteAPIKey(ctx, in.ID, user.ID); err != nil { |
| 176 | if errors.Is(err, identity.ErrAPIKeyNotFound) { |
| 177 | return nil, NewError(http.StatusNotFound, "not_found", "API key not found") |
| 178 | } |
| 179 | return nil, NewError(http.StatusInternalServerError, "internal_error", "failed to revoke API key") |
| 180 | } |
| 181 | return &deleteAPIKeyOutput{Status: http.StatusNoContent}, nil |
| 182 | } |
nothing calls this directly
no test coverage detected