gitlab_support_readiness 1.0.96 → 1.0.98

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 754610e153f321d1eadcbd227ef10672ba943d7432cc8c3604d7a82553cf0777
4
- data.tar.gz: 06d952982516a7dd04590b2c0217518e052d9d10989a8a5aa229e915d300c3fb
3
+ metadata.gz: e486d9f6b43546f5073304d53ef0c734283094c406ed2404caf05668d0571ab1
4
+ data.tar.gz: 1cd5d00382324ceaf28d8f919eeb522e46ba1c0782aa6cb6fb1ac16630516609
5
5
  SHA512:
6
- metadata.gz: 83274d91d5ab5c61ad276e26afed4b3f8b4cdccc9bd29ef7105978b8a3533efc690ade271bf88af70a4a72a77e6781baf39c7b3d18afc6cd551ea81051f1065a
7
- data.tar.gz: bd40779668abdcd1658cca7d7bd57edbcb8322767e5b51d4d61eda7617145cd8e1e7a964a2507571f1de41d09a57b93c3cff45823c265b19aaad9b69bb081804
6
+ metadata.gz: 0fa52abd690bce0672c7a30685ddfac93053c784345b90ae73c3fa136827cddbe4e87ee31066fc38a1d6ff33c0e8ec2fa9872c156d6cde59fd41f80c2a43530b
7
+ data.tar.gz: fcbf5633e740a1dcc1c4a3aa730a954ce0e3ddde3fe738cbe9546ef5549c2f1140b21c25863972a1e1b7a0955a7e3070702f4c38564619c69b0b3f0dbafde488
@@ -182,7 +182,7 @@ module Readiness
182
182
  if c['field'] =~ /Field\:\ /
183
183
  name = c['field'].split('Field: ').last
184
184
  ticket_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, name, @ticket_fields)
185
- trigger['conditions'][type][i]['value'] = "custom_fields_#{ticket_field.id}"
185
+ trigger['conditions'][type][i]['field'] = "custom_fields_#{ticket_field.id}"
186
186
  end
187
187
  if c['value'].to_s =~ /Schedule\:\ /
188
188
  name = c['value'].split('Schedule: ').last
@@ -246,6 +246,7 @@ module Readiness
246
246
  sub_types.push('sub_consumption_cicd_minutes') if SubscriptionDefinitions.consumption_cicd_minutes.include? sub.Name
247
247
  sub_types.push('sub_consumption_duo_premium') if SubscriptionDefinitions.consumption_duo_premium.include? sub.Name
248
248
  sub_types.push('sub_consumption_duo_enterprise') if SubscriptionDefinitions.consumption_duo_enterprise.include? sub.Name
249
+ sub_types.push('sub_consumption_duo_amazon_q') if SubscriptionDefinitions.consumption_duo_amazon_q.include? sub.Name
249
250
  sub_types.push('sub_consumption_eap') if SubscriptionDefinitions.consumption_eap.include? sub.Name
250
251
  sub_types.push('sub_consumption_storage') if SubscriptionDefinitions.consumption_storage.include? sub.Name
251
252
  sub_types.push('sub_proserv') if SubscriptionDefinitions.proserv.include? sub.Name
@@ -0,0 +1,178 @@
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 DisableUSGov within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.97
12
+ class DisableUSGov < Readiness::Client
13
+ ##
14
+ # Process a Disable US Government request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.97
18
+ def self.process!(gitlab_client, gitlab_admin_client, zendesk_client, sfdc_client)
19
+ @gitlab_client = gitlab_client
20
+ @gitlab_admin_client = gitlab_admin_client
21
+ @zendesk_client = zendesk_client
22
+ @sfdc_client = sfdc_client
23
+ requester
24
+ zd_user
25
+ checks
26
+ unless errors.count.zero?
27
+ Readiness::SupportSuperFormProcessor::Shared.invalid_enable_usgov(requester, errors)
28
+ end
29
+ issue = Readiness::GitLab::Issues.new
30
+ issue.title = 'Remove US Government Support exception'
31
+ issue.description = message
32
+ create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
33
+ puts "Issue created: #{create.web_url}"
34
+ exit 0
35
+ end
36
+
37
+ ##
38
+ # Peform validity checks for this request
39
+ #
40
+ # @author Jason Colyer
41
+ # @since 1.0.97
42
+ def self.checks
43
+ errors.push("Invalid SFDC account given: #{account_id}") if account.nil?
44
+ return unless errors.count.zero?
45
+
46
+ errors.push("SFDC account #{account_id} does not have an exception to remove") if account.Support_Instance__c != 'federal-support'
47
+ end
48
+
49
+ ##
50
+ # Sets the global variable errors
51
+ #
52
+ # @author Jason Colyer
53
+ # @since 1.0.97
54
+ def self.errors
55
+ @errors ||= []
56
+ end
57
+
58
+ ##
59
+ # Sets the global variable requester
60
+ #
61
+ # @author Jason Colyer
62
+ # @since 1.0.97
63
+ def self.requester
64
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
65
+ end
66
+
67
+ ##
68
+ # Sets the global variable zd_user
69
+ #
70
+ # @author Jason Colyer
71
+ # @since 1.0.97
72
+ def self.zd_user
73
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
74
+ end
75
+
76
+ ##
77
+ # Sets the global variable requester_email
78
+ #
79
+ # @author Jason Colyer
80
+ # @since 1.0.97
81
+ def self.requester_email
82
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
83
+ end
84
+
85
+ ##
86
+ # Sets the global variable account
87
+ #
88
+ # @author Jason Colyer
89
+ # @since 1.0.97
90
+ def self.account
91
+ @account ||= fetch_account
92
+ end
93
+
94
+ ##
95
+ # Run a SQOL query to get account information
96
+ #
97
+ # @author Jason Colyer
98
+ # @since 1.0.97
99
+ def self.fetch_account
100
+ query = Readiness::Salesforce::Queries.new(account_query)
101
+ results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
102
+ results.first
103
+ end
104
+
105
+ ##
106
+ # Sets the global variable account_id
107
+ #
108
+ # @author Jason Colyer
109
+ # @since 1.0.97
110
+ def self.account_id
111
+ @account_id ||= ENV.fetch('DISABLE_US_GOV_SUPPORT_SFDC_ACCOUNT')
112
+ end
113
+
114
+ ##
115
+ # Returns a String to get account information
116
+ #
117
+ # @author Jason Colyer
118
+ # @since 1.0.97
119
+ def self.account_query
120
+ <<~STRING
121
+ SELECT
122
+ Account_ID_18__c,
123
+ Name,
124
+ Ultimate_Parent_Sales_Segment_Employees__c,
125
+ Account_Owner_Calc__c,
126
+ Technical_Account_Manager_Name__c,
127
+ GS_Health_Score_Color__c,
128
+ Restricted_Account__c,
129
+ Solutions_Architect_Lookup__r.Name,
130
+ Support_Hold__c,
131
+ Support_Instance__c,
132
+ (
133
+ SELECT
134
+ Id,
135
+ Name,
136
+ Zuora__ProductName__c,
137
+ Zuora__EffectiveEndDate__c,
138
+ Zuora__Quantity__c,
139
+ Zuora__TotalContractValue__c,
140
+ Subscription_Status__c
141
+ FROM Zuora__R00N40000001lGjTEAU__r
142
+ )
143
+ FROM Account
144
+ WHERE
145
+ Id = '#{account_id}'
146
+ STRING
147
+ end
148
+
149
+ ##
150
+ # Return the string for the issue body
151
+ #
152
+ # @author Jason Colyer
153
+ # @since 1.0.97
154
+ def self.message
155
+ <<~STRING
156
+ ## Remove US Government Support exception for #{account.Account_ID_18__c}
157
+
158
+ A request has been filed to remove the US Government Support exception for a SFDC account. The details are as follows:
159
+
160
+ - Requester: @#{requester.username}
161
+ - SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.lightning.force.com/lightning/r/Account/#{account.Account_ID_18__c}/view)
162
+
163
+ #### Readiness TODO list
164
+
165
+ - [ ] Review above information for accuracy
166
+ - [ ] Confirm the corresponding organization does not currently have an ongoing tickets
167
+ - [ ] Follow the process detailed in [this handbook page](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/us_gov_support_exceptions)
168
+
169
+ /assign @#{requester.username} @jcolyer @secole @lyle
170
+
171
+ /label ~"Readiness::Triage" "Readiness::Current Quarter"
172
+
173
+ cc @leeeee-gtlb
174
+ STRING
175
+ end
176
+ end
177
+ end
178
+ end
@@ -27,8 +27,8 @@ module Readiness
27
27
  Readiness::SupportSuperFormProcessor::Shared.invalid_enable_usgov(requester, errors)
28
28
  end
29
29
  issue = Readiness::GitLab::Issues.new
30
- issue.title = 'Enable US Government Support'
31
- issue.description = message(file_path)
30
+ issue.title = 'Add US Government Support exception'
31
+ issue.description = message
32
32
  create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
33
33
  puts "Issue created: #{create.web_url}"
34
34
  exit 0
@@ -44,7 +44,7 @@ module Readiness
44
44
  errors.push("Invalid SFDC opportunity given: #{opportunity_id}") if opportunity.nil?
45
45
  return unless errors.count.zero?
46
46
 
47
- errors.push("SFDC account #{account_id} is already entitled") if Readiness::Salesforce::Client.us_gover_enabled?(@sfdc_client, account_id)
47
+ errors.push("SFDC account #{account_id} already has the exception") if account.Support_Instance__c == 'federal-support'
48
48
  errors.push("Missing US Government SKU on #{account_id}") unless correct_sku?
49
49
  end
50
50
 
@@ -54,6 +54,8 @@ module Readiness
54
54
  # @author Jason Colyer
55
55
  # @since 1.0.42
56
56
  def self.correct_sku?
57
+ return false if account.Zuora__R00N40000001lGjTEAU__r.nil?
58
+
57
59
  account.Zuora__R00N40000001lGjTEAU__r.map { |r| r.Name }.each do |name|
58
60
  return true if Readiness::Salesforce::SubscriptionDefinitions.usgov_12x5.include? name
59
61
  return true if Readiness::Salesforce::SubscriptionDefinitions.usgov_24x7.include? name
@@ -172,6 +174,7 @@ module Readiness
172
174
  Restricted_Account__c,
173
175
  Solutions_Architect_Lookup__r.Name,
174
176
  Support_Hold__c,
177
+ Support_Instance__c,
175
178
  (
176
179
  SELECT
177
180
  Id,
@@ -211,9 +214,9 @@ module Readiness
211
214
  # @since 1.0.42
212
215
  def self.message
213
216
  <<~STRING
214
- ## Enable US Government Support for #{account.Account_ID_18__c}
217
+ ## Add US Government Support exception for #{account.Account_ID_18__c}
215
218
 
216
- A request has been filed to enable US Government Support for a SFDC account. The details are as follows:
219
+ A request has been filed to add the US Government Support exception for a SFDC account. The details are as follows:
217
220
 
218
221
  - Requester: @#{requester.username}
219
222
  - SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.lightning.force.com/lightning/r/Account/#{account.Account_ID_18__c}/view)
@@ -224,11 +227,13 @@ module Readiness
224
227
  #### Readiness TODO list
225
228
 
226
229
  - [ ] Review above information
227
- - [ ] Follow the process detailed in [this handbook page](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/enable_us_gov_support)
230
+ - [ ] Follow the process detailed in [this handbook page](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/us_gov_support_exceptions)
228
231
 
229
232
  /assign @#{requester.username} @jcolyer @secole @lyle
230
233
 
231
- cc @jscarborough @JamesRLopes
234
+ /label ~"Readiness::Triage" "Readiness::Current Quarter"
235
+
236
+ cc @jscarborough @leeeee-gtlb
232
237
  STRING
233
238
  end
234
239
  end
@@ -215,7 +215,7 @@ module Readiness
215
215
  email.subject = 'Invalid Support Super Form submission'
216
216
  email.text = invalid_enable_usgov_message(requester, errors)
217
217
  Readiness::Mailgun::Emails.send!(mailgun_client, email)
218
- puts "Invalid enable us gov submission by #{requester.email}"
218
+ puts "Invalid enable/disable us gov submission by #{requester.email}"
219
219
  exit 0
220
220
  end
221
221
 
@@ -485,7 +485,7 @@ module Readiness
485
485
  <<~STRING
486
486
  Greetings @#{requester.username} ,
487
487
 
488
- Your recent request to enable US Goverment support was not able to be filed due to the following issues:
488
+ Your recent request to enable/disable US Goverment support was not able to be filed due to the following issues:
489
489
 
490
490
  #{errors.map { |e| "- #{e}" }.join("\n")}
491
491
 
@@ -12,6 +12,7 @@ module Readiness
12
12
 
13
13
  require "#{__dir__}/support_super_form_processor/create_article"
14
14
  require "#{__dir__}/support_super_form_processor/create_macro"
15
+ require "#{__dir__}/support_super_form_processor/disable_us_government"
15
16
  require "#{__dir__}/support_super_form_processor/edit_macro"
16
17
  require "#{__dir__}/support_super_form_processor/enable_us_government"
17
18
  require "#{__dir__}/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.96
4
+ version: 1.0.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -319,6 +319,7 @@ files:
319
319
  - lib/support_readiness/support_super_form_processor.rb
320
320
  - lib/support_readiness/support_super_form_processor/create_article.rb
321
321
  - lib/support_readiness/support_super_form_processor/create_macro.rb
322
+ - lib/support_readiness/support_super_form_processor/disable_us_government.rb
322
323
  - lib/support_readiness/support_super_form_processor/edit_macro.rb
323
324
  - lib/support_readiness/support_super_form_processor/enable_us_government.rb
324
325
  - lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change.rb