Skip to content

Commit 24fedbf

Browse files
feat: add datasource for report groups [ENG-5559] (#91)
[ENG-5559](https://stacklet.atlassian.net/browse/ENG-5559) ### what Add datasource for notification report groups. ### why allow accessing information about existing report groups. ### testing Local testing in sandbox. It's currently quite hard to add acceptance tests, since the resource is not yet available, but will add direct tests once it is. ### docs updated here [ENG-5559]: https://stacklet.atlassian.net/browse/ENG-5559?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 252cc50 commit 24fedbf

File tree

9 files changed

+1190
-26
lines changed

9 files changed

+1190
-26
lines changed

docs/data-sources/report_group.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stacklet_report_group Data Source - terraform-provider-stacklet"
4+
subcategory: ""
5+
description: |-
6+
Retrieve information about a notification report group by name.
7+
---
8+
9+
# stacklet_report_group (Data Source)
10+
11+
Retrieve information about a notification report group by name.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "stacklet_report_group" "example" {
17+
name = "report-group"
18+
}
19+
```
20+
21+
<!-- schema generated by tfplugindocs -->
22+
## Schema
23+
24+
### Required
25+
26+
- `name` (String) The name for the report group.
27+
28+
### Read-Only
29+
30+
- `bindings` (List of String) List of UUIDs for bindings the report group is for.
31+
- `email_delivery_settings` (Block List) Notifications delivery settings for email. (see [below for nested schema](#nestedblock--email_delivery_settings))
32+
- `enabled` (Boolean) Whether the report group is enabled.
33+
- `group_by` (List of String) Fields on which matching resources are grouped.
34+
- `id` (String) The GraphQL Node ID of the report group.
35+
- `jira_delivery_settings` (Block List) Notifications delivery settings for Jira. (see [below for nested schema](#nestedblock--jira_delivery_settings))
36+
- `schedule` (String) Notification schedule.
37+
- `servicenow_delivery_settings` (Block List) Notifications delivery settings for ServiceNow. (see [below for nested schema](#nestedblock--servicenow_delivery_settings))
38+
- `slack_delivery_settings` (Block List) Notifications delivery settings for Slack. (see [below for nested schema](#nestedblock--slack_delivery_settings))
39+
- `source` (String) Type of the source for the report group.
40+
- `symphony_delivery_settings` (Block List) Notifications delivery settings for Symphony. (see [below for nested schema](#nestedblock--symphony_delivery_settings))
41+
- `teams_delivery_settings` (Block List) Notifications delivery settings for Microsoft Teams. (see [below for nested schema](#nestedblock--teams_delivery_settings))
42+
- `use_message_settings` (Boolean) Whether to use delivery settings from the notification message.
43+
44+
<a id="nestedblock--email_delivery_settings"></a>
45+
### Nested Schema for `email_delivery_settings`
46+
47+
Read-Only:
48+
49+
- `cc` (List of String) List of CC addresses.
50+
- `first_match_only` (Boolean) Only report the first match.
51+
- `format` (String) Email format (html or plain). Autodetected from the template if not specified.
52+
- `from` (String) Email from address.
53+
- `priority` (String) Email priority.
54+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--email_delivery_settings--recipients))
55+
- `subject` (String) Email subject.
56+
- `template` (String) Name of the template for the email.
57+
58+
<a id="nestedatt--email_delivery_settings--recipients"></a>
59+
### Nested Schema for `email_delivery_settings.recipients`
60+
61+
Read-Only:
62+
63+
- `account_owner` (Boolean) Whether to notify the account owner.
64+
- `event_owner` (Boolean) Whether to notify the event owner.
65+
- `resource_owner` (Boolean) Whether to notify the resource owner.
66+
- `tag` (String) Tag to match the resource owner from.
67+
- `value` (String) Explicit value for a notification recipient.
68+
69+
70+
71+
<a id="nestedblock--jira_delivery_settings"></a>
72+
### Nested Schema for `jira_delivery_settings`
73+
74+
Read-Only:
75+
76+
- `description` (String) Ticket description.
77+
- `first_match_only` (Boolean) Only report the first match.
78+
- `project` (String) Jira project key.
79+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--jira_delivery_settings--recipients))
80+
- `summary` (String) Ticket summary.
81+
- `template` (String) Name of the template for the notification.
82+
83+
<a id="nestedatt--jira_delivery_settings--recipients"></a>
84+
### Nested Schema for `jira_delivery_settings.recipients`
85+
86+
Read-Only:
87+
88+
- `account_owner` (Boolean) Whether to notify the account owner.
89+
- `event_owner` (Boolean) Whether to notify the event owner.
90+
- `resource_owner` (Boolean) Whether to notify the resource owner.
91+
- `tag` (String) Tag to match the resource owner from.
92+
- `value` (String) Explicit value for a notification recipient.
93+
94+
95+
96+
<a id="nestedblock--servicenow_delivery_settings"></a>
97+
### Nested Schema for `servicenow_delivery_settings`
98+
99+
Read-Only:
100+
101+
- `first_match_only` (Boolean) Only report the first match.
102+
- `impact` (String) Impact to use for the ticket.
103+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--servicenow_delivery_settings--recipients))
104+
- `short_description` (String) Ticket description.
105+
- `template` (String) Name of the template for the notification.
106+
- `urgency` (String) Ticket urgency.
107+
108+
<a id="nestedatt--servicenow_delivery_settings--recipients"></a>
109+
### Nested Schema for `servicenow_delivery_settings.recipients`
110+
111+
Read-Only:
112+
113+
- `account_owner` (Boolean) Whether to notify the account owner.
114+
- `event_owner` (Boolean) Whether to notify the event owner.
115+
- `resource_owner` (Boolean) Whether to notify the resource owner.
116+
- `tag` (String) Tag to match the resource owner from.
117+
- `value` (String) Explicit value for a notification recipient.
118+
119+
120+
121+
<a id="nestedblock--slack_delivery_settings"></a>
122+
### Nested Schema for `slack_delivery_settings`
123+
124+
Read-Only:
125+
126+
- `first_match_only` (Boolean) Only report the first match.
127+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--slack_delivery_settings--recipients))
128+
- `template` (String) Name of the template for the email.
129+
130+
<a id="nestedatt--slack_delivery_settings--recipients"></a>
131+
### Nested Schema for `slack_delivery_settings.recipients`
132+
133+
Read-Only:
134+
135+
- `account_owner` (Boolean) Whether to notify the account owner.
136+
- `event_owner` (Boolean) Whether to notify the event owner.
137+
- `resource_owner` (Boolean) Whether to notify the resource owner.
138+
- `tag` (String) Tag to match the resource owner from.
139+
- `value` (String) Explicit value for a notification recipient.
140+
141+
142+
143+
<a id="nestedblock--symphony_delivery_settings"></a>
144+
### Nested Schema for `symphony_delivery_settings`
145+
146+
Read-Only:
147+
148+
- `first_match_only` (Boolean) Only report the first match.
149+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--symphony_delivery_settings--recipients))
150+
- `template` (String) Name of the template for the notification.
151+
152+
<a id="nestedatt--symphony_delivery_settings--recipients"></a>
153+
### Nested Schema for `symphony_delivery_settings.recipients`
154+
155+
Read-Only:
156+
157+
- `account_owner` (Boolean) Whether to notify the account owner.
158+
- `event_owner` (Boolean) Whether to notify the event owner.
159+
- `resource_owner` (Boolean) Whether to notify the resource owner.
160+
- `tag` (String) Tag to match the resource owner from.
161+
- `value` (String) Explicit value for a notification recipient.
162+
163+
164+
165+
<a id="nestedblock--teams_delivery_settings"></a>
166+
### Nested Schema for `teams_delivery_settings`
167+
168+
Read-Only:
169+
170+
- `first_match_only` (Boolean) Only report the first match.
171+
- `recipients` (Attributes List) Recipients for the notification. (see [below for nested schema](#nestedatt--teams_delivery_settings--recipients))
172+
- `template` (String) Name of the template for the email.
173+
174+
<a id="nestedatt--teams_delivery_settings--recipients"></a>
175+
### Nested Schema for `teams_delivery_settings.recipients`
176+
177+
Read-Only:
178+
179+
- `account_owner` (Boolean) Whether to notify the account owner.
180+
- `event_owner` (Boolean) Whether to notify the event owner.
181+
- `resource_owner` (Boolean) Whether to notify the resource owner.
182+
- `tag` (String) Tag to match the resource owner from.
183+
- `value` (String) Explicit value for a notification recipient.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "stacklet_report_group" "example" {
2+
name = "report-group"
3+
}

internal/api/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type API struct {
1818
Policy policyAPI
1919
PolicyCollection policyCollectionAPI
2020
PolicyCollectionMapping policyCollectionMappingAPI
21+
ReportGroup reportGroupAPI
2122
Repository repositoryAPI
2223
}
2324

@@ -33,6 +34,7 @@ func New(c *graphql.Client) *API {
3334
Policy: policyAPI{c},
3435
PolicyCollection: policyCollectionAPI{c},
3536
PolicyCollectionMapping: policyCollectionMappingAPI{c},
37+
ReportGroup: reportGroupAPI{c},
3638
Repository: repositoryAPI{c},
3739
}
3840
}

internal/api/enums.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) 2025 - Stacklet, Inc.
2+
3+
package api
4+
5+
// CloudProvider represents a cloud service provider in Stacklet.
6+
type CloudProvider StringEnum
7+
8+
const (
9+
CloudProviderAWS = CloudProvider("AWS")
10+
CloudProviderAzure = CloudProvider("Azure")
11+
CloudProviderGCP = CloudProvider("GCP")
12+
CloudProviderKubernetes = CloudProvider("Kubernetes")
13+
CloudProviderTencentCloud = CloudProvider("TencentCloud")
14+
)
15+
16+
// CLOUD_PROVIDERS is the list of all supported cloud providers.
17+
var CLOUD_PROVIDERS = []CloudProvider{
18+
CloudProviderAWS,
19+
CloudProviderAzure,
20+
CloudProviderGCP,
21+
CloudProviderKubernetes,
22+
CloudProviderTencentCloud,
23+
}
24+
25+
// ReportSource represents a report group source.
26+
type ReportSource StringEnum
27+
28+
const (
29+
ReportSourceBinding = ReportSource("BINDING")
30+
ReportSourceControl = ReportSource("CONTROL")
31+
ReportSourcePolicy = ReportSource("POLICY")
32+
)
33+
34+
// REPORT_SOURCES is the list of all supported report group sources.
35+
var REPORT_SOURCES = []ReportSource{
36+
ReportSourceBinding,
37+
ReportSourceControl,
38+
ReportSourcePolicy,
39+
}

0 commit comments

Comments
 (0)