github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/rbac/v1/roleBinding.go (about) 1 // Code generated by pulumigen DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package v1 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // 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. 16 type RoleBinding struct { 17 pulumi.CustomResourceState 18 19 // 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 20 ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"` 21 // 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 22 Kind pulumi.StringPtrOutput `pulumi:"kind"` 23 // Standard object's metadata. 24 Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"` 25 // 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. 26 RoleRef RoleRefOutput `pulumi:"roleRef"` 27 // Subjects holds references to the objects the role applies to. 28 Subjects SubjectArrayOutput `pulumi:"subjects"` 29 } 30 31 // NewRoleBinding registers a new resource with the given unique name, arguments, and options. 32 func NewRoleBinding(ctx *pulumi.Context, 33 name string, args *RoleBindingArgs, opts ...pulumi.ResourceOption) (*RoleBinding, error) { 34 if args == nil { 35 return nil, errors.New("missing one or more required arguments") 36 } 37 38 if args.RoleRef == nil { 39 return nil, errors.New("invalid value for required argument 'RoleRef'") 40 } 41 args.ApiVersion = pulumi.StringPtr("rbac.authorization.k8s.io/v1") 42 args.Kind = pulumi.StringPtr("RoleBinding") 43 aliases := pulumi.Aliases([]pulumi.Alias{ 44 { 45 Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1alpha1:RoleBinding"), 46 }, 47 { 48 Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:RoleBinding"), 49 }, 50 }) 51 opts = append(opts, aliases) 52 var resource RoleBinding 53 err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1:RoleBinding", name, args, &resource, opts...) 54 if err != nil { 55 return nil, err 56 } 57 return &resource, nil 58 } 59 60 // GetRoleBinding gets an existing RoleBinding resource's state with the given name, ID, and optional 61 // state properties that are used to uniquely qualify the lookup (nil if not required). 62 func GetRoleBinding(ctx *pulumi.Context, 63 name string, id pulumi.IDInput, state *RoleBindingState, opts ...pulumi.ResourceOption) (*RoleBinding, error) { 64 var resource RoleBinding 65 err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1:RoleBinding", name, id, state, &resource, opts...) 66 if err != nil { 67 return nil, err 68 } 69 return &resource, nil 70 } 71 72 // Input properties used for looking up and filtering RoleBinding resources. 73 type roleBindingState struct { 74 } 75 76 type RoleBindingState struct { 77 } 78 79 func (RoleBindingState) ElementType() reflect.Type { 80 return reflect.TypeOf((*roleBindingState)(nil)).Elem() 81 } 82 83 type roleBindingArgs struct { 84 // 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 85 ApiVersion *string `pulumi:"apiVersion"` 86 // 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 87 Kind *string `pulumi:"kind"` 88 // Standard object's metadata. 89 Metadata *metav1.ObjectMeta `pulumi:"metadata"` 90 // 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. 91 RoleRef RoleRef `pulumi:"roleRef"` 92 // Subjects holds references to the objects the role applies to. 93 Subjects []Subject `pulumi:"subjects"` 94 } 95 96 // The set of arguments for constructing a RoleBinding resource. 97 type RoleBindingArgs struct { 98 // 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 99 ApiVersion pulumi.StringPtrInput 100 // 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 101 Kind pulumi.StringPtrInput 102 // Standard object's metadata. 103 Metadata metav1.ObjectMetaPtrInput 104 // 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. 105 RoleRef RoleRefInput 106 // Subjects holds references to the objects the role applies to. 107 Subjects SubjectArrayInput 108 } 109 110 func (RoleBindingArgs) ElementType() reflect.Type { 111 return reflect.TypeOf((*roleBindingArgs)(nil)).Elem() 112 } 113 114 type RoleBindingInput interface { 115 pulumi.Input 116 117 ToRoleBindingOutput() RoleBindingOutput 118 ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput 119 } 120 121 func (*RoleBinding) ElementType() reflect.Type { 122 return reflect.TypeOf((**RoleBinding)(nil)).Elem() 123 } 124 125 func (i *RoleBinding) ToRoleBindingOutput() RoleBindingOutput { 126 return i.ToRoleBindingOutputWithContext(context.Background()) 127 } 128 129 func (i *RoleBinding) ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput { 130 return pulumi.ToOutputWithContext(ctx, i).(RoleBindingOutput) 131 } 132 133 // RoleBindingArrayInput is an input type that accepts RoleBindingArray and RoleBindingArrayOutput values. 134 // You can construct a concrete instance of `RoleBindingArrayInput` via: 135 // 136 // RoleBindingArray{ RoleBindingArgs{...} } 137 type RoleBindingArrayInput interface { 138 pulumi.Input 139 140 ToRoleBindingArrayOutput() RoleBindingArrayOutput 141 ToRoleBindingArrayOutputWithContext(context.Context) RoleBindingArrayOutput 142 } 143 144 type RoleBindingArray []RoleBindingInput 145 146 func (RoleBindingArray) ElementType() reflect.Type { 147 return reflect.TypeOf((*[]*RoleBinding)(nil)).Elem() 148 } 149 150 func (i RoleBindingArray) ToRoleBindingArrayOutput() RoleBindingArrayOutput { 151 return i.ToRoleBindingArrayOutputWithContext(context.Background()) 152 } 153 154 func (i RoleBindingArray) ToRoleBindingArrayOutputWithContext(ctx context.Context) RoleBindingArrayOutput { 155 return pulumi.ToOutputWithContext(ctx, i).(RoleBindingArrayOutput) 156 } 157 158 // RoleBindingMapInput is an input type that accepts RoleBindingMap and RoleBindingMapOutput values. 159 // You can construct a concrete instance of `RoleBindingMapInput` via: 160 // 161 // RoleBindingMap{ "key": RoleBindingArgs{...} } 162 type RoleBindingMapInput interface { 163 pulumi.Input 164 165 ToRoleBindingMapOutput() RoleBindingMapOutput 166 ToRoleBindingMapOutputWithContext(context.Context) RoleBindingMapOutput 167 } 168 169 type RoleBindingMap map[string]RoleBindingInput 170 171 func (RoleBindingMap) ElementType() reflect.Type { 172 return reflect.TypeOf((*map[string]*RoleBinding)(nil)).Elem() 173 } 174 175 func (i RoleBindingMap) ToRoleBindingMapOutput() RoleBindingMapOutput { 176 return i.ToRoleBindingMapOutputWithContext(context.Background()) 177 } 178 179 func (i RoleBindingMap) ToRoleBindingMapOutputWithContext(ctx context.Context) RoleBindingMapOutput { 180 return pulumi.ToOutputWithContext(ctx, i).(RoleBindingMapOutput) 181 } 182 183 type RoleBindingOutput struct{ *pulumi.OutputState } 184 185 func (RoleBindingOutput) ElementType() reflect.Type { 186 return reflect.TypeOf((**RoleBinding)(nil)).Elem() 187 } 188 189 func (o RoleBindingOutput) ToRoleBindingOutput() RoleBindingOutput { 190 return o 191 } 192 193 func (o RoleBindingOutput) ToRoleBindingOutputWithContext(ctx context.Context) RoleBindingOutput { 194 return o 195 } 196 197 // 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 198 func (o RoleBindingOutput) ApiVersion() pulumi.StringPtrOutput { 199 return o.ApplyT(func(v *RoleBinding) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput) 200 } 201 202 // 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 203 func (o RoleBindingOutput) Kind() pulumi.StringPtrOutput { 204 return o.ApplyT(func(v *RoleBinding) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput) 205 } 206 207 // Standard object's metadata. 208 func (o RoleBindingOutput) Metadata() metav1.ObjectMetaPtrOutput { 209 return o.ApplyT(func(v *RoleBinding) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput) 210 } 211 212 // 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. 213 func (o RoleBindingOutput) RoleRef() RoleRefOutput { 214 return o.ApplyT(func(v *RoleBinding) RoleRefOutput { return v.RoleRef }).(RoleRefOutput) 215 } 216 217 // Subjects holds references to the objects the role applies to. 218 func (o RoleBindingOutput) Subjects() SubjectArrayOutput { 219 return o.ApplyT(func(v *RoleBinding) SubjectArrayOutput { return v.Subjects }).(SubjectArrayOutput) 220 } 221 222 type RoleBindingArrayOutput struct{ *pulumi.OutputState } 223 224 func (RoleBindingArrayOutput) ElementType() reflect.Type { 225 return reflect.TypeOf((*[]*RoleBinding)(nil)).Elem() 226 } 227 228 func (o RoleBindingArrayOutput) ToRoleBindingArrayOutput() RoleBindingArrayOutput { 229 return o 230 } 231 232 func (o RoleBindingArrayOutput) ToRoleBindingArrayOutputWithContext(ctx context.Context) RoleBindingArrayOutput { 233 return o 234 } 235 236 func (o RoleBindingArrayOutput) Index(i pulumi.IntInput) RoleBindingOutput { 237 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RoleBinding { 238 return vs[0].([]*RoleBinding)[vs[1].(int)] 239 }).(RoleBindingOutput) 240 } 241 242 type RoleBindingMapOutput struct{ *pulumi.OutputState } 243 244 func (RoleBindingMapOutput) ElementType() reflect.Type { 245 return reflect.TypeOf((*map[string]*RoleBinding)(nil)).Elem() 246 } 247 248 func (o RoleBindingMapOutput) ToRoleBindingMapOutput() RoleBindingMapOutput { 249 return o 250 } 251 252 func (o RoleBindingMapOutput) ToRoleBindingMapOutputWithContext(ctx context.Context) RoleBindingMapOutput { 253 return o 254 } 255 256 func (o RoleBindingMapOutput) MapIndex(k pulumi.StringInput) RoleBindingOutput { 257 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RoleBinding { 258 return vs[0].(map[string]*RoleBinding)[vs[1].(string)] 259 }).(RoleBindingOutput) 260 } 261 262 func init() { 263 pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingInput)(nil)).Elem(), &RoleBinding{}) 264 pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingArrayInput)(nil)).Elem(), RoleBindingArray{}) 265 pulumi.RegisterInputType(reflect.TypeOf((*RoleBindingMapInput)(nil)).Elem(), RoleBindingMap{}) 266 pulumi.RegisterOutputType(RoleBindingOutput{}) 267 pulumi.RegisterOutputType(RoleBindingArrayOutput{}) 268 pulumi.RegisterOutputType(RoleBindingMapOutput{}) 269 }