This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
attributes.go
193 lines (168 loc) · 6.96 KB
/
attributes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package adminservice
import (
"context"
"github.com/flyteorg/flyteadmin/pkg/rpc/adminservice/util"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (m *AdminService) UpdateWorkflowAttributes(ctx context.Context, request *admin.WorkflowAttributesUpdateRequest) (
*admin.WorkflowAttributesUpdateResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.WorkflowAttributesUpdateResponse
var err error
m.Metrics.workflowAttributesEndpointMetrics.update.Time(func() {
response, err = m.ResourceManager.UpdateWorkflowAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.workflowAttributesEndpointMetrics.update)
}
return response, nil
}
func (m *AdminService) GetWorkflowAttributes(ctx context.Context, request *admin.WorkflowAttributesGetRequest) (
*admin.WorkflowAttributesGetResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.WorkflowAttributesGetResponse
var err error
m.Metrics.workflowAttributesEndpointMetrics.get.Time(func() {
response, err = m.ResourceManager.GetWorkflowAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.workflowAttributesEndpointMetrics.get)
}
return response, nil
}
func (m *AdminService) DeleteWorkflowAttributes(ctx context.Context, request *admin.WorkflowAttributesDeleteRequest) (
*admin.WorkflowAttributesDeleteResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.WorkflowAttributesDeleteResponse
var err error
m.Metrics.workflowAttributesEndpointMetrics.delete.Time(func() {
response, err = m.ResourceManager.DeleteWorkflowAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.workflowAttributesEndpointMetrics.delete)
}
return response, nil
}
func (m *AdminService) UpdateProjectDomainAttributes(ctx context.Context, request *admin.ProjectDomainAttributesUpdateRequest) (
*admin.ProjectDomainAttributesUpdateResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectDomainAttributesUpdateResponse
var err error
m.Metrics.projectDomainAttributesEndpointMetrics.update.Time(func() {
response, err = m.ResourceManager.UpdateProjectDomainAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.projectDomainAttributesEndpointMetrics.update)
}
return response, nil
}
func (m *AdminService) GetProjectDomainAttributes(ctx context.Context, request *admin.ProjectDomainAttributesGetRequest) (
*admin.ProjectDomainAttributesGetResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectDomainAttributesGetResponse
var err error
m.Metrics.workflowAttributesEndpointMetrics.get.Time(func() {
response, err = m.ResourceManager.GetProjectDomainAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.workflowAttributesEndpointMetrics.get)
}
return response, nil
}
func (m *AdminService) DeleteProjectDomainAttributes(ctx context.Context, request *admin.ProjectDomainAttributesDeleteRequest) (
*admin.ProjectDomainAttributesDeleteResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectDomainAttributesDeleteResponse
var err error
m.Metrics.workflowAttributesEndpointMetrics.delete.Time(func() {
response, err = m.ResourceManager.DeleteProjectDomainAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.workflowAttributesEndpointMetrics.delete)
}
return response, nil
}
func (m *AdminService) UpdateProjectAttributes(ctx context.Context, request *admin.ProjectAttributesUpdateRequest) (
*admin.ProjectAttributesUpdateResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectAttributesUpdateResponse
var err error
m.Metrics.projectAttributesEndpointMetrics.get.Time(func() {
response, err = m.ResourceManager.UpdateProjectAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.projectAttributesEndpointMetrics.get)
}
return response, nil
}
func (m *AdminService) GetProjectAttributes(ctx context.Context, request *admin.ProjectAttributesGetRequest) (
*admin.ProjectAttributesGetResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectAttributesGetResponse
var err error
m.Metrics.projectAttributesEndpointMetrics.get.Time(func() {
response, err = m.ResourceManager.GetProjectAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.projectAttributesEndpointMetrics.get)
}
return response, nil
}
func (m *AdminService) DeleteProjectAttributes(ctx context.Context, request *admin.ProjectAttributesDeleteRequest) (
*admin.ProjectAttributesDeleteResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ProjectAttributesDeleteResponse
var err error
m.Metrics.projectAttributesEndpointMetrics.delete.Time(func() {
response, err = m.ResourceManager.DeleteProjectAttributes(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.projectAttributesEndpointMetrics.delete)
}
return response, nil
}
func (m *AdminService) ListMatchableAttributes(ctx context.Context, request *admin.ListMatchableAttributesRequest) (
*admin.ListMatchableAttributesResponse, error) {
defer m.interceptPanic(ctx, request)
if request == nil {
return nil, status.Errorf(codes.InvalidArgument, "Incorrect request, nil requests not allowed")
}
var response *admin.ListMatchableAttributesResponse
var err error
m.Metrics.matchableAttributesEndpointMetrics.list.Time(func() {
response, err = m.ResourceManager.ListAll(ctx, *request)
})
if err != nil {
return nil, util.TransformAndRecordError(err, &m.Metrics.matchableAttributesEndpointMetrics.list)
}
return response, nil
}