// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***

package v1alpha2

import (
	"context"
	"reflect"

	"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
	v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)

// UDPRoute provides a way to route UDP traffic. When combined with a Gateway listener, it can be used to forward traffic on the port specified by the listener to a set of backends specified by the UDPRoute.
type UDPRoute struct {
	pulumi.CustomResourceState

	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
	Kind       pulumi.StringPtrOutput `pulumi:"kind"`
	Metadata   v1.ObjectMetaPtrOutput `pulumi:"metadata"`
	// Spec defines the desired state of UDPRoute.
	Spec UDPRouteSpecOutput `pulumi:"spec"`
	// Status defines the current state of UDPRoute.
	Status UDPRouteStatusPtrOutput `pulumi:"status"`
}

// NewUDPRoute registers a new resource with the given unique name, arguments, and options.
func NewUDPRoute(ctx *pulumi.Context,
	name string, args *UDPRouteArgs, opts ...pulumi.ResourceOption) (*UDPRoute, error) {
	if args == nil {
		args = &UDPRouteArgs{}
	}

	args.ApiVersion = pulumi.StringPtr("gateway.networking.k8s.io/v1alpha2")
	args.Kind = pulumi.StringPtr("UDPRoute")
	opts = internal.PkgResourceDefaultOpts(opts)
	var resource UDPRoute
	err := ctx.RegisterResource("kubernetes:gateway.networking.k8s.io/v1alpha2:UDPRoute", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// GetUDPRoute gets an existing UDPRoute resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetUDPRoute(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *UDPRouteState, opts ...pulumi.ResourceOption) (*UDPRoute, error) {
	var resource UDPRoute
	err := ctx.ReadResource("kubernetes:gateway.networking.k8s.io/v1alpha2:UDPRoute", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// Input properties used for looking up and filtering UDPRoute resources.
type udprouteState struct {
}

type UDPRouteState struct {
}

func (UDPRouteState) ElementType() reflect.Type {
	return reflect.TypeOf((*udprouteState)(nil)).Elem()
}

type udprouteArgs struct {
	ApiVersion *string        `pulumi:"apiVersion"`
	Kind       *string        `pulumi:"kind"`
	Metadata   *v1.ObjectMeta `pulumi:"metadata"`
	// Spec defines the desired state of UDPRoute.
	Spec *UDPRouteSpec `pulumi:"spec"`
	// Status defines the current state of UDPRoute.
	Status *UDPRouteStatus `pulumi:"status"`
}

// The set of arguments for constructing a UDPRoute resource.
type UDPRouteArgs struct {
	ApiVersion pulumi.StringPtrInput
	Kind       pulumi.StringPtrInput
	Metadata   v1.ObjectMetaPtrInput
	// Spec defines the desired state of UDPRoute.
	Spec UDPRouteSpecPtrInput
	// Status defines the current state of UDPRoute.
	Status UDPRouteStatusPtrInput
}

func (UDPRouteArgs) ElementType() reflect.Type {
	return reflect.TypeOf((*udprouteArgs)(nil)).Elem()
}

type UDPRouteInput interface {
	pulumi.Input

	ToUDPRouteOutput() UDPRouteOutput
	ToUDPRouteOutputWithContext(ctx context.Context) UDPRouteOutput
}

func (*UDPRoute) ElementType() reflect.Type {
	return reflect.TypeOf((**UDPRoute)(nil)).Elem()
}

func (i *UDPRoute) ToUDPRouteOutput() UDPRouteOutput {
	return i.ToUDPRouteOutputWithContext(context.Background())
}

func (i *UDPRoute) ToUDPRouteOutputWithContext(ctx context.Context) UDPRouteOutput {
	return pulumi.ToOutputWithContext(ctx, i).(UDPRouteOutput)
}

func (i *UDPRoute) ToOutput(ctx context.Context) pulumix.Output[*UDPRoute] {
	return pulumix.Output[*UDPRoute]{
		OutputState: i.ToUDPRouteOutputWithContext(ctx).OutputState,
	}
}

type UDPRouteOutput struct{ *pulumi.OutputState }

func (UDPRouteOutput) ElementType() reflect.Type {
	return reflect.TypeOf((**UDPRoute)(nil)).Elem()
}

func (o UDPRouteOutput) ToUDPRouteOutput() UDPRouteOutput {
	return o
}

func (o UDPRouteOutput) ToUDPRouteOutputWithContext(ctx context.Context) UDPRouteOutput {
	return o
}

func (o UDPRouteOutput) ToOutput(ctx context.Context) pulumix.Output[*UDPRoute] {
	return pulumix.Output[*UDPRoute]{
		OutputState: o.OutputState,
	}
}

func (o UDPRouteOutput) ApiVersion() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *UDPRoute) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}

func (o UDPRouteOutput) Kind() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *UDPRoute) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}

func (o UDPRouteOutput) Metadata() v1.ObjectMetaPtrOutput {
	return o.ApplyT(func(v *UDPRoute) v1.ObjectMetaPtrOutput { return v.Metadata }).(v1.ObjectMetaPtrOutput)
}

// Spec defines the desired state of UDPRoute.
func (o UDPRouteOutput) Spec() UDPRouteSpecOutput {
	return o.ApplyT(func(v *UDPRoute) UDPRouteSpecOutput { return v.Spec }).(UDPRouteSpecOutput)
}

// Status defines the current state of UDPRoute.
func (o UDPRouteOutput) Status() UDPRouteStatusPtrOutput {
	return o.ApplyT(func(v *UDPRoute) UDPRouteStatusPtrOutput { return v.Status }).(UDPRouteStatusPtrOutput)
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*UDPRouteInput)(nil)).Elem(), &UDPRoute{})
	pulumi.RegisterOutputType(UDPRouteOutput{})
}
