-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathdata_source_sysdig_monitor_notification_channel_slack.go
More file actions
91 lines (80 loc) · 2.04 KB
/
data_source_sysdig_monitor_notification_channel_slack.go
File metadata and controls
91 lines (80 loc) · 2.04 KB
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
package sysdig
import (
"context"
"strconv"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceSysdigMonitorNotificationChannelSlack() *schema.Resource {
timeout := 5 * time.Minute
return &schema.Resource{
ReadContext: dataSourceSysdigMonitorNotificationChannelSlackRead,
Timeouts: &schema.ResourceTimeout{
Read: schema.DefaultTimeout(timeout),
},
Schema: createMonitorNotificationChannelSchema(map[string]*schema.Schema{
"url": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"channel": {
Type: schema.TypeString,
Computed: true,
},
"is_private_channel": {
Type: schema.TypeBool,
Computed: true,
},
"private_channel_url": {
Type: schema.TypeString,
Computed: true,
},
"show_section_runbook_links": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_event_details": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_user_defined_content": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_notification_chart": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_dashboard_links": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_alert_details": {
Type: schema.TypeBool,
Computed: true,
},
"show_section_capturing_information": {
Type: schema.TypeBool,
Computed: true,
},
}),
}
}
func dataSourceSysdigMonitorNotificationChannelSlackRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client, err := getMonitorNotificationChannelClient(meta.(SysdigClients))
if err != nil {
return diag.FromErr(err)
}
nc, err := client.GetNotificationChannelByName(ctx, d.Get("name").(string))
if err != nil {
return diag.FromErr(err)
}
err = monitorNotificationChannelSlackToResourceData(&nc, d)
if err != nil {
return diag.FromErr(err)
}
d.SetId(strconv.Itoa(nc.ID))
return nil
}