-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathteam.go
252 lines (170 loc) · 5.79 KB
/
team.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
package team
import (
"context"
"github.com/opsgenie/opsgenie-go-sdk-v2/client"
)
type Client struct {
client *client.OpsGenieClient
}
func NewClient(config *client.Config) (*Client, error) {
opsgenieClient, err := client.NewOpsGenieClient(config)
if err != nil {
return nil, err
}
return &Client{opsgenieClient}, nil
}
func (c *Client) Create(ctx context.Context, req *CreateTeamRequest) (*CreateTeamResult, error) {
createTeamResponse := &CreateTeamResult{}
err := c.client.Exec(ctx, req, createTeamResponse)
if err != nil {
return nil, err
}
return createTeamResponse, nil
}
func (c *Client) Get(ctx context.Context, req *GetTeamRequest) (*GetTeamResult, error) {
getTeamResponse := &GetTeamResult{}
err := c.client.Exec(ctx, req, getTeamResponse)
if err != nil {
return nil, err
}
return getTeamResponse, nil
}
func (c *Client) Update(ctx context.Context, req *UpdateTeamRequest) (*UpdateTeamResult, error) {
updateTeamResponse := &UpdateTeamResult{}
err := c.client.Exec(ctx, req, updateTeamResponse)
if err != nil {
return nil, err
}
return updateTeamResponse, nil
}
func (c *Client) Delete(ctx context.Context, req *DeleteTeamRequest) (*DeleteTeamResult, error) {
deleteTeamResponse := &DeleteTeamResult{}
err := c.client.Exec(ctx, req, deleteTeamResponse)
if err != nil {
return nil, err
}
return deleteTeamResponse, nil
}
func (c *Client) List(ctx context.Context, req *ListTeamRequest) (*ListTeamResult, error) {
listTeamResponse := &ListTeamResult{}
err := c.client.Exec(ctx, req, listTeamResponse)
if err != nil {
return nil, err
}
return listTeamResponse, nil
}
func (c *Client) ListTeamLogs(ctx context.Context, req *ListTeamLogsRequest) (*ListTeamLogsResult, error) {
ListTeamLogsResponse := &ListTeamLogsResult{}
err := c.client.Exec(ctx, req, ListTeamLogsResponse)
if err != nil {
return nil, err
}
return ListTeamLogsResponse, nil
}
//team role api
func (c *Client) CreateRole(ctx context.Context, req *CreateTeamRoleRequest) (*CreateTeamRoleResult, error) {
createTeamRoleResponse := &CreateTeamRoleResult{}
err := c.client.Exec(ctx, req, createTeamRoleResponse)
if err != nil {
return nil, err
}
return createTeamRoleResponse, nil
}
func (c *Client) GetRole(ctx context.Context, req *GetTeamRoleRequest) (*GetTeamRoleResult, error) {
getTeamRoleResponse := &GetTeamRoleResult{}
err := c.client.Exec(ctx, req, getTeamRoleResponse)
if err != nil {
return nil, err
}
return getTeamRoleResponse, nil
}
func (c *Client) UpdateRole(ctx context.Context, req *UpdateTeamRoleRequest) (*UpdateTeamRoleResult, error) {
updateTeamRoleResponse := &UpdateTeamRoleResult{}
err := c.client.Exec(ctx, req, updateTeamRoleResponse)
if err != nil {
return nil, err
}
return updateTeamRoleResponse, nil
}
func (c *Client) DeleteRole(ctx context.Context, req *DeleteTeamRoleRequest) (*DeleteTeamRoleResult, error) {
deleteTeamRoleResponse := &DeleteTeamRoleResult{}
err := c.client.Exec(ctx, req, deleteTeamRoleResponse)
if err != nil {
return nil, err
}
return deleteTeamRoleResponse, nil
}
func (c *Client) ListRole(ctx context.Context, req *ListTeamRoleRequest) (*ListTeamRoleResult, error) {
listTeamRoleResponse := &ListTeamRoleResult{}
err := c.client.Exec(ctx, req, listTeamRoleResponse)
if err != nil {
return nil, err
}
return listTeamRoleResponse, nil
}
//team member api
func (c *Client) AddMember(ctx context.Context, req *AddTeamMemberRequest) (*AddTeamMemberResult, error) {
addTeamMemberResponse := &AddTeamMemberResult{}
err := c.client.Exec(ctx, req, addTeamMemberResponse)
if err != nil {
return nil, err
}
return addTeamMemberResponse, nil
}
func (c *Client) RemoveMember(ctx context.Context, req *RemoveTeamMemberRequest) (*RemoveTeamMemberResult, error) {
removeTeamMemberResponse := &RemoveTeamMemberResult{}
err := c.client.Exec(ctx, req, removeTeamMemberResponse)
if err != nil {
return nil, err
}
return removeTeamMemberResponse, nil
}
//team routing rule api
func (c *Client) CreateRoutingRule(ctx context.Context, req *CreateRoutingRuleRequest) (*RoutingRuleResult, error) {
createRoutingRuleResponse := &RoutingRuleResult{}
err := c.client.Exec(ctx, req, createRoutingRuleResponse)
if err != nil {
return nil, err
}
return createRoutingRuleResponse, nil
}
func (c *Client) GetRoutingRule(ctx context.Context, req *GetRoutingRuleRequest) (*GetRoutingRuleResult, error) {
getRoutingRuleResponse := &GetRoutingRuleResult{}
err := c.client.Exec(ctx, req, getRoutingRuleResponse)
if err != nil {
return nil, err
}
return getRoutingRuleResponse, nil
}
func (c *Client) UpdateRoutingRule(ctx context.Context, req *UpdateRoutingRuleRequest) (*RoutingRuleResult, error) {
updateRoutingRuleResponse := &RoutingRuleResult{}
err := c.client.Exec(ctx, req, updateRoutingRuleResponse)
if err != nil {
return nil, err
}
return updateRoutingRuleResponse, nil
}
func (c *Client) DeleteRoutingRule(ctx context.Context, req *DeleteRoutingRuleRequest) (*DeleteRoutingRuleResult, error) {
deleteRoutingRuleResponse := &DeleteRoutingRuleResult{}
err := c.client.Exec(ctx, req, deleteRoutingRuleResponse)
if err != nil {
return nil, err
}
return deleteRoutingRuleResponse, nil
}
func (c *Client) ListRoutingRules(ctx context.Context, req *ListRoutingRulesRequest) (*ListRoutingRulesResult, error) {
listRoutingRulesResponse := &ListRoutingRulesResult{}
err := c.client.Exec(ctx, req, listRoutingRulesResponse)
if err != nil {
return nil, err
}
return listRoutingRulesResponse, nil
}
func (c *Client) ChangeRoutingRuleOrder(ctx context.Context, req *ChangeRoutingRuleOrderRequest) (*RoutingRuleResult, error) {
changeRoutingRuleOrderResponse := &RoutingRuleResult{}
err := c.client.Exec(ctx, req, changeRoutingRuleOrderResponse)
if err != nil {
return nil, err
}
return changeRoutingRuleOrderResponse, nil
}