/
getAlertRule.go
67 lines (62 loc) · 2.14 KB
/
getAlertRule.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package sentinel
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Use this data source to access information about an existing Sentinel Alert Rule.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/operationalinsights"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/sentinel"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleAnalyticsWorkspace, err := operationalinsights.LookupAnalyticsWorkspace(ctx, &operationalinsights.LookupAnalyticsWorkspaceArgs{
// Name: "example",
// ResourceGroupName: "example-resources",
// }, nil)
// if err != nil {
// return err
// }
// exampleAlertRule, err := sentinel.GetAlertRule(ctx, &sentinel.GetAlertRuleArgs{
// Name: "existing",
// LogAnalyticsWorkspaceId: exampleAnalyticsWorkspace.Id,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("id", exampleAlertRule.Id)
// return nil
// })
// }
// ```
func GetAlertRule(ctx *pulumi.Context, args *GetAlertRuleArgs, opts ...pulumi.InvokeOption) (*GetAlertRuleResult, error) {
var rv GetAlertRuleResult
err := ctx.Invoke("azure:sentinel/getAlertRule:getAlertRule", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getAlertRule.
type GetAlertRuleArgs struct {
// The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.
LogAnalyticsWorkspaceId string `pulumi:"logAnalyticsWorkspaceId"`
// The name which should be used for this Sentinel Alert Rule.
Name string `pulumi:"name"`
}
// A collection of values returned by getAlertRule.
type GetAlertRuleResult struct {
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
LogAnalyticsWorkspaceId string `pulumi:"logAnalyticsWorkspaceId"`
Name string `pulumi:"name"`
}