mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
chore!: remove JFrog integration (#17353)
- Removes displaying XRay scan results in the dashboard. I'm not sure anyone was even using this integration so it's just debt for us to maintain. We can open up a separate issue to get rid of the db tables once we know for sure that we haven't broken anyone.
This commit is contained in:
103
coderd/apidoc/docs.go
generated
103
coderd/apidoc/docs.go
generated
@ -1432,84 +1432,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/integrations/jfrog/xray-scan": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Enterprise"
|
||||
],
|
||||
"summary": "Get JFrog XRay scan by workspace agent ID.",
|
||||
"operationId": "get-jfrog-xray-scan-by-workspace-agent-id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Workspace ID",
|
||||
"name": "workspace_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Agent ID",
|
||||
"name": "agent_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.JFrogXrayScan"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Enterprise"
|
||||
],
|
||||
"summary": "Post JFrog XRay scan by workspace agent ID.",
|
||||
"operationId": "post-jfrog-xray-scan-by-workspace-agent-id",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Post JFrog XRay scan request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.JFrogXrayScan"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/licenses": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -12579,31 +12501,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.JFrogXrayScan": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"critical": {
|
||||
"type": "integer"
|
||||
},
|
||||
"high": {
|
||||
"type": "integer"
|
||||
},
|
||||
"medium": {
|
||||
"type": "integer"
|
||||
},
|
||||
"results_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"workspace_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.JobErrorCode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
93
coderd/apidoc/swagger.json
generated
93
coderd/apidoc/swagger.json
generated
@ -1249,74 +1249,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/integrations/jfrog/xray-scan": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"produces": ["application/json"],
|
||||
"tags": ["Enterprise"],
|
||||
"summary": "Get JFrog XRay scan by workspace agent ID.",
|
||||
"operationId": "get-jfrog-xray-scan-by-workspace-agent-id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Workspace ID",
|
||||
"name": "workspace_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Agent ID",
|
||||
"name": "agent_id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.JFrogXrayScan"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"consumes": ["application/json"],
|
||||
"produces": ["application/json"],
|
||||
"tags": ["Enterprise"],
|
||||
"summary": "Post JFrog XRay scan by workspace agent ID.",
|
||||
"operationId": "post-jfrog-xray-scan-by-workspace-agent-id",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Post JFrog XRay scan request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.JFrogXrayScan"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/licenses": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -11311,31 +11243,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.JFrogXrayScan": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"critical": {
|
||||
"type": "integer"
|
||||
},
|
||||
"high": {
|
||||
"type": "integer"
|
||||
},
|
||||
"medium": {
|
||||
"type": "integer"
|
||||
},
|
||||
"results_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"workspace_id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.JobErrorCode": {
|
||||
"type": "string",
|
||||
"enum": ["REQUIRED_TEMPLATE_VARIABLES"],
|
||||
|
@ -1895,13 +1895,6 @@ func (q *querier) GetInboxNotificationsByUserID(ctx context.Context, userID data
|
||||
return fetchWithPostFilter(q.auth, policy.ActionRead, q.db.GetInboxNotificationsByUserID)(ctx, userID)
|
||||
}
|
||||
|
||||
func (q *querier) GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.GetJFrogXrayScanByWorkspaceAndAgentIDParams) (database.JfrogXrayScan, error) {
|
||||
if _, err := fetch(q.log, q.auth, q.db.GetWorkspaceByID)(ctx, arg.WorkspaceID); err != nil {
|
||||
return database.JfrogXrayScan{}, err
|
||||
}
|
||||
return q.db.GetJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
|
||||
}
|
||||
|
||||
func (q *querier) GetLastUpdateCheck(ctx context.Context) (string, error) {
|
||||
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {
|
||||
return "", err
|
||||
@ -4767,27 +4760,6 @@ func (q *querier) UpsertHealthSettings(ctx context.Context, value string) error
|
||||
return q.db.UpsertHealthSettings(ctx, value)
|
||||
}
|
||||
|
||||
func (q *querier) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
|
||||
// TODO: Having to do all this extra querying makes me a sad panda.
|
||||
workspace, err := q.db.GetWorkspaceByID(ctx, arg.WorkspaceID)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("get workspace by id: %w", err)
|
||||
}
|
||||
|
||||
template, err := q.db.GetTemplateByID(ctx, workspace.TemplateID)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("get template by id: %w", err)
|
||||
}
|
||||
|
||||
// Only template admins should be able to write JFrog Xray scans to a workspace.
|
||||
// We don't want this to be a workspace-level permission because then users
|
||||
// could overwrite their own results.
|
||||
if err := q.authorizeContext(ctx, policy.ActionCreate, template); err != nil {
|
||||
return err
|
||||
}
|
||||
return q.db.UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
|
||||
}
|
||||
|
||||
func (q *querier) UpsertLastUpdateCheck(ctx context.Context, value string) error {
|
||||
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceSystem); err != nil {
|
||||
return err
|
||||
|
@ -4293,74 +4293,6 @@ func (s *MethodTestSuite) TestSystemFunctions() {
|
||||
s.Run("GetUserLinksByUserID", s.Subtest(func(db database.Store, check *expects) {
|
||||
check.Args(uuid.New()).Asserts(rbac.ResourceSystem, policy.ActionRead)
|
||||
}))
|
||||
s.Run("GetJFrogXrayScanByWorkspaceAndAgentID", s.Subtest(func(db database.Store, check *expects) {
|
||||
u := dbgen.User(s.T(), db, database.User{})
|
||||
org := dbgen.Organization(s.T(), db, database.Organization{})
|
||||
tpl := dbgen.Template(s.T(), db, database.Template{
|
||||
OrganizationID: org.ID,
|
||||
CreatedBy: u.ID,
|
||||
})
|
||||
ws := dbgen.Workspace(s.T(), db, database.WorkspaceTable{
|
||||
OwnerID: u.ID,
|
||||
OrganizationID: org.ID,
|
||||
TemplateID: tpl.ID,
|
||||
})
|
||||
pj := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
|
||||
res := dbgen.WorkspaceResource(s.T(), db, database.WorkspaceResource{
|
||||
JobID: pj.ID,
|
||||
})
|
||||
agent := dbgen.WorkspaceAgent(s.T(), db, database.WorkspaceAgent{
|
||||
ResourceID: res.ID,
|
||||
})
|
||||
|
||||
err := db.UpsertJFrogXrayScanByWorkspaceAndAgentID(context.Background(), database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams{
|
||||
AgentID: agent.ID,
|
||||
WorkspaceID: ws.ID,
|
||||
Critical: 1,
|
||||
High: 12,
|
||||
Medium: 14,
|
||||
ResultsUrl: "http://hello",
|
||||
})
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
expect := database.JfrogXrayScan{
|
||||
WorkspaceID: ws.ID,
|
||||
AgentID: agent.ID,
|
||||
Critical: 1,
|
||||
High: 12,
|
||||
Medium: 14,
|
||||
ResultsUrl: "http://hello",
|
||||
}
|
||||
|
||||
check.Args(database.GetJFrogXrayScanByWorkspaceAndAgentIDParams{
|
||||
WorkspaceID: ws.ID,
|
||||
AgentID: agent.ID,
|
||||
}).Asserts(ws, policy.ActionRead).Returns(expect)
|
||||
}))
|
||||
s.Run("UpsertJFrogXrayScanByWorkspaceAndAgentID", s.Subtest(func(db database.Store, check *expects) {
|
||||
u := dbgen.User(s.T(), db, database.User{})
|
||||
org := dbgen.Organization(s.T(), db, database.Organization{})
|
||||
tpl := dbgen.Template(s.T(), db, database.Template{
|
||||
OrganizationID: org.ID,
|
||||
CreatedBy: u.ID,
|
||||
})
|
||||
ws := dbgen.Workspace(s.T(), db, database.WorkspaceTable{
|
||||
OwnerID: u.ID,
|
||||
OrganizationID: org.ID,
|
||||
TemplateID: tpl.ID,
|
||||
})
|
||||
pj := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
|
||||
res := dbgen.WorkspaceResource(s.T(), db, database.WorkspaceResource{
|
||||
JobID: pj.ID,
|
||||
})
|
||||
agent := dbgen.WorkspaceAgent(s.T(), db, database.WorkspaceAgent{
|
||||
ResourceID: res.ID,
|
||||
})
|
||||
check.Args(database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams{
|
||||
WorkspaceID: ws.ID,
|
||||
AgentID: agent.ID,
|
||||
}).Asserts(tpl, policy.ActionCreate)
|
||||
}))
|
||||
s.Run("DeleteRuntimeConfig", s.Subtest(func(db database.Store, check *expects) {
|
||||
check.Args("test").Asserts(rbac.ResourceSystem, policy.ActionDelete)
|
||||
}))
|
||||
|
@ -222,7 +222,6 @@ type data struct {
|
||||
gitSSHKey []database.GitSSHKey
|
||||
groupMembers []database.GroupMemberTable
|
||||
groups []database.Group
|
||||
jfrogXRayScans []database.JfrogXrayScan
|
||||
licenses []database.License
|
||||
notificationMessages []database.NotificationMessage
|
||||
notificationPreferences []database.NotificationPreference
|
||||
@ -3687,24 +3686,6 @@ func (q *FakeQuerier) GetInboxNotificationsByUserID(_ context.Context, params da
|
||||
return notifications, nil
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) GetJFrogXrayScanByWorkspaceAndAgentID(_ context.Context, arg database.GetJFrogXrayScanByWorkspaceAndAgentIDParams) (database.JfrogXrayScan, error) {
|
||||
err := validateDatabaseType(arg)
|
||||
if err != nil {
|
||||
return database.JfrogXrayScan{}, err
|
||||
}
|
||||
|
||||
q.mutex.RLock()
|
||||
defer q.mutex.RUnlock()
|
||||
|
||||
for _, scan := range q.jfrogXRayScans {
|
||||
if scan.AgentID == arg.AgentID && scan.WorkspaceID == arg.WorkspaceID {
|
||||
return scan, nil
|
||||
}
|
||||
}
|
||||
|
||||
return database.JfrogXrayScan{}, sql.ErrNoRows
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) GetLastUpdateCheck(_ context.Context) (string, error) {
|
||||
q.mutex.RLock()
|
||||
defer q.mutex.RUnlock()
|
||||
@ -4241,7 +4222,7 @@ func (q *FakeQuerier) GetPresetByID(ctx context.Context, presetID uuid.UUID) (da
|
||||
if preset.ID == presetID {
|
||||
tv, ok := versionMap[preset.TemplateVersionID]
|
||||
if !ok {
|
||||
return empty, fmt.Errorf("template version %v does not exist", preset.TemplateVersionID)
|
||||
return empty, xerrors.Errorf("template version %v does not exist", preset.TemplateVersionID)
|
||||
}
|
||||
return database.GetPresetByIDRow{
|
||||
ID: preset.ID,
|
||||
@ -4256,7 +4237,7 @@ func (q *FakeQuerier) GetPresetByID(ctx context.Context, presetID uuid.UUID) (da
|
||||
}
|
||||
}
|
||||
|
||||
return empty, fmt.Errorf("preset %v does not exist", presetID)
|
||||
return empty, xerrors.Errorf("preset %v does not exist", presetID)
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) GetPresetByWorkspaceBuildID(_ context.Context, workspaceBuildID uuid.UUID) (database.TemplateVersionPreset, error) {
|
||||
@ -11986,39 +11967,6 @@ func (q *FakeQuerier) UpsertHealthSettings(_ context.Context, data string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) UpsertJFrogXrayScanByWorkspaceAndAgentID(_ context.Context, arg database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
|
||||
err := validateDatabaseType(arg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
|
||||
for i, scan := range q.jfrogXRayScans {
|
||||
if scan.AgentID == arg.AgentID && scan.WorkspaceID == arg.WorkspaceID {
|
||||
scan.Critical = arg.Critical
|
||||
scan.High = arg.High
|
||||
scan.Medium = arg.Medium
|
||||
scan.ResultsUrl = arg.ResultsUrl
|
||||
q.jfrogXRayScans[i] = scan
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//nolint:gosimple
|
||||
q.jfrogXRayScans = append(q.jfrogXRayScans, database.JfrogXrayScan{
|
||||
WorkspaceID: arg.WorkspaceID,
|
||||
AgentID: arg.AgentID,
|
||||
Critical: arg.Critical,
|
||||
High: arg.High,
|
||||
Medium: arg.Medium,
|
||||
ResultsUrl: arg.ResultsUrl,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) UpsertLastUpdateCheck(_ context.Context, data string) error {
|
||||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
|
@ -858,13 +858,6 @@ func (m queryMetricsStore) GetInboxNotificationsByUserID(ctx context.Context, us
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
func (m queryMetricsStore) GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.GetJFrogXrayScanByWorkspaceAndAgentIDParams) (database.JfrogXrayScan, error) {
|
||||
start := time.Now()
|
||||
r0, r1 := m.s.GetJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
|
||||
m.queryLatencies.WithLabelValues("GetJFrogXrayScanByWorkspaceAndAgentID").Observe(time.Since(start).Seconds())
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
func (m queryMetricsStore) GetLastUpdateCheck(ctx context.Context) (string, error) {
|
||||
start := time.Now()
|
||||
version, err := m.s.GetLastUpdateCheck(ctx)
|
||||
@ -3042,13 +3035,6 @@ func (m queryMetricsStore) UpsertHealthSettings(ctx context.Context, value strin
|
||||
return r0
|
||||
}
|
||||
|
||||
func (m queryMetricsStore) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
|
||||
start := time.Now()
|
||||
r0 := m.s.UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx, arg)
|
||||
m.queryLatencies.WithLabelValues("UpsertJFrogXrayScanByWorkspaceAndAgentID").Observe(time.Since(start).Seconds())
|
||||
return r0
|
||||
}
|
||||
|
||||
func (m queryMetricsStore) UpsertLastUpdateCheck(ctx context.Context, value string) error {
|
||||
start := time.Now()
|
||||
r0 := m.s.UpsertLastUpdateCheck(ctx, value)
|
||||
|
@ -1729,21 +1729,6 @@ func (mr *MockStoreMockRecorder) GetInboxNotificationsByUserID(ctx, arg any) *go
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInboxNotificationsByUserID", reflect.TypeOf((*MockStore)(nil).GetInboxNotificationsByUserID), ctx, arg)
|
||||
}
|
||||
|
||||
// GetJFrogXrayScanByWorkspaceAndAgentID mocks base method.
|
||||
func (m *MockStore) GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.GetJFrogXrayScanByWorkspaceAndAgentIDParams) (database.JfrogXrayScan, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetJFrogXrayScanByWorkspaceAndAgentID", ctx, arg)
|
||||
ret0, _ := ret[0].(database.JfrogXrayScan)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetJFrogXrayScanByWorkspaceAndAgentID indicates an expected call of GetJFrogXrayScanByWorkspaceAndAgentID.
|
||||
func (mr *MockStoreMockRecorder) GetJFrogXrayScanByWorkspaceAndAgentID(ctx, arg any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetJFrogXrayScanByWorkspaceAndAgentID", reflect.TypeOf((*MockStore)(nil).GetJFrogXrayScanByWorkspaceAndAgentID), ctx, arg)
|
||||
}
|
||||
|
||||
// GetLastUpdateCheck mocks base method.
|
||||
func (m *MockStore) GetLastUpdateCheck(ctx context.Context) (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -6415,20 +6400,6 @@ func (mr *MockStoreMockRecorder) UpsertHealthSettings(ctx, value any) *gomock.Ca
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertHealthSettings", reflect.TypeOf((*MockStore)(nil).UpsertHealthSettings), ctx, value)
|
||||
}
|
||||
|
||||
// UpsertJFrogXrayScanByWorkspaceAndAgentID mocks base method.
|
||||
func (m *MockStore) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg database.UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "UpsertJFrogXrayScanByWorkspaceAndAgentID", ctx, arg)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// UpsertJFrogXrayScanByWorkspaceAndAgentID indicates an expected call of UpsertJFrogXrayScanByWorkspaceAndAgentID.
|
||||
func (mr *MockStoreMockRecorder) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx, arg any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertJFrogXrayScanByWorkspaceAndAgentID", reflect.TypeOf((*MockStore)(nil).UpsertJFrogXrayScanByWorkspaceAndAgentID), ctx, arg)
|
||||
}
|
||||
|
||||
// UpsertLastUpdateCheck mocks base method.
|
||||
func (m *MockStore) UpsertLastUpdateCheck(ctx context.Context, value string) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -200,7 +200,6 @@ type sqlcQuerier interface {
|
||||
// param created_at_opt: The created_at timestamp to filter by. This parameter is usd for pagination - it fetches notifications created before the specified timestamp if it is not the zero value
|
||||
// param limit_opt: The limit of notifications to fetch. If the limit is not specified, it defaults to 25
|
||||
GetInboxNotificationsByUserID(ctx context.Context, arg GetInboxNotificationsByUserIDParams) ([]InboxNotification, error)
|
||||
GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg GetJFrogXrayScanByWorkspaceAndAgentIDParams) (JfrogXrayScan, error)
|
||||
GetLastUpdateCheck(ctx context.Context) (string, error)
|
||||
GetLatestCryptoKeyByFeature(ctx context.Context, feature CryptoKeyFeature) (CryptoKey, error)
|
||||
GetLatestWorkspaceAppStatusesByWorkspaceIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAppStatus, error)
|
||||
@ -619,7 +618,6 @@ type sqlcQuerier interface {
|
||||
// The functional values are immutable and controlled implicitly.
|
||||
UpsertDefaultProxy(ctx context.Context, arg UpsertDefaultProxyParams) error
|
||||
UpsertHealthSettings(ctx context.Context, value string) error
|
||||
UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error
|
||||
UpsertLastUpdateCheck(ctx context.Context, value string) error
|
||||
UpsertLogoURL(ctx context.Context, value string) error
|
||||
// Insert or update notification report generator logs with recent activity.
|
||||
|
@ -3570,75 +3570,6 @@ func (q *sqlQuerier) UpsertTemplateUsageStats(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const getJFrogXrayScanByWorkspaceAndAgentID = `-- name: GetJFrogXrayScanByWorkspaceAndAgentID :one
|
||||
SELECT
|
||||
agent_id, workspace_id, critical, high, medium, results_url
|
||||
FROM
|
||||
jfrog_xray_scans
|
||||
WHERE
|
||||
agent_id = $1
|
||||
AND
|
||||
workspace_id = $2
|
||||
LIMIT
|
||||
1
|
||||
`
|
||||
|
||||
type GetJFrogXrayScanByWorkspaceAndAgentIDParams struct {
|
||||
AgentID uuid.UUID `db:"agent_id" json:"agent_id"`
|
||||
WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
|
||||
}
|
||||
|
||||
func (q *sqlQuerier) GetJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg GetJFrogXrayScanByWorkspaceAndAgentIDParams) (JfrogXrayScan, error) {
|
||||
row := q.db.QueryRowContext(ctx, getJFrogXrayScanByWorkspaceAndAgentID, arg.AgentID, arg.WorkspaceID)
|
||||
var i JfrogXrayScan
|
||||
err := row.Scan(
|
||||
&i.AgentID,
|
||||
&i.WorkspaceID,
|
||||
&i.Critical,
|
||||
&i.High,
|
||||
&i.Medium,
|
||||
&i.ResultsUrl,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const upsertJFrogXrayScanByWorkspaceAndAgentID = `-- name: UpsertJFrogXrayScanByWorkspaceAndAgentID :exec
|
||||
INSERT INTO
|
||||
jfrog_xray_scans (
|
||||
agent_id,
|
||||
workspace_id,
|
||||
critical,
|
||||
high,
|
||||
medium,
|
||||
results_url
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (agent_id, workspace_id)
|
||||
DO UPDATE SET critical = $3, high = $4, medium = $5, results_url = $6
|
||||
`
|
||||
|
||||
type UpsertJFrogXrayScanByWorkspaceAndAgentIDParams struct {
|
||||
AgentID uuid.UUID `db:"agent_id" json:"agent_id"`
|
||||
WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
|
||||
Critical int32 `db:"critical" json:"critical"`
|
||||
High int32 `db:"high" json:"high"`
|
||||
Medium int32 `db:"medium" json:"medium"`
|
||||
ResultsUrl string `db:"results_url" json:"results_url"`
|
||||
}
|
||||
|
||||
func (q *sqlQuerier) UpsertJFrogXrayScanByWorkspaceAndAgentID(ctx context.Context, arg UpsertJFrogXrayScanByWorkspaceAndAgentIDParams) error {
|
||||
_, err := q.db.ExecContext(ctx, upsertJFrogXrayScanByWorkspaceAndAgentID,
|
||||
arg.AgentID,
|
||||
arg.WorkspaceID,
|
||||
arg.Critical,
|
||||
arg.High,
|
||||
arg.Medium,
|
||||
arg.ResultsUrl,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteLicense = `-- name: DeleteLicense :one
|
||||
DELETE
|
||||
FROM licenses
|
||||
|
@ -1,26 +0,0 @@
|
||||
-- name: GetJFrogXrayScanByWorkspaceAndAgentID :one
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
jfrog_xray_scans
|
||||
WHERE
|
||||
agent_id = $1
|
||||
AND
|
||||
workspace_id = $2
|
||||
LIMIT
|
||||
1;
|
||||
|
||||
-- name: UpsertJFrogXrayScanByWorkspaceAndAgentID :exec
|
||||
INSERT INTO
|
||||
jfrog_xray_scans (
|
||||
agent_id,
|
||||
workspace_id,
|
||||
critical,
|
||||
high,
|
||||
medium,
|
||||
results_url
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (agent_id, workspace_id)
|
||||
DO UPDATE SET critical = $3, high = $4, medium = $5, results_url = $6;
|
Reference in New Issue
Block a user