mirror of https://github.com/coder/coder.git
chore: remove unused query failing to prepare (#11167)
This commit is contained in:
parent
19c0cfdabf
commit
0181e036f6
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/open-policy-agent/opa/topdown"
|
||||
|
||||
"cdr.dev/slog"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
"github.com/coder/coder/v2/coderd/httpapi/httpapiconstraints"
|
||||
|
@ -903,13 +904,6 @@ func (q *querier) GetAllTailnetAgents(ctx context.Context) ([]database.TailnetAg
|
|||
return q.db.GetAllTailnetAgents(ctx)
|
||||
}
|
||||
|
||||
func (q *querier) GetAllTailnetClients(ctx context.Context) ([]database.GetAllTailnetClientsRow, error) {
|
||||
if err := q.authorizeContext(ctx, rbac.ActionRead, rbac.ResourceTailnetCoordinator); err != nil {
|
||||
return []database.GetAllTailnetClientsRow{}, err
|
||||
}
|
||||
return q.db.GetAllTailnetClients(ctx)
|
||||
}
|
||||
|
||||
func (q *querier) GetAllTailnetCoordinators(ctx context.Context) ([]database.TailnetCoordinator, error) {
|
||||
if err := q.authorizeContext(ctx, rbac.ActionRead, rbac.ResourceTailnetCoordinator); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -1357,10 +1357,6 @@ func (*FakeQuerier) GetAllTailnetAgents(_ context.Context) ([]database.TailnetAg
|
|||
return nil, ErrUnimplemented
|
||||
}
|
||||
|
||||
func (*FakeQuerier) GetAllTailnetClients(_ context.Context) ([]database.GetAllTailnetClientsRow, error) {
|
||||
return nil, ErrUnimplemented
|
||||
}
|
||||
|
||||
func (*FakeQuerier) GetAllTailnetCoordinators(context.Context) ([]database.TailnetCoordinator, error) {
|
||||
return nil, ErrUnimplemented
|
||||
}
|
||||
|
|
|
@ -335,13 +335,6 @@ func (m metricsStore) GetAllTailnetAgents(ctx context.Context) ([]database.Tailn
|
|||
return r0, r1
|
||||
}
|
||||
|
||||
func (m metricsStore) GetAllTailnetClients(ctx context.Context) ([]database.GetAllTailnetClientsRow, error) {
|
||||
start := time.Now()
|
||||
r0, r1 := m.s.GetAllTailnetClients(ctx)
|
||||
m.queryLatencies.WithLabelValues("GetAllTailnetClients").Observe(time.Since(start).Seconds())
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
func (m metricsStore) GetAllTailnetCoordinators(ctx context.Context) ([]database.TailnetCoordinator, error) {
|
||||
start := time.Now()
|
||||
r0, r1 := m.s.GetAllTailnetCoordinators(ctx)
|
||||
|
|
|
@ -573,21 +573,6 @@ func (mr *MockStoreMockRecorder) GetAllTailnetAgents(arg0 interface{}) *gomock.C
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllTailnetAgents", reflect.TypeOf((*MockStore)(nil).GetAllTailnetAgents), arg0)
|
||||
}
|
||||
|
||||
// GetAllTailnetClients mocks base method.
|
||||
func (m *MockStore) GetAllTailnetClients(arg0 context.Context) ([]database.GetAllTailnetClientsRow, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAllTailnetClients", arg0)
|
||||
ret0, _ := ret[0].([]database.GetAllTailnetClientsRow)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetAllTailnetClients indicates an expected call of GetAllTailnetClients.
|
||||
func (mr *MockStoreMockRecorder) GetAllTailnetClients(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllTailnetClients", reflect.TypeOf((*MockStore)(nil).GetAllTailnetClients), arg0)
|
||||
}
|
||||
|
||||
// GetAllTailnetCoordinators mocks base method.
|
||||
func (m *MockStore) GetAllTailnetCoordinators(arg0 context.Context) ([]database.TailnetCoordinator, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
|
@ -81,7 +81,6 @@ type sqlcQuerier interface {
|
|||
GetActiveUserCount(ctx context.Context) (int64, error)
|
||||
GetActiveWorkspaceBuildsByTemplateID(ctx context.Context, templateID uuid.UUID) ([]WorkspaceBuild, error)
|
||||
GetAllTailnetAgents(ctx context.Context) ([]TailnetAgent, error)
|
||||
GetAllTailnetClients(ctx context.Context) ([]GetAllTailnetClientsRow, error)
|
||||
// For PG Coordinator HTMLDebug
|
||||
GetAllTailnetCoordinators(ctx context.Context) ([]TailnetCoordinator, error)
|
||||
GetAllTailnetPeers(ctx context.Context) ([]TailnetPeer, error)
|
||||
|
|
|
@ -4774,47 +4774,6 @@ func (q *sqlQuerier) GetAllTailnetAgents(ctx context.Context) ([]TailnetAgent, e
|
|||
return items, nil
|
||||
}
|
||||
|
||||
const getAllTailnetClients = `-- name: GetAllTailnetClients :many
|
||||
SELECT tailnet_clients.id, tailnet_clients.coordinator_id, tailnet_clients.updated_at, tailnet_clients.node, array_agg(tailnet_client_subscriptions.agent_id)::uuid[] as agent_ids
|
||||
FROM tailnet_clients
|
||||
LEFT JOIN tailnet_client_subscriptions
|
||||
ON tailnet_clients.id = tailnet_client_subscriptions.client_id
|
||||
`
|
||||
|
||||
type GetAllTailnetClientsRow struct {
|
||||
TailnetClient TailnetClient `db:"tailnet_client" json:"tailnet_client"`
|
||||
AgentIds []uuid.UUID `db:"agent_ids" json:"agent_ids"`
|
||||
}
|
||||
|
||||
func (q *sqlQuerier) GetAllTailnetClients(ctx context.Context) ([]GetAllTailnetClientsRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getAllTailnetClients)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetAllTailnetClientsRow
|
||||
for rows.Next() {
|
||||
var i GetAllTailnetClientsRow
|
||||
if err := rows.Scan(
|
||||
&i.TailnetClient.ID,
|
||||
&i.TailnetClient.CoordinatorID,
|
||||
&i.TailnetClient.UpdatedAt,
|
||||
&i.TailnetClient.Node,
|
||||
pq.Array(&i.AgentIds),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getAllTailnetCoordinators = `-- name: GetAllTailnetCoordinators :many
|
||||
|
||||
SELECT id, heartbeat_at FROM tailnet_coordinators
|
||||
|
|
|
@ -97,12 +97,6 @@ WHERE id IN (
|
|||
WHERE tailnet_client_subscriptions.agent_id = $1
|
||||
);
|
||||
|
||||
-- name: GetAllTailnetClients :many
|
||||
SELECT sqlc.embed(tailnet_clients), array_agg(tailnet_client_subscriptions.agent_id)::uuid[] as agent_ids
|
||||
FROM tailnet_clients
|
||||
LEFT JOIN tailnet_client_subscriptions
|
||||
ON tailnet_clients.id = tailnet_client_subscriptions.client_id;
|
||||
|
||||
-- name: UpsertTailnetCoordinator :one
|
||||
INSERT INTO
|
||||
tailnet_coordinators (
|
||||
|
|
Loading…
Reference in New Issue