-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerated-yaml-structs.go
294 lines (250 loc) · 12.1 KB
/
generated-yaml-structs.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// This file is autogenerated by "go generate". Do not modify it.
// It has been generated from your 'gitlab.yaml' file.
// To update those structure, update the 'gitlab.yaml' and run 'go generate'
package main
// Object app groups structure
// Groups structure
// Object Instance structures
type AppInstanceStruct struct {
ForjjGroup string `json:"forjj-group"` // Default FORJJ group. Used by default as gitlab group. If you want different one, use --gitlab-group
ForjjInfra string `json:"forjj-infra"` // Name of the Infra repository to use in github if requested.
Group string `json:"group"` // Gitlab group name.
OrgHookPolicy string `json:"org-hook-policy"` // Set 'sync' to manage all repository webhooks. set 'manage' to manage only listed.
OrganizationWebhooksDisabled string `json:"organization-webhooks-disabled"` // true if the plugin should not manage github organization webhooks.
ProDeployment string `json:"pro-deployment"` // true if current deployment is production one
ProductionGroup string `json:"production-group"` // Production github organization name. By default, it uses the FORJJ organization name
ProjectsDisabled string `json:"projects-disabled"` // true if the plugin should not manage github repositories except the infra repository.
ProjectsWebhooksDisabled string `json:"projects-webhooks-disabled"` // true if the plugin should not manage github repositories webhooks.
Server string `json:"server"` // Github Enterprise Server name. By default, public 'github.com' API is used.
Token string `json:"token"` // Github token to access. This token must authorize organization level access.
}
// Object group groups structure
// Groups structure
// Object Instance structures
type GroupInstanceStruct struct {
Members []string `json:"members"` // List of users to attach to the new group.
Name string `json:"name"` // group name
Role string `json:"role"` // List of roles to apply to the new group.
}
// Object repo groups structure
// Groups structure
// Object Instance structures
type RepoInstanceStruct struct {
Deployable string `json:"Deployable"` // true if the repo is identified by forjj as deployable in the current deployment context
Flow string `json:"flow"` // Flow activated on this repository
ForjjWorkspaceMount string `json:"forjj-workspace-mount"` // Where the workspace dir is located in the github plugin container.
Groups string `json:"groups"` // List of groups to attach to the repository, separated by comma.
Issue_tracker string `json:"issue_tracker"` // To activate the Issue tracker to the Repository
Name string `json:"name"` // Repository name
Role string `json:"role"` // Role of the repository. Forjj will set it to 'infra', 'deploy' or 'code'
Title string `json:"title"` // Github Repository title
Users string `json:"users"` // List of users to attach to the repository, separated by comma.
WebhooksManagement string `json:"webhooks-management"` // Set 'sync' to manage all repository webhooks. set 'manage' to manage only listed.
}
// Object user groups structure
// Groups structure
// Object Instance structures
type UserInstanceStruct struct {
Name string `json:"name"` //
Role string `json:"role"` //
}
// ************************
// Create request structure
// ************************
type ForjCommonStruct struct {
ForjjDeploymentEnv string `json:"deployment-env"` // Deployment environment name
ForjjDeploymentType string `json:"deployment-type"` // Deployment environment type
ForjjDeployMount string `json:"forjj-deploy-mount"`
ForjjGroup string `json:"forjj-group"`
ForjjInfra string `json:"forjj-infra"`
ForjjInstanceName string `json:"forjj-instance-name"`
ForjjSourceMount string `json:"forjj-source-mount"`
GitlabDebug string `json:"gitlab-debug"`
}
type CreateReq struct {
Forj struct {
ForjCommonStruct
}
Objects CreateArgReq
Creds map[string]string
}
type CreateArgReq struct {
App map[string]AppInstanceStruct `json:"app"` // Object details
Group map[string]GroupInstanceStruct `json:"group"` // Object details
Repo map[string]RepoInstanceStruct `json:"repo"` // Object details
User map[string]UserInstanceStruct `json:"user"` // Object details
}
// ************************
// Update request structure
// ************************
type UpdateReq struct {
Forj struct {
ForjCommonStruct
}
Objects UpdateArgReq
Creds map[string]string
}
type UpdateArgReq struct {
App map[string]AppInstanceStruct `json:"app"` // Object details
Group map[string]GroupInstanceStruct `json:"group"` // Object details
Repo map[string]RepoInstanceStruct `json:"repo"` // Object details
User map[string]UserInstanceStruct `json:"user"` // Object details
}
// **************************
// Maintain request structure
// **************************
type MaintainReq struct {
Forj struct {
ForjCommonStruct
DeployTo string `json:"deploy-to"`
Force string `json:"force"`
ForjjWorkspaceMount string `json:"forjj-workspace-mount"`
}
Objects MaintainArgReq
Creds map[string]string
}
type MaintainArgReq struct {
App map[string]AppMaintainStruct `json:"app"` // Object details
}
type AppMaintainStruct struct {
Token string `json:"token"` // Github token to access. This token must authorize organization level access.
}
// YamlDesc has been created from your 'gitlab.yaml' file.
const YamlDesc = "---\n" +
"plugin: \"gitlab\"\n" +
"version: \"0.1\"\n" +
"description: \"gitlab plugin for FORJJ.\"\n" +
"runtime:\n" +
" docker_image: \"docker.hos.hpecorp.net/forjj/gitlab\"\n" +
" service_type: \"REST API\"\n" +
" service:\n" +
" #socket: \"gitlab.sock\"\n" +
" parameters: [ \"service\", \"start\" ]\n" +
"created_flag_file: \"{{ .InstanceName }}/forjj-{{ .Name }}.yaml\"\n" +
"task_flags:\n" +
" common:\n" +
" forjj-infra:\n" +
" help: \"Name of the Infra repository to use\"\n" +
" gitlab-debug:\n" +
" help: \"To activate gitlab debug information\"\n" +
" forjj-source-mount: # Used by the plugin to store plugin data in yaml. See gitlab_plugin.go\n" +
" help: \"Where the source dir is located for gitlab plugin.\"\n" +
" forjj-instance-name:\n" +
" forjj-deploy-mount:\n" +
" forjj-group:\n" +
" maintain:\n" +
" deploy-to:\n" +
" default: docker\n" +
" forjj-workspace-mount:\n" +
" help: \"Where the workspace dir is located in the gitlab plugin container\"\n" +
" force:\n" +
" help: Set 'true' to force removal of teams/users when forjj creates a new forge.\n" +
"objects: # All objects will be delivered by forjj except workspace/infra under objects/<type>/<instance>/<action>/key=value\n" +
" # Define infra object special flag for github\n" +
" app: # already defined by Forjj\n" +
" # Default is : actions: [\"add\", \"change\", \"remove\"] No need to define it.\n" +
" flags:\n" +
" server:\n" +
" help: \"Github Enterprise Server name. By default, public 'github.com' API is used.\"\n" +
" forjj-group:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"Default FORJJ group. Used by default as gitlab group. If you want different one, use --gitlab-group\"\n" +
"# organization:\n" +
" # only-for-actions: [\"add\"]\n" +
" # help: \"Github Organization name. By default, it uses the FORJJ organization name\"\n" +
" group:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"Gitlab group name.\"\n" +
" production-group:\n" +
" help: \"Production github organization name. By default, it uses the FORJJ organization name\"\n" +
" default: \"{{ .Deployments.GetFromPRO \\\"app\\\" .Current.Name \\\"organization\\\" }}\"\n" +
" forjj-infra:\n" +
" only-for-actions: [\"add\", \"change\"]\n" +
" help: \"Name of the Infra repository to use in github if requested.\"\n" +
" token:\n" +
" cli-exported-to-actions: [\"create\", \"update\", \"maintain\"]\n" +
" only-for-actions: [\"add\", \"change\"]\n" +
" help: \"Github token to access. This token must authorize organization level access.\"\n" +
" required: true\n" +
" secure: true\n" +
" envar: \"TOKEN\"\n" +
"# teams-disabled:\n" +
"# help: \"true if the plugin should not manage github users and groups\"\n" +
"# default: false\n" +
" projects-disabled:\n" +
" help: \"true if the plugin should not manage github repositories except the infra repository.\"\n" +
" default: false\n" +
" organization-webhooks-disabled:\n" +
" help: true if the plugin should not manage github organization webhooks.\n" +
" default: false\n" +
" projects-webhooks-disabled:\n" +
" help: true if the plugin should not manage github repositories webhooks.\n" +
" default: false\n" +
" org-hook-policy:\n" +
" help: Set 'sync' to manage all repository webhooks. set 'manage' to manage only listed.\n" +
" default: sync\n" +
" pro-deployment:\n" +
" help: true if current deployment is production one\n" +
" default: \"{{ if (eq (.Deployments.Get .Current.Deployment).Type \\\"PRO\\\") }}true{{ else }}false{{ end }}\"\n" +
" # Define github group exposure to forjj\n" +
" group: # New object type in forjj\n" +
" # Default is : actions: [\"add\", \"change\", \"remove\", \"list\", \"rename\"]\n" +
" help: \"Manage teams in github\"\n" +
" identified_by_flag: name\n" +
" flags:\n" +
" members:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"List of users to attach to the new group.\"\n" +
" of-type: \"[]string\"\n" +
" name:\n" +
" help: \"group name\"\n" +
" required: true\n" +
" role:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"List of roles to apply to the new group.\"\n" +
" # Define github users exposure to forjj\n" +
" user: # New object type in forjj\n" +
" # Default is : actions: [\"add\", \"change\", \"remove\", \"list\", \"rename\"]\n" +
" help: \"Manage organization list of users\"\n" +
" identified_by_flag: name\n" +
" flags:\n" +
" name:\n" +
" options:\n" +
" help: \"user name\"\n" +
" required: true\n" +
" role:\n" +
" only-for-actions: [\"add\"]\n" +
" options:\n" +
" help: \"List of roles to apply to the new user.\"\n" +
" repo: # Enhance Forjj repo object\n" +
" actions: [\"add\", \"change\"]\n" +
" flags:\n" +
" name:\n" +
" help: \"Repository name\"\n" +
" title:\n" +
" help: \"Github Repository title\"\n" +
" issue_tracker:\n" +
" help: \"To activate the Issue tracker to the Repository\"\n" +
" default: \"true\"\n" +
" users:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"List of users to attach to the repository, separated by comma.\"\n" +
" format-regexp: \"[+-]?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9]))*,\"\n" +
" groups:\n" +
" only-for-actions: [\"add\"]\n" +
" help: \"List of groups to attach to the repository, separated by comma.\"\n" +
" format-regexp: \"[+-]?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9]))*,\"\n" +
" flow:\n" +
" help: \"Flow activated on this repository\"\n" +
" forjj-workspace-mount:\n" +
" help: \"Where the workspace dir is located in the github plugin container.\"\n" +
" webhooks-management:\n" +
" help: Set 'sync' to manage all repository webhooks. set 'manage' to manage only listed.\n" +
" default: sync\n" +
" role:\n" +
" help: Role of the repository. Forjj will set it to 'infra', 'deploy' or 'code'\n" +
" Deployable:\n" +
" internal: true\n" +
" help: true if the repo is identified by forjj as deployable in the current deployment context\n" +
" default: \"{{ if (index .Forjfile.Repos .Current.Name).IsDeployable }}true{{ end }}\"\n" +
""