/
clusterRole.go
265 lines (214 loc) · 11.7 KB
/
clusterRole.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
// Code generated by pulumigen DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1
import (
"context"
"reflect"
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
type ClusterRole struct {
pulumi.CustomResourceState
// AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.
AggregationRule AggregationRulePtrOutput `pulumi:"aggregationRule"`
// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Kind pulumi.StringPtrOutput `pulumi:"kind"`
// Standard object's metadata.
Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
// Rules holds all the PolicyRules for this ClusterRole
Rules PolicyRuleArrayOutput `pulumi:"rules"`
}
// NewClusterRole registers a new resource with the given unique name, arguments, and options.
func NewClusterRole(ctx *pulumi.Context,
name string, args *ClusterRoleArgs, opts ...pulumi.ResourceOption) (*ClusterRole, error) {
if args == nil {
args = &ClusterRoleArgs{}
}
args.ApiVersion = pulumi.StringPtr("rbac.authorization.k8s.io/v1")
args.Kind = pulumi.StringPtr("ClusterRole")
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1alpha1:ClusterRole"),
},
{
Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRole"),
},
})
opts = append(opts, aliases)
var resource ClusterRole
err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1:ClusterRole", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetClusterRole gets an existing ClusterRole 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 GetClusterRole(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClusterRoleState, opts ...pulumi.ResourceOption) (*ClusterRole, error) {
var resource ClusterRole
err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1:ClusterRole", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ClusterRole resources.
type clusterRoleState struct {
}
type ClusterRoleState struct {
}
func (ClusterRoleState) ElementType() reflect.Type {
return reflect.TypeOf((*clusterRoleState)(nil)).Elem()
}
type clusterRoleArgs struct {
// AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.
AggregationRule *AggregationRule `pulumi:"aggregationRule"`
// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
ApiVersion *string `pulumi:"apiVersion"`
// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Kind *string `pulumi:"kind"`
// Standard object's metadata.
Metadata *metav1.ObjectMeta `pulumi:"metadata"`
// Rules holds all the PolicyRules for this ClusterRole
Rules []PolicyRule `pulumi:"rules"`
}
// The set of arguments for constructing a ClusterRole resource.
type ClusterRoleArgs struct {
// AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.
AggregationRule AggregationRulePtrInput
// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
ApiVersion pulumi.StringPtrInput
// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Kind pulumi.StringPtrInput
// Standard object's metadata.
Metadata metav1.ObjectMetaPtrInput
// Rules holds all the PolicyRules for this ClusterRole
Rules PolicyRuleArrayInput
}
func (ClusterRoleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*clusterRoleArgs)(nil)).Elem()
}
type ClusterRoleInput interface {
pulumi.Input
ToClusterRoleOutput() ClusterRoleOutput
ToClusterRoleOutputWithContext(ctx context.Context) ClusterRoleOutput
}
func (*ClusterRole) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterRole)(nil)).Elem()
}
func (i *ClusterRole) ToClusterRoleOutput() ClusterRoleOutput {
return i.ToClusterRoleOutputWithContext(context.Background())
}
func (i *ClusterRole) ToClusterRoleOutputWithContext(ctx context.Context) ClusterRoleOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleOutput)
}
// ClusterRoleArrayInput is an input type that accepts ClusterRoleArray and ClusterRoleArrayOutput values.
// You can construct a concrete instance of `ClusterRoleArrayInput` via:
//
// ClusterRoleArray{ ClusterRoleArgs{...} }
type ClusterRoleArrayInput interface {
pulumi.Input
ToClusterRoleArrayOutput() ClusterRoleArrayOutput
ToClusterRoleArrayOutputWithContext(context.Context) ClusterRoleArrayOutput
}
type ClusterRoleArray []ClusterRoleInput
func (ClusterRoleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterRole)(nil)).Elem()
}
func (i ClusterRoleArray) ToClusterRoleArrayOutput() ClusterRoleArrayOutput {
return i.ToClusterRoleArrayOutputWithContext(context.Background())
}
func (i ClusterRoleArray) ToClusterRoleArrayOutputWithContext(ctx context.Context) ClusterRoleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleArrayOutput)
}
// ClusterRoleMapInput is an input type that accepts ClusterRoleMap and ClusterRoleMapOutput values.
// You can construct a concrete instance of `ClusterRoleMapInput` via:
//
// ClusterRoleMap{ "key": ClusterRoleArgs{...} }
type ClusterRoleMapInput interface {
pulumi.Input
ToClusterRoleMapOutput() ClusterRoleMapOutput
ToClusterRoleMapOutputWithContext(context.Context) ClusterRoleMapOutput
}
type ClusterRoleMap map[string]ClusterRoleInput
func (ClusterRoleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterRole)(nil)).Elem()
}
func (i ClusterRoleMap) ToClusterRoleMapOutput() ClusterRoleMapOutput {
return i.ToClusterRoleMapOutputWithContext(context.Background())
}
func (i ClusterRoleMap) ToClusterRoleMapOutputWithContext(ctx context.Context) ClusterRoleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleMapOutput)
}
type ClusterRoleOutput struct{ *pulumi.OutputState }
func (ClusterRoleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterRole)(nil)).Elem()
}
func (o ClusterRoleOutput) ToClusterRoleOutput() ClusterRoleOutput {
return o
}
func (o ClusterRoleOutput) ToClusterRoleOutputWithContext(ctx context.Context) ClusterRoleOutput {
return o
}
// AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.
func (o ClusterRoleOutput) AggregationRule() AggregationRulePtrOutput {
return o.ApplyT(func(v *ClusterRole) AggregationRulePtrOutput { return v.AggregationRule }).(AggregationRulePtrOutput)
}
// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
func (o ClusterRoleOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ClusterRole) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
func (o ClusterRoleOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ClusterRole) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
// Standard object's metadata.
func (o ClusterRoleOutput) Metadata() metav1.ObjectMetaPtrOutput {
return o.ApplyT(func(v *ClusterRole) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
}
// Rules holds all the PolicyRules for this ClusterRole
func (o ClusterRoleOutput) Rules() PolicyRuleArrayOutput {
return o.ApplyT(func(v *ClusterRole) PolicyRuleArrayOutput { return v.Rules }).(PolicyRuleArrayOutput)
}
type ClusterRoleArrayOutput struct{ *pulumi.OutputState }
func (ClusterRoleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterRole)(nil)).Elem()
}
func (o ClusterRoleArrayOutput) ToClusterRoleArrayOutput() ClusterRoleArrayOutput {
return o
}
func (o ClusterRoleArrayOutput) ToClusterRoleArrayOutputWithContext(ctx context.Context) ClusterRoleArrayOutput {
return o
}
func (o ClusterRoleArrayOutput) Index(i pulumi.IntInput) ClusterRoleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterRole {
return vs[0].([]*ClusterRole)[vs[1].(int)]
}).(ClusterRoleOutput)
}
type ClusterRoleMapOutput struct{ *pulumi.OutputState }
func (ClusterRoleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterRole)(nil)).Elem()
}
func (o ClusterRoleMapOutput) ToClusterRoleMapOutput() ClusterRoleMapOutput {
return o
}
func (o ClusterRoleMapOutput) ToClusterRoleMapOutputWithContext(ctx context.Context) ClusterRoleMapOutput {
return o
}
func (o ClusterRoleMapOutput) MapIndex(k pulumi.StringInput) ClusterRoleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterRole {
return vs[0].(map[string]*ClusterRole)[vs[1].(string)]
}).(ClusterRoleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleInput)(nil)).Elem(), &ClusterRole{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleArrayInput)(nil)).Elem(), ClusterRoleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleMapInput)(nil)).Elem(), ClusterRoleMap{})
pulumi.RegisterOutputType(ClusterRoleOutput{})
pulumi.RegisterOutputType(ClusterRoleArrayOutput{})
pulumi.RegisterOutputType(ClusterRoleMapOutput{})
}