generated from pulumi/pulumi-tf-provider-boilerplate
/
getSecurityPolicyDeployments.go
224 lines (199 loc) · 11.9 KB
/
getSecurityPolicyDeployments.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
// 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 Security Policy Deployments in Oracle Cloud Infrastructure Data Safe service.
//
// Retrieves a list of all security policy deployments in Data Safe.
//
// The ListSecurityPolicyDeployments operation returns only the security policy deployments in the specified `compartmentId`.
//
// The parameter `accessLevel` specifies whether to return only those compartments for which the
// requestor has INSPECT permissions on at least one resource directly
// or indirectly (ACCESSIBLE) (the resource can be in a subcompartment) or to return Not Authorized if
// Principal doesn't have access to even one of the child compartments. This is valid only when
// `compartmentIdInSubtree` is set to `true`.
//
// The parameter `compartmentIdInSubtree` applies when you perform ListSecurityPolicyDeployments on the
// `compartmentId` passed and when it is set to true, the entire hierarchy of compartments can be returned.
// To get a full list of all compartments and subcompartments in the tenancy (root compartment),
// set the parameter `compartmentIdInSubtree` to true and `accessLevel` to ACCESSIBLE.
//
// ## 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.GetSecurityPolicyDeployments(ctx, &datasafe.GetSecurityPolicyDeploymentsArgs{
// CompartmentId: compartmentId,
// AccessLevel: pulumi.StringRef(securityPolicyDeploymentAccessLevel),
// CompartmentIdInSubtree: pulumi.BoolRef(securityPolicyDeploymentCompartmentIdInSubtree),
// DisplayName: pulumi.StringRef(securityPolicyDeploymentDisplayName),
// SecurityPolicyDeploymentId: pulumi.StringRef(testSecurityPolicyDeployment.Id),
// SecurityPolicyId: pulumi.StringRef(testSecurityPolicy.Id),
// State: pulumi.StringRef(securityPolicyDeploymentState),
// TargetId: pulumi.StringRef(testTarget.Id),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetSecurityPolicyDeployments(ctx *pulumi.Context, args *GetSecurityPolicyDeploymentsArgs, opts ...pulumi.InvokeOption) (*GetSecurityPolicyDeploymentsResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetSecurityPolicyDeploymentsResult
err := ctx.Invoke("oci:DataSafe/getSecurityPolicyDeployments:getSecurityPolicyDeployments", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getSecurityPolicyDeployments.
type GetSecurityPolicyDeploymentsArgs 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 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 []GetSecurityPolicyDeploymentsFilter `pulumi:"filters"`
// An optional filter to return only resources that match the specified OCID of the security policy deployment resource.
SecurityPolicyDeploymentId *string `pulumi:"securityPolicyDeploymentId"`
// An optional filter to return only resources that match the specified OCID of the security policy resource.
SecurityPolicyId *string `pulumi:"securityPolicyId"`
// The current state of the security policy deployment.
State *string `pulumi:"state"`
// A filter to return only items related to a specific target OCID.
TargetId *string `pulumi:"targetId"`
}
// A collection of values returned by getSecurityPolicyDeployments.
type GetSecurityPolicyDeploymentsResult struct {
AccessLevel *string `pulumi:"accessLevel"`
// The OCID of the compartment containing the security policy deployment.
CompartmentId string `pulumi:"compartmentId"`
CompartmentIdInSubtree *bool `pulumi:"compartmentIdInSubtree"`
// The display name of the security policy deployment.
DisplayName *string `pulumi:"displayName"`
Filters []GetSecurityPolicyDeploymentsFilter `pulumi:"filters"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The list of security_policy_deployment_collection.
SecurityPolicyDeploymentCollections []GetSecurityPolicyDeploymentsSecurityPolicyDeploymentCollection `pulumi:"securityPolicyDeploymentCollections"`
SecurityPolicyDeploymentId *string `pulumi:"securityPolicyDeploymentId"`
// The OCID of the security policy corresponding to the security policy deployment.
SecurityPolicyId *string `pulumi:"securityPolicyId"`
// The current state of the security policy deployment.
State *string `pulumi:"state"`
// The OCID of the target where the security policy is deployed.
TargetId *string `pulumi:"targetId"`
}
func GetSecurityPolicyDeploymentsOutput(ctx *pulumi.Context, args GetSecurityPolicyDeploymentsOutputArgs, opts ...pulumi.InvokeOption) GetSecurityPolicyDeploymentsResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetSecurityPolicyDeploymentsResult, error) {
args := v.(GetSecurityPolicyDeploymentsArgs)
r, err := GetSecurityPolicyDeployments(ctx, &args, opts...)
var s GetSecurityPolicyDeploymentsResult
if r != nil {
s = *r
}
return s, err
}).(GetSecurityPolicyDeploymentsResultOutput)
}
// A collection of arguments for invoking getSecurityPolicyDeployments.
type GetSecurityPolicyDeploymentsOutputArgs 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 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 GetSecurityPolicyDeploymentsFilterArrayInput `pulumi:"filters"`
// An optional filter to return only resources that match the specified OCID of the security policy deployment resource.
SecurityPolicyDeploymentId pulumi.StringPtrInput `pulumi:"securityPolicyDeploymentId"`
// An optional filter to return only resources that match the specified OCID of the security policy resource.
SecurityPolicyId pulumi.StringPtrInput `pulumi:"securityPolicyId"`
// The current state of the security policy deployment.
State pulumi.StringPtrInput `pulumi:"state"`
// A filter to return only items related to a specific target OCID.
TargetId pulumi.StringPtrInput `pulumi:"targetId"`
}
func (GetSecurityPolicyDeploymentsOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetSecurityPolicyDeploymentsArgs)(nil)).Elem()
}
// A collection of values returned by getSecurityPolicyDeployments.
type GetSecurityPolicyDeploymentsResultOutput struct{ *pulumi.OutputState }
func (GetSecurityPolicyDeploymentsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetSecurityPolicyDeploymentsResult)(nil)).Elem()
}
func (o GetSecurityPolicyDeploymentsResultOutput) ToGetSecurityPolicyDeploymentsResultOutput() GetSecurityPolicyDeploymentsResultOutput {
return o
}
func (o GetSecurityPolicyDeploymentsResultOutput) ToGetSecurityPolicyDeploymentsResultOutputWithContext(ctx context.Context) GetSecurityPolicyDeploymentsResultOutput {
return o
}
func (o GetSecurityPolicyDeploymentsResultOutput) AccessLevel() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.AccessLevel }).(pulumi.StringPtrOutput)
}
// The OCID of the compartment containing the security policy deployment.
func (o GetSecurityPolicyDeploymentsResultOutput) CompartmentId() pulumi.StringOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) string { return v.CompartmentId }).(pulumi.StringOutput)
}
func (o GetSecurityPolicyDeploymentsResultOutput) CompartmentIdInSubtree() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *bool { return v.CompartmentIdInSubtree }).(pulumi.BoolPtrOutput)
}
// The display name of the security policy deployment.
func (o GetSecurityPolicyDeploymentsResultOutput) DisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.DisplayName }).(pulumi.StringPtrOutput)
}
func (o GetSecurityPolicyDeploymentsResultOutput) Filters() GetSecurityPolicyDeploymentsFilterArrayOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) []GetSecurityPolicyDeploymentsFilter { return v.Filters }).(GetSecurityPolicyDeploymentsFilterArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetSecurityPolicyDeploymentsResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) string { return v.Id }).(pulumi.StringOutput)
}
// The list of security_policy_deployment_collection.
func (o GetSecurityPolicyDeploymentsResultOutput) SecurityPolicyDeploymentCollections() GetSecurityPolicyDeploymentsSecurityPolicyDeploymentCollectionArrayOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) []GetSecurityPolicyDeploymentsSecurityPolicyDeploymentCollection {
return v.SecurityPolicyDeploymentCollections
}).(GetSecurityPolicyDeploymentsSecurityPolicyDeploymentCollectionArrayOutput)
}
func (o GetSecurityPolicyDeploymentsResultOutput) SecurityPolicyDeploymentId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.SecurityPolicyDeploymentId }).(pulumi.StringPtrOutput)
}
// The OCID of the security policy corresponding to the security policy deployment.
func (o GetSecurityPolicyDeploymentsResultOutput) SecurityPolicyId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.SecurityPolicyId }).(pulumi.StringPtrOutput)
}
// The current state of the security policy deployment.
func (o GetSecurityPolicyDeploymentsResultOutput) State() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.State }).(pulumi.StringPtrOutput)
}
// The OCID of the target where the security policy is deployed.
func (o GetSecurityPolicyDeploymentsResultOutput) TargetId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetSecurityPolicyDeploymentsResult) *string { return v.TargetId }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(GetSecurityPolicyDeploymentsResultOutput{})
}