generated from pulumi/pulumi-tf-provider-boilerplate
/
getAlertPolicies.go
237 lines (210 loc) · 11.8 KB
/
getAlertPolicies.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
// 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 datasafe
import (
"context"
"reflect"
"github.com/pulumi/pulumi-oci/sdk/go/oci/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This data source provides the list of Alert Policies in Oracle Cloud Infrastructure Data Safe service.
//
// Gets a list of all alert policies.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-oci/sdk/go/oci/DataSafe"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := DataSafe.GetAlertPolicies(ctx, &datasafe.GetAlertPoliciesArgs{
// CompartmentId: compartmentId,
// AccessLevel: pulumi.StringRef(alertPolicyAccessLevel),
// AlertPolicyId: pulumi.StringRef(testAlertPolicy.Id),
// CompartmentIdInSubtree: pulumi.BoolRef(alertPolicyCompartmentIdInSubtree),
// DisplayName: pulumi.StringRef(alertPolicyDisplayName),
// IsUserDefined: pulumi.BoolRef(alertPolicyIsUserDefined),
// State: pulumi.StringRef(alertPolicyState),
// TimeCreatedGreaterThanOrEqualTo: pulumi.StringRef(alertPolicyTimeCreatedGreaterThanOrEqualTo),
// TimeCreatedLessThan: pulumi.StringRef(alertPolicyTimeCreatedLessThan),
// Type: pulumi.StringRef(alertPolicyType),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetAlertPolicies(ctx *pulumi.Context, args *GetAlertPoliciesArgs, opts ...pulumi.InvokeOption) (*GetAlertPoliciesResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetAlertPoliciesResult
err := ctx.Invoke("oci:DataSafe/getAlertPolicies:getAlertPolicies", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getAlertPolicies.
type GetAlertPoliciesArgs struct {
// Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.
AccessLevel *string `pulumi:"accessLevel"`
// A filter to return policy by it's OCID.
AlertPolicyId *string `pulumi:"alertPolicyId"`
// A filter to return only resources that match the specified compartment OCID.
CompartmentId string `pulumi:"compartmentId"`
// Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
CompartmentIdInSubtree *bool `pulumi:"compartmentIdInSubtree"`
// A filter to return only resources that match the specified display name.
DisplayName *string `pulumi:"displayName"`
Filters []GetAlertPoliciesFilter `pulumi:"filters"`
// An optional filter to return only alert policies that are user-defined or not.
IsUserDefined *bool `pulumi:"isUserDefined"`
// An optional filter to return only alert policies that have the given life-cycle state.
State *string `pulumi:"state"`
// A filter to return only the resources that were created after the specified date and time, as defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Using TimeCreatedGreaterThanOrEqualToQueryParam parameter retrieves all resources created after that date.
//
// **Example:** 2016-12-19T16:39:57.600Z
TimeCreatedGreaterThanOrEqualTo *string `pulumi:"timeCreatedGreaterThanOrEqualTo"`
// Search for resources that were created before a specific date. Specifying this parameter corresponding `timeCreatedLessThan` parameter will retrieve all resources created before the specified created date, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
//
// **Example:** 2016-12-19T16:39:57.600Z
TimeCreatedLessThan *string `pulumi:"timeCreatedLessThan"`
// An optional filter to return only alert policies of a certain type.
Type *string `pulumi:"type"`
}
// A collection of values returned by getAlertPolicies.
type GetAlertPoliciesResult struct {
AccessLevel *string `pulumi:"accessLevel"`
// The list of alert_policy_collection.
AlertPolicyCollections []GetAlertPoliciesAlertPolicyCollection `pulumi:"alertPolicyCollections"`
AlertPolicyId *string `pulumi:"alertPolicyId"`
// The OCID of the compartment that contains the alert policy.
CompartmentId string `pulumi:"compartmentId"`
CompartmentIdInSubtree *bool `pulumi:"compartmentIdInSubtree"`
// The display name of the alert policy.
DisplayName *string `pulumi:"displayName"`
Filters []GetAlertPoliciesFilter `pulumi:"filters"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// Indicates if the alert policy is user-defined (true) or pre-defined (false).
IsUserDefined *bool `pulumi:"isUserDefined"`
// The current state of the alert.
State *string `pulumi:"state"`
TimeCreatedGreaterThanOrEqualTo *string `pulumi:"timeCreatedGreaterThanOrEqualTo"`
TimeCreatedLessThan *string `pulumi:"timeCreatedLessThan"`
Type *string `pulumi:"type"`
}
func GetAlertPoliciesOutput(ctx *pulumi.Context, args GetAlertPoliciesOutputArgs, opts ...pulumi.InvokeOption) GetAlertPoliciesResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetAlertPoliciesResult, error) {
args := v.(GetAlertPoliciesArgs)
r, err := GetAlertPolicies(ctx, &args, opts...)
var s GetAlertPoliciesResult
if r != nil {
s = *r
}
return s, err
}).(GetAlertPoliciesResultOutput)
}
// A collection of arguments for invoking getAlertPolicies.
type GetAlertPoliciesOutputArgs struct {
// Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.
AccessLevel pulumi.StringPtrInput `pulumi:"accessLevel"`
// A filter to return policy by it's OCID.
AlertPolicyId pulumi.StringPtrInput `pulumi:"alertPolicyId"`
// A filter to return only resources that match the specified compartment OCID.
CompartmentId pulumi.StringInput `pulumi:"compartmentId"`
// Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
CompartmentIdInSubtree pulumi.BoolPtrInput `pulumi:"compartmentIdInSubtree"`
// A filter to return only resources that match the specified display name.
DisplayName pulumi.StringPtrInput `pulumi:"displayName"`
Filters GetAlertPoliciesFilterArrayInput `pulumi:"filters"`
// An optional filter to return only alert policies that are user-defined or not.
IsUserDefined pulumi.BoolPtrInput `pulumi:"isUserDefined"`
// An optional filter to return only alert policies that have the given life-cycle state.
State pulumi.StringPtrInput `pulumi:"state"`
// A filter to return only the resources that were created after the specified date and time, as defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Using TimeCreatedGreaterThanOrEqualToQueryParam parameter retrieves all resources created after that date.
//
// **Example:** 2016-12-19T16:39:57.600Z
TimeCreatedGreaterThanOrEqualTo pulumi.StringPtrInput `pulumi:"timeCreatedGreaterThanOrEqualTo"`
// Search for resources that were created before a specific date. Specifying this parameter corresponding `timeCreatedLessThan` parameter will retrieve all resources created before the specified created date, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
//
// **Example:** 2016-12-19T16:39:57.600Z
TimeCreatedLessThan pulumi.StringPtrInput `pulumi:"timeCreatedLessThan"`
// An optional filter to return only alert policies of a certain type.
Type pulumi.StringPtrInput `pulumi:"type"`
}
func (GetAlertPoliciesOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetAlertPoliciesArgs)(nil)).Elem()
}
// A collection of values returned by getAlertPolicies.
type GetAlertPoliciesResultOutput struct{ *pulumi.OutputState }
func (GetAlertPoliciesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetAlertPoliciesResult)(nil)).Elem()
}
func (o GetAlertPoliciesResultOutput) ToGetAlertPoliciesResultOutput() GetAlertPoliciesResultOutput {
return o
}
func (o GetAlertPoliciesResultOutput) ToGetAlertPoliciesResultOutputWithContext(ctx context.Context) GetAlertPoliciesResultOutput {
return o
}
func (o GetAlertPoliciesResultOutput) AccessLevel() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.AccessLevel }).(pulumi.StringPtrOutput)
}
// The list of alert_policy_collection.
func (o GetAlertPoliciesResultOutput) AlertPolicyCollections() GetAlertPoliciesAlertPolicyCollectionArrayOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) []GetAlertPoliciesAlertPolicyCollection {
return v.AlertPolicyCollections
}).(GetAlertPoliciesAlertPolicyCollectionArrayOutput)
}
func (o GetAlertPoliciesResultOutput) AlertPolicyId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.AlertPolicyId }).(pulumi.StringPtrOutput)
}
// The OCID of the compartment that contains the alert policy.
func (o GetAlertPoliciesResultOutput) CompartmentId() pulumi.StringOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) string { return v.CompartmentId }).(pulumi.StringOutput)
}
func (o GetAlertPoliciesResultOutput) CompartmentIdInSubtree() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *bool { return v.CompartmentIdInSubtree }).(pulumi.BoolPtrOutput)
}
// The display name of the alert policy.
func (o GetAlertPoliciesResultOutput) DisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.DisplayName }).(pulumi.StringPtrOutput)
}
func (o GetAlertPoliciesResultOutput) Filters() GetAlertPoliciesFilterArrayOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) []GetAlertPoliciesFilter { return v.Filters }).(GetAlertPoliciesFilterArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetAlertPoliciesResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) string { return v.Id }).(pulumi.StringOutput)
}
// Indicates if the alert policy is user-defined (true) or pre-defined (false).
func (o GetAlertPoliciesResultOutput) IsUserDefined() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *bool { return v.IsUserDefined }).(pulumi.BoolPtrOutput)
}
// The current state of the alert.
func (o GetAlertPoliciesResultOutput) State() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.State }).(pulumi.StringPtrOutput)
}
func (o GetAlertPoliciesResultOutput) TimeCreatedGreaterThanOrEqualTo() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.TimeCreatedGreaterThanOrEqualTo }).(pulumi.StringPtrOutput)
}
func (o GetAlertPoliciesResultOutput) TimeCreatedLessThan() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.TimeCreatedLessThan }).(pulumi.StringPtrOutput)
}
func (o GetAlertPoliciesResultOutput) Type() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAlertPoliciesResult) *string { return v.Type }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(GetAlertPoliciesResultOutput{})
}