github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/rbac/v1/rolePatch.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  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Patch resources are used to modify existing Kubernetes resources by using
    15  // Server-Side Apply updates. The name of the resource must be specified, but all other properties are optional. More than
    16  // one patch may be applied to the same resource, and a random FieldManager name will be used for each Patch resource.
    17  // Conflicts will result in an error by default, but can be forced using the "pulumi.com/patchForce" annotation. See the
    18  // [Server-Side Apply Docs](https://www.pulumi.com/registry/packages/kubernetes/how-to-guides/managing-resources-with-server-side-apply/) for
    19  // additional information about using Server-Side Apply to manage Kubernetes resources with Pulumi.
    20  // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
    21  type RolePatch struct {
    22  	pulumi.CustomResourceState
    23  
    24  	// 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
    25  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    26  	// 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
    27  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    28  	// Standard object's metadata.
    29  	Metadata metav1.ObjectMetaPatchPtrOutput `pulumi:"metadata"`
    30  	// Rules holds all the PolicyRules for this Role
    31  	Rules PolicyRulePatchArrayOutput `pulumi:"rules"`
    32  }
    33  
    34  // NewRolePatch registers a new resource with the given unique name, arguments, and options.
    35  func NewRolePatch(ctx *pulumi.Context,
    36  	name string, args *RolePatchArgs, opts ...pulumi.ResourceOption) (*RolePatch, error) {
    37  	if args == nil {
    38  		args = &RolePatchArgs{}
    39  	}
    40  
    41  	args.ApiVersion = pulumi.StringPtr("rbac.authorization.k8s.io/v1")
    42  	args.Kind = pulumi.StringPtr("Role")
    43  	aliases := pulumi.Aliases([]pulumi.Alias{
    44  		{
    45  			Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1alpha1:RolePatch"),
    46  		},
    47  		{
    48  			Type: pulumi.String("kubernetes:rbac.authorization.k8s.io/v1beta1:RolePatch"),
    49  		},
    50  	})
    51  	opts = append(opts, aliases)
    52  	var resource RolePatch
    53  	err := ctx.RegisterResource("kubernetes:rbac.authorization.k8s.io/v1:RolePatch", name, args, &resource, opts...)
    54  	if err != nil {
    55  		return nil, err
    56  	}
    57  	return &resource, nil
    58  }
    59  
    60  // GetRolePatch gets an existing RolePatch 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 GetRolePatch(ctx *pulumi.Context,
    63  	name string, id pulumi.IDInput, state *RolePatchState, opts ...pulumi.ResourceOption) (*RolePatch, error) {
    64  	var resource RolePatch
    65  	err := ctx.ReadResource("kubernetes:rbac.authorization.k8s.io/v1:RolePatch", 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 RolePatch resources.
    73  type rolePatchState struct {
    74  }
    75  
    76  type RolePatchState struct {
    77  }
    78  
    79  func (RolePatchState) ElementType() reflect.Type {
    80  	return reflect.TypeOf((*rolePatchState)(nil)).Elem()
    81  }
    82  
    83  type rolePatchArgs 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.ObjectMetaPatch `pulumi:"metadata"`
    90  	// Rules holds all the PolicyRules for this Role
    91  	Rules []PolicyRulePatch `pulumi:"rules"`
    92  }
    93  
    94  // The set of arguments for constructing a RolePatch resource.
    95  type RolePatchArgs struct {
    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.ObjectMetaPatchPtrInput
   102  	// Rules holds all the PolicyRules for this Role
   103  	Rules PolicyRulePatchArrayInput
   104  }
   105  
   106  func (RolePatchArgs) ElementType() reflect.Type {
   107  	return reflect.TypeOf((*rolePatchArgs)(nil)).Elem()
   108  }
   109  
   110  type RolePatchInput interface {
   111  	pulumi.Input
   112  
   113  	ToRolePatchOutput() RolePatchOutput
   114  	ToRolePatchOutputWithContext(ctx context.Context) RolePatchOutput
   115  }
   116  
   117  func (*RolePatch) ElementType() reflect.Type {
   118  	return reflect.TypeOf((**RolePatch)(nil)).Elem()
   119  }
   120  
   121  func (i *RolePatch) ToRolePatchOutput() RolePatchOutput {
   122  	return i.ToRolePatchOutputWithContext(context.Background())
   123  }
   124  
   125  func (i *RolePatch) ToRolePatchOutputWithContext(ctx context.Context) RolePatchOutput {
   126  	return pulumi.ToOutputWithContext(ctx, i).(RolePatchOutput)
   127  }
   128  
   129  // RolePatchArrayInput is an input type that accepts RolePatchArray and RolePatchArrayOutput values.
   130  // You can construct a concrete instance of `RolePatchArrayInput` via:
   131  //
   132  //	RolePatchArray{ RolePatchArgs{...} }
   133  type RolePatchArrayInput interface {
   134  	pulumi.Input
   135  
   136  	ToRolePatchArrayOutput() RolePatchArrayOutput
   137  	ToRolePatchArrayOutputWithContext(context.Context) RolePatchArrayOutput
   138  }
   139  
   140  type RolePatchArray []RolePatchInput
   141  
   142  func (RolePatchArray) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*[]*RolePatch)(nil)).Elem()
   144  }
   145  
   146  func (i RolePatchArray) ToRolePatchArrayOutput() RolePatchArrayOutput {
   147  	return i.ToRolePatchArrayOutputWithContext(context.Background())
   148  }
   149  
   150  func (i RolePatchArray) ToRolePatchArrayOutputWithContext(ctx context.Context) RolePatchArrayOutput {
   151  	return pulumi.ToOutputWithContext(ctx, i).(RolePatchArrayOutput)
   152  }
   153  
   154  // RolePatchMapInput is an input type that accepts RolePatchMap and RolePatchMapOutput values.
   155  // You can construct a concrete instance of `RolePatchMapInput` via:
   156  //
   157  //	RolePatchMap{ "key": RolePatchArgs{...} }
   158  type RolePatchMapInput interface {
   159  	pulumi.Input
   160  
   161  	ToRolePatchMapOutput() RolePatchMapOutput
   162  	ToRolePatchMapOutputWithContext(context.Context) RolePatchMapOutput
   163  }
   164  
   165  type RolePatchMap map[string]RolePatchInput
   166  
   167  func (RolePatchMap) ElementType() reflect.Type {
   168  	return reflect.TypeOf((*map[string]*RolePatch)(nil)).Elem()
   169  }
   170  
   171  func (i RolePatchMap) ToRolePatchMapOutput() RolePatchMapOutput {
   172  	return i.ToRolePatchMapOutputWithContext(context.Background())
   173  }
   174  
   175  func (i RolePatchMap) ToRolePatchMapOutputWithContext(ctx context.Context) RolePatchMapOutput {
   176  	return pulumi.ToOutputWithContext(ctx, i).(RolePatchMapOutput)
   177  }
   178  
   179  type RolePatchOutput struct{ *pulumi.OutputState }
   180  
   181  func (RolePatchOutput) ElementType() reflect.Type {
   182  	return reflect.TypeOf((**RolePatch)(nil)).Elem()
   183  }
   184  
   185  func (o RolePatchOutput) ToRolePatchOutput() RolePatchOutput {
   186  	return o
   187  }
   188  
   189  func (o RolePatchOutput) ToRolePatchOutputWithContext(ctx context.Context) RolePatchOutput {
   190  	return o
   191  }
   192  
   193  // 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
   194  func (o RolePatchOutput) ApiVersion() pulumi.StringPtrOutput {
   195  	return o.ApplyT(func(v *RolePatch) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   196  }
   197  
   198  // 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
   199  func (o RolePatchOutput) Kind() pulumi.StringPtrOutput {
   200  	return o.ApplyT(func(v *RolePatch) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   201  }
   202  
   203  // Standard object's metadata.
   204  func (o RolePatchOutput) Metadata() metav1.ObjectMetaPatchPtrOutput {
   205  	return o.ApplyT(func(v *RolePatch) metav1.ObjectMetaPatchPtrOutput { return v.Metadata }).(metav1.ObjectMetaPatchPtrOutput)
   206  }
   207  
   208  // Rules holds all the PolicyRules for this Role
   209  func (o RolePatchOutput) Rules() PolicyRulePatchArrayOutput {
   210  	return o.ApplyT(func(v *RolePatch) PolicyRulePatchArrayOutput { return v.Rules }).(PolicyRulePatchArrayOutput)
   211  }
   212  
   213  type RolePatchArrayOutput struct{ *pulumi.OutputState }
   214  
   215  func (RolePatchArrayOutput) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*[]*RolePatch)(nil)).Elem()
   217  }
   218  
   219  func (o RolePatchArrayOutput) ToRolePatchArrayOutput() RolePatchArrayOutput {
   220  	return o
   221  }
   222  
   223  func (o RolePatchArrayOutput) ToRolePatchArrayOutputWithContext(ctx context.Context) RolePatchArrayOutput {
   224  	return o
   225  }
   226  
   227  func (o RolePatchArrayOutput) Index(i pulumi.IntInput) RolePatchOutput {
   228  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RolePatch {
   229  		return vs[0].([]*RolePatch)[vs[1].(int)]
   230  	}).(RolePatchOutput)
   231  }
   232  
   233  type RolePatchMapOutput struct{ *pulumi.OutputState }
   234  
   235  func (RolePatchMapOutput) ElementType() reflect.Type {
   236  	return reflect.TypeOf((*map[string]*RolePatch)(nil)).Elem()
   237  }
   238  
   239  func (o RolePatchMapOutput) ToRolePatchMapOutput() RolePatchMapOutput {
   240  	return o
   241  }
   242  
   243  func (o RolePatchMapOutput) ToRolePatchMapOutputWithContext(ctx context.Context) RolePatchMapOutput {
   244  	return o
   245  }
   246  
   247  func (o RolePatchMapOutput) MapIndex(k pulumi.StringInput) RolePatchOutput {
   248  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RolePatch {
   249  		return vs[0].(map[string]*RolePatch)[vs[1].(string)]
   250  	}).(RolePatchOutput)
   251  }
   252  
   253  func init() {
   254  	pulumi.RegisterInputType(reflect.TypeOf((*RolePatchInput)(nil)).Elem(), &RolePatch{})
   255  	pulumi.RegisterInputType(reflect.TypeOf((*RolePatchArrayInput)(nil)).Elem(), RolePatchArray{})
   256  	pulumi.RegisterInputType(reflect.TypeOf((*RolePatchMapInput)(nil)).Elem(), RolePatchMap{})
   257  	pulumi.RegisterOutputType(RolePatchOutput{})
   258  	pulumi.RegisterOutputType(RolePatchArrayOutput{})
   259  	pulumi.RegisterOutputType(RolePatchMapOutput{})
   260  }