-
Notifications
You must be signed in to change notification settings - Fork 50
/
getPolicyDefintion.go
169 lines (145 loc) · 6.32 KB
/
getPolicyDefintion.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
// 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 policy
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to access information about a Policy Definition, both custom and built in. Retrieves Policy Definitions from your current subscription by default.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/policy"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := policy.GetPolicyDefintion(ctx, &policy.GetPolicyDefintionArgs{
// DisplayName: pulumi.StringRef("Allowed resource types"),
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("id", example.Id)
// return nil
// })
// }
// ```
func GetPolicyDefintion(ctx *pulumi.Context, args *GetPolicyDefintionArgs, opts ...pulumi.InvokeOption) (*GetPolicyDefintionResult, error) {
var rv GetPolicyDefintionResult
err := ctx.Invoke("azure:policy/getPolicyDefintion:getPolicyDefintion", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getPolicyDefintion.
type GetPolicyDefintionArgs struct {
// Specifies the display name of the Policy Definition. Conflicts with `name`.
DisplayName *string `pulumi:"displayName"`
// Only retrieve Policy Definitions from this Management Group.
ManagementGroupName *string `pulumi:"managementGroupName"`
// Specifies the name of the Policy Definition. Conflicts with `displayName`.
Name *string `pulumi:"name"`
}
// A collection of values returned by getPolicyDefintion.
type GetPolicyDefintionResult struct {
// The Description of the Policy.
Description string `pulumi:"description"`
DisplayName string `pulumi:"displayName"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
ManagementGroupName *string `pulumi:"managementGroupName"`
// Any Metadata defined in the Policy.
Metadata string `pulumi:"metadata"`
Name string `pulumi:"name"`
// Any Parameters defined in the Policy.
Parameters string `pulumi:"parameters"`
// The Rule as defined (in JSON) in the Policy.
PolicyRule string `pulumi:"policyRule"`
// The Type of the Policy. Possible values are `BuiltIn`, `Custom` and `NotSpecified`.
PolicyType string `pulumi:"policyType"`
// The Type of Policy.
Type string `pulumi:"type"`
}
func GetPolicyDefintionOutput(ctx *pulumi.Context, args GetPolicyDefintionOutputArgs, opts ...pulumi.InvokeOption) GetPolicyDefintionResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetPolicyDefintionResult, error) {
args := v.(GetPolicyDefintionArgs)
r, err := GetPolicyDefintion(ctx, &args, opts...)
var s GetPolicyDefintionResult
if r != nil {
s = *r
}
return s, err
}).(GetPolicyDefintionResultOutput)
}
// A collection of arguments for invoking getPolicyDefintion.
type GetPolicyDefintionOutputArgs struct {
// Specifies the display name of the Policy Definition. Conflicts with `name`.
DisplayName pulumi.StringPtrInput `pulumi:"displayName"`
// Only retrieve Policy Definitions from this Management Group.
ManagementGroupName pulumi.StringPtrInput `pulumi:"managementGroupName"`
// Specifies the name of the Policy Definition. Conflicts with `displayName`.
Name pulumi.StringPtrInput `pulumi:"name"`
}
func (GetPolicyDefintionOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetPolicyDefintionArgs)(nil)).Elem()
}
// A collection of values returned by getPolicyDefintion.
type GetPolicyDefintionResultOutput struct{ *pulumi.OutputState }
func (GetPolicyDefintionResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetPolicyDefintionResult)(nil)).Elem()
}
func (o GetPolicyDefintionResultOutput) ToGetPolicyDefintionResultOutput() GetPolicyDefintionResultOutput {
return o
}
func (o GetPolicyDefintionResultOutput) ToGetPolicyDefintionResultOutputWithContext(ctx context.Context) GetPolicyDefintionResultOutput {
return o
}
// The Description of the Policy.
func (o GetPolicyDefintionResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Description }).(pulumi.StringOutput)
}
func (o GetPolicyDefintionResultOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.DisplayName }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetPolicyDefintionResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetPolicyDefintionResultOutput) ManagementGroupName() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) *string { return v.ManagementGroupName }).(pulumi.StringPtrOutput)
}
// Any Metadata defined in the Policy.
func (o GetPolicyDefintionResultOutput) Metadata() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Metadata }).(pulumi.StringOutput)
}
func (o GetPolicyDefintionResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Name }).(pulumi.StringOutput)
}
// Any Parameters defined in the Policy.
func (o GetPolicyDefintionResultOutput) Parameters() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Parameters }).(pulumi.StringOutput)
}
// The Rule as defined (in JSON) in the Policy.
func (o GetPolicyDefintionResultOutput) PolicyRule() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.PolicyRule }).(pulumi.StringOutput)
}
// The Type of the Policy. Possible values are `BuiltIn`, `Custom` and `NotSpecified`.
func (o GetPolicyDefintionResultOutput) PolicyType() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.PolicyType }).(pulumi.StringOutput)
}
// The Type of Policy.
func (o GetPolicyDefintionResultOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v GetPolicyDefintionResult) string { return v.Type }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(GetPolicyDefintionResultOutput{})
}