-
Notifications
You must be signed in to change notification settings - Fork 113
/
roleBinding.go
271 lines (220 loc) · 11.9 KB
/
roleBinding.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
// 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"
"errors"
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/utilities"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.
type RoleBinding struct {
pulumi.CustomResourceState
// 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.StringOutput `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.StringOutput `pulumi:"kind"`
// Standard object's metadata.
Metadata metav1.ObjectMetaOutput `pulumi:"metadata"`
// RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.
RoleRef RoleRefOutput `pulumi:"roleRef"`
// Subjects holds references to the objects the role applies to.
Subjects SubjectArrayOutput `pulumi:"subjects"`
}
// NewRoleBinding registers a new resource with the given unique name, arguments, and options.
func NewRoleBinding(ctx *pulumi.Context,
name string, args *RoleBindingArgs, opts ...pulumi.ResourceOption) (*RoleBinding, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RoleRef == nil {
return nil, errors.New("invalid value for required argument 'RoleRef'")
}
args.ApiVersion = pulumi.StringPtr("rbac.authorization.k8s.io/v1")
args.Kind = pulumi.StringPtr("RoleBinding")
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1alpha1:RoleBinding"),
},
{
Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:RoleBinding"),
},
})
opts = append(opts, aliases)
opts = utilities.PkgResourceDefaultOpts(opts)
var resource RoleBinding
err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1:RoleBinding", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRoleBinding gets an existing RoleBinding 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 GetRoleBinding(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RoleBindingState, opts ...pulumi.ResourceOption) (*RoleBinding, error) {
var resource RoleBinding
err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1:RoleBinding", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RoleBinding resources.
type roleBindingState struct {
}
type RoleBindingState struct {
}
func (RoleBindingState) ElementType() reflect.Type {
return reflect.TypeOf((*roleBindingState)(nil)).Elem()
}
type roleBindingArgs struct {
// 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"`
// RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.
RoleRef RoleRef `pulumi:"roleRef"`
// Subjects holds references to the objects the role applies to.
Subjects []Subject `pulumi:"subjects"`
}
// The set of arguments for constructing a RoleBinding resource.
type RoleBindingArgs struct {
// 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
// RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.
RoleRef RoleRefInput
// Subjects holds references to the objects the role applies to.
Subjects SubjectArrayInput
}
func (RoleBindingArgs) ElementType() reflect.Type {
return reflect.TypeOf((*roleBindingArgs)(nil)).Elem()
}
type RoleBindingInput interface {
pulumi.Input
ToRoleBindingOutput() RoleBindingOutput
ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput
}
func (*RoleBinding) ElementType() reflect.Type {
return reflect.TypeOf((**RoleBinding)(nil)).Elem()
}
func (i *RoleBinding) ToRoleBindingOutput() RoleBindingOutput {
return i.ToRoleBindingOutputWithContext(context.Background())
}
func (i *RoleBinding) ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput {
return pulumi.ToOutputWithContext(ctx, i).(RoleBindingOutput)
}
// RoleBindingArrayInput is an input type that accepts RoleBindingArray and RoleBindingArrayOutput values.
// You can construct a concrete instance of `RoleBindingArrayInput` via:
//
// RoleBindingArray{ RoleBindingArgs{...} }
type RoleBindingArrayInput interface {
pulumi.Input
ToRoleBindingArrayOutput() RoleBindingArrayOutput
ToRoleBindingArrayOutputWithContext(context.Context) RoleBindingArrayOutput
}
type RoleBindingArray []RoleBindingInput
func (RoleBindingArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RoleBinding)(nil)).Elem()
}
func (i RoleBindingArray) ToRoleBindingArrayOutput() RoleBindingArrayOutput {
return i.ToRoleBindingArrayOutputWithContext(context.Background())
}
func (i RoleBindingArray) ToRoleBindingArrayOutputWithContext(ctx context.Context) RoleBindingArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RoleBindingArrayOutput)
}
// RoleBindingMapInput is an input type that accepts RoleBindingMap and RoleBindingMapOutput values.
// You can construct a concrete instance of `RoleBindingMapInput` via:
//
// RoleBindingMap{ "key": RoleBindingArgs{...} }
type RoleBindingMapInput interface {
pulumi.Input
ToRoleBindingMapOutput() RoleBindingMapOutput
ToRoleBindingMapOutputWithContext(context.Context) RoleBindingMapOutput
}
type RoleBindingMap map[string]RoleBindingInput
func (RoleBindingMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RoleBinding)(nil)).Elem()
}
func (i RoleBindingMap) ToRoleBindingMapOutput() RoleBindingMapOutput {
return i.ToRoleBindingMapOutputWithContext(context.Background())
}
func (i RoleBindingMap) ToRoleBindingMapOutputWithContext(ctx context.Context) RoleBindingMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RoleBindingMapOutput)
}
type RoleBindingOutput struct{ *pulumi.OutputState }
func (RoleBindingOutput) ElementType() reflect.Type {
return reflect.TypeOf((**RoleBinding)(nil)).Elem()
}
func (o RoleBindingOutput) ToRoleBindingOutput() RoleBindingOutput {
return o
}
func (o RoleBindingOutput) ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput {
return o
}
// 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 RoleBindingOutput) ApiVersion() pulumi.StringOutput {
return o.ApplyT(func(v *RoleBinding) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)
}
// 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 RoleBindingOutput) Kind() pulumi.StringOutput {
return o.ApplyT(func(v *RoleBinding) pulumi.StringOutput { return v.Kind }).(pulumi.StringOutput)
}
// Standard object's metadata.
func (o RoleBindingOutput) Metadata() metav1.ObjectMetaOutput {
return o.ApplyT(func(v *RoleBinding) metav1.ObjectMetaOutput { return v.Metadata }).(metav1.ObjectMetaOutput)
}
// RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.
func (o RoleBindingOutput) RoleRef() RoleRefOutput {
return o.ApplyT(func(v *RoleBinding) RoleRefOutput { return v.RoleRef }).(RoleRefOutput)
}
// Subjects holds references to the objects the role applies to.
func (o RoleBindingOutput) Subjects() SubjectArrayOutput {
return o.ApplyT(func(v *RoleBinding) SubjectArrayOutput { return v.Subjects }).(SubjectArrayOutput)
}
type RoleBindingArrayOutput struct{ *pulumi.OutputState }
func (RoleBindingArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RoleBinding)(nil)).Elem()
}
func (o RoleBindingArrayOutput) ToRoleBindingArrayOutput() RoleBindingArrayOutput {
return o
}
func (o RoleBindingArrayOutput) ToRoleBindingArrayOutputWithContext(ctx context.Context) RoleBindingArrayOutput {
return o
}
func (o RoleBindingArrayOutput) Index(i pulumi.IntInput) RoleBindingOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RoleBinding {
return vs[0].([]*RoleBinding)[vs[1].(int)]
}).(RoleBindingOutput)
}
type RoleBindingMapOutput struct{ *pulumi.OutputState }
func (RoleBindingMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RoleBinding)(nil)).Elem()
}
func (o RoleBindingMapOutput) ToRoleBindingMapOutput() RoleBindingMapOutput {
return o
}
func (o RoleBindingMapOutput) ToRoleBindingMapOutputWithContext(ctx context.Context) RoleBindingMapOutput {
return o
}
func (o RoleBindingMapOutput) MapIndex(k pulumi.StringInput) RoleBindingOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RoleBinding {
return vs[0].(map[string]*RoleBinding)[vs[1].(string)]
}).(RoleBindingOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingInput)(nil)).Elem(), &RoleBinding{})
pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingArrayInput)(nil)).Elem(), RoleBindingArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingMapInput)(nil)).Elem(), RoleBindingMap{})
pulumi.RegisterOutputType(RoleBindingOutput{})
pulumi.RegisterOutputType(RoleBindingArrayOutput{})
pulumi.RegisterOutputType(RoleBindingMapOutput{})
}