gitlab_support_readiness 1.0.41 → 1.0.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/support_readiness/mailgun/client.rb +2 -1
- data/lib/support_readiness/mailgun/emails.rb +1 -1
- data/lib/support_readiness/support_super_form_processor/create_article.rb +375 -0
- data/lib/support_readiness/support_super_form_processor/create_macro.rb +183 -0
- data/lib/support_readiness/support_super_form_processor/edit_macro.rb +161 -0
- data/lib/support_readiness/support_super_form_processor/enable_us_government.rb +236 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change.rb +218 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_extension.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_investigate.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_link.rb +213 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_nfr.rb +224 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_reset_seat_qsr.rb +194 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_edit.rb +198 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_extension.rb +228 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_over_plan.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_hackerone_license.rb +172 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_oem_license.rb +241 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_order_management.rb +267 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_other.rb +137 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_provison_failure.rb +179 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_did_not_receive.rb +191 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_multiyear.rb +188 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_nfr.rb +215 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_resend.rb +188 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_scl.rb +194 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_temp.rb +234 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_edit.rb +203 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_extension.rb +233 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_new.rb +223 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_wider_community_license.rb +247 -0
- data/lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb +151 -0
- data/lib/support_readiness/support_super_form_processor/global_set_org_ase.rb +293 -0
- data/lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb +142 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_extension.rb +247 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_former_customer.rb +288 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_migration.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_other.rb +221 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_prospect.rb +288 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_upgrade.rb +298 -0
- data/lib/support_readiness/support_super_form_processor/namespace_availability.rb +213 -0
- data/lib/support_readiness/support_super_form_processor/pd_shadow_modification.rb +189 -0
- data/lib/support_readiness/support_super_form_processor/sa_request_for_support.rb +214 -0
- data/lib/support_readiness/support_super_form_processor/shared.rb +518 -0
- data/lib/support_readiness/support_super_form_processor/team_member_license.rb +144 -0
- data/lib/support_readiness/support_super_form_processor/two_fa_exemption.rb +260 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_order_management.rb +252 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_other.rb +136 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_did_not_receive.rb +162 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_multiyear.rb +159 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_nfr.rb +196 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_resend.rb +159 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_scl.rb +160 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_edit.rb +189 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_extension.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_new.rb +209 -0
- data/lib/support_readiness/support_super_form_processor/usgov_set_collaboration_id.rb +151 -0
- data/lib/support_readiness/support_super_form_processor/usgov_set_org_ase.rb +295 -0
- data/lib/support_readiness/support_super_form_processor.rb +67 -0
- data/lib/support_readiness.rb +1 -0
- metadata +59 -2
@@ -0,0 +1,293 @@
|
|
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 GlobalSetOrgASE within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class GlobalSetOrgASE < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process setting an ASE on a Global organization
|
15
|
+
#
|
16
|
+
# @author Jason Colyer
|
17
|
+
# @since 1.0.42
|
18
|
+
def self.process!(gitlab_client, gitlab_admin_client, zendesk_client, redis_client)
|
19
|
+
@gitlab_client = gitlab_client
|
20
|
+
@gitlab_admin_client = gitlab_admin_client
|
21
|
+
@zendesk_client = zendesk_client
|
22
|
+
@redis_client = redis_client
|
23
|
+
requester
|
24
|
+
bad_requester unless approved_requester?
|
25
|
+
org_does_not_exist if org.is_a? Hash
|
26
|
+
invalid_agent unless agent_valid?
|
27
|
+
new_org = Readiness::Zendesk::Organizations.new
|
28
|
+
new_org.id = org.id
|
29
|
+
new_org.custom_fields = {
|
30
|
+
"assigned_se" => agent_info
|
31
|
+
}
|
32
|
+
Readiness::Zendesk::Organizations.update!(@zendesk_client, new_org)
|
33
|
+
issue = Readiness::GitLab::Issues.new
|
34
|
+
issue.title = "Set an Assigned Support Engineer for a Zendesk Global organization - #{org.id}"
|
35
|
+
issue.description = message
|
36
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
37
|
+
puts "Issue created: #{create.web_url}"
|
38
|
+
exit 0
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.bad_requester
|
42
|
+
issue = Readiness::GitLab::Issues.new
|
43
|
+
issue.title = 'Invalid Request - Not approved to make this request'
|
44
|
+
issue.description = bad_requester_message
|
45
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
46
|
+
puts "Issue created: #{create.web_url}"
|
47
|
+
exit 0
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.org_does_not_exist
|
51
|
+
issue = Readiness::GitLab::Issues.new
|
52
|
+
issue.title = 'Invalid Request - Organization Not Found'
|
53
|
+
issue.description = org_does_not_exist_message
|
54
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
55
|
+
puts "Issue created: #{create.web_url}"
|
56
|
+
exit 0
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.invalid_agent
|
60
|
+
issue = Readiness::GitLab::Issues.new
|
61
|
+
issue.title = 'Invalid Request - Invalid agent provided'
|
62
|
+
issue.description = invalid_user_message
|
63
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
64
|
+
puts "Issue created: #{create.web_url}"
|
65
|
+
exit 0
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Determines if the requester is authorized to make the request
|
70
|
+
#
|
71
|
+
# @author Jason Colyer
|
72
|
+
# @since 1.0.42
|
73
|
+
def self.approved_requester?
|
74
|
+
return true if approved_requester_list.map { |t| t['email'] }.include? requester_email
|
75
|
+
|
76
|
+
false
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Sets the global variable approved_requester_list
|
81
|
+
#
|
82
|
+
# @author Jason Colyer
|
83
|
+
# @since 1.0.42
|
84
|
+
def self.approved_requester_list
|
85
|
+
@approved_requester_list ||= determine_approved_requesters
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Determines the list of approved requesters
|
90
|
+
#
|
91
|
+
# @author Jason Colyer
|
92
|
+
# @since 1.0.42
|
93
|
+
def self.determine_approved_requesters
|
94
|
+
members = []
|
95
|
+
members += team.select { |t| t['title'] =~ /Director/ }
|
96
|
+
members += team.select { |t| t['title'] =~ /Manager/ }
|
97
|
+
members
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Determines if the agent to use is valid
|
102
|
+
#
|
103
|
+
# @author Jason Colyer
|
104
|
+
# @since 1.0.42
|
105
|
+
def self.agent_valid?
|
106
|
+
return true if agent_id == 'None'
|
107
|
+
return false if agent.is_a? Hash
|
108
|
+
return false if agent.role == 'end-user'
|
109
|
+
return false if agent.suspended
|
110
|
+
return false if agent.custom_role_id == 360004984553
|
111
|
+
|
112
|
+
true
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Returns the value to set the organization field to
|
117
|
+
#
|
118
|
+
# @author Jason Colyer
|
119
|
+
# @since 1.0.42
|
120
|
+
def self.agent_info
|
121
|
+
return '' if agent_id == 'None'
|
122
|
+
|
123
|
+
agent.id
|
124
|
+
end
|
125
|
+
|
126
|
+
##
|
127
|
+
# Sets the global variable team
|
128
|
+
#
|
129
|
+
# @author Jason Colyer
|
130
|
+
# @since 1.0.42
|
131
|
+
def self.team
|
132
|
+
@team ||= Readiness::Redis.get(@redis_client, 'support_team')
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Sets the global variable requester
|
137
|
+
#
|
138
|
+
# @author Jason Colyer
|
139
|
+
# @since 1.0.42
|
140
|
+
def self.requester
|
141
|
+
@requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Sets the global variable requester_email
|
146
|
+
#
|
147
|
+
# @author Jason Colyer
|
148
|
+
# @since 1.0.42
|
149
|
+
def self.requester_email
|
150
|
+
@requester_email ||= ENV.fetch('REQUESTER_EMAIL')
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# Sets the global variable project
|
155
|
+
#
|
156
|
+
# @author Jason Colyer
|
157
|
+
# @since 1.0.42
|
158
|
+
def self.project
|
159
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526)
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# Sets the global variable org
|
164
|
+
#
|
165
|
+
# @author Jason Colyer
|
166
|
+
# @since 1.0.42
|
167
|
+
def self.org
|
168
|
+
@org ||= Readiness::Zendesk::Organizations.find(@zendesk_client, org_id)
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Sets the global variable org_id
|
173
|
+
#
|
174
|
+
# @author Jason Colyer
|
175
|
+
# @since 1.0.42
|
176
|
+
def self.org_id
|
177
|
+
@org_id ||= ENV.fetch('ZENDESK_ORGANIZATION_ID')
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Sets the global variable agent
|
182
|
+
#
|
183
|
+
# @author Jason Colyer
|
184
|
+
# @since 1.0.42
|
185
|
+
def self.agent
|
186
|
+
@agent ||= Readiness::Zendesk::Users.find(@zendesk_client, agent_id)
|
187
|
+
end
|
188
|
+
|
189
|
+
##
|
190
|
+
# Sets the global variable agent_id
|
191
|
+
#
|
192
|
+
# @author Jason Colyer
|
193
|
+
# @since 1.0.42
|
194
|
+
def self.agent_id
|
195
|
+
@agent_id ||= ENV.fetch('ZENDESK_ASE_ID')
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Returns the issue description
|
200
|
+
#
|
201
|
+
# @author Jason Colyer
|
202
|
+
# @since 1.0.42
|
203
|
+
def self.message
|
204
|
+
<<~STRING
|
205
|
+
## Set an Assigned Support Engineer for a Zendesk Global organization - #{org.id}
|
206
|
+
|
207
|
+
Greetings @#{requester.username} !
|
208
|
+
|
209
|
+
We have set the Assigned Support Engineer of the Zendesk Global organization to that of #{agent_id} at this time.
|
210
|
+
|
211
|
+
If that is not the ID of the agent you were intending to use, please review the Zendesk agent you were wanting to use once more and file a new submission.
|
212
|
+
|
213
|
+
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
214
|
+
|
215
|
+
/label ~"AutomatedRequests::Set Org ASE"
|
216
|
+
|
217
|
+
/assign @#{requester.username}
|
218
|
+
STRING
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Returns the issue description
|
223
|
+
#
|
224
|
+
# @author Jason Colyer
|
225
|
+
# @since 1.0.42
|
226
|
+
def self.org_does_not_exist_message
|
227
|
+
<<~STRING
|
228
|
+
## Invalid Request Organization Not Found
|
229
|
+
|
230
|
+
Greetings @#{requester.username} !
|
231
|
+
|
232
|
+
We received a request from you recently, however the organization ID given #{org_id} is not a valid Zendesk Global Organization ID. As such, we are not able to proceed.
|
233
|
+
|
234
|
+
Please review the Zendesk Global organization you were wanting to use once more and file a new submission.
|
235
|
+
|
236
|
+
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
237
|
+
|
238
|
+
/label ~"AutomatedRequests::Invalid Organization"
|
239
|
+
|
240
|
+
/label ~"Invalid Zendesk Global organization given"
|
241
|
+
|
242
|
+
/assign @#{requester.username}
|
243
|
+
STRING
|
244
|
+
end
|
245
|
+
|
246
|
+
def self.bad_requester_message
|
247
|
+
<<~STRING
|
248
|
+
## Invalid Request - Not approved to make this request
|
249
|
+
|
250
|
+
Greetings @#{requester.username} !
|
251
|
+
|
252
|
+
We received a request from you recently to set an ASE on a Zendesk Global organization, however this type of request can only be made by specifc approved persons.
|
253
|
+
|
254
|
+
Please contact one fo the following via [#support_leadership](https://gitlab.enterprise.slack.com/archives/C01F9S37AKT) to discuss this request:
|
255
|
+
|
256
|
+
#{approved_requester_list.map { |a| "- #{a['email']}" }.join("\n")}
|
257
|
+
|
258
|
+
/label ~"AutomatedRequests::Invalid Permissions"
|
259
|
+
|
260
|
+
/assign @#{requester.username}
|
261
|
+
STRING
|
262
|
+
end
|
263
|
+
|
264
|
+
##
|
265
|
+
# Returns the issue description for an invalid user
|
266
|
+
#
|
267
|
+
# @author Jason Colyer
|
268
|
+
# @since 1.0.42
|
269
|
+
def self.invalid_user_message
|
270
|
+
<<~STRING
|
271
|
+
## Set an Assigned Support Engineer for a Zendesk Global organization - #{org.id}
|
272
|
+
|
273
|
+
Greetings @#{requester.username} !
|
274
|
+
|
275
|
+
We were unable to set the ASE on the Zendesk Global organization at this time, as we were encountered one of the following issues with the Zendesk Global agent with the ID of #{agent_id}:
|
276
|
+
|
277
|
+
- The agent does not exist
|
278
|
+
- The agent does not have write permissions on tickets
|
279
|
+
- The agent is suspended
|
280
|
+
- The agent is an end-user
|
281
|
+
|
282
|
+
Please review the Zendesk agent you were wanting to use once more and file a new submission.
|
283
|
+
|
284
|
+
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
285
|
+
|
286
|
+
/label ~"AutomatedRequests::Set Org ASE" ~"SupportOps::Blocked"
|
287
|
+
|
288
|
+
/assign @#{requester.username}
|
289
|
+
STRING
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
@@ -0,0 +1,142 @@
|
|
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 GlobalToggleEscalation within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class GlobalToggleEscalation < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process a Namesquatting Availability check request
|
15
|
+
#
|
16
|
+
# @author Jason Colyer
|
17
|
+
# @since 1.0.42
|
18
|
+
def self.process!(gitlab_client, gitlab_admin_client, zendesk_client)
|
19
|
+
@gitlab_client = gitlab_client
|
20
|
+
@gitlab_admin_client = gitlab_admin_client
|
21
|
+
@zendesk_client = zendesk_client
|
22
|
+
requester
|
23
|
+
org_does_not_exist if org.is_a? Hash
|
24
|
+
new_org = Readiness::Zendesk::Organizations.new
|
25
|
+
new_org.id = org.id
|
26
|
+
new_org.custom_fields = {
|
27
|
+
"org_in_escalated_state" => !org.custom_fields['org_in_escalated_state']
|
28
|
+
}
|
29
|
+
Readiness::Zendesk::Organizations.update!(@zendesk_client, new_org)
|
30
|
+
issue = Readiness::GitLab::Issues.new
|
31
|
+
issue.title = "Toggle the escalation status of an organization - #{org.id}"
|
32
|
+
issue.description = message
|
33
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
34
|
+
puts "Issue created: #{create.web_url}"
|
35
|
+
exit 0
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Create issue when organization does not exist
|
40
|
+
#
|
41
|
+
# @author Jason Colyer
|
42
|
+
# @since 1.0.42
|
43
|
+
def self.org_does_not_exist
|
44
|
+
issue = Readiness::GitLab::Issues.new
|
45
|
+
issue.title = "Invalid Request - Organization Not Found"
|
46
|
+
issue.description = org_does_not_exist_message
|
47
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
48
|
+
puts "Issue created: #{create.web_url}"
|
49
|
+
exit 0
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Sets the global variable requester
|
54
|
+
#
|
55
|
+
# @author Jason Colyer
|
56
|
+
# @since 1.0.42
|
57
|
+
def self.requester
|
58
|
+
@requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Sets the global variable requester_email
|
63
|
+
#
|
64
|
+
# @author Jason Colyer
|
65
|
+
# @since 1.0.42
|
66
|
+
def self.requester_email
|
67
|
+
@requester_email ||= ENV.fetch('REQUESTER_EMAIL')
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Sets the global variable project
|
72
|
+
#
|
73
|
+
# @author Jason Colyer
|
74
|
+
# @since 1.0.42
|
75
|
+
def self.project
|
76
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526)
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Sets the global variable org
|
81
|
+
#
|
82
|
+
# @author Jason Colyer
|
83
|
+
# @since 1.0.42
|
84
|
+
def self.org
|
85
|
+
@org ||= Readiness::Zendesk::Organizations.find(@zendesk_client, org_id)
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Sets the global variable org_id
|
90
|
+
#
|
91
|
+
# @author Jason Colyer
|
92
|
+
# @since 1.0.42
|
93
|
+
def self.org_id
|
94
|
+
@org_id ||= ENV.fetch('ZENDESK_ORGANIZATION_ID')
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Returns the issue description
|
99
|
+
#
|
100
|
+
# @author Jason Colyer
|
101
|
+
# @since 1.0.42
|
102
|
+
def self.message
|
103
|
+
<<~STRING
|
104
|
+
## Toggle the escalation status of an organization - #{org.id}
|
105
|
+
|
106
|
+
Greetings @#{requester.username} !
|
107
|
+
|
108
|
+
We have now toggled the escalated state of the organization at this time.
|
109
|
+
|
110
|
+
/label ~"AutomatedRequests::Toggle Org Escalation State"
|
111
|
+
|
112
|
+
/assign @#{requester.username}
|
113
|
+
STRING
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Returns the issue description
|
118
|
+
#
|
119
|
+
# @author Jason Colyer
|
120
|
+
# @since 1.0.42
|
121
|
+
def self.org_does_not_exist_message
|
122
|
+
<<~STRING
|
123
|
+
## Invalid Request Organization Not Found
|
124
|
+
|
125
|
+
Greetings @#{requester.username} !
|
126
|
+
|
127
|
+
We received a request from you recently, however the organization ID given #{org_id} is not a valid Zendesk Global Organization ID. As such, we are not able to proceed.
|
128
|
+
|
129
|
+
Please review the Zendesk Global organization you were wanting to use once more and file a new submission.
|
130
|
+
|
131
|
+
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
132
|
+
|
133
|
+
/label ~"AutomatedRequests::Invalid Organization"
|
134
|
+
|
135
|
+
/label ~"Invalid Zendesk Global organization given"
|
136
|
+
|
137
|
+
/assign @#{requester.username}
|
138
|
+
STRING
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,247 @@
|
|
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 GratisSupportExtension within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class GratisSupportExtension < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process a Gratis Support Extension request
|
15
|
+
#
|
16
|
+
# @author Jason Colyer
|
17
|
+
# @since 1.0.42
|
18
|
+
def self.process!(gitlab_client, gitlab_admin_client, sfdc_client)
|
19
|
+
@gitlab_client = gitlab_client
|
20
|
+
@gitlab_admin_client = gitlab_admin_client
|
21
|
+
@sfdc_client = sfdc_client
|
22
|
+
requester
|
23
|
+
checks
|
24
|
+
issue = Readiness::GitLab::Issues.new
|
25
|
+
issue.title = 'Gratis Support Extension Request'
|
26
|
+
issue.description = message
|
27
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
28
|
+
puts "Issue created: #{create.web_url}"
|
29
|
+
exit 0
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Sets the global variable errors
|
34
|
+
#
|
35
|
+
# @author Jason Colyer
|
36
|
+
# @since 1.0.42
|
37
|
+
def self.errors
|
38
|
+
@errors ||= []
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Perform the checks for this request
|
43
|
+
#
|
44
|
+
# @author Jason Colyer
|
45
|
+
# @since 1.0.42
|
46
|
+
def self.checks
|
47
|
+
errors.push('Invalid previous issue given') if issue.is_a? Hash
|
48
|
+
errors.push('Invalid SFDC account given') if sfdc_account.nil?
|
49
|
+
errors.push('Invalid manager handle given') if manager.nil?
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Sets the global variable requester
|
54
|
+
#
|
55
|
+
# @author Jason Colyer
|
56
|
+
# @since 1.0.42
|
57
|
+
def self.requester
|
58
|
+
@requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.manager
|
62
|
+
@manager ||= Readiness::GitLab::Users.search_by_username(@gitlab_admin_client, manager_handle).detect { |a| a.username == 'manager_handle' }
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Sets the global variable requester_email
|
67
|
+
#
|
68
|
+
# @author Jason Colyer
|
69
|
+
# @since 1.0.42
|
70
|
+
def self.requester_email
|
71
|
+
@requester_email ||= ENV.fetch('REQUESTER_EMAIL')
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Sets the global variable project
|
76
|
+
#
|
77
|
+
# @author Jason Colyer
|
78
|
+
# @since 1.0.42
|
79
|
+
def self.project
|
80
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526)
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Sets the global variable manager_handle
|
85
|
+
#
|
86
|
+
# @author Jason Colyer
|
87
|
+
# @since 1.0.42
|
88
|
+
def self.manager_handle
|
89
|
+
@manager_handle ||= ENV.fetch('GRATUS_SUPPORT_APPROVING_MANAGER')
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Sets the global variable sfdc_account_id
|
94
|
+
#
|
95
|
+
# @author Jason Colyer
|
96
|
+
# @since 1.0.42
|
97
|
+
def self.sfdc_account_id
|
98
|
+
@sfdc_account_id ||= determine_sfdc_account_id
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Determines the SFDC Account ID based off of the link given
|
103
|
+
#
|
104
|
+
# @author Jason Colyer
|
105
|
+
# @since 1.0.42
|
106
|
+
def self.determine_sfdc_account_id
|
107
|
+
link = ENV.fetch('GRATUS_SUPPORT_SFDC_ACCOUNT')
|
108
|
+
return link.split('/')[-2] if link =~ /lightning/
|
109
|
+
|
110
|
+
link.split('/').last
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Sets the global variable sfdc_account
|
115
|
+
#
|
116
|
+
# @author Jason Colyer
|
117
|
+
# @since 1.0.42
|
118
|
+
def self.sfdc_account
|
119
|
+
@sfdc_account ||= fetch_sfdc_account
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Gets the SFDC Account information
|
124
|
+
#
|
125
|
+
# @author Jason Colyer
|
126
|
+
# @since 1.0.42
|
127
|
+
def self.fetch_sfdc_account
|
128
|
+
query = Readiness::Salesforce::Queries.new(account_query)
|
129
|
+
results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
|
130
|
+
results.first
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# Sets the global variable issue_link
|
135
|
+
#
|
136
|
+
# @author Jason Colyer
|
137
|
+
# @since 1.0.42
|
138
|
+
def self.issue_link
|
139
|
+
@issue_link ||= ENV.fetch('GRATIS_SUPPORT_PREVIOUS_ISSUE')
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# Sets the global variable issue
|
144
|
+
#
|
145
|
+
# @author Jason Colyer
|
146
|
+
# @since 1.0.42
|
147
|
+
def self.issue
|
148
|
+
@issue ||= Readiness::GitLab::Issues.find(@gitlab_client, project, issue_link.split('/').last)
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# Sets the global variable justification
|
153
|
+
#
|
154
|
+
# @author Jason Colyer
|
155
|
+
# @since 1.0.42
|
156
|
+
def self.justification
|
157
|
+
@justification ||= ENV.fetch('GRATUS_SUPPORT_JUSTIFICATION')
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Returns a SOQL query string to get Account info
|
162
|
+
#
|
163
|
+
# @author Jason Colyer
|
164
|
+
# @since 1.0.42
|
165
|
+
def self.account_query
|
166
|
+
<<~STRING
|
167
|
+
SELECT
|
168
|
+
Account.Account_ID_18__c,
|
169
|
+
Account.Name,
|
170
|
+
Account.Type
|
171
|
+
FROM Account
|
172
|
+
WHERE
|
173
|
+
Account.Account_ID_18__c = '#{sfdc_account_id}'
|
174
|
+
STRING
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Returns a string for the errors block
|
179
|
+
#
|
180
|
+
# @author Jason Colyer
|
181
|
+
# @since 1.0.42
|
182
|
+
def self.errors_block
|
183
|
+
return '' if errors.count.zero?
|
184
|
+
|
185
|
+
<<~STRING
|
186
|
+
## Attention @jcolyer and @#{requester.username}
|
187
|
+
|
188
|
+
The following problems were detected in the form submission:
|
189
|
+
|
190
|
+
#{errors.map { |e| "- #{e}" }.join("\n")}
|
191
|
+
|
192
|
+
These will need to be corrected to proceed. Please communicate via issue comments to work this out.
|
193
|
+
STRING
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# Returns a string for the issue body
|
198
|
+
#
|
199
|
+
# @author Jason Colyer
|
200
|
+
# @since 1.0.42
|
201
|
+
def self.message
|
202
|
+
<<~STRING
|
203
|
+
## Gratis Support Extension Request
|
204
|
+
|
205
|
+
- Requester: @#{requester.username}
|
206
|
+
- Approver: @#{manager.nil? ? manager_handle : manager.username}
|
207
|
+
- SFDC Account: #{sfdc_account.nil? ? sfdc_account_id : sfdc_account.Account_ID_18__c}
|
208
|
+
- Previous Gratis Support issue: #{issue.is_a?(Hash) ? issue_link : issue.web_url}
|
209
|
+
- Justification:
|
210
|
+
|
211
|
+
```
|
212
|
+
#{justification}
|
213
|
+
```
|
214
|
+
|
215
|
+
#{errors_block}
|
216
|
+
|
217
|
+
## @#{requester.username} TODO
|
218
|
+
|
219
|
+
- [ ] Look over the issue and confirm all data is correct
|
220
|
+
- [ ] Work with the approver on their TODO section
|
221
|
+
|
222
|
+
## @#{manager.nil? ? manager_handle : manager.username} TODO
|
223
|
+
|
224
|
+
- [ ] Review the request and check this box to approve the request
|
225
|
+
- If you are not approving it, please add a comment explaining why and close the issue.
|
226
|
+
- [ ] Add a comment signaling your approval (this let's the assignees know the issue is ready to proceed).
|
227
|
+
- Please note your comment must explicitly say that you approve this request. If that is not explict, you may be asked to state the approval explicitly.
|
228
|
+
|
229
|
+
## Support Readiness TODO
|
230
|
+
|
231
|
+
- [ ] Review the above information for accuracy
|
232
|
+
- [ ] Review [our documentation](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/gratis_support/#extensions) for this and ensure it passes all required checks/validations
|
233
|
+
- [ ] Ensure the approver has checked the above box to signal approval
|
234
|
+
- [ ] Implement this as per [our documentation](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/gratis_support/#extensions)
|
235
|
+
|
236
|
+
/assign @jcolyer
|
237
|
+
|
238
|
+
/cc @#{requester.username} @#{manager.nil? ? manager_handle : manager.username}
|
239
|
+
|
240
|
+
/label ~"Readiness Priority::Current Quarter" ~"Readiness::Consulting" ~"Zendesk::Global" ~"Support-Ops-Category::Orgs and Users" ~"Gratis Support Request::Extension"
|
241
|
+
|
242
|
+
/due in 72 hours
|
243
|
+
STRING
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|