@@ -6,30 +6,8 @@ import (
66 "github.com/ovh/cds/sdk"
77)
88
9- // Usage for action.
10- type Usage struct {
11- Pipelines []UsagePipeline `json:"pipelines"`
12- Actions []UsageAction `json:"actions"`
13- }
14-
15- // UsagePipeline represent a pipeline using an action.
16- type UsagePipeline struct {
17- ProjectID int64 `json:"project_id"`
18- ProjectKey string `json:"project_key"`
19- ProjectName string `json:"project_name"`
20- PipelineID int64 `json:"pipeline_id"`
21- PipelineName string `json:"pipeline_name"`
22- StageID int64 `json:"stage_id"`
23- StageName string `json:"stage_name"`
24- JobID int64 `json:"job_id"`
25- JobName string `json:"job_name"`
26- ActionID int64 `json:"action_id"`
27- ActionName string `json:"action_name"`
28- Warning bool `json:"warning"`
29- }
30-
319// GetPipelineUsages returns the list of pipelines using an action
32- func GetPipelineUsages (db gorp.SqlExecutor , sharedInfraGroupID , actionID int64 ) ([]UsagePipeline , error ) {
10+ func GetPipelineUsages (db gorp.SqlExecutor , sharedInfraGroupID , actionID int64 ) ([]sdk. UsagePipeline , error ) {
3311 rows , err := db .Query (`
3412 SELECT DISTINCT
3513 project.id, project.projectKey, project.name,
@@ -54,9 +32,9 @@ func GetPipelineUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64)
5432 }
5533 defer rows .Close ()
5634
57- us := []UsagePipeline {}
35+ us := []sdk. UsagePipeline {}
5836 for rows .Next () {
59- var u UsagePipeline
37+ var u sdk. UsagePipeline
6038 if err := rows .Scan (
6139 & u .ProjectID , & u .ProjectKey , & u .ProjectName ,
6240 & u .PipelineID , & u .PipelineName ,
@@ -73,19 +51,8 @@ func GetPipelineUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64)
7351 return us , nil
7452}
7553
76- // UsageAction represent a action using an action.
77- type UsageAction struct {
78- GroupID int64 `json:"group_id"`
79- GroupName string `json:"group_name"`
80- ParentActionID int64 `json:"parent_action_id"`
81- ParentActionName string `json:"parent_action_name"`
82- ActionID int64 `json:"action_id"`
83- ActionName string `json:"action_name"`
84- Warning bool `json:"warning"`
85- }
86-
8754// GetActionUsages returns the list of actions using an action
88- func GetActionUsages (db gorp.SqlExecutor , sharedInfraGroupID , actionID int64 ) ([]UsageAction , error ) {
55+ func GetActionUsages (db gorp.SqlExecutor , sharedInfraGroupID , actionID int64 ) ([]sdk. UsageAction , error ) {
8956 rows , err := db .Query (`
9057 SELECT DISTINCT
9158 "group".id, "group".name,
@@ -104,9 +71,9 @@ func GetActionUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64) ([
10471 }
10572 defer rows .Close ()
10673
107- us := []UsageAction {}
74+ us := []sdk. UsageAction {}
10875 for rows .Next () {
109- var u UsageAction
76+ var u sdk. UsageAction
11077 if err := rows .Scan (
11178 & u .GroupID , & u .GroupName ,
11279 & u .ParentActionID , & u .ParentActionName ,
0 commit comments