github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/rbac/v1/clusterRoleBinding.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 // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. 16 type ClusterRoleBinding 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 only reference 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 // NewClusterRoleBinding registers a new resource with the given unique name, arguments, and options. 32 func NewClusterRoleBinding(ctx *pulumi.Context, 33 name string, args *ClusterRoleBindingArgs, opts ...pulumi.ResourceOption) (*ClusterRoleBinding, 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("ClusterRoleBinding") 43 aliases := pulumi.Aliases([]pulumi.Alias{ 44 { 45 Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1alpha1:ClusterRoleBinding"), 46 }, 47 { 48 Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRoleBinding"), 49 }, 50 }) 51 opts = append(opts, aliases) 52 var resource ClusterRoleBinding 53 err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding", name, args, &resource, opts...) 54 if err != nil { 55 return nil, err 56 } 57 return &resource, nil 58 } 59 60 // GetClusterRoleBinding gets an existing ClusterRoleBinding 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 GetClusterRoleBinding(ctx *pulumi.Context, 63 name string, id pulumi.IDInput, state *ClusterRoleBindingState, opts ...pulumi.ResourceOption) (*ClusterRoleBinding, error) { 64 var resource ClusterRoleBinding 65 err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding", 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 ClusterRoleBinding resources. 73 type clusterRoleBindingState struct { 74 } 75 76 type ClusterRoleBindingState struct { 77 } 78 79 func (ClusterRoleBindingState) ElementType() reflect.Type { 80 return reflect.TypeOf((*clusterRoleBindingState)(nil)).Elem() 81 } 82 83 type clusterRoleBindingArgs 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 only reference 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 ClusterRoleBinding resource. 97 type ClusterRoleBindingArgs 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 only reference 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 (ClusterRoleBindingArgs) ElementType() reflect.Type { 111 return reflect.TypeOf((*clusterRoleBindingArgs)(nil)).Elem() 112 } 113 114 type ClusterRoleBindingInput interface { 115 pulumi.Input 116 117 ToClusterRoleBindingOutput() ClusterRoleBindingOutput 118 ToClusterRoleBindingOutputWithContext(ctx context.Context) ClusterRoleBindingOutput 119 } 120 121 func (*ClusterRoleBinding) ElementType() reflect.Type { 122 return reflect.TypeOf((**ClusterRoleBinding)(nil)).Elem() 123 } 124 125 func (i *ClusterRoleBinding) ToClusterRoleBindingOutput() ClusterRoleBindingOutput { 126 return i.ToClusterRoleBindingOutputWithContext(context.Background()) 127 } 128 129 func (i *ClusterRoleBinding) ToClusterRoleBindingOutputWithContext(ctx context.Context) ClusterRoleBindingOutput { 130 return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleBindingOutput) 131 } 132 133 // ClusterRoleBindingArrayInput is an input type that accepts ClusterRoleBindingArray and ClusterRoleBindingArrayOutput values. 134 // You can construct a concrete instance of `ClusterRoleBindingArrayInput` via: 135 // 136 // ClusterRoleBindingArray{ ClusterRoleBindingArgs{...} } 137 type ClusterRoleBindingArrayInput interface { 138 pulumi.Input 139 140 ToClusterRoleBindingArrayOutput() ClusterRoleBindingArrayOutput 141 ToClusterRoleBindingArrayOutputWithContext(context.Context) ClusterRoleBindingArrayOutput 142 } 143 144 type ClusterRoleBindingArray []ClusterRoleBindingInput 145 146 func (ClusterRoleBindingArray) ElementType() reflect.Type { 147 return reflect.TypeOf((*[]*ClusterRoleBinding)(nil)).Elem() 148 } 149 150 func (i ClusterRoleBindingArray) ToClusterRoleBindingArrayOutput() ClusterRoleBindingArrayOutput { 151 return i.ToClusterRoleBindingArrayOutputWithContext(context.Background()) 152 } 153 154 func (i ClusterRoleBindingArray) ToClusterRoleBindingArrayOutputWithContext(ctx context.Context) ClusterRoleBindingArrayOutput { 155 return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleBindingArrayOutput) 156 } 157 158 // ClusterRoleBindingMapInput is an input type that accepts ClusterRoleBindingMap and ClusterRoleBindingMapOutput values. 159 // You can construct a concrete instance of `ClusterRoleBindingMapInput` via: 160 // 161 // ClusterRoleBindingMap{ "key": ClusterRoleBindingArgs{...} } 162 type ClusterRoleBindingMapInput interface { 163 pulumi.Input 164 165 ToClusterRoleBindingMapOutput() ClusterRoleBindingMapOutput 166 ToClusterRoleBindingMapOutputWithContext(context.Context) ClusterRoleBindingMapOutput 167 } 168 169 type ClusterRoleBindingMap map[string]ClusterRoleBindingInput 170 171 func (ClusterRoleBindingMap) ElementType() reflect.Type { 172 return reflect.TypeOf((*map[string]*ClusterRoleBinding)(nil)).Elem() 173 } 174 175 func (i ClusterRoleBindingMap) ToClusterRoleBindingMapOutput() ClusterRoleBindingMapOutput { 176 return i.ToClusterRoleBindingMapOutputWithContext(context.Background()) 177 } 178 179 func (i ClusterRoleBindingMap) ToClusterRoleBindingMapOutputWithContext(ctx context.Context) ClusterRoleBindingMapOutput { 180 return pulumi.ToOutputWithContext(ctx, i).(ClusterRoleBindingMapOutput) 181 } 182 183 type ClusterRoleBindingOutput struct{ *pulumi.OutputState } 184 185 func (ClusterRoleBindingOutput) ElementType() reflect.Type { 186 return reflect.TypeOf((**ClusterRoleBinding)(nil)).Elem() 187 } 188 189 func (o ClusterRoleBindingOutput) ToClusterRoleBindingOutput() ClusterRoleBindingOutput { 190 return o 191 } 192 193 func (o ClusterRoleBindingOutput) ToClusterRoleBindingOutputWithContext(ctx context.Context) ClusterRoleBindingOutput { 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 ClusterRoleBindingOutput) ApiVersion() pulumi.StringPtrOutput { 199 return o.ApplyT(func(v *ClusterRoleBinding) 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 ClusterRoleBindingOutput) Kind() pulumi.StringPtrOutput { 204 return o.ApplyT(func(v *ClusterRoleBinding) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput) 205 } 206 207 // Standard object's metadata. 208 func (o ClusterRoleBindingOutput) Metadata() metav1.ObjectMetaPtrOutput { 209 return o.ApplyT(func(v *ClusterRoleBinding) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput) 210 } 211 212 // RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. 213 func (o ClusterRoleBindingOutput) RoleRef() RoleRefOutput { 214 return o.ApplyT(func(v *ClusterRoleBinding) RoleRefOutput { return v.RoleRef }).(RoleRefOutput) 215 } 216 217 // Subjects holds references to the objects the role applies to. 218 func (o ClusterRoleBindingOutput) Subjects() SubjectArrayOutput { 219 return o.ApplyT(func(v *ClusterRoleBinding) SubjectArrayOutput { return v.Subjects }).(SubjectArrayOutput) 220 } 221 222 type ClusterRoleBindingArrayOutput struct{ *pulumi.OutputState } 223 224 func (ClusterRoleBindingArrayOutput) ElementType() reflect.Type { 225 return reflect.TypeOf((*[]*ClusterRoleBinding)(nil)).Elem() 226 } 227 228 func (o ClusterRoleBindingArrayOutput) ToClusterRoleBindingArrayOutput() ClusterRoleBindingArrayOutput { 229 return o 230 } 231 232 func (o ClusterRoleBindingArrayOutput) ToClusterRoleBindingArrayOutputWithContext(ctx context.Context) ClusterRoleBindingArrayOutput { 233 return o 234 } 235 236 func (o ClusterRoleBindingArrayOutput) Index(i pulumi.IntInput) ClusterRoleBindingOutput { 237 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterRoleBinding { 238 return vs[0].([]*ClusterRoleBinding)[vs[1].(int)] 239 }).(ClusterRoleBindingOutput) 240 } 241 242 type ClusterRoleBindingMapOutput struct{ *pulumi.OutputState } 243 244 func (ClusterRoleBindingMapOutput) ElementType() reflect.Type { 245 return reflect.TypeOf((*map[string]*ClusterRoleBinding)(nil)).Elem() 246 } 247 248 func (o ClusterRoleBindingMapOutput) ToClusterRoleBindingMapOutput() ClusterRoleBindingMapOutput { 249 return o 250 } 251 252 func (o ClusterRoleBindingMapOutput) ToClusterRoleBindingMapOutputWithContext(ctx context.Context) ClusterRoleBindingMapOutput { 253 return o 254 } 255 256 func (o ClusterRoleBindingMapOutput) MapIndex(k pulumi.StringInput) ClusterRoleBindingOutput { 257 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterRoleBinding { 258 return vs[0].(map[string]*ClusterRoleBinding)[vs[1].(string)] 259 }).(ClusterRoleBindingOutput) 260 } 261 262 func init() { 263 pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleBindingInput)(nil)).Elem(), &ClusterRoleBinding{}) 264 pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleBindingArrayInput)(nil)).Elem(), ClusterRoleBindingArray{}) 265 pulumi.RegisterInputType(reflect.TypeOf((*ClusterRoleBindingMapInput)(nil)).Elem(), ClusterRoleBindingMap{}) 266 pulumi.RegisterOutputType(ClusterRoleBindingOutput{}) 267 pulumi.RegisterOutputType(ClusterRoleBindingArrayOutput{}) 268 pulumi.RegisterOutputType(ClusterRoleBindingMapOutput{}) 269 }