This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models_gen.go
265 lines (226 loc) · 6.5 KB
/
models_gen.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
253
254
255
256
257
258
259
260
261
262
263
264
265
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
"time"
"github.com/google/uuid"
"github.com/nais/teams-backend/pkg/db"
"github.com/nais/teams-backend/pkg/slug"
"github.com/nais/teams-backend/pkg/sqlc"
)
// Input for creating a new team.
type CreateTeamInput struct {
// Team slug. After creation, this value can not be changed.
Slug *slug.Slug `json:"slug"`
// Team purpose.
Purpose string `json:"purpose"`
// Specify the Slack channel for the team.
SlackChannel string `json:"slackChannel"`
}
// GCP project type.
type GcpProject struct {
// The environment for the project.
Environment string `json:"environment"`
// The display name of the project.
ProjectName string `json:"projectName"`
// The GCP project ID.
ProjectID string `json:"projectId"`
}
// NAIS namespace type.
type NaisNamespace struct {
// The environment for the namespace.
Environment string `json:"environment"`
// The namespace.
Namespace *slug.Slug `json:"namespace"`
}
// Reconciler configuration input.
type ReconcilerConfigInput struct {
// Configuration key.
Key sqlc.ReconcilerConfigKey `json:"key"`
// Configuration value.
Value string `json:"value"`
}
// Reconciler state type.
type ReconcilerState struct {
// The GitHub team slug.
GitHubTeamSlug *slug.Slug `json:"gitHubTeamSlug,omitempty"`
// The Google Workspace group email.
GoogleWorkspaceGroupEmail *string `json:"googleWorkspaceGroupEmail,omitempty"`
// The Azure AD group ID.
AzureADGroupID *uuid.UUID `json:"azureADGroupId,omitempty"`
// A list of GCP projects.
GcpProjects []*GcpProject `json:"gcpProjects"`
// A list of NAIS namespaces.
NaisNamespaces []*NaisNamespace `json:"naisNamespaces"`
// Timestamp of when the NAIS deploy key was provisioned.
NaisDeployKeyProvisioned *time.Time `json:"naisDeployKeyProvisioned,omitempty"`
// Name of the GAR repository for the team.
GarRepositoryName *string `json:"garRepositoryName,omitempty"`
}
// Slack alerts channel type.
type SlackAlertsChannel struct {
// The environment for the alerts sent to the channel.
Environment string `json:"environment"`
// The name of the Slack channel.
ChannelName string `json:"channelName"`
}
// Slack alerts channel input.
type SlackAlertsChannelInput struct {
// The environment for the alerts sent to the channel.
Environment string `json:"environment"`
// The name of the Slack channel.
ChannelName *string `json:"channelName,omitempty"`
}
// Sync error type.
type SyncError struct {
// Creation time of the error.
CreatedAt time.Time `json:"createdAt"`
// The name of the reconciler.
Reconciler sqlc.ReconcilerName `json:"reconciler"`
// Error message.
Error string `json:"error"`
}
// Team member.
type TeamMember struct {
// Team instance.
Team *db.Team `json:"team"`
// User instance.
User *db.User `json:"user"`
// The role that the user has in the team.
Role TeamRole `json:"role"`
// Reconcilers for this member in this team.
Reconcilers []*sqlc.GetTeamMemberOptOutsRow `json:"reconcilers"`
}
// Team member input.
type TeamMemberInput struct {
// The ID of user.
UserID *uuid.UUID `json:"userId"`
// The role that the user will receive.
Role TeamRole `json:"role"`
// Reconcilers to opt the team member out of.
ReconcilerOptOuts []sqlc.ReconcilerName `json:"reconcilerOptOuts,omitempty"`
}
// Team sync type.
type TeamSync struct {
// The correlation ID for the sync.
CorrelationID *uuid.UUID `json:"correlationID"`
}
// Input for updating an existing team.
type UpdateTeamInput struct {
// Specify team purpose to update the existing value.
Purpose *string `json:"purpose,omitempty"`
// Specify the Slack channel to update the existing value.
SlackChannel *string `json:"slackChannel,omitempty"`
// A list of Slack channels for NAIS alerts.
SlackAlertsChannels []*SlackAlertsChannelInput `json:"slackAlertsChannels,omitempty"`
}
// Repository authorizations.
type RepositoryAuthorization string
const (
// Authorize for NAIS deployment.
RepositoryAuthorizationDeploy RepositoryAuthorization = "DEPLOY"
)
var AllRepositoryAuthorization = []RepositoryAuthorization{
RepositoryAuthorizationDeploy,
}
func (e RepositoryAuthorization) IsValid() bool {
switch e {
case RepositoryAuthorizationDeploy:
return true
}
return false
}
func (e RepositoryAuthorization) String() string {
return string(e)
}
func (e *RepositoryAuthorization) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = RepositoryAuthorization(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid RepositoryAuthorization", str)
}
return nil
}
func (e RepositoryAuthorization) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// Available team roles.
type TeamRole string
const (
// Regular member, read only access.
TeamRoleMember TeamRole = "MEMBER"
// Team owner, full access to the team.
TeamRoleOwner TeamRole = "OWNER"
)
var AllTeamRole = []TeamRole{
TeamRoleMember,
TeamRoleOwner,
}
func (e TeamRole) IsValid() bool {
switch e {
case TeamRoleMember, TeamRoleOwner:
return true
}
return false
}
func (e TeamRole) String() string {
return string(e)
}
func (e *TeamRole) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TeamRole(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TeamRole", str)
}
return nil
}
func (e TeamRole) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// User sync run status.
type UserSyncRunStatus string
const (
// User sync run in progress.
UserSyncRunStatusInProgress UserSyncRunStatus = "IN_PROGRESS"
// Successful user sync run.
UserSyncRunStatusSuccess UserSyncRunStatus = "SUCCESS"
// Failed user sync run.
UserSyncRunStatusFailure UserSyncRunStatus = "FAILURE"
)
var AllUserSyncRunStatus = []UserSyncRunStatus{
UserSyncRunStatusInProgress,
UserSyncRunStatusSuccess,
UserSyncRunStatusFailure,
}
func (e UserSyncRunStatus) IsValid() bool {
switch e {
case UserSyncRunStatusInProgress, UserSyncRunStatusSuccess, UserSyncRunStatusFailure:
return true
}
return false
}
func (e UserSyncRunStatus) String() string {
return string(e)
}
func (e *UserSyncRunStatus) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = UserSyncRunStatus(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid UserSyncRunStatus", str)
}
return nil
}
func (e UserSyncRunStatus) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}