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

package v1alpha1

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"
)

// TraefikService is the CRD implementation of a Traefik Service.
// TraefikService object allows to:
//   - Apply weight to Services on load-balancing
//   - Mirror traffic on services
//     More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-traefikservice
type TraefikService struct {
	pulumi.CustomResourceState

	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
	Kind       pulumi.StringPtrOutput `pulumi:"kind"`
	Metadata   v1.ObjectMetaOutput    `pulumi:"metadata"`
	// TraefikServiceSpec defines the desired state of a TraefikService.
	Spec TraefikServiceSpecOutput `pulumi:"spec"`
}

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

	args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
	args.Kind = pulumi.StringPtr("TraefikService")
	opts = internal.PkgResourceDefaultOpts(opts)
	var resource TraefikService
	err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:TraefikService", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// GetTraefikService gets an existing TraefikService 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 GetTraefikService(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *TraefikServiceState, opts ...pulumi.ResourceOption) (*TraefikService, error) {
	var resource TraefikService
	err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:TraefikService", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// Input properties used for looking up and filtering TraefikService resources.
type traefikServiceState struct {
}

type TraefikServiceState struct {
}

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

type traefikServiceArgs struct {
	ApiVersion *string        `pulumi:"apiVersion"`
	Kind       *string        `pulumi:"kind"`
	Metadata   *v1.ObjectMeta `pulumi:"metadata"`
	// TraefikServiceSpec defines the desired state of a TraefikService.
	Spec *TraefikServiceSpec `pulumi:"spec"`
}

// The set of arguments for constructing a TraefikService resource.
type TraefikServiceArgs struct {
	ApiVersion pulumi.StringPtrInput
	Kind       pulumi.StringPtrInput
	Metadata   v1.ObjectMetaPtrInput
	// TraefikServiceSpec defines the desired state of a TraefikService.
	Spec TraefikServiceSpecPtrInput
}

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

type TraefikServiceInput interface {
	pulumi.Input

	ToTraefikServiceOutput() TraefikServiceOutput
	ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput
}

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

func (i *TraefikService) ToTraefikServiceOutput() TraefikServiceOutput {
	return i.ToTraefikServiceOutputWithContext(context.Background())
}

func (i *TraefikService) ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput {
	return pulumi.ToOutputWithContext(ctx, i).(TraefikServiceOutput)
}

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

type TraefikServiceOutput struct{ *pulumi.OutputState }

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

func (o TraefikServiceOutput) ToTraefikServiceOutput() TraefikServiceOutput {
	return o
}

func (o TraefikServiceOutput) ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput {
	return o
}

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

func (o TraefikServiceOutput) ApiVersion() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *TraefikService) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}

func (o TraefikServiceOutput) Kind() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *TraefikService) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}

func (o TraefikServiceOutput) Metadata() v1.ObjectMetaOutput {
	return o.ApplyT(func(v *TraefikService) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}

// TraefikServiceSpec defines the desired state of a TraefikService.
func (o TraefikServiceOutput) Spec() TraefikServiceSpecOutput {
	return o.ApplyT(func(v *TraefikService) TraefikServiceSpecOutput { return v.Spec }).(TraefikServiceSpecOutput)
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*TraefikServiceInput)(nil)).Elem(), &TraefikService{})
	pulumi.RegisterOutputType(TraefikServiceOutput{})
}
