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