@@ -6,30 +6,8 @@ import (
6
6
"github.com/ovh/cds/sdk"
7
7
)
8
8
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
-
31
9
// 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 ) {
33
11
rows , err := db .Query (`
34
12
SELECT DISTINCT
35
13
project.id, project.projectKey, project.name,
@@ -54,9 +32,9 @@ func GetPipelineUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64)
54
32
}
55
33
defer rows .Close ()
56
34
57
- us := []UsagePipeline {}
35
+ us := []sdk. UsagePipeline {}
58
36
for rows .Next () {
59
- var u UsagePipeline
37
+ var u sdk. UsagePipeline
60
38
if err := rows .Scan (
61
39
& u .ProjectID , & u .ProjectKey , & u .ProjectName ,
62
40
& u .PipelineID , & u .PipelineName ,
@@ -73,19 +51,8 @@ func GetPipelineUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64)
73
51
return us , nil
74
52
}
75
53
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
-
87
54
// 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 ) {
89
56
rows , err := db .Query (`
90
57
SELECT DISTINCT
91
58
"group".id, "group".name,
@@ -104,9 +71,9 @@ func GetActionUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64) ([
104
71
}
105
72
defer rows .Close ()
106
73
107
- us := []UsageAction {}
74
+ us := []sdk. UsageAction {}
108
75
for rows .Next () {
109
- var u UsageAction
76
+ var u sdk. UsageAction
110
77
if err := rows .Scan (
111
78
& u .GroupID , & u .GroupName ,
112
79
& u .ParentActionID , & u .ParentActionName ,
0 commit comments