forked from cortexapps/terraform-provider-cortex
/
catalog_entity_resource.go
1239 lines (1195 loc) · 45.4 KB
/
catalog_entity_resource.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
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package provider
import (
"context"
"fmt"
"github.com/bigcommerce/terraform-provider-cortex/internal/cortex"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)
// Ensure provider defined types fully satisfy framework interfaces.
var _ resource.Resource = &CatalogEntityResource{}
var _ resource.ResourceWithImportState = &CatalogEntityResource{}
func NewCatalogEntityResource() resource.Resource {
return &CatalogEntityResource{}
}
func NewCatalogEntityResourceModel() CatalogEntityResourceModel {
return CatalogEntityResourceModel{}
}
/***********************************************************************************************************************
* Types
**********************************************************************************************************************/
// CatalogEntityResource defines the resource implementation.
type CatalogEntityResource struct {
client *cortex.HttpClient
}
func (r *CatalogEntityResource) toUpsertRequest(ctx context.Context, diagnostics *diag.Diagnostics, data *CatalogEntityResourceModel) cortex.UpsertCatalogEntityRequest {
return cortex.UpsertCatalogEntityRequest{
Info: data.ToApiModel(ctx, diagnostics),
}
}
/***********************************************************************************************************************
* Methods
**********************************************************************************************************************/
func (r *CatalogEntityResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_catalog_entity"
}
func (r *CatalogEntityResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
MarkdownDescription: "Catalog Entity",
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "Human-readable name for the entity",
Required: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "Description of the entity visible in the Service or Resource Catalog. Markdown is supported.",
Optional: true,
},
"tag": schema.StringAttribute{
MarkdownDescription: "Unique identifier for the entity. Corresponds to the x-cortex-tag field in the entity descriptor.",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"type": schema.StringAttribute{
MarkdownDescription: "Set when the entity is a Resource or Team. This must match a tag of a valid Resource Definition or be \"team\" or \"domain\".",
Optional: true,
},
"definition": schema.StringAttribute{
MarkdownDescription: "Set when the entity is a Resource. These are the properties defined by the Resource Definition, in JSON format in a string (use the `jsonencode` function to convert a JSON object to a string).",
Optional: true,
},
// Optional attributes
"owners": schema.ListNestedAttribute{
MarkdownDescription: "List of owners for the entity. Owners can be users, groups, or Slack channels.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
MarkdownDescription: "Type of owner. Valid values are `EMAIL`, `GROUP`, `OKTA`, or `SLACK`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("EMAIL", "GROUP", "OKTA", "SLACK"),
},
},
"name": schema.StringAttribute{
MarkdownDescription: "Name of the owner. Only required for `user` or `group` types.",
Optional: true,
},
"email": schema.StringAttribute{
MarkdownDescription: "Email of the owner. Only allowed if `type` is `user`.",
Optional: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "Description of the owner. Optional.",
Optional: true,
},
"provider": schema.StringAttribute{
MarkdownDescription: "Provider of the owner. Only allowed if `type` is `group`.",
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("ACTIVE_DIRECTORY", "BAMBOO_HR", "CORTEX", "GITHUB", "GOOGLE", "OKTA", "OPSGENIE", "WORKDAY"),
},
},
"channel": schema.StringAttribute{
MarkdownDescription: "Channel of the owner. Only allowed if `type` is `slack`. Omit the #.",
Optional: true,
},
"notifications_enabled": schema.BoolAttribute{
MarkdownDescription: "Whether Slack notifications are enabled for all owners of this service. Only allowed if `type` is `slack`.",
Optional: true,
},
},
},
},
"children": schema.ListNestedAttribute{
MarkdownDescription: "List of child entities for the entity. Only used for entities of type `TEAM` or `DOMAIN`.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"tag": schema.StringAttribute{
MarkdownDescription: "Tag of the child entity.",
Required: true,
},
},
},
},
"domain_parents": schema.ListNestedAttribute{
MarkdownDescription: "List of parent domains for the entity. The list of parents can only be entities of type `DOMAIN`.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"tag": schema.StringAttribute{
MarkdownDescription: "Tag of the parent domain.",
Required: true,
},
},
},
},
"groups": schema.ListAttribute{
MarkdownDescription: "List of groups related to the entity.",
Optional: true,
ElementType: types.StringType,
},
"links": schema.ListNestedAttribute{
MarkdownDescription: "List of links related to the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "Name of the link.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "Type of the link. Valid values are `runbook`, `documentation`, `logs`, `dashboard`, `metrics`, `healthcheck`, `OPENAPI`, `ASYNC_API`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("runbook", "documentation", "logs", "dashboard", "metrics", "healthcheck", "OPENAPI", "ASYNC_API"),
},
},
"url": schema.StringAttribute{
MarkdownDescription: "URL of the link.",
Required: true,
},
},
},
},
"ignore_metadata": schema.BoolAttribute{
MarkdownDescription: "Whether the entity's custom metadata is managed by Terraform. Defaults to `false`. If set to `true`, the provider will ignore any metadata on the Entity and not persist it to state.",
Optional: true,
},
"metadata": schema.StringAttribute{
MarkdownDescription: "Custom metadata for the entity, in JSON format in a string. (Use the `jsonencode` function to convert a JSON object to a string.)",
Optional: true,
},
"dependencies": schema.ListNestedAttribute{
MarkdownDescription: "List of dependencies for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"tag": schema.StringAttribute{
MarkdownDescription: "Tag of the dependency.",
Required: true,
},
"method": schema.StringAttribute{
MarkdownDescription: "HTTP method if depending on a specific endpoint.",
Optional: true,
},
"path": schema.StringAttribute{
MarkdownDescription: "The actual endpoint this dependency refers to.",
Optional: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "Description of the dependency.",
Optional: true,
},
"metadata": schema.StringAttribute{
MarkdownDescription: "Custom metadata for the dependency, in JSON format in a string. (Use the `jsonencode` function to convert a JSON object to a string.)",
Optional: true,
},
},
},
},
"alerts": schema.ListNestedAttribute{
MarkdownDescription: "List of alerts for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
MarkdownDescription: "Type of alert. Valid values are `opsgenie`",
Required: true,
},
"tag": schema.StringAttribute{
MarkdownDescription: "Tag of the alert.",
Required: true,
},
"value": schema.StringAttribute{
MarkdownDescription: "Value of the alert.",
Optional: true,
},
},
},
},
"git": schema.SingleNestedAttribute{
MarkdownDescription: "Git configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"github": schema.SingleNestedAttribute{
MarkdownDescription: "GitHub configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"repository": schema.StringAttribute{
MarkdownDescription: "GitHub repository for the entity.",
Required: true,
},
"base_path": schema.StringAttribute{
MarkdownDescription: "Base path if not /",
Optional: true,
},
},
},
"gitlab": schema.SingleNestedAttribute{
MarkdownDescription: "GitLab configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"repository": schema.StringAttribute{
MarkdownDescription: "GitLab repository for the entity.",
Required: true,
},
"base_path": schema.StringAttribute{
MarkdownDescription: "Base path if not /",
Optional: true,
},
},
},
"azure": schema.SingleNestedAttribute{
MarkdownDescription: "Azure configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"project": schema.StringAttribute{
MarkdownDescription: "Azure project for the entity.",
Required: true,
},
"repository": schema.StringAttribute{
MarkdownDescription: "Azure repository for the entity.",
Required: true,
},
"base_path": schema.StringAttribute{
MarkdownDescription: "Base path if not /",
Optional: true,
},
},
},
"bitbucket": schema.SingleNestedAttribute{
MarkdownDescription: "BitBucket configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"repository": schema.StringAttribute{
MarkdownDescription: "BitBucket repository for the entity.",
Required: true,
},
},
},
},
},
"issues": schema.SingleNestedAttribute{
MarkdownDescription: "Issue tracking configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"jira": schema.SingleNestedAttribute{
MarkdownDescription: "Jira configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"default_jql": schema.StringAttribute{
MarkdownDescription: "Default JQL to surface issues for the entity.",
Optional: true,
},
"projects": schema.ListAttribute{
MarkdownDescription: "List of Jira projects for the entity.",
Optional: true,
ElementType: types.StringType,
},
"components": schema.ListAttribute{
MarkdownDescription: "List of Jira components for the entity.",
Optional: true,
ElementType: types.StringType,
},
"labels": schema.ListAttribute{
MarkdownDescription: "List of Jira labels for the entity.",
Optional: true,
ElementType: types.StringType,
},
},
},
},
},
"on_call": schema.SingleNestedAttribute{
MarkdownDescription: "On-call configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"pager_duty": schema.SingleNestedAttribute{
MarkdownDescription: "PagerDuty configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "PagerDuty Service, Schedule, or Escalation Policy ID.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "Type. Valid values are `SERVICE`, `SCHEDULE`, or `ESCALATION_POLICY`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SERVICE", "SCHEDULE", "ESCALATION_POLICY"),
},
},
},
},
"ops_genie": schema.SingleNestedAttribute{
MarkdownDescription: "OpsGenie configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "OpsGenie Schedule ID.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "Type. Valid values are `SCHEDULE`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SCHEDULE"),
},
},
},
},
"victor_ops": schema.SingleNestedAttribute{
MarkdownDescription: "VictorOps configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "VictorOps Schedule ID.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "Type. Valid values are `SCHEDULE`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SCHEDULE"),
},
},
},
},
"xmatters": schema.SingleNestedAttribute{
MarkdownDescription: "XMatters configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "XMatters Group Name.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "Type. Valid values are `SERVICE`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SERVICE"),
},
},
},
},
},
},
"apm": schema.SingleNestedAttribute{
MarkdownDescription: "APM configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"data_dog": schema.SingleNestedAttribute{
MarkdownDescription: "DataDog configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"monitors": schema.ListAttribute{
MarkdownDescription: "List of DataDog monitors for the entity.",
Optional: true,
ElementType: types.Int64Type,
},
},
},
"dynatrace": schema.SingleNestedAttribute{
MarkdownDescription: "Dynatrace configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"entity_ids": schema.ListAttribute{
MarkdownDescription: "List of Dynatrace entity IDs for the entity.",
Optional: true,
ElementType: types.StringType,
},
"entity_name_matchers": schema.ListAttribute{
MarkdownDescription: "List of Dynatrace entity name matchers for the entity.",
Optional: true,
ElementType: types.StringType,
},
},
},
"new_relic": schema.ListNestedAttribute{
MarkdownDescription: "NewRelic configurations for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"application_id": schema.Int64Attribute{
MarkdownDescription: "NewRelic application ID for the entity.",
Optional: true,
},
"alias": schema.StringAttribute{
MarkdownDescription: "Alias for the service. Only used if opted into multi-account support in New Relic.",
Optional: true,
},
},
},
},
},
},
"dashboards": schema.SingleNestedAttribute{
MarkdownDescription: "Dashboards configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"embeds": schema.ListNestedAttribute{
MarkdownDescription: "List of dashboard embeds for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"type": schema.StringAttribute{
MarkdownDescription: "Type of embed. Valid values are `grafana`, `datadog` or `newrelic`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("grafana", "datadog", "newrelic"),
},
},
"url": schema.StringAttribute{
MarkdownDescription: "URL of the embed.",
Required: true,
},
},
},
},
},
},
"slos": schema.SingleNestedAttribute{
MarkdownDescription: "Service-level Objectives configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"data_dog": schema.ListNestedAttribute{
MarkdownDescription: "DataDog SLO configuration for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "DataDog SLO ID.",
Required: true,
},
},
},
},
"dynatrace": schema.ListNestedAttribute{
MarkdownDescription: "Dynatrace SLO configuration for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "Dynatrace SLO ID.",
Required: true,
},
},
},
},
"lightstep": schema.SingleNestedAttribute{
MarkdownDescription: "Lightstep SLO configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"streams": schema.ListNestedAttribute{
MarkdownDescription: "List of Lightstep streams for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"stream_id": schema.StringAttribute{
MarkdownDescription: "Lightstep stream ID.",
Required: true,
},
"targets": schema.SingleNestedAttribute{
MarkdownDescription: "List of target latencies and error rates for the stream.",
Optional: true,
Attributes: map[string]schema.Attribute{
"latencies": schema.ListNestedAttribute{
MarkdownDescription: "List of latency targets for the stream.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"percentile": schema.Float64Attribute{
MarkdownDescription: "Percentile latency for your given streamId, out of 1.",
Required: true,
},
"target": schema.Int64Attribute{
MarkdownDescription: "Target latency, in ms.",
Required: true,
},
"slo": schema.Float64Attribute{
MarkdownDescription: "SLO percentile, out of 1.",
Required: true,
},
},
},
},
},
},
},
},
},
},
},
"prometheus": schema.ListNestedAttribute{
MarkdownDescription: "Prometheus SLO configuration for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"error_query": schema.StringAttribute{
MarkdownDescription: "Query that indicates error events for your metric.",
Required: true,
},
"total_query": schema.StringAttribute{
MarkdownDescription: "Query that indicates all events to be considered for your metric.",
Required: true,
},
"slo": schema.Float64Attribute{
MarkdownDescription: "Target number for SLO.",
Required: true,
},
"alias": schema.StringAttribute{
MarkdownDescription: "Ties the SLO registration to a Prometheus instance listed under Settings → Prometheus. The alias parameter is optional, but if not provided the SLO will use the default configuration under Settings → Prometheus.",
Optional: true,
},
"name": schema.StringAttribute{
MarkdownDescription: "The SLO's name in Prometheus. The name parameter is optional.",
Optional: true,
},
},
},
},
"signal_fx": schema.ListNestedAttribute{
MarkdownDescription: "SignalFx SLO configuration for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"query": schema.StringAttribute{
MarkdownDescription: "Elasticsearch query for your metric. Filter by metric with `sf_metric` and add additional dimensions to narrow the search. Queries resulting in multiple datasets will be rolled up according to `rollup`.",
Required: true,
},
"rollup": schema.StringAttribute{
MarkdownDescription: "SUM or AVERAGE.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SUM", "AVERAGE"),
},
},
"target": schema.Int64Attribute{
MarkdownDescription: "Target number for SLO.",
Required: true,
},
"lookback": schema.StringAttribute{
MarkdownDescription: "ISO-8601 duration `(P[n]Y[n]M[n]DT[n]H[n]M[n]S)`.",
Required: true,
},
"operation": schema.StringAttribute{
MarkdownDescription: "> / < / = / <=, >=.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf(">", "<", "=", "<=", ">="),
},
},
},
},
},
"sumo_logic": schema.ListNestedAttribute{
MarkdownDescription: "SumoLogic SLO configuration for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "SumoLogic SLO ID.",
Required: true,
},
},
},
},
},
},
"static_analysis": schema.SingleNestedAttribute{
MarkdownDescription: "Static analysis configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"code_cov": schema.SingleNestedAttribute{
MarkdownDescription: "Code coverage configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"repository": schema.StringAttribute{
MarkdownDescription: "Git repository, in `organization/repository` format.",
Required: true,
},
"provider": schema.StringAttribute{
MarkdownDescription: "Git provider. One of: `GITHUB`, `GITLAB`, or `BITBUCKET`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("GITHUB", "GITLAB", "BITBUCKET"),
},
},
"owner": schema.StringAttribute{
MarkdownDescription: "Username from service provider (optional).",
Optional: true,
},
"flag": schema.StringAttribute{
MarkdownDescription: "Pulls from isolated & categorized coverage reports (optional).",
Optional: true,
},
},
},
"mend": schema.SingleNestedAttribute{
MarkdownDescription: "Mend static analysis configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"application_ids": schema.ListAttribute{
MarkdownDescription: "Mend application IDs, found in the Mend SAST web interface.",
Optional: true,
ElementType: types.StringType,
},
"project_ids": schema.ListAttribute{
MarkdownDescription: "Mend project IDs, found in the Mend SCA web interface.",
Optional: true,
ElementType: types.StringType,
},
},
},
"sonar_qube": schema.SingleNestedAttribute{
MarkdownDescription: "SonarQube static analysis configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"project": schema.StringAttribute{
MarkdownDescription: "SonarQube project key.",
Required: true,
},
"alias": schema.StringAttribute{
MarkdownDescription: "Ties the SonarQube registration to a SonarQube instance listed under Settings → SonarQube. The alias parameter is optional, but if not provided the SonarQube registration will use the default configuration under Settings → SonarQube.",
Optional: true,
},
},
},
"veracode": schema.SingleNestedAttribute{
MarkdownDescription: "Veracode static analysis configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"application_names": schema.ListAttribute{
MarkdownDescription: "Veracode application names.",
Optional: true,
ElementType: types.StringType,
},
"sandboxes": schema.ListNestedAttribute{
MarkdownDescription: "Veracode sandboxes.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"application_name": schema.StringAttribute{
MarkdownDescription: "Veracode application name.",
Required: true,
},
"sandbox_name": schema.StringAttribute{
MarkdownDescription: "Veracode sandbox name.",
Required: true,
},
},
},
},
},
},
},
},
"ci_cd": schema.SingleNestedAttribute{
MarkdownDescription: "CI/CD configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"buildkite": schema.SingleNestedAttribute{
MarkdownDescription: "Buildkite CI/CD configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"pipelines": schema.SetNestedAttribute{
MarkdownDescription: "Buildkite pipelines.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"slug": schema.StringAttribute{
MarkdownDescription: "Buildkite pipeline slug.",
Required: true,
},
},
},
},
"tags": schema.SetNestedAttribute{
MarkdownDescription: "Buildkite pipelines.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"tag": schema.StringAttribute{
MarkdownDescription: "Buildkite tag.",
Required: true,
},
},
},
},
},
},
},
},
"bug_snag": schema.SingleNestedAttribute{
MarkdownDescription: "BugSnag configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"project": schema.StringAttribute{
MarkdownDescription: "BugSnag project ID for the entity.",
Required: true,
},
},
},
"checkmarx": schema.SingleNestedAttribute{
MarkdownDescription: "Checkmarx configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"projects": schema.ListNestedAttribute{
MarkdownDescription: "List of Checkmarx projects for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
MarkdownDescription: "Checkmarx project ID. Required if Name is not set.",
Optional: true,
},
"name": schema.StringAttribute{
MarkdownDescription: "Checkmarx project name. Required if ID is not set.",
Optional: true,
},
},
},
},
},
},
"coralogix": schema.SingleNestedAttribute{
MarkdownDescription: "Coralogix configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"applications": schema.ListNestedAttribute{
MarkdownDescription: "List of Coralogix applications for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "Coralogix application Name.",
Required: true,
},
"alias": schema.StringAttribute{
MarkdownDescription: "Alias is optional and only relevant if you have opted into multi account support.",
Optional: true,
},
},
},
},
},
},
"firehydrant": schema.SingleNestedAttribute{
MarkdownDescription: "FireHydrant configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"services": schema.ListNestedAttribute{
MarkdownDescription: "List of FireHydrant services for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "FireHydrant service identifier. Either the ID or the Slug, based on the value of Type below.",
Required: true,
},
"type": schema.StringAttribute{
MarkdownDescription: "FireHydrant service identifier type. Either `ID` or `SLUG`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("ID", "SLUG"),
},
},
},
},
},
},
},
"k8s": schema.SingleNestedAttribute{
MarkdownDescription: "Kubernetes configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"deployments": schema.ListNestedAttribute{
MarkdownDescription: "List of K8s deployment configurations for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"identifier": schema.StringAttribute{
MarkdownDescription: "Deployment identifier. `namespace/name` as found in Kubernetes.",
Required: true,
},
"cluster": schema.StringAttribute{
MarkdownDescription: "Optional. Kubernetes cluster name.",
Optional: true,
},
},
},
},
"argo_rollouts": schema.ListNestedAttribute{
MarkdownDescription: "List of K8s argo rollout configurations for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"identifier": schema.StringAttribute{
MarkdownDescription: "Argo Rollout identifier. `namespace/name` as found in Kubernetes.",
Required: true,
},
"cluster": schema.StringAttribute{
MarkdownDescription: "Optional. Kubernetes cluster name.",
Optional: true,
},
},
},
},
"stateful_sets": schema.ListNestedAttribute{
MarkdownDescription: "List of K8s stateful set configurations for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"identifier": schema.StringAttribute{
MarkdownDescription: "Stateful Set identifier. `namespace/name` as found in Kubernetes.",
Required: true,
},
"cluster": schema.StringAttribute{
MarkdownDescription: "Optional. Kubernetes cluster name.",
Optional: true,
},
},
},
},
"cron_jobs": schema.ListNestedAttribute{
MarkdownDescription: "List of K8s cron job configurations for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"identifier": schema.StringAttribute{
MarkdownDescription: "Cron Job identifier. `namespace/name` as found in Kubernetes.",
Required: true,
},
"cluster": schema.StringAttribute{
MarkdownDescription: "Optional. Kubernetes cluster name.",
Optional: true,
},
},
},
},
},
},
"microsoft_teams": schema.ListNestedAttribute{
MarkdownDescription: "List of Microsoft Teams channels for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "Exact match name of the channel.",
Required: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "Description of the channel.",
Optional: true,
},
"notifications_enabled": schema.BoolAttribute{
MarkdownDescription: "Whether the channel should receive notifications.",
Optional: true,
},
},
},
},
"rollbar": schema.SingleNestedAttribute{
MarkdownDescription: "Rollbar configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"project": schema.StringAttribute{
MarkdownDescription: "Rollbar project ID for the entity.",
Required: true,
},
},
},
"sentry": schema.SingleNestedAttribute{
MarkdownDescription: "Sentry configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"project": schema.StringAttribute{
MarkdownDescription: "Sentry project ID for the entity.",
Required: true,
},
},
},
"service_now": schema.SingleNestedAttribute{
MarkdownDescription: "ServiceNow configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"services": schema.ListNestedAttribute{
MarkdownDescription: "List of ServiceNow services for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
MarkdownDescription: "ServiceNow service ID.",
Optional: true,
},
"table_name": schema.StringAttribute{
MarkdownDescription: "ServiceNow table name.",
Optional: true,
},
},
},
},
},
},
"slack": schema.SingleNestedAttribute{
MarkdownDescription: "Slack configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"channels": schema.SetNestedAttribute{
MarkdownDescription: "List of Slack channels for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "Slack channel name.",
Required: true,
},
"notifications_enabled": schema.BoolAttribute{
MarkdownDescription: "Whether the slack channel should receive notifications.",
Optional: true,
},
},
},
},
},
},
"snyk": schema.SingleNestedAttribute{
MarkdownDescription: "Snyk configuration for the entity.",
Optional: true,
Attributes: map[string]schema.Attribute{
"projects": schema.ListNestedAttribute{
MarkdownDescription: "List of Snyk projects for the entity.",
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"organization": schema.StringAttribute{
MarkdownDescription: "Snyk organization ID.",
Required: true,
},
"project_id": schema.StringAttribute{
MarkdownDescription: "Snyk project ID.",
Required: true,
},
"source": schema.StringAttribute{
MarkdownDescription: "Type of Snyk product. Valid values are `CODE` or `OPEN_SOURCE`.",
Required: true,
Validators: []validator.String{