generated from pulumi/pulumi-tf-provider-boilerplate
/
getAlarmPolicy.go
312 lines (272 loc) · 20.3 KB
/
getAlarmPolicy.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package monitor
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to query detailed information of monitor alarmPolicy
func LookupAlarmPolicy(ctx *pulumi.Context, args *LookupAlarmPolicyArgs, opts ...pulumi.InvokeOption) (*LookupAlarmPolicyResult, error) {
opts = pkgInvokeDefaultOpts(opts)
var rv LookupAlarmPolicyResult
err := ctx.Invoke("tencentcloud:Monitor/getAlarmPolicy:getAlarmPolicy", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getAlarmPolicy.
type LookupAlarmPolicyArgs struct {
// The alarm object list, which is a JSON string. The outer array corresponds to multiple instances, and the inner array is the dimension of an object.For example, 'CVM - Basic Monitor' can be written as: [ {Dimensions: {unInstanceId: ins-qr8d555g}}, {Dimensions: {unInstanceId: ins-qr8d555h}} ]You can also refer to the 'Example 2' below.For more information on the parameter samples of different Tencent Cloud services, see [Product Policy Type and Dimension Information](https://www.tencentcloud.com/document/product/248/39565?has_map=1).Note: If 1 is passed in for NeedCorrespondence, the relationship between a policy and an instance needs to be returned. You can pass in up to 20 alarm object dimensions to avoid request timeout.
Dimensions *string `pulumi:"dimensions"`
// Filter by alarm status. Valid values: [1]: enabled; [0]: disabled; [0, 1]: all.
Enables []int `pulumi:"enables"`
// Sort by field. For example, to sort by the last modification time, use Field: UpdateTime.
Field *string `pulumi:"field"`
// Instance group ID.
InstanceGroupId *int `pulumi:"instanceGroupId"`
// Value fixed at monitor.
Module string `pulumi:"module"`
// Filter by monitor type. Valid values: MT_QCE (Tencent Cloud service monitoring). If this parameter is left empty, all will be queried by default.
MonitorTypes []string `pulumi:"monitorTypes"`
// Filter by namespace. For the values of different policy types, please see:[Poicy Type List](https://www.tencentcloud.com/document/product/248/39565?has_map=1).
Namespaces []string `pulumi:"namespaces"`
// Whether the relationship between a policy and the input parameter filter dimension is required. 1: Yes. 0: No. Default value: 0.
NeedCorrespondence *int `pulumi:"needCorrespondence"`
// Whether the returned result needs to filter policies associated with all objects. Valid values: 1 (Yes), 0 (No).
NotBindAll *int `pulumi:"notBindAll"`
// If 1 is passed in, alarm policies with no notification rules configured are queried. If it is left empty or other values are passed in, all alarm policies are queried.
NotBindingNoticeRule *int `pulumi:"notBindingNoticeRule"`
// Whether the returned result needs to filter policies associated with instance groups. Valid values: 1 (Yes), 0 (No).
NotInstanceGroup *int `pulumi:"notInstanceGroup"`
// List of the notification template IDs, which can be obtained by querying the notification template list.It can be queried with the API [DescribeAlarmNotices](https://www.tencentcloud.com/document/product/248/39300).
NoticeIds []string `pulumi:"noticeIds"`
// Filter by quick alarm policy. If this parameter is left empty, all policies are displayed. ONECLICK: Display quick alarm policies; NOT_ONECLICK: Display non-quick alarm policies.
OneClickPolicyTypes []string `pulumi:"oneClickPolicyTypes"`
// Sort order. Valid values: ASC (ascending), DESC (descending).
Order *string `pulumi:"order"`
// Fuzzy search by policy name.
PolicyName *string `pulumi:"policyName"`
// Filter by default policy. Valid values: DEFAULT (display default policy), NOT_DEFAULT (display non-default policies). If this parameter is left empty, all policies will be displayed.
PolicyTypes []string `pulumi:"policyTypes"`
// ID array of the policy project, which can be viewed on the following page: [Project Management](https://console.tencentcloud.com/project).
ProjectIds []int `pulumi:"projectIds"`
// ID of the TencentCloud Managed Service for Prometheus instance, which is used for customizing a metric policy.
PromInsId *string `pulumi:"promInsId"`
// Search by recipient group. You can get the user group list with the API [ListGroups](https://www.tencentcloud.com/document/product/598/34589?from_cn_redirect=1) in 'Cloud Access Management' or query the user group list where a sub-user is in with the API [ListGroupsForUser](https://www.tencentcloud.com/document/product/598/34588?from_cn_redirect=1). The GroupId field in the returned result should be entered here.
ReceiverGroups []int `pulumi:"receiverGroups"`
// Search by schedule.
ReceiverOnCallFormIds []string `pulumi:"receiverOnCallFormIds"`
// Search by recipient. You can get the user list with the API [ListUsers](https://www.tencentcloud.com/document/product/598/34587?from_cn_redirect=1) in 'Cloud Access Management' or query the sub-user information with the API [GetUser](https://www.tencentcloud.com/document/product/598/34590?from_cn_redirect=1). The Uid field in the returned result should be entered here.
ReceiverUids []int `pulumi:"receiverUids"`
// Used to save results.
ResultOutputFile *string `pulumi:"resultOutputFile"`
// Filter by trigger condition. Valid values: STATIC (display policies with static threshold), DYNAMIC (display policies with dynamic threshold). If this parameter is left empty, all policies will be displayed.
RuleTypes []string `pulumi:"ruleTypes"`
// Filter alarm policy by triggered task (such as auto scaling task). Up to 10 tasks can be specified.
TriggerTasks []GetAlarmPolicyTriggerTask `pulumi:"triggerTasks"`
}
// A collection of values returned by getAlarmPolicy.
type LookupAlarmPolicyResult struct {
// JSON string generated by serializing the AlarmPolicyDimension two-dimensional array. The one-dimensional arrays are in OR relationship, and the elements in a one-dimensional array are in AND relationshipNote: this field may return null, indicating that no valid values can be obtained.
Dimensions *string `pulumi:"dimensions"`
// Status. Valid values: 0 (disabled), 1 (enabled). Default value: 1 (enabled). This parameter can be left empty.
Enables []int `pulumi:"enables"`
Field *string `pulumi:"field"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// Instance group IDNote: this field may return null, indicating that no valid values can be obtained.
InstanceGroupId *int `pulumi:"instanceGroupId"`
Module string `pulumi:"module"`
MonitorTypes []string `pulumi:"monitorTypes"`
Namespaces []string `pulumi:"namespaces"`
NeedCorrespondence *int `pulumi:"needCorrespondence"`
NotBindAll *int `pulumi:"notBindAll"`
NotBindingNoticeRule *int `pulumi:"notBindingNoticeRule"`
NotInstanceGroup *int `pulumi:"notInstanceGroup"`
// Notification rule ID listNote: this field may return null, indicating that no valid values can be obtained.
NoticeIds []string `pulumi:"noticeIds"`
OneClickPolicyTypes []string `pulumi:"oneClickPolicyTypes"`
Order *string `pulumi:"order"`
// Policy array.
Policies []GetAlarmPolicyPolicy `pulumi:"policies"`
// Alarm policy nameNote: this field may return null, indicating that no valid values can be obtained.
PolicyName *string `pulumi:"policyName"`
PolicyTypes []string `pulumi:"policyTypes"`
ProjectIds []int `pulumi:"projectIds"`
PromInsId *string `pulumi:"promInsId"`
ReceiverGroups []int `pulumi:"receiverGroups"`
ReceiverOnCallFormIds []string `pulumi:"receiverOnCallFormIds"`
ReceiverUids []int `pulumi:"receiverUids"`
ResultOutputFile *string `pulumi:"resultOutputFile"`
RuleTypes []string `pulumi:"ruleTypes"`
// Triggered task listNote: this field may return null, indicating that no valid values can be obtained.
TriggerTasks []GetAlarmPolicyTriggerTask `pulumi:"triggerTasks"`
}
func LookupAlarmPolicyOutput(ctx *pulumi.Context, args LookupAlarmPolicyOutputArgs, opts ...pulumi.InvokeOption) LookupAlarmPolicyResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupAlarmPolicyResult, error) {
args := v.(LookupAlarmPolicyArgs)
r, err := LookupAlarmPolicy(ctx, &args, opts...)
var s LookupAlarmPolicyResult
if r != nil {
s = *r
}
return s, err
}).(LookupAlarmPolicyResultOutput)
}
// A collection of arguments for invoking getAlarmPolicy.
type LookupAlarmPolicyOutputArgs struct {
// The alarm object list, which is a JSON string. The outer array corresponds to multiple instances, and the inner array is the dimension of an object.For example, 'CVM - Basic Monitor' can be written as: [ {Dimensions: {unInstanceId: ins-qr8d555g}}, {Dimensions: {unInstanceId: ins-qr8d555h}} ]You can also refer to the 'Example 2' below.For more information on the parameter samples of different Tencent Cloud services, see [Product Policy Type and Dimension Information](https://www.tencentcloud.com/document/product/248/39565?has_map=1).Note: If 1 is passed in for NeedCorrespondence, the relationship between a policy and an instance needs to be returned. You can pass in up to 20 alarm object dimensions to avoid request timeout.
Dimensions pulumi.StringPtrInput `pulumi:"dimensions"`
// Filter by alarm status. Valid values: [1]: enabled; [0]: disabled; [0, 1]: all.
Enables pulumi.IntArrayInput `pulumi:"enables"`
// Sort by field. For example, to sort by the last modification time, use Field: UpdateTime.
Field pulumi.StringPtrInput `pulumi:"field"`
// Instance group ID.
InstanceGroupId pulumi.IntPtrInput `pulumi:"instanceGroupId"`
// Value fixed at monitor.
Module pulumi.StringInput `pulumi:"module"`
// Filter by monitor type. Valid values: MT_QCE (Tencent Cloud service monitoring). If this parameter is left empty, all will be queried by default.
MonitorTypes pulumi.StringArrayInput `pulumi:"monitorTypes"`
// Filter by namespace. For the values of different policy types, please see:[Poicy Type List](https://www.tencentcloud.com/document/product/248/39565?has_map=1).
Namespaces pulumi.StringArrayInput `pulumi:"namespaces"`
// Whether the relationship between a policy and the input parameter filter dimension is required. 1: Yes. 0: No. Default value: 0.
NeedCorrespondence pulumi.IntPtrInput `pulumi:"needCorrespondence"`
// Whether the returned result needs to filter policies associated with all objects. Valid values: 1 (Yes), 0 (No).
NotBindAll pulumi.IntPtrInput `pulumi:"notBindAll"`
// If 1 is passed in, alarm policies with no notification rules configured are queried. If it is left empty or other values are passed in, all alarm policies are queried.
NotBindingNoticeRule pulumi.IntPtrInput `pulumi:"notBindingNoticeRule"`
// Whether the returned result needs to filter policies associated with instance groups. Valid values: 1 (Yes), 0 (No).
NotInstanceGroup pulumi.IntPtrInput `pulumi:"notInstanceGroup"`
// List of the notification template IDs, which can be obtained by querying the notification template list.It can be queried with the API [DescribeAlarmNotices](https://www.tencentcloud.com/document/product/248/39300).
NoticeIds pulumi.StringArrayInput `pulumi:"noticeIds"`
// Filter by quick alarm policy. If this parameter is left empty, all policies are displayed. ONECLICK: Display quick alarm policies; NOT_ONECLICK: Display non-quick alarm policies.
OneClickPolicyTypes pulumi.StringArrayInput `pulumi:"oneClickPolicyTypes"`
// Sort order. Valid values: ASC (ascending), DESC (descending).
Order pulumi.StringPtrInput `pulumi:"order"`
// Fuzzy search by policy name.
PolicyName pulumi.StringPtrInput `pulumi:"policyName"`
// Filter by default policy. Valid values: DEFAULT (display default policy), NOT_DEFAULT (display non-default policies). If this parameter is left empty, all policies will be displayed.
PolicyTypes pulumi.StringArrayInput `pulumi:"policyTypes"`
// ID array of the policy project, which can be viewed on the following page: [Project Management](https://console.tencentcloud.com/project).
ProjectIds pulumi.IntArrayInput `pulumi:"projectIds"`
// ID of the TencentCloud Managed Service for Prometheus instance, which is used for customizing a metric policy.
PromInsId pulumi.StringPtrInput `pulumi:"promInsId"`
// Search by recipient group. You can get the user group list with the API [ListGroups](https://www.tencentcloud.com/document/product/598/34589?from_cn_redirect=1) in 'Cloud Access Management' or query the user group list where a sub-user is in with the API [ListGroupsForUser](https://www.tencentcloud.com/document/product/598/34588?from_cn_redirect=1). The GroupId field in the returned result should be entered here.
ReceiverGroups pulumi.IntArrayInput `pulumi:"receiverGroups"`
// Search by schedule.
ReceiverOnCallFormIds pulumi.StringArrayInput `pulumi:"receiverOnCallFormIds"`
// Search by recipient. You can get the user list with the API [ListUsers](https://www.tencentcloud.com/document/product/598/34587?from_cn_redirect=1) in 'Cloud Access Management' or query the sub-user information with the API [GetUser](https://www.tencentcloud.com/document/product/598/34590?from_cn_redirect=1). The Uid field in the returned result should be entered here.
ReceiverUids pulumi.IntArrayInput `pulumi:"receiverUids"`
// Used to save results.
ResultOutputFile pulumi.StringPtrInput `pulumi:"resultOutputFile"`
// Filter by trigger condition. Valid values: STATIC (display policies with static threshold), DYNAMIC (display policies with dynamic threshold). If this parameter is left empty, all policies will be displayed.
RuleTypes pulumi.StringArrayInput `pulumi:"ruleTypes"`
// Filter alarm policy by triggered task (such as auto scaling task). Up to 10 tasks can be specified.
TriggerTasks GetAlarmPolicyTriggerTaskArrayInput `pulumi:"triggerTasks"`
}
func (LookupAlarmPolicyOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupAlarmPolicyArgs)(nil)).Elem()
}
// A collection of values returned by getAlarmPolicy.
type LookupAlarmPolicyResultOutput struct{ *pulumi.OutputState }
func (LookupAlarmPolicyResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupAlarmPolicyResult)(nil)).Elem()
}
func (o LookupAlarmPolicyResultOutput) ToLookupAlarmPolicyResultOutput() LookupAlarmPolicyResultOutput {
return o
}
func (o LookupAlarmPolicyResultOutput) ToLookupAlarmPolicyResultOutputWithContext(ctx context.Context) LookupAlarmPolicyResultOutput {
return o
}
// JSON string generated by serializing the AlarmPolicyDimension two-dimensional array. The one-dimensional arrays are in OR relationship, and the elements in a one-dimensional array are in AND relationshipNote: this field may return null, indicating that no valid values can be obtained.
func (o LookupAlarmPolicyResultOutput) Dimensions() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.Dimensions }).(pulumi.StringPtrOutput)
}
// Status. Valid values: 0 (disabled), 1 (enabled). Default value: 1 (enabled). This parameter can be left empty.
func (o LookupAlarmPolicyResultOutput) Enables() pulumi.IntArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []int { return v.Enables }).(pulumi.IntArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) Field() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.Field }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupAlarmPolicyResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) string { return v.Id }).(pulumi.StringOutput)
}
// Instance group IDNote: this field may return null, indicating that no valid values can be obtained.
func (o LookupAlarmPolicyResultOutput) InstanceGroupId() pulumi.IntPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *int { return v.InstanceGroupId }).(pulumi.IntPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) Module() pulumi.StringOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) string { return v.Module }).(pulumi.StringOutput)
}
func (o LookupAlarmPolicyResultOutput) MonitorTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.MonitorTypes }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) Namespaces() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.Namespaces }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) NeedCorrespondence() pulumi.IntPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *int { return v.NeedCorrespondence }).(pulumi.IntPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) NotBindAll() pulumi.IntPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *int { return v.NotBindAll }).(pulumi.IntPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) NotBindingNoticeRule() pulumi.IntPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *int { return v.NotBindingNoticeRule }).(pulumi.IntPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) NotInstanceGroup() pulumi.IntPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *int { return v.NotInstanceGroup }).(pulumi.IntPtrOutput)
}
// Notification rule ID listNote: this field may return null, indicating that no valid values can be obtained.
func (o LookupAlarmPolicyResultOutput) NoticeIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.NoticeIds }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) OneClickPolicyTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.OneClickPolicyTypes }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) Order() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.Order }).(pulumi.StringPtrOutput)
}
// Policy array.
func (o LookupAlarmPolicyResultOutput) Policies() GetAlarmPolicyPolicyArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []GetAlarmPolicyPolicy { return v.Policies }).(GetAlarmPolicyPolicyArrayOutput)
}
// Alarm policy nameNote: this field may return null, indicating that no valid values can be obtained.
func (o LookupAlarmPolicyResultOutput) PolicyName() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.PolicyName }).(pulumi.StringPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) PolicyTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.PolicyTypes }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) ProjectIds() pulumi.IntArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []int { return v.ProjectIds }).(pulumi.IntArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) PromInsId() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.PromInsId }).(pulumi.StringPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) ReceiverGroups() pulumi.IntArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []int { return v.ReceiverGroups }).(pulumi.IntArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) ReceiverOnCallFormIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.ReceiverOnCallFormIds }).(pulumi.StringArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) ReceiverUids() pulumi.IntArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []int { return v.ReceiverUids }).(pulumi.IntArrayOutput)
}
func (o LookupAlarmPolicyResultOutput) ResultOutputFile() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) *string { return v.ResultOutputFile }).(pulumi.StringPtrOutput)
}
func (o LookupAlarmPolicyResultOutput) RuleTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []string { return v.RuleTypes }).(pulumi.StringArrayOutput)
}
// Triggered task listNote: this field may return null, indicating that no valid values can be obtained.
func (o LookupAlarmPolicyResultOutput) TriggerTasks() GetAlarmPolicyTriggerTaskArrayOutput {
return o.ApplyT(func(v LookupAlarmPolicyResult) []GetAlarmPolicyTriggerTask { return v.TriggerTasks }).(GetAlarmPolicyTriggerTaskArrayOutput)
}
func init() {
pulumi.RegisterOutputType(LookupAlarmPolicyResultOutput{})
}