-
Notifications
You must be signed in to change notification settings - Fork 51
/
diagnosticSetting.go
150 lines (133 loc) · 6.13 KB
/
diagnosticSetting.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
// *** 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 monitoring
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a Diagnostic Setting for an existing Resource.
type DiagnosticSetting struct {
s *pulumi.ResourceState
}
// NewDiagnosticSetting registers a new resource with the given unique name, arguments, and options.
func NewDiagnosticSetting(ctx *pulumi.Context,
name string, args *DiagnosticSettingArgs, opts ...pulumi.ResourceOpt) (*DiagnosticSetting, error) {
if args == nil || args.TargetResourceId == nil {
return nil, errors.New("missing required argument 'TargetResourceId'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["eventhubAuthorizationRuleId"] = nil
inputs["eventhubName"] = nil
inputs["logs"] = nil
inputs["logAnalyticsWorkspaceId"] = nil
inputs["metrics"] = nil
inputs["name"] = nil
inputs["storageAccountId"] = nil
inputs["targetResourceId"] = nil
} else {
inputs["eventhubAuthorizationRuleId"] = args.EventhubAuthorizationRuleId
inputs["eventhubName"] = args.EventhubName
inputs["logs"] = args.Logs
inputs["logAnalyticsWorkspaceId"] = args.LogAnalyticsWorkspaceId
inputs["metrics"] = args.Metrics
inputs["name"] = args.Name
inputs["storageAccountId"] = args.StorageAccountId
inputs["targetResourceId"] = args.TargetResourceId
}
s, err := ctx.RegisterResource("azure:monitoring/diagnosticSetting:DiagnosticSetting", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &DiagnosticSetting{s: s}, nil
}
// GetDiagnosticSetting gets an existing DiagnosticSetting resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetDiagnosticSetting(ctx *pulumi.Context,
name string, id pulumi.ID, state *DiagnosticSettingState, opts ...pulumi.ResourceOpt) (*DiagnosticSetting, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["eventhubAuthorizationRuleId"] = state.EventhubAuthorizationRuleId
inputs["eventhubName"] = state.EventhubName
inputs["logs"] = state.Logs
inputs["logAnalyticsWorkspaceId"] = state.LogAnalyticsWorkspaceId
inputs["metrics"] = state.Metrics
inputs["name"] = state.Name
inputs["storageAccountId"] = state.StorageAccountId
inputs["targetResourceId"] = state.TargetResourceId
}
s, err := ctx.ReadResource("azure:monitoring/diagnosticSetting:DiagnosticSetting", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &DiagnosticSetting{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *DiagnosticSetting) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *DiagnosticSetting) ID() *pulumi.IDOutput {
return r.s.ID()
}
func (r *DiagnosticSetting) EventhubAuthorizationRuleId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["eventhubAuthorizationRuleId"])
}
func (r *DiagnosticSetting) EventhubName() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["eventhubName"])
}
// One or more `log` blocks as defined below.
func (r *DiagnosticSetting) Logs() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["logs"])
}
// Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. Changing this forces a new resource to be created.
func (r *DiagnosticSetting) LogAnalyticsWorkspaceId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["logAnalyticsWorkspaceId"])
}
// One or more `metric` blocks as defined below.
func (r *DiagnosticSetting) Metrics() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["metrics"])
}
// Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
func (r *DiagnosticSetting) Name() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["name"])
}
// With this parameter you can specify a storage account which should be used to send the logs to. Parameter must be a valid Azure Resource ID. Changing this forces a new resource to be created.
func (r *DiagnosticSetting) StorageAccountId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["storageAccountId"])
}
func (r *DiagnosticSetting) TargetResourceId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["targetResourceId"])
}
// Input properties used for looking up and filtering DiagnosticSetting resources.
type DiagnosticSettingState struct {
EventhubAuthorizationRuleId interface{}
EventhubName interface{}
// One or more `log` blocks as defined below.
Logs interface{}
// Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. Changing this forces a new resource to be created.
LogAnalyticsWorkspaceId interface{}
// One or more `metric` blocks as defined below.
Metrics interface{}
// Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
Name interface{}
// With this parameter you can specify a storage account which should be used to send the logs to. Parameter must be a valid Azure Resource ID. Changing this forces a new resource to be created.
StorageAccountId interface{}
TargetResourceId interface{}
}
// The set of arguments for constructing a DiagnosticSetting resource.
type DiagnosticSettingArgs struct {
EventhubAuthorizationRuleId interface{}
EventhubName interface{}
// One or more `log` blocks as defined below.
Logs interface{}
// Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. Changing this forces a new resource to be created.
LogAnalyticsWorkspaceId interface{}
// One or more `metric` blocks as defined below.
Metrics interface{}
// Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
Name interface{}
// With this parameter you can specify a storage account which should be used to send the logs to. Parameter must be a valid Azure Resource ID. Changing this forces a new resource to be created.
StorageAccountId interface{}
TargetResourceId interface{}
}