-
Notifications
You must be signed in to change notification settings - Fork 12
/
check.go
823 lines (697 loc) · 26.7 KB
/
check.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
package opslevel
import (
"fmt"
"github.com/relvacode/iso8601"
)
type CheckOwner struct {
Team TeamId `graphql:"... on Team"`
// User User `graphql:"... on User"` // TODO: will this be public?
}
type Check struct {
Category Category `graphql:"category"`
Description string `graphql:"description"`
Enabled bool `graphql:"enabled"`
EnableOn iso8601.Time `graphql:"enableOn"`
Filter Filter `graphql:"filter"`
Id ID `graphql:"id"`
Level Level `graphql:"level"`
Name string `graphql:"name"`
Notes string `graphql:"notes"`
Owner CheckOwner `graphql:"owner"`
Type CheckType `graphql:"type"`
AlertSourceUsageCheckFragment `graphql:"... on AlertSourceUsageCheck"`
CustomEventCheckFragment `graphql:"... on CustomEventCheck"`
HasRecentDeployCheckFragment `graphql:"... on HasRecentDeployCheck"`
ManualCheckFragment `graphql:"... on ManualCheck"`
RepositoryFileCheckFragment `graphql:"... on RepositoryFileCheck"`
RepositoryGrepCheckFragment `graphql:"... on RepositoryGrepCheck"`
RepositorySearchCheckFragment `graphql:"... on RepositorySearchCheck"`
ServiceOwnershipCheckFragment `graphql:"... on ServiceOwnershipCheck"`
ServicePropertyCheckFragment `graphql:"... on ServicePropertyCheck"`
TagDefinedCheckFragment `graphql:"... on TagDefinedCheck"`
ToolUsageCheckFragment `graphql:"... on ToolUsageCheck"`
HasDocumentationCheckFragment `graphql:"... on HasDocumentationCheck"`
}
type AlertSourceUsageCheckFragment struct {
AlertSourceNamePredicate Predicate `graphql:"alertSourceNamePredicate"`
AlertSourceType AlertSourceTypeEnum `graphql:"alertSourceType"`
}
type CustomEventCheckFragment struct {
Integration IntegrationId `graphql:"integration"`
PassPending bool `graphql:"passPending"`
ResultMessage string `graphql:"resultMessage"`
ServiceSelector string `graphql:"serviceSelector"`
SuccessCondition string `graphql:"successCondition"`
}
type ServiceOwnershipCheckFragment struct {
RequireContactMethod *bool `graphql:"requireContactMethod"`
ContactMethod *ServiceOwnershipCheckContactType `graphql:"contactMethod"`
TeamTagKey string `graphql:"tagKey"`
TeamTagPredicate *Predicate `graphql:"tagPredicate"`
}
type GitBranchProtectionCheckFragment struct {
}
type HasRecentDeployCheckFragment struct {
Days int `graphql:"days"`
}
type HasDocumentationCheckFragment struct {
DocumentType HasDocumentationTypeEnum `graphql:"documentType"`
DocumentSubtype HasDocumentationSubtypeEnum `graphql:"documentSubtype"`
}
type ManualCheckFragment struct {
UpdateFrequency *ManualCheckFrequency `graphql:"updateFrequency"`
UpdateRequiresComment bool `graphql:"updateRequiresComment"`
}
type RepositoryFileCheckFragment struct {
DirectorySearch bool `graphql:"directorySearch"`
Filepaths []string `graphql:"filePaths"`
FileContentsPredicate *Predicate `graphql:"fileContentsPredicate"`
UseAbsoluteRoot bool `graphql:"useAbsoluteRoot"`
}
type RepositoryGrepCheckFragment struct {
DirectorySearch bool `graphql:"directorySearch"`
Filepaths []string `graphql:"filePaths"`
FileContentsPredicate *Predicate `graphql:"fileContentsPredicate"`
}
type RepositorySearchCheckFragment struct {
FileExtensions []string `graphql:"fileExtensions"`
FileContentsPredicate Predicate `graphql:"fileContentsPredicate"`
}
type ServicePropertyCheckFragment struct {
Property ServicePropertyTypeEnum `graphql:"serviceProperty"`
Predicate *Predicate `graphql:"propertyValuePredicate"`
}
type TagDefinedCheckFragment struct {
TagKey string `graphql:"tagKey"`
TagPredicate *Predicate `graphql:"tagPredicate"`
}
type ToolUsageCheckFragment struct {
ToolCategory ToolCategory `graphql:"toolCategory"`
ToolNamePredicate *Predicate `graphql:"toolNamePredicate"`
ToolUrlPredicate *Predicate `graphql:"toolUrlPredicate"`
EnvironmentPredicate *Predicate `graphql:"environmentPredicate"`
}
type CheckConnection struct {
Nodes []Check
PageInfo PageInfo
TotalCount int
}
type CheckCreateInputProvider interface {
GetCheckCreateInput() *CheckCreateInput
}
type CheckCreateInput struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
EnableOn *iso8601.Time `json:"enableOn,omitempty"`
Category ID `json:"categoryId"`
Level ID `json:"levelId"`
Owner *ID `json:"ownerId,omitempty"`
Filter *ID `json:"filterId,omitempty"`
Notes string `json:"notes"`
}
func (c *CheckCreateInput) GetCheckCreateInput() *CheckCreateInput {
return c
}
type CheckUpdateInputProvider interface {
GetCheckUpdateInput() *CheckUpdateInput
}
type CheckUpdateInput struct {
Id ID `json:"id"`
Name string `json:"name,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
EnableOn *iso8601.Time `json:"enableOn,omitempty"`
Category ID `json:"categoryId,omitempty"`
Level ID `json:"levelId,omitempty"`
Owner *ID `json:"ownerId,omitempty"`
Filter *ID `json:"filterId,omitempty"`
Notes *string `json:"notes,omitempty"`
}
func (c *CheckUpdateInput) GetCheckUpdateInput() *CheckUpdateInput {
return c
}
type CheckAlertSourceUsageCreateInput struct {
CheckCreateInput
AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
AlertSourceNamePredicate *PredicateInput `json:"alertSourceNamePredicate,omitempty"`
}
type CheckAlertSourceUsageUpdateInput struct {
CheckUpdateInput
AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
AlertSourceNamePredicate *PredicateUpdateInput `json:"alertSourceNamePredicate,omitempty"`
}
type CheckCustomEventCreateInput struct {
CheckCreateInput
Integration ID `json:"integrationId"`
ServiceSelector string `json:"serviceSelector"`
SuccessCondition string `json:"successCondition"`
Message string `json:"resultMessage,omitempty"`
PassPending *bool `json:"passPending,omitempty"`
}
type CheckCustomEventUpdateInput struct {
CheckUpdateInput
ServiceSelector string `json:"serviceSelector,omitempty"`
SuccessCondition string `json:"successCondition,omitempty"`
Message *string `json:"resultMessage,omitempty"`
PassPending *bool `json:"passPending,omitempty"`
Integration *ID `json:"integrationId,omitempty"`
}
type CheckGitBranchProtectionCreateInput struct {
CheckCreateInput
}
type CheckGitBranchProtectionUpdateInput struct {
CheckUpdateInput
}
type CheckHasDocumentationCreateInput struct {
CheckCreateInput
DocumentType HasDocumentationTypeEnum `json:"documentType"`
DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype"`
}
type CheckHasDocumentationUpdateInput struct {
CheckUpdateInput
DocumentType HasDocumentationTypeEnum `json:"documentType"`
DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype"`
}
type CheckHasRecentDeployCreateInput struct {
CheckCreateInput
Days int `json:"days"`
}
type CheckHasRecentDeployUpdateInput struct {
CheckUpdateInput
Days *int `json:"days,omitempty"`
}
type ManualCheckFrequency struct {
StartingDate iso8601.Time `graphql:"startingDate"`
FrequencyTimeScale FrequencyTimeScale `graphql:"frequencyTimeScale"`
FrequencyValue int `graphql:"frequencyValue"`
}
type ManualCheckFrequencyInput struct {
StartingDate iso8601.Time `json:"startingDate"`
FrequencyTimeScale FrequencyTimeScale `json:"frequencyTimeScale"`
FrequencyValue int `json:"frequencyValue"`
}
func NewManualCheckFrequencyInput(startingDate string, timeScale FrequencyTimeScale, value int) *ManualCheckFrequencyInput {
return &ManualCheckFrequencyInput{
StartingDate: NewISO8601Date(startingDate),
FrequencyTimeScale: timeScale,
FrequencyValue: value,
}
}
type CheckManualCreateInput struct {
CheckCreateInput
UpdateFrequency *ManualCheckFrequencyInput `json:"updateFrequency,omitempty"`
UpdateRequiresComment bool `json:"updateRequiresComment"`
}
type CheckManualUpdateInput struct {
CheckUpdateInput
UpdateFrequency *ManualCheckFrequencyInput `json:"updateFrequency,omitempty"`
UpdateRequiresComment bool `json:"updateRequiresComment,omitempty"`
}
type CheckRepositoryFileCreateInput struct {
CheckCreateInput
DirectorySearch bool `json:"directorySearch"`
Filepaths []string `json:"filePaths"`
FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
UseAbsoluteRoot bool `json:"useAbsoluteRoot"`
}
type CheckRepositoryFileUpdateInput struct {
CheckUpdateInput
DirectorySearch bool `json:"directorySearch"`
Filepaths []string `json:"filePaths,omitempty"`
FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
UseAbsoluteRoot bool `json:"useAbsoluteRoot"`
}
type CheckRepositoryGrepCreateInput struct {
CheckCreateInput
DirectorySearch bool `json:"directorySearch"`
Filepaths []string `json:"filePaths"`
FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}
type CheckRepositoryGrepUpdateInput struct {
CheckUpdateInput
DirectorySearch bool `json:"directorySearch"`
Filepaths []string `json:"filePaths,omitempty"`
FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}
type CheckRepositoryIntegratedCreateInput struct {
CheckCreateInput
}
type CheckRepositoryIntegratedUpdateInput struct {
CheckUpdateInput
}
type CheckRepositorySearchCreateInput struct {
CheckCreateInput
FileExtensions []string `json:"fileExtensions,omitempty"`
FileContentsPredicate PredicateInput `json:"fileContentsPredicate"`
}
type CheckRepositorySearchUpdateInput struct {
CheckUpdateInput
FileExtensions []string `json:"fileExtensions,omitempty"`
FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}
type CheckServiceDependencyCreateInput struct {
CheckCreateInput
}
type CheckServiceDependencyUpdateInput struct {
CheckUpdateInput
}
type CheckServiceConfigurationCreateInput struct {
CheckCreateInput
}
type CheckServiceConfigurationUpdateInput struct {
CheckUpdateInput
}
type CheckServiceOwnershipCreateInput struct {
CheckCreateInput
RequireContactMethod *bool `json:"requireContactMethod,omitempty"`
ContactMethod *ServiceOwnershipCheckContactType `json:"contactMethod,omitempty"`
TeamTagKey string `json:"tagKey,omitempty"`
TeamTagPredicate *PredicateInput `json:"tagPredicate,omitempty"`
}
type CheckServiceOwnershipUpdateInput struct {
CheckUpdateInput
RequireContactMethod *bool `json:"requireContactMethod,omitempty"`
ContactMethod *ServiceOwnershipCheckContactType `json:"contactMethod,omitempty"`
TeamTagKey string `json:"tagKey,omitempty"`
TeamTagPredicate *PredicateUpdateInput `json:"tagPredicate,omitempty"`
}
type CheckServicePropertyCreateInput struct {
CheckCreateInput
Property ServicePropertyTypeEnum `json:"serviceProperty"`
Predicate *PredicateInput `json:"propertyValuePredicate,omitempty"`
}
type CheckServicePropertyUpdateInput struct {
CheckUpdateInput
Property ServicePropertyTypeEnum `json:"serviceProperty,omitempty"`
Predicate *PredicateInput `json:"propertyValuePredicate,omitempty"`
}
type CheckTagDefinedCreateInput struct {
CheckCreateInput
TagKey string `json:"tagKey"`
TagPredicate *PredicateInput `json:"tagPredicate,omitempty"`
}
type CheckTagDefinedUpdateInput struct {
CheckUpdateInput
TagKey string `json:"tagKey,omitempty"`
TagPredicate *PredicateInput `json:"tagPredicate,omitempty"`
}
type CheckToolUsageCreateInput struct {
CheckCreateInput
ToolCategory ToolCategory `json:"toolCategory"`
ToolNamePredicate *PredicateInput `json:"toolNamePredicate,omitempty"`
ToolUrlPredicate *PredicateInput `json:"toolUrlPredicate,omitempty"`
EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}
type CheckToolUsageUpdateInput struct {
CheckUpdateInput
ToolCategory ToolCategory `json:"toolCategory,omitempty"`
ToolNamePredicate *PredicateInput `json:"toolNamePredicate,omitempty"`
ToolUrlPredicate *PredicateInput `json:"toolUrlPredicate,omitempty"`
EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}
type CheckDeleteInput struct {
Id ID `json:"id"`
}
// Encompass CheckCreatePayload and CheckUpdatePayload into 1 struct
type CheckResponsePayload struct {
Check Check
Errors []OpsLevelErrors
}
//#region Create
func (client *Client) CreateCheckAlertSourceUsage(input CheckAlertSourceUsageCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkAlertSourceUsageCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckAlertSourceUsageCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckAlertSourceUsage(input CheckAlertSourceUsageUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkAlertSourceUsageUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckAlertSourceUsageUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckCustomEvent(input CheckCustomEventCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkCustomEventCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckCustomEventCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckCustomEvent(input CheckCustomEventUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkCustomEventUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckCustomEventUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckGitBranchProtection(input CheckGitBranchProtectionCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkGitBranchProtectionCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckGitBranchProtectionCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckGitBranchProtection(input CheckGitBranchProtectionUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkGitBranchProtectionUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckGitBranchProtectionUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckHasRecentDeploy(input CheckHasRecentDeployCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkHasRecentDeployCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckHasRecentDeployCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckHasRecentDeploy(input CheckHasRecentDeployUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkHasRecentDeployUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckHasRecentDeployUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckHasDocumentation(input CheckHasDocumentationCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkHasDocumentationCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckHasDocumentationCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckHasDocumentation(input CheckHasDocumentationUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkHasDocumentationUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckHasDocumentationUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckManual(input CheckManualCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkManualCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckManualCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckManual(input CheckManualUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkManualUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckManualUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckRepositoryFile(input CheckRepositoryFileCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryFileCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryFileCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckRepositoryFile(input CheckRepositoryFileUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryFileUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryFileUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckRepositoryGrep(input CheckRepositoryGrepCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryGrepCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryGrepCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckRepositoryGrep(input CheckRepositoryGrepUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryGrepUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryGrepUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckRepositoryIntegrated(input CheckRepositoryIntegratedCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryIntegratedCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryIntegratedCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckRepositoryIntegrated(input CheckRepositoryIntegratedUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryIntegratedUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryIntegratedUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckRepositorySearch(input CheckRepositorySearchCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositorySearchCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositorySearchCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckRepositorySearch(input CheckRepositorySearchUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositorySearchUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositorySearchUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckServiceDependency(input CheckServiceDependencyCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceDependencyCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceDependencyCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckServiceDependency(input CheckServiceDependencyUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceDependencyUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceDependencyUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckServiceConfiguration(input CheckServiceConfigurationCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceConfigurationCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceConfigurationCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckServiceConfiguration(input CheckServiceConfigurationUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceConfigurationUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceConfigurationUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckServiceOwnership(input CheckServiceOwnershipCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceOwnershipCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceOwnershipCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckServiceOwnership(input CheckServiceOwnershipUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServiceOwnershipUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServiceOwnershipUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckServiceProperty(input CheckServicePropertyCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServicePropertyCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServicePropertyCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckServiceProperty(input CheckServicePropertyUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkServicePropertyUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckServicePropertyUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckTagDefined(input CheckTagDefinedCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkTagDefinedCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckTagDefinedCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckTagDefined(input CheckTagDefinedUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkTagDefinedUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckTagDefinedUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) CreateCheckToolUsage(input CheckToolUsageCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkToolUsageCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckToolUsageCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckToolUsage(input CheckToolUsageUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkToolUsageUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckToolUsageUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
//#endregion
//#region Retrieve
func (client *Client) GetCheck(id ID) (*Check, error) {
var q struct {
Account struct {
Check Check `graphql:"check(id: $id)"`
}
}
v := PayloadVariables{
"id": id,
}
err := client.Query(&q, v, WithName("CheckGet"))
if q.Account.Check.Id == "" {
err = fmt.Errorf("check with ID '%s' not found", id)
}
return &q.Account.Check, HandleErrors(err, nil)
}
func (client *Client) ListChecks(variables *PayloadVariables) (CheckConnection, error) {
var q struct {
Account struct {
Rubric struct {
Checks CheckConnection `graphql:"checks(after: $after, first: $first)"`
}
}
}
if variables == nil {
variables = client.InitialPageVariablesPointer()
}
if err := client.Query(&q, *variables, WithName("CheckList")); err != nil {
return CheckConnection{}, err
}
for q.Account.Rubric.Checks.PageInfo.HasNextPage {
(*variables)["after"] = q.Account.Rubric.Checks.PageInfo.End
resp, err := client.ListChecks(variables)
if err != nil {
return CheckConnection{}, err
}
q.Account.Rubric.Checks.Nodes = append(q.Account.Rubric.Checks.Nodes, resp.Nodes...)
q.Account.Rubric.Checks.PageInfo = resp.PageInfo
q.Account.Rubric.Checks.TotalCount += resp.TotalCount
}
return q.Account.Rubric.Checks, nil
}
//#endregion
//#region Delete
func (client *Client) DeleteCheck(id ID) error {
var m struct {
Payload struct {
Errors []OpsLevelErrors
} `graphql:"checkDelete(input: $input)"`
}
v := PayloadVariables{
"input": CheckDeleteInput{Id: id},
}
err := client.Mutate(&m, v, WithName("CheckDelete"))
return HandleErrors(err, m.Payload.Errors)
}
//#endregion