github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/rbac/v1alpha1/role.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 v1alpha1
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. Deprecated in v1.17 in favor of rbac.authorization.k8s.io/v1 Role, and will no longer be served in v1.20.
    15  type Role struct {
    16  	pulumi.CustomResourceState
    17  
    18  	// 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
    19  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    20  	// 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
    21  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    22  	// Standard object's metadata.
    23  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    24  	// Rules holds all the PolicyRules for this Role
    25  	Rules PolicyRuleArrayOutput `pulumi:"rules"`
    26  }
    27  
    28  // NewRole registers a new resource with the given unique name, arguments, and options.
    29  func NewRole(ctx *pulumi.Context,
    30  	name string, args *RoleArgs, opts ...pulumi.ResourceOption) (*Role, error) {
    31  	if args == nil {
    32  		args = &RoleArgs{}
    33  	}
    34  
    35  	args.ApiVersion = pulumi.StringPtr("rbac.authorization.k8s.io/v1alpha1")
    36  	args.Kind = pulumi.StringPtr("Role")
    37  	aliases := pulumi.Aliases([]pulumi.Alias{
    38  		{
    39  			Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1:Role"),
    40  		},
    41  		{
    42  			Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:Role"),
    43  		},
    44  	})
    45  	opts = append(opts, aliases)
    46  	var resource Role
    47  	err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1alpha1:Role", name, args, &resource, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return &resource, nil
    52  }
    53  
    54  // GetRole gets an existing Role resource's state with the given name, ID, and optional
    55  // state properties that are used to uniquely qualify the lookup (nil if not required).
    56  func GetRole(ctx *pulumi.Context,
    57  	name string, id pulumi.IDInput, state *RoleState, opts ...pulumi.ResourceOption) (*Role, error) {
    58  	var resource Role
    59  	err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1alpha1:Role", name, id, state, &resource, opts...)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	return &resource, nil
    64  }
    65  
    66  // Input properties used for looking up and filtering Role resources.
    67  type roleState struct {
    68  }
    69  
    70  type RoleState struct {
    71  }
    72  
    73  func (RoleState) ElementType() reflect.Type {
    74  	return reflect.TypeOf((*roleState)(nil)).Elem()
    75  }
    76  
    77  type roleArgs struct {
    78  	// 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
    79  	ApiVersion *string `pulumi:"apiVersion"`
    80  	// 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
    81  	Kind *string `pulumi:"kind"`
    82  	// Standard object's metadata.
    83  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
    84  	// Rules holds all the PolicyRules for this Role
    85  	Rules []PolicyRule `pulumi:"rules"`
    86  }
    87  
    88  // The set of arguments for constructing a Role resource.
    89  type RoleArgs struct {
    90  	// 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
    91  	ApiVersion pulumi.StringPtrInput
    92  	// 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
    93  	Kind pulumi.StringPtrInput
    94  	// Standard object's metadata.
    95  	Metadata metav1.ObjectMetaPtrInput
    96  	// Rules holds all the PolicyRules for this Role
    97  	Rules PolicyRuleArrayInput
    98  }
    99  
   100  func (RoleArgs) ElementType() reflect.Type {
   101  	return reflect.TypeOf((*roleArgs)(nil)).Elem()
   102  }
   103  
   104  type RoleInput interface {
   105  	pulumi.Input
   106  
   107  	ToRoleOutput() RoleOutput
   108  	ToRoleOutputWithContext(ctx context.Context) RoleOutput
   109  }
   110  
   111  func (*Role) ElementType() reflect.Type {
   112  	return reflect.TypeOf((**Role)(nil)).Elem()
   113  }
   114  
   115  func (i *Role) ToRoleOutput() RoleOutput {
   116  	return i.ToRoleOutputWithContext(context.Background())
   117  }
   118  
   119  func (i *Role) ToRoleOutputWithContext(ctx context.Context) RoleOutput {
   120  	return pulumi.ToOutputWithContext(ctx, i).(RoleOutput)
   121  }
   122  
   123  // RoleArrayInput is an input type that accepts RoleArray and RoleArrayOutput values.
   124  // You can construct a concrete instance of `RoleArrayInput` via:
   125  //
   126  //	RoleArray{ RoleArgs{...} }
   127  type RoleArrayInput interface {
   128  	pulumi.Input
   129  
   130  	ToRoleArrayOutput() RoleArrayOutput
   131  	ToRoleArrayOutputWithContext(context.Context) RoleArrayOutput
   132  }
   133  
   134  type RoleArray []RoleInput
   135  
   136  func (RoleArray) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*[]*Role)(nil)).Elem()
   138  }
   139  
   140  func (i RoleArray) ToRoleArrayOutput() RoleArrayOutput {
   141  	return i.ToRoleArrayOutputWithContext(context.Background())
   142  }
   143  
   144  func (i RoleArray) ToRoleArrayOutputWithContext(ctx context.Context) RoleArrayOutput {
   145  	return pulumi.ToOutputWithContext(ctx, i).(RoleArrayOutput)
   146  }
   147  
   148  // RoleMapInput is an input type that accepts RoleMap and RoleMapOutput values.
   149  // You can construct a concrete instance of `RoleMapInput` via:
   150  //
   151  //	RoleMap{ "key": RoleArgs{...} }
   152  type RoleMapInput interface {
   153  	pulumi.Input
   154  
   155  	ToRoleMapOutput() RoleMapOutput
   156  	ToRoleMapOutputWithContext(context.Context) RoleMapOutput
   157  }
   158  
   159  type RoleMap map[string]RoleInput
   160  
   161  func (RoleMap) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*map[string]*Role)(nil)).Elem()
   163  }
   164  
   165  func (i RoleMap) ToRoleMapOutput() RoleMapOutput {
   166  	return i.ToRoleMapOutputWithContext(context.Background())
   167  }
   168  
   169  func (i RoleMap) ToRoleMapOutputWithContext(ctx context.Context) RoleMapOutput {
   170  	return pulumi.ToOutputWithContext(ctx, i).(RoleMapOutput)
   171  }
   172  
   173  type RoleOutput struct{ *pulumi.OutputState }
   174  
   175  func (RoleOutput) ElementType() reflect.Type {
   176  	return reflect.TypeOf((**Role)(nil)).Elem()
   177  }
   178  
   179  func (o RoleOutput) ToRoleOutput() RoleOutput {
   180  	return o
   181  }
   182  
   183  func (o RoleOutput) ToRoleOutputWithContext(ctx context.Context) RoleOutput {
   184  	return o
   185  }
   186  
   187  // 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
   188  func (o RoleOutput) ApiVersion() pulumi.StringPtrOutput {
   189  	return o.ApplyT(func(v *Role) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   190  }
   191  
   192  // 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
   193  func (o RoleOutput) Kind() pulumi.StringPtrOutput {
   194  	return o.ApplyT(func(v *Role) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   195  }
   196  
   197  // Standard object's metadata.
   198  func (o RoleOutput) Metadata() metav1.ObjectMetaPtrOutput {
   199  	return o.ApplyT(func(v *Role) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   200  }
   201  
   202  // Rules holds all the PolicyRules for this Role
   203  func (o RoleOutput) Rules() PolicyRuleArrayOutput {
   204  	return o.ApplyT(func(v *Role) PolicyRuleArrayOutput { return v.Rules }).(PolicyRuleArrayOutput)
   205  }
   206  
   207  type RoleArrayOutput struct{ *pulumi.OutputState }
   208  
   209  func (RoleArrayOutput) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*[]*Role)(nil)).Elem()
   211  }
   212  
   213  func (o RoleArrayOutput) ToRoleArrayOutput() RoleArrayOutput {
   214  	return o
   215  }
   216  
   217  func (o RoleArrayOutput) ToRoleArrayOutputWithContext(ctx context.Context) RoleArrayOutput {
   218  	return o
   219  }
   220  
   221  func (o RoleArrayOutput) Index(i pulumi.IntInput) RoleOutput {
   222  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Role {
   223  		return vs[0].([]*Role)[vs[1].(int)]
   224  	}).(RoleOutput)
   225  }
   226  
   227  type RoleMapOutput struct{ *pulumi.OutputState }
   228  
   229  func (RoleMapOutput) ElementType() reflect.Type {
   230  	return reflect.TypeOf((*map[string]*Role)(nil)).Elem()
   231  }
   232  
   233  func (o RoleMapOutput) ToRoleMapOutput() RoleMapOutput {
   234  	return o
   235  }
   236  
   237  func (o RoleMapOutput) ToRoleMapOutputWithContext(ctx context.Context) RoleMapOutput {
   238  	return o
   239  }
   240  
   241  func (o RoleMapOutput) MapIndex(k pulumi.StringInput) RoleOutput {
   242  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Role {
   243  		return vs[0].(map[string]*Role)[vs[1].(string)]
   244  	}).(RoleOutput)
   245  }
   246  
   247  func init() {
   248  	pulumi.RegisterInputType(reflect.TypeOf((*RoleInput)(nil)).Elem(), &Role{})
   249  	pulumi.RegisterInputType(reflect.TypeOf((*RoleArrayInput)(nil)).Elem(), RoleArray{})
   250  	pulumi.RegisterInputType(reflect.TypeOf((*RoleMapInput)(nil)).Elem(), RoleMap{})
   251  	pulumi.RegisterOutputType(RoleOutput{})
   252  	pulumi.RegisterOutputType(RoleArrayOutput{})
   253  	pulumi.RegisterOutputType(RoleMapOutput{})
   254  }