Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit 47a4c4c

Browse files
committed
✨ Separate issue service
1 parent 906c513 commit 47a4c4c

File tree

8 files changed

+205
-102
lines changed

8 files changed

+205
-102
lines changed

docs/docs/api/platform-api.md

Lines changed: 152 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77

8-
98
### api.v1.activity.Service
109
<a name="api-v1-activity-Service"></a>
1110

@@ -67,6 +66,7 @@
6766

6867

6968

69+
7070

7171

7272
### api.v1.capsule.Service
@@ -203,6 +203,20 @@
203203

204204

205205

206+
### api.v1.issue.Service
207+
<a name="api-v1-issue-Service"></a>
208+
209+
210+
211+
| Method Name | Request Type | Response Type | Description |
212+
| ----------- | ------------ | ------------- | ------------|
213+
| /api.v1.issue.Service/GetIssues | [GetIssuesRequest](#api-v1-issue-GetIssuesRequest) | [GetIssuesResponse](#api-v1-issue-GetIssuesResponse) | Get issues |
214+
215+
216+
217+
218+
219+
206220

207221
### api.v1.metrics.Service
208222
<a name="api-v1-metrics-Service"></a>
@@ -759,77 +773,6 @@ Different states a step can be in.
759773

760774

761775

762-
<a name="model_issue-proto"></a>
763-
764-
## model/issue.proto
765-
766-
767-
768-
<a name="model-Issue"></a>
769-
770-
### Issue
771-
772-
773-
774-
| Field | Type | Label | Description |
775-
| ----- | ---- | ----- | ----------- |
776-
| issue_id | [string](#string) | | |
777-
| type | [string](#string) | | |
778-
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
779-
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
780-
| stale_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
781-
| closed_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
782-
| reference | [Reference](#model-Reference) | | |
783-
| message | [string](#string) | | |
784-
| level | [Level](#model-Level) | | |
785-
| count | [uint32](#uint32) | | |
786-
787-
788-
789-
790-
791-
792-
<a name="model-Reference"></a>
793-
794-
### Reference
795-
796-
797-
798-
| Field | Type | Label | Description |
799-
| ----- | ---- | ----- | ----------- |
800-
| project_id | [string](#string) | | |
801-
| capsule_id | [string](#string) | | |
802-
| environment_id | [string](#string) | | |
803-
| rollout_id | [uint64](#uint64) | | |
804-
| instance_id | [string](#string) | | |
805-
806-
807-
808-
809-
810-
811-
812-
813-
<a name="model-Level"></a>
814-
815-
### Level
816-
817-
818-
| Name | Number | Description |
819-
| ---- | ------ | ----------- |
820-
| LEVEL_UNSPECIFIED | 0 | |
821-
| LEVEL_INFORMATIVE | 1 | |
822-
| LEVEL_MINOR | 2 | |
823-
| LEVEL_MAJOR | 3 | |
824-
| LEVEL_CRITICAL | 4 | |
825-
826-
827-
828-
829-
830-
831-
832-
833776
<a name="api_v1_activity_activity-proto"></a>
834777

835778
## api/v1/activity/activity.proto
@@ -904,24 +847,6 @@ Different states a step can be in.
904847

905848

906849

907-
<a name="api-v1-activity-Message-Issue"></a>
908-
909-
### Message.Issue
910-
911-
912-
913-
| Field | Type | Label | Description |
914-
| ----- | ---- | ----- | ----------- |
915-
| level | [model.Level](#model-Level) | | |
916-
| rolloutID | [uint64](#uint64) | | |
917-
| message | [string](#string) | | |
918-
| resolved | [bool](#bool) | | |
919-
920-
921-
922-
923-
924-
925850
<a name="api-v1-activity-Message-Project"></a>
926851

927852
### Message.Project
@@ -5579,6 +5504,77 @@ The rollout model.
55795504

55805505

55815506

5507+
<a name="api_v1_issue_issue-proto"></a>
5508+
5509+
## api/v1/issue/issue.proto
5510+
5511+
5512+
5513+
<a name="api-v1-issue-Issue"></a>
5514+
5515+
### Issue
5516+
5517+
5518+
5519+
| Field | Type | Label | Description |
5520+
| ----- | ---- | ----- | ----------- |
5521+
| issue_id | [string](#string) | | |
5522+
| type | [string](#string) | | |
5523+
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
5524+
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
5525+
| stale_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
5526+
| closed_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
5527+
| reference | [Reference](#api-v1-issue-Reference) | | |
5528+
| message | [string](#string) | | |
5529+
| level | [Level](#api-v1-issue-Level) | | |
5530+
| count | [uint32](#uint32) | | |
5531+
5532+
5533+
5534+
5535+
5536+
5537+
<a name="api-v1-issue-Reference"></a>
5538+
5539+
### Reference
5540+
5541+
5542+
5543+
| Field | Type | Label | Description |
5544+
| ----- | ---- | ----- | ----------- |
5545+
| project_id | [string](#string) | | |
5546+
| capsule_id | [string](#string) | | |
5547+
| environment_id | [string](#string) | | |
5548+
| rollout_id | [uint64](#uint64) | | |
5549+
| instance_id | [string](#string) | | |
5550+
5551+
5552+
5553+
5554+
5555+
5556+
5557+
5558+
<a name="api-v1-issue-Level"></a>
5559+
5560+
### Level
5561+
5562+
5563+
| Name | Number | Description |
5564+
| ---- | ------ | ----------- |
5565+
| LEVEL_UNSPECIFIED | 0 | |
5566+
| LEVEL_INFORMATIVE | 1 | |
5567+
| LEVEL_MINOR | 2 | |
5568+
| LEVEL_MAJOR | 3 | |
5569+
| LEVEL_CRITICAL | 4 | |
5570+
5571+
5572+
5573+
5574+
5575+
5576+
5577+
55825578
<a name="api_v1_capsule_status-proto"></a>
55835579

55845580
## api/v1/capsule/status.proto
@@ -5743,7 +5739,7 @@ The rollout model.
57435739
| interfaces | [InterfaceStatus](#api-v1-capsule-InterfaceStatus) | repeated | |
57445740
| config_files | [ConfigFileStatus](#api-v1-capsule-ConfigFileStatus) | repeated | |
57455741
| cron_jobs | [CronJobStatus](#api-v1-capsule-CronJobStatus) | repeated | |
5746-
| issues | [model.Issue](#model-Issue) | repeated | List of all issues associated to the Capsule, include those of the current rollout. The list does not include instance-level issues. |
5742+
| issues | [api.v1.issue.Issue](#api-v1-issue-Issue) | repeated | List of all issues associated to the Capsule, include those of the current rollout. The list does not include instance-level issues. |
57475743

57485744

57495745

@@ -8515,6 +8511,71 @@ A docker image tag.
85158511

85168512

85178513

8514+
<a name="api_v1_issue_service-proto"></a>
8515+
8516+
## api/v1/issue/service.proto
8517+
8518+
8519+
8520+
<a name="api-v1-issue-Filter"></a>
8521+
8522+
### Filter
8523+
8524+
8525+
8526+
| Field | Type | Label | Description |
8527+
| ----- | ---- | ----- | ----------- |
8528+
| project | [string](#string) | | |
8529+
| environment | [string](#string) | | |
8530+
| capsule | [string](#string) | | |
8531+
| level | [Level](#api-v1-issue-Level) | | |
8532+
| include_closed | [bool](#bool) | | |
8533+
| include_stale | [bool](#bool) | | |
8534+
8535+
8536+
8537+
8538+
8539+
8540+
<a name="api-v1-issue-GetIssuesRequest"></a>
8541+
8542+
### GetIssuesRequest
8543+
8544+
8545+
8546+
| Field | Type | Label | Description |
8547+
| ----- | ---- | ----- | ----------- |
8548+
| pagination | [model.Pagination](#model-Pagination) | | |
8549+
| filter | [Filter](#api-v1-issue-Filter) | | |
8550+
8551+
8552+
8553+
8554+
8555+
8556+
<a name="api-v1-issue-GetIssuesResponse"></a>
8557+
8558+
### GetIssuesResponse
8559+
8560+
8561+
8562+
| Field | Type | Label | Description |
8563+
| ----- | ---- | ----- | ----------- |
8564+
| issues | [Issue](#api-v1-issue-Issue) | repeated | |
8565+
| total | [uint64](#uint64) | | |
8566+
8567+
8568+
8569+
8570+
8571+
8572+
8573+
8574+
8575+
8576+
8577+
8578+
85188579
<a name="api_v1_metrics_metrics-proto"></a>
85198580

85208581
## api/v1/metrics/metrics.proto

pkg/rbac/actions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/rigdev/rig-go-api/api/v1/environment/environmentconnect"
88
"github.com/rigdev/rig-go-api/api/v1/group/groupconnect"
99
"github.com/rigdev/rig-go-api/api/v1/image/imageconnect"
10+
"github.com/rigdev/rig-go-api/api/v1/issue/issueconnect"
1011
"github.com/rigdev/rig-go-api/api/v1/metrics/metricsconnect"
1112
"github.com/rigdev/rig-go-api/api/v1/project/projectconnect"
1213
"github.com/rigdev/rig-go-api/api/v1/role/roleconnect"
@@ -132,10 +133,16 @@ const (
132133
ActionMetricsView = "metrics:view"
133134
)
134135

136+
// Activity actions
135137
const (
136138
ActionActivityView = "activity:view"
137139
)
138140

141+
// Issue actions
142+
const (
143+
ActionIssueView = "issue:view"
144+
)
145+
139146
var CapsuleActionMap = map[string]string{
140147
capsuleconnect.ServiceWatchStatusProcedure: ActionCapsuleView,
141148
capsuleconnect.ServiceGetStatusProcedure: ActionCapsuleView,
@@ -271,3 +278,7 @@ var MetricsActionMap = map[string]string{
271278
var ActivityActionMap = map[string]string{
272279
activityconnect.ServiceGetActivitiesProcedure: ActionActivityView,
273280
}
281+
282+
var IssueActionMap = map[string]string{
283+
issueconnect.ServiceGetIssuesProcedure: ActionIssueView,
284+
}

pkg/rbac/permissions.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ func GetViewerPermissions(projectID, environmentID string) []*role.Permission {
125125
Project: projectID,
126126
},
127127
},
128+
{
129+
Action: ActionIssueView,
130+
Scope: &role.Scope{
131+
Resource: WithWildcard(ResourceIssue),
132+
Environment: environmentID,
133+
Project: projectID,
134+
},
135+
},
128136
}
129137
}
130138

pkg/rbac/resources.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
ResourceEnvironment = "environment"
1414
ResourceMetrics = "metrics"
1515
ResourceActivity = "activity"
16+
ResourceIssue = "issue"
1617
)
1718

1819
func WithWildcard(resource string) string {

proto/rig/api/v1/activity/activity.proto

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package api.v1.activity;
44

55
import "google/protobuf/timestamp.proto";
66
import "api/v1/capsule/rollout/status.proto";
7-
import "model/issue.proto";
87

98
message Activity {
109
google.protobuf.Timestamp timestamp = 1;
@@ -25,13 +24,6 @@ message Message {
2524
api.v1.capsule.rollout.StepState state = 2;
2625
}
2726

28-
message Issue {
29-
model.Level level = 1;
30-
uint64 rolloutID = 2;
31-
string message = 3;
32-
bool resolved = 4;
33-
}
34-
3527
message Project {
3628
string project_id = 1;
3729
bool deleted = 2;

proto/rig/api/v1/capsule/status.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ syntax = "proto3";
22

33
package api.v1.capsule;
44

5-
import "model/issue.proto";
5+
import "api/v1/issue/issue.proto";
66
import "api/v1/capsule/change.proto";
77
import "operator/api/v1/pipeline/object_status.proto";
88

@@ -17,7 +17,7 @@ message Status {
1717
repeated CronJobStatus cron_jobs = 8;
1818
// List of all issues associated to the Capsule, include those of the current
1919
// rollout. The list does not include instance-level issues.
20-
repeated model.Issue issues = 9;
20+
repeated api.v1.issue.Issue issues = 9;
2121
}
2222

2323
message CapsuleStatus {

0 commit comments

Comments
 (0)