github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/networking/v1/networkPolicyPatch.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  // NetworkPolicy describes what network traffic is allowed for a set of Pods
    21  type NetworkPolicyPatch 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. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    29  	Metadata metav1.ObjectMetaPatchPtrOutput `pulumi:"metadata"`
    30  	// spec represents the specification of the desired behavior for this NetworkPolicy.
    31  	Spec NetworkPolicySpecPatchPtrOutput `pulumi:"spec"`
    32  	// status represents the current state of the NetworkPolicy. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    33  	Status NetworkPolicyStatusPatchPtrOutput `pulumi:"status"`
    34  }
    35  
    36  // NewNetworkPolicyPatch registers a new resource with the given unique name, arguments, and options.
    37  func NewNetworkPolicyPatch(ctx *pulumi.Context,
    38  	name string, args *NetworkPolicyPatchArgs, opts ...pulumi.ResourceOption) (*NetworkPolicyPatch, error) {
    39  	if args == nil {
    40  		args = &NetworkPolicyPatchArgs{}
    41  	}
    42  
    43  	args.ApiVersion = pulumi.StringPtr("networking.k8s.io/v1")
    44  	args.Kind = pulumi.StringPtr("NetworkPolicy")
    45  	aliases := pulumi.Aliases([]pulumi.Alias{
    46  		{
    47  			Type: pulumi.String("kubernetes:extensions/v1beta1:NetworkPolicyPatch"),
    48  		},
    49  	})
    50  	opts = append(opts, aliases)
    51  	var resource NetworkPolicyPatch
    52  	err := ctx.RegisterResource("kubernetes:networking.k8s.io/v1:NetworkPolicyPatch", name, args, &resource, opts...)
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  	return &resource, nil
    57  }
    58  
    59  // GetNetworkPolicyPatch gets an existing NetworkPolicyPatch resource's state with the given name, ID, and optional
    60  // state properties that are used to uniquely qualify the lookup (nil if not required).
    61  func GetNetworkPolicyPatch(ctx *pulumi.Context,
    62  	name string, id pulumi.IDInput, state *NetworkPolicyPatchState, opts ...pulumi.ResourceOption) (*NetworkPolicyPatch, error) {
    63  	var resource NetworkPolicyPatch
    64  	err := ctx.ReadResource("kubernetes:networking.k8s.io/v1:NetworkPolicyPatch", name, id, state, &resource, opts...)
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return &resource, nil
    69  }
    70  
    71  // Input properties used for looking up and filtering NetworkPolicyPatch resources.
    72  type networkPolicyPatchState struct {
    73  }
    74  
    75  type NetworkPolicyPatchState struct {
    76  }
    77  
    78  func (NetworkPolicyPatchState) ElementType() reflect.Type {
    79  	return reflect.TypeOf((*networkPolicyPatchState)(nil)).Elem()
    80  }
    81  
    82  type networkPolicyPatchArgs struct {
    83  	// 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
    84  	ApiVersion *string `pulumi:"apiVersion"`
    85  	// 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
    86  	Kind *string `pulumi:"kind"`
    87  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    88  	Metadata *metav1.ObjectMetaPatch `pulumi:"metadata"`
    89  	// spec represents the specification of the desired behavior for this NetworkPolicy.
    90  	Spec *NetworkPolicySpecPatch `pulumi:"spec"`
    91  }
    92  
    93  // The set of arguments for constructing a NetworkPolicyPatch resource.
    94  type NetworkPolicyPatchArgs struct {
    95  	// 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
    96  	ApiVersion pulumi.StringPtrInput
    97  	// 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
    98  	Kind pulumi.StringPtrInput
    99  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   100  	Metadata metav1.ObjectMetaPatchPtrInput
   101  	// spec represents the specification of the desired behavior for this NetworkPolicy.
   102  	Spec NetworkPolicySpecPatchPtrInput
   103  }
   104  
   105  func (NetworkPolicyPatchArgs) ElementType() reflect.Type {
   106  	return reflect.TypeOf((*networkPolicyPatchArgs)(nil)).Elem()
   107  }
   108  
   109  type NetworkPolicyPatchInput interface {
   110  	pulumi.Input
   111  
   112  	ToNetworkPolicyPatchOutput() NetworkPolicyPatchOutput
   113  	ToNetworkPolicyPatchOutputWithContext(ctx context.Context) NetworkPolicyPatchOutput
   114  }
   115  
   116  func (*NetworkPolicyPatch) ElementType() reflect.Type {
   117  	return reflect.TypeOf((**NetworkPolicyPatch)(nil)).Elem()
   118  }
   119  
   120  func (i *NetworkPolicyPatch) ToNetworkPolicyPatchOutput() NetworkPolicyPatchOutput {
   121  	return i.ToNetworkPolicyPatchOutputWithContext(context.Background())
   122  }
   123  
   124  func (i *NetworkPolicyPatch) ToNetworkPolicyPatchOutputWithContext(ctx context.Context) NetworkPolicyPatchOutput {
   125  	return pulumi.ToOutputWithContext(ctx, i).(NetworkPolicyPatchOutput)
   126  }
   127  
   128  // NetworkPolicyPatchArrayInput is an input type that accepts NetworkPolicyPatchArray and NetworkPolicyPatchArrayOutput values.
   129  // You can construct a concrete instance of `NetworkPolicyPatchArrayInput` via:
   130  //
   131  //	NetworkPolicyPatchArray{ NetworkPolicyPatchArgs{...} }
   132  type NetworkPolicyPatchArrayInput interface {
   133  	pulumi.Input
   134  
   135  	ToNetworkPolicyPatchArrayOutput() NetworkPolicyPatchArrayOutput
   136  	ToNetworkPolicyPatchArrayOutputWithContext(context.Context) NetworkPolicyPatchArrayOutput
   137  }
   138  
   139  type NetworkPolicyPatchArray []NetworkPolicyPatchInput
   140  
   141  func (NetworkPolicyPatchArray) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*[]*NetworkPolicyPatch)(nil)).Elem()
   143  }
   144  
   145  func (i NetworkPolicyPatchArray) ToNetworkPolicyPatchArrayOutput() NetworkPolicyPatchArrayOutput {
   146  	return i.ToNetworkPolicyPatchArrayOutputWithContext(context.Background())
   147  }
   148  
   149  func (i NetworkPolicyPatchArray) ToNetworkPolicyPatchArrayOutputWithContext(ctx context.Context) NetworkPolicyPatchArrayOutput {
   150  	return pulumi.ToOutputWithContext(ctx, i).(NetworkPolicyPatchArrayOutput)
   151  }
   152  
   153  // NetworkPolicyPatchMapInput is an input type that accepts NetworkPolicyPatchMap and NetworkPolicyPatchMapOutput values.
   154  // You can construct a concrete instance of `NetworkPolicyPatchMapInput` via:
   155  //
   156  //	NetworkPolicyPatchMap{ "key": NetworkPolicyPatchArgs{...} }
   157  type NetworkPolicyPatchMapInput interface {
   158  	pulumi.Input
   159  
   160  	ToNetworkPolicyPatchMapOutput() NetworkPolicyPatchMapOutput
   161  	ToNetworkPolicyPatchMapOutputWithContext(context.Context) NetworkPolicyPatchMapOutput
   162  }
   163  
   164  type NetworkPolicyPatchMap map[string]NetworkPolicyPatchInput
   165  
   166  func (NetworkPolicyPatchMap) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*map[string]*NetworkPolicyPatch)(nil)).Elem()
   168  }
   169  
   170  func (i NetworkPolicyPatchMap) ToNetworkPolicyPatchMapOutput() NetworkPolicyPatchMapOutput {
   171  	return i.ToNetworkPolicyPatchMapOutputWithContext(context.Background())
   172  }
   173  
   174  func (i NetworkPolicyPatchMap) ToNetworkPolicyPatchMapOutputWithContext(ctx context.Context) NetworkPolicyPatchMapOutput {
   175  	return pulumi.ToOutputWithContext(ctx, i).(NetworkPolicyPatchMapOutput)
   176  }
   177  
   178  type NetworkPolicyPatchOutput struct{ *pulumi.OutputState }
   179  
   180  func (NetworkPolicyPatchOutput) ElementType() reflect.Type {
   181  	return reflect.TypeOf((**NetworkPolicyPatch)(nil)).Elem()
   182  }
   183  
   184  func (o NetworkPolicyPatchOutput) ToNetworkPolicyPatchOutput() NetworkPolicyPatchOutput {
   185  	return o
   186  }
   187  
   188  func (o NetworkPolicyPatchOutput) ToNetworkPolicyPatchOutputWithContext(ctx context.Context) NetworkPolicyPatchOutput {
   189  	return o
   190  }
   191  
   192  // 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
   193  func (o NetworkPolicyPatchOutput) ApiVersion() pulumi.StringPtrOutput {
   194  	return o.ApplyT(func(v *NetworkPolicyPatch) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   195  }
   196  
   197  // 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
   198  func (o NetworkPolicyPatchOutput) Kind() pulumi.StringPtrOutput {
   199  	return o.ApplyT(func(v *NetworkPolicyPatch) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   200  }
   201  
   202  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   203  func (o NetworkPolicyPatchOutput) Metadata() metav1.ObjectMetaPatchPtrOutput {
   204  	return o.ApplyT(func(v *NetworkPolicyPatch) metav1.ObjectMetaPatchPtrOutput { return v.Metadata }).(metav1.ObjectMetaPatchPtrOutput)
   205  }
   206  
   207  // spec represents the specification of the desired behavior for this NetworkPolicy.
   208  func (o NetworkPolicyPatchOutput) Spec() NetworkPolicySpecPatchPtrOutput {
   209  	return o.ApplyT(func(v *NetworkPolicyPatch) NetworkPolicySpecPatchPtrOutput { return v.Spec }).(NetworkPolicySpecPatchPtrOutput)
   210  }
   211  
   212  // status represents the current state of the NetworkPolicy. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   213  func (o NetworkPolicyPatchOutput) Status() NetworkPolicyStatusPatchPtrOutput {
   214  	return o.ApplyT(func(v *NetworkPolicyPatch) NetworkPolicyStatusPatchPtrOutput { return v.Status }).(NetworkPolicyStatusPatchPtrOutput)
   215  }
   216  
   217  type NetworkPolicyPatchArrayOutput struct{ *pulumi.OutputState }
   218  
   219  func (NetworkPolicyPatchArrayOutput) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*[]*NetworkPolicyPatch)(nil)).Elem()
   221  }
   222  
   223  func (o NetworkPolicyPatchArrayOutput) ToNetworkPolicyPatchArrayOutput() NetworkPolicyPatchArrayOutput {
   224  	return o
   225  }
   226  
   227  func (o NetworkPolicyPatchArrayOutput) ToNetworkPolicyPatchArrayOutputWithContext(ctx context.Context) NetworkPolicyPatchArrayOutput {
   228  	return o
   229  }
   230  
   231  func (o NetworkPolicyPatchArrayOutput) Index(i pulumi.IntInput) NetworkPolicyPatchOutput {
   232  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NetworkPolicyPatch {
   233  		return vs[0].([]*NetworkPolicyPatch)[vs[1].(int)]
   234  	}).(NetworkPolicyPatchOutput)
   235  }
   236  
   237  type NetworkPolicyPatchMapOutput struct{ *pulumi.OutputState }
   238  
   239  func (NetworkPolicyPatchMapOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*map[string]*NetworkPolicyPatch)(nil)).Elem()
   241  }
   242  
   243  func (o NetworkPolicyPatchMapOutput) ToNetworkPolicyPatchMapOutput() NetworkPolicyPatchMapOutput {
   244  	return o
   245  }
   246  
   247  func (o NetworkPolicyPatchMapOutput) ToNetworkPolicyPatchMapOutputWithContext(ctx context.Context) NetworkPolicyPatchMapOutput {
   248  	return o
   249  }
   250  
   251  func (o NetworkPolicyPatchMapOutput) MapIndex(k pulumi.StringInput) NetworkPolicyPatchOutput {
   252  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NetworkPolicyPatch {
   253  		return vs[0].(map[string]*NetworkPolicyPatch)[vs[1].(string)]
   254  	}).(NetworkPolicyPatchOutput)
   255  }
   256  
   257  func init() {
   258  	pulumi.RegisterInputType(reflect.TypeOf((*NetworkPolicyPatchInput)(nil)).Elem(), &NetworkPolicyPatch{})
   259  	pulumi.RegisterInputType(reflect.TypeOf((*NetworkPolicyPatchArrayInput)(nil)).Elem(), NetworkPolicyPatchArray{})
   260  	pulumi.RegisterInputType(reflect.TypeOf((*NetworkPolicyPatchMapInput)(nil)).Elem(), NetworkPolicyPatchMap{})
   261  	pulumi.RegisterOutputType(NetworkPolicyPatchOutput{})
   262  	pulumi.RegisterOutputType(NetworkPolicyPatchArrayOutput{})
   263  	pulumi.RegisterOutputType(NetworkPolicyPatchMapOutput{})
   264  }