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