gitlab_support_readiness 1.0.41 → 1.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/support_readiness/mailgun/client.rb +2 -1
  3. data/lib/support_readiness/mailgun/emails.rb +1 -1
  4. data/lib/support_readiness/support_super_form_processor/create_article.rb +375 -0
  5. data/lib/support_readiness/support_super_form_processor/create_macro.rb +183 -0
  6. data/lib/support_readiness/support_super_form_processor/edit_macro.rb +161 -0
  7. data/lib/support_readiness/support_super_form_processor/enable_us_government.rb +236 -0
  8. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change.rb +218 -0
  9. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_extension.rb +238 -0
  10. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_investigate.rb +238 -0
  11. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_link.rb +213 -0
  12. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_nfr.rb +224 -0
  13. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_reset_seat_qsr.rb +194 -0
  14. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_edit.rb +198 -0
  15. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_extension.rb +228 -0
  16. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_over_plan.rb +219 -0
  17. data/lib/support_readiness/support_super_form_processor/global_ir_hackerone_license.rb +172 -0
  18. data/lib/support_readiness/support_super_form_processor/global_ir_oem_license.rb +241 -0
  19. data/lib/support_readiness/support_super_form_processor/global_ir_order_management.rb +267 -0
  20. data/lib/support_readiness/support_super_form_processor/global_ir_other.rb +137 -0
  21. data/lib/support_readiness/support_super_form_processor/global_ir_provison_failure.rb +179 -0
  22. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_did_not_receive.rb +191 -0
  23. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_multiyear.rb +188 -0
  24. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_nfr.rb +215 -0
  25. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_resend.rb +188 -0
  26. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_scl.rb +194 -0
  27. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_temp.rb +234 -0
  28. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_edit.rb +203 -0
  29. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_extension.rb +233 -0
  30. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_new.rb +223 -0
  31. data/lib/support_readiness/support_super_form_processor/global_ir_wider_community_license.rb +247 -0
  32. data/lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb +151 -0
  33. data/lib/support_readiness/support_super_form_processor/global_set_org_ase.rb +293 -0
  34. data/lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb +142 -0
  35. data/lib/support_readiness/support_super_form_processor/gratis_support_extension.rb +247 -0
  36. data/lib/support_readiness/support_super_form_processor/gratis_support_former_customer.rb +288 -0
  37. data/lib/support_readiness/support_super_form_processor/gratis_support_migration.rb +238 -0
  38. data/lib/support_readiness/support_super_form_processor/gratis_support_other.rb +221 -0
  39. data/lib/support_readiness/support_super_form_processor/gratis_support_prospect.rb +288 -0
  40. data/lib/support_readiness/support_super_form_processor/gratis_support_upgrade.rb +298 -0
  41. data/lib/support_readiness/support_super_form_processor/namespace_availability.rb +213 -0
  42. data/lib/support_readiness/support_super_form_processor/pd_shadow_modification.rb +189 -0
  43. data/lib/support_readiness/support_super_form_processor/sa_request_for_support.rb +214 -0
  44. data/lib/support_readiness/support_super_form_processor/shared.rb +518 -0
  45. data/lib/support_readiness/support_super_form_processor/team_member_license.rb +144 -0
  46. data/lib/support_readiness/support_super_form_processor/two_fa_exemption.rb +260 -0
  47. data/lib/support_readiness/support_super_form_processor/usgov_ir_order_management.rb +252 -0
  48. data/lib/support_readiness/support_super_form_processor/usgov_ir_other.rb +136 -0
  49. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_did_not_receive.rb +162 -0
  50. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_multiyear.rb +159 -0
  51. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_nfr.rb +196 -0
  52. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_resend.rb +159 -0
  53. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_scl.rb +160 -0
  54. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb +219 -0
  55. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_edit.rb +189 -0
  56. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_extension.rb +219 -0
  57. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_new.rb +209 -0
  58. data/lib/support_readiness/support_super_form_processor/usgov_set_collaboration_id.rb +151 -0
  59. data/lib/support_readiness/support_super_form_processor/usgov_set_org_ase.rb +295 -0
  60. data/lib/support_readiness/support_super_form_processor.rb +67 -0
  61. data/lib/support_readiness/zendesk/tickets.rb +3 -1
  62. data/lib/support_readiness.rb +1 -0
  63. metadata +59 -2
@@ -0,0 +1,518 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class Shared within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class Shared < Readiness::Client
13
+ ##
14
+ # Performs a gitlab.com user check
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ # @param client [Object] An instance of {Readiness::GitLab::Client}
19
+ # @param email [String] The email to search for
20
+ def self.gitlab_user_check(client, email)
21
+ user_search = Readiness::GitLab::Users.search_by_email(client, email)
22
+ requester = user_search.detect { |u| u.email == email }
23
+ no_such_gitlab_user(email) if requester.nil?
24
+ requester
25
+ end
26
+
27
+ ##
28
+ # Performs a Zendesk user check
29
+ #
30
+ # @author Jason Colyer
31
+ # @since 1.0.42
32
+ # @param client [Object] An instance of {Readiness::GitLab::Client}
33
+ # @param email [String] The email to search for
34
+ def self.zendesk_user_check(client, email)
35
+ user_search = Readiness::Zendesk::Search.users(client, "email:#{CGI.escape(email)} -role:end-user")
36
+ user = user_search.detect { |u| u.email.downcase == email.downcase }
37
+ no_such_zendesk_user(email) if user.nil?
38
+ user
39
+ end
40
+
41
+ ##
42
+ # Sends an email if a gitlab.com user check fails
43
+ #
44
+ # @author Jason Colyer
45
+ # @since 1.0.42
46
+ # @param address [String] The email addresses used
47
+ def self.no_such_gitlab_user(address)
48
+ email = Readiness::Mailgun::Emails.new
49
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
50
+ email.to = address
51
+ email.subject = 'Invalid Support Super Form submission'
52
+ email.text = no_such_gitlab_user_message(email)
53
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
54
+ puts "No such gitlab.com account tied to #{address}"
55
+ exit 0
56
+ end
57
+
58
+ ##
59
+ # Sends an email if a Zendesk user check fails
60
+ #
61
+ # @author Jason Colyer
62
+ # @since 1.0.42
63
+ # @param address [String] The email addresses used
64
+ def self.no_such_zendesk_user(address)
65
+ email = Readiness::Mailgun::Emails.new
66
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
67
+ email.to = address
68
+ email.subject = 'Invalid Support Super Form submission'
69
+ email.text = no_such_zendesk_user_message(email)
70
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
71
+ puts "No such Zendesk account tied to #{address}"
72
+ exit 0
73
+ end
74
+
75
+ ##
76
+ # Sends an email if not an OEM member
77
+ #
78
+ # @author Jason Colyer
79
+ # @since 1.0.42
80
+ # @param address [String] The email addresses used
81
+ def self.not_oem_member(address)
82
+ email = Readiness::Mailgun::Emails.new
83
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
84
+ email.to = address
85
+ email.subject = 'Invalid Support Super Form submission'
86
+ email.text = not_oem_member_message
87
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
88
+ puts "Not an OEM member - #{address}"
89
+ exit 0
90
+ end
91
+
92
+ ##
93
+ # Sends an email if not an Order Management member
94
+ #
95
+ # @author Jason Colyer
96
+ # @since 1.0.42
97
+ # @param address [String] The email addresses used
98
+ def self.not_order_management_member(address)
99
+ email = Readiness::Mailgun::Emails.new
100
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
101
+ email.to = address
102
+ email.subject = 'Invalid Support Super Form submission'
103
+ email.text = not_order_management_member_message
104
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
105
+ puts "Not an Order Management member - #{address}"
106
+ exit 0
107
+ end
108
+
109
+ ##
110
+ # Sends an email if the namespace provided was invalid
111
+ #
112
+ # @author Jason Colyer
113
+ # @since 1.0.42
114
+ # @param address [String] The email addresses used
115
+ def self.invalid_namespace(address, namespace)
116
+ email = Readiness::Mailgun::Emails.new
117
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
118
+ email.to = address
119
+ email.subject = 'Invalid Support Super Form submission'
120
+ email.text = invalid_namespace_message(namespace)
121
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
122
+ puts "#{address} provided invalid namespace - #{namespace}"
123
+ exit 0
124
+ end
125
+
126
+ ##
127
+ # Sends an email if not an Partner Support member
128
+ #
129
+ # @author Jason Colyer
130
+ # @since 1.0.42
131
+ # @param address [String] The email addresses used
132
+ def self.not_partner_support_member(address)
133
+ email = Readiness::Mailgun::Emails.new
134
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
135
+ email.to = address
136
+ email.subject = 'Invalid Support Super Form submission'
137
+ email.text = not_partner_support_member_message
138
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
139
+ puts "Not an Order Management member - #{address}"
140
+ exit 0
141
+ end
142
+
143
+ ##
144
+ # Sends an email if not a valid NFR request
145
+ #
146
+ # @author Jason Colyer
147
+ # @since 1.0.42
148
+ # @param address [String] The email addresses used
149
+ def self.invalid_nfr_request(address)
150
+ email = Readiness::Mailgun::Emails.new
151
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
152
+ email.to = address
153
+ email.subject = 'Invalid Support Super Form submission'
154
+ email.text = invalid_nfr_request_message
155
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
156
+ puts "Invalid NFR request made by #{address}"
157
+ exit 0
158
+ end
159
+
160
+ ##
161
+ # Sends an email if not a valid Wider Community License request
162
+ #
163
+ # @author Jason Colyer
164
+ # @since 1.0.42
165
+ # @param address [String] The email addresses used
166
+ def self.cannot_self_approve(address)
167
+ email = Readiness::Mailgun::Emails.new
168
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
169
+ email.to = address
170
+ email.subject = 'Invalid Support Super Form submission'
171
+ email.text = cannot_self_approve_message
172
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
173
+ puts "Invalid WCL request made by #{address}"
174
+ exit 0
175
+ end
176
+
177
+ ##
178
+ # Sends an email if not a valid article creation request
179
+ #
180
+ # @author Jason Colyer
181
+ # @since 1.0.42
182
+ def self.invalid_article_creation(requester, errors)
183
+ email = Readiness::Mailgun::Emails.new
184
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
185
+ email.to = requester.email
186
+ email.subject = 'Invalid Support Super Form submission'
187
+ email.text = invalid_article_creation_message(requester, errors)
188
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
189
+ puts "Invalid article creation submission by #{requester.email}"
190
+ exit 0
191
+ end
192
+
193
+ ##
194
+ # Sends an email if not a valid enable us gov request
195
+ #
196
+ # @author Jason Colyer
197
+ # @since 1.0.42
198
+ def self.invalid_enable_usgov(requester, errors)
199
+ email = Readiness::Mailgun::Emails.new
200
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
201
+ email.to = requester.email
202
+ email.subject = 'Invalid Support Super Form submission'
203
+ email.text = invalid_enable_usgov_message(requester, errors)
204
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
205
+ puts "Invalid enable us gov submission by #{requester.email}"
206
+ exit 0
207
+ end
208
+
209
+ ##
210
+ # Sets a global variable for an instance of {Readiness::Mailgun::Client}
211
+ #
212
+ # @author Jason Colyer
213
+ # @since 1.0.42
214
+ # @return [Object] {Readiness::Mailgun::Client}
215
+ def self.mailgun_client
216
+ @mailgun_client ||= generate_mailgun_connection
217
+ end
218
+
219
+ ##
220
+ # Generates a Mailgun connection
221
+ #
222
+ # @author Jason Colyer
223
+ # @since 1.0.42
224
+ # @return [Object] {Readiness::Mailgun::Client}
225
+ def self.generate_mailgun_connection
226
+ mailgun_config = Readiness::Mailgun::Configuration.new
227
+ mailgun_config.domain = 'mg.gitlab.com'
228
+ mailgun_config.token = ENV.fetch('MAILGUN_KEY')
229
+ Readiness::Mailgun::Client.new(mailgun_config)
230
+ end
231
+
232
+ ##
233
+ # Returns the email body message for a failed gitlab.com user check
234
+ #
235
+ # @author Jason Colyer
236
+ # @since 1.0.42
237
+ # @return [String]
238
+ def self.no_such_gitlab_user_message(email)
239
+ <<~STRING
240
+ Greetings,
241
+
242
+ Recently a Support Super Form submission was made stating the requester email was #{email}.
243
+
244
+ We were unable to find a gitlab.com account using that email address as the primary email. As such, the request could not be completed.
245
+
246
+ If you have a gitlab.com account using that as a secondary email, please modify your gitlab.com account to make your official GitLab email the primary.
247
+
248
+ Once that has been rectified, please re-submit your request.
249
+
250
+ Thank you,
251
+
252
+ GitLab Support
253
+ STRING
254
+ end
255
+
256
+ ##
257
+ # Returns the email body message for a failed Zendesk user check
258
+ #
259
+ # @author Jason Colyer
260
+ # @since 1.0.42
261
+ # @return [String]
262
+ def self.no_such_zendesk_user_message(email)
263
+ <<~STRING
264
+ Greetings,
265
+
266
+ The Internal Request Form submission you recently filed was not able to be filed due to the following issues:
267
+
268
+ - Invalid Zendesk user: #{CGI.escape(email)}
269
+
270
+ Please rectify the above issues and re-submit your Internal Request via the form.
271
+
272
+ Thank you,
273
+
274
+ GitLab Support
275
+
276
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
277
+ STRING
278
+ end
279
+
280
+ ##
281
+ # Returns the email body message for a failed OEM check
282
+ #
283
+ # @author Jason Colyer
284
+ # @since 1.0.42
285
+ # @return [String]
286
+ def self.not_oem_member_message
287
+ <<~STRING
288
+ Greetings,
289
+
290
+ The Internal Request Form submission you recently filed was not able to be filed due to the following issues:
291
+
292
+ - You are not a member of the OEM management team.
293
+
294
+ Please rectify the above issues and re-submit your Internal Request via the form.
295
+
296
+ Thank you,
297
+
298
+ GitLab Support
299
+
300
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
301
+ STRING
302
+ end
303
+
304
+ ##
305
+ # Returns the email body message for a failed Order Management check
306
+ #
307
+ # @author Jason Colyer
308
+ # @since 1.0.42
309
+ # @return [String]
310
+ def self.not_order_management_member_message
311
+ <<~STRING
312
+ Greetings,
313
+
314
+ The Internal Request Form submission you recently filed was not able to be filed due to the following issues:
315
+
316
+ - You are not a member of the order management team.
317
+
318
+ Please rectify the above issues and re-submit your Internal Request via the form.
319
+
320
+ Thank you,
321
+
322
+ GitLab Support
323
+
324
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
325
+ STRING
326
+ end
327
+
328
+ ##
329
+ # Returns the email body message when the namespace is invalid
330
+ #
331
+ # @author Jason Colyer
332
+ # @since 1.0.42
333
+ # @return [String]
334
+ def self.invalid_namespace_message(namespace)
335
+ <<~STRING
336
+ Greetings,
337
+
338
+ The Internal Request Form submission you recently filed was not able to be filed due to the following issues:
339
+
340
+ - Invalid namespace: '#{namespace}'. Ensure the provided namespace is an existing top-level group, as only those are accepted.
341
+
342
+ Please rectify the above issues and re-submit your Internal Request via the form.
343
+
344
+ Thank you,
345
+
346
+ GitLab Support
347
+
348
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
349
+ STRING
350
+ end
351
+
352
+ ##
353
+ # Returns the email body message when not a Partner Supprot member
354
+ #
355
+ # @author Jason Colyer
356
+ # @since 1.0.42
357
+ # @return [String]
358
+ def self.not_partner_support_member_message
359
+ <<~STRING
360
+ Greetings,
361
+
362
+ The Internal Request Form submission you recently filed was not able to be filed due to the following issues:
363
+
364
+ - You are not a member of the partner support team.
365
+
366
+ Please rectify the above issues and re-submit your Internal Request via the form.
367
+
368
+ Thank you,
369
+
370
+ GitLab Support
371
+
372
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
373
+ STRING
374
+ end
375
+
376
+ ##
377
+ # Returns the email body message when not a valid NFR request
378
+ #
379
+ # @author Jason Colyer
380
+ # @since 1.0.42
381
+ # @return [String]
382
+ def self.invalid_nfr_request_message
383
+ <<~STRING
384
+ Greetings,
385
+
386
+ The Internal Request Form submission you recently filed was not able to be filed due to one of the following issues:
387
+
388
+ - NFR licenses cannot exceed 25 seats
389
+ - NFR licenses cannot have an expiration more than one year in the future
390
+
391
+ Please rectify the above issues and re-submit your Internal Request via the form.
392
+
393
+ Thank you,
394
+
395
+ GitLab Support
396
+
397
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
398
+ STRING
399
+ end
400
+
401
+ ##
402
+ # Returns the email body message when not a valid Wider Community License request
403
+ #
404
+ # @author Jason Colyer
405
+ # @since 1.0.42
406
+ # @return [String]
407
+ def self.cannot_self_approve_message
408
+ <<~STRING
409
+ Greetings,
410
+
411
+ The Internal Request Form submission you recently filed was not able to be filed due to one of the following issues:
412
+
413
+ - You cannot be the approver for community licenses lasting more than 90 days.
414
+
415
+ Please rectify the above issues and re-submit your Internal Request via the form.
416
+
417
+ Thank you,
418
+
419
+ GitLab Support
420
+
421
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
422
+ STRING
423
+ end
424
+
425
+ ##
426
+ # Returns the email body message when not a valid article creation submission
427
+ #
428
+ # @author Jason Colyer
429
+ # @since 1.0.42
430
+ # @return [String]
431
+ def self.invalid_article_creation_message(requester, errors)
432
+ <<~STRING
433
+ Greetings @#{requester.username} ,
434
+
435
+ Your recent request to create a Zendesk article was not able to be filed due to the following issues:
436
+
437
+ #{errors.map { |e| "- #{e}" }.join("\n")}
438
+
439
+ Please rectify the above issues and re-submit your request via the form.
440
+
441
+ Thank you,
442
+
443
+ GitLab Support
444
+
445
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
446
+ STRING
447
+ end
448
+
449
+ ##
450
+ # Returns the email body message when not a valid enable us gov submission
451
+ #
452
+ # @author Jason Colyer
453
+ # @since 1.0.42
454
+ # @return [String]
455
+ def self.invalid_enable_usgov_message(requester, errors)
456
+ <<~STRING
457
+ Greetings @#{requester.username} ,
458
+
459
+ Your recent request to enable US Goverment support was not able to be filed due to the following issues:
460
+
461
+ #{errors.map { |e| "- #{e}" }.join("\n")}
462
+
463
+ Please rectify the above issues and re-submit your request via the form.
464
+
465
+ Thank you,
466
+
467
+ GitLab Support
468
+
469
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
470
+ STRING
471
+ end
472
+
473
+ def self.sfdc_account_string(link)
474
+ id = if link =~ /lightning/
475
+ link.split('/')[-2]
476
+ else
477
+ link.split('/').last
478
+ end
479
+ classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
480
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Account/#{id}/view' target='_blank'>Lightning</a>"
481
+ "SFDC Account: #{id} (#{classic} | #{lightning})"
482
+ end
483
+
484
+ def self.sfdc_opportunity_string(link)
485
+ id = if link =~ /lightning/
486
+ link.split('/')[-2]
487
+ else
488
+ link.split('/').last
489
+ end
490
+ classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
491
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Opportunity/#{id}/view' target='_blank'>Lightning</a>"
492
+ "SFDC Opportunity: #{id} (#{classic} | #{lightning})"
493
+ end
494
+
495
+ def self.sfdc_upload_string(link)
496
+ id = if link =~ /lightning/
497
+ link.split('/')[-2]
498
+ else
499
+ link.split('/').last
500
+ end
501
+ classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
502
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/ContentDocument/#{id}/view' target='_blank'>Lightning</a>"
503
+ "Customer verification proof: #{id} (#{classic} | #{lightning})"
504
+ end
505
+
506
+ def self.sfdc_chattr_string(link)
507
+ id = if link =~ /lightning/
508
+ link.split('/')[-2]
509
+ else
510
+ link.split('/').last
511
+ end
512
+ classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
513
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/#{id}/view' target='_blank'>Lightning</a>"
514
+ "Chattr link containing approval: #{id} (#{classic} | #{lightning})"
515
+ end
516
+ end
517
+ end
518
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class TeamMemberLicense within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class TeamMemberLicense < Readiness::Client
13
+ ##
14
+ # Process a Team Member License check request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ def self.process!(client, admin_client)
19
+ @gitlab_client = client
20
+ @gitlab_admin_client = admin_client
21
+ requester
22
+ issue = Readiness::GitLab::Issues.new
23
+ issue.title = "GitLab Team Member License request - #{requester.name}"
24
+ issue.description = team_member_license_message
25
+ create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
26
+ puts "Issue created: #{create.web_url}"
27
+ exit 0
28
+ end
29
+
30
+ ##
31
+ # Sets the global variable requester
32
+ #
33
+ # @author Jason Colyer
34
+ # @since 1.0.42
35
+ def self.requester
36
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
37
+ end
38
+
39
+ ##
40
+ # Sets the global variable requester_email
41
+ #
42
+ # @author Jason Colyer
43
+ # @since 1.0.42
44
+ def self.requester_email
45
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
46
+ end
47
+
48
+ ##
49
+ # Sets the global variable project
50
+ #
51
+ # @author Jason Colyer
52
+ # @since 1.0.42
53
+ def self.project
54
+ @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526)
55
+ end
56
+
57
+ ##
58
+ # Sets the global variable plan
59
+ #
60
+ # @author Jason Colyer
61
+ # @since 1.0.42
62
+ def self.plan
63
+ @plan ||= ENV.fetch('TEAM_MEMBER_LICENSE_PLAN')
64
+ end
65
+
66
+ ##
67
+ # Sets the global variable seats
68
+ #
69
+ # @author Jason Colyer
70
+ # @since 1.0.42
71
+ def self.seats
72
+ @seats ||= ENV.fetch('TEAM_MEMBER_LICENSE_COUNT')
73
+ end
74
+
75
+ ##
76
+ # Sets the global variable trueup
77
+ #
78
+ # @author Jason Colyer
79
+ # @since 1.0.42
80
+ def self.trueup
81
+ @trueup ||= ENV.fetch('TEAM_MEMBER_LICENSE_TRUEUP')
82
+ end
83
+
84
+ ##
85
+ # Sets the global variable previous
86
+ #
87
+ # @author Jason Colyer
88
+ # @since 1.0.42
89
+ def self.previous
90
+ @previous ||= ENV.fetch('TEAM_MEMBER_LICENSE_PREVIOUS')
91
+ end
92
+
93
+ ##
94
+ # Sets the global variable expiration
95
+ #
96
+ # @author Jason Colyer
97
+ # @since 1.0.42
98
+ def self.expiration
99
+ @expiration ||= ENV.fetch('TEAM_MEMBER_LICENSE_EXPIRATION')
100
+ end
101
+
102
+ ##
103
+ # Returns the issue description for a team member license request
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.team_member_license_message
108
+ <<~STRING
109
+ # GitLab Team Member License request
110
+
111
+ ## Please Note the Following
112
+
113
+ - This is for requesting an **internal** self-managed GitLab license. This license should **only** be used by **GitLab team members**.
114
+ - This is solely for **self-managed** GitLab instances. If you are wanting a subscription put on a GitLab.com namespace, please file an AR to IT Ops using the appropriate template.
115
+ - The license can only exist for one year at a time
116
+ - The license will be generated via our cDot **staging** environment only.
117
+
118
+ ## Information
119
+
120
+ - Name: #{requester.name}
121
+ - Email: #{requester.email}
122
+ - GitLab username: @#{requester.username}
123
+ - License plan: #{plan.capitalize}
124
+ - Number of users: #{seats}
125
+ - True-up count: #{trueup}
126
+ - Previous user count: #{previous}
127
+ - Expiration date: #{expiration}
128
+
129
+ ### Support Operations
130
+
131
+ * [ ] Follow the directions of the workflow, which can be found [here](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/team_member_licenses/)
132
+
133
+ ---
134
+
135
+ /confidential
136
+
137
+ /assign @nabeel.bilgrami @avilla4 @secole @rverschoor
138
+
139
+ /label ~"Internal-License" ~"Readiness::Triage" ~"Readiness Priority::Current Quarter"
140
+ STRING
141
+ end
142
+ end
143
+ end
144
+ end