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

// API defines an HTTP interface that is exposed to external clients. It specifies the supported versions
// and provides instructions for accessing its documentation. Once instantiated, an API object is associated
// with an Ingress, IngressRoute, or HTTPRoute resource, enabling the exposure of the described API to the outside world.
type API struct {
	pulumi.CustomResourceState

	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
	Kind       pulumi.StringPtrOutput `pulumi:"kind"`
	Metadata   v1.ObjectMetaPtrOutput `pulumi:"metadata"`
	// APISpec describes the API.
	Spec APISpecPtrOutput `pulumi:"spec"`
	// The current status of this API.
	Status APIStatusPtrOutput `pulumi:"status"`
}

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

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

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

// Input properties used for looking up and filtering API resources.
type apiState struct {
}

type APIState struct {
}

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

type apiArgs struct {
	ApiVersion *string        `pulumi:"apiVersion"`
	Kind       *string        `pulumi:"kind"`
	Metadata   *v1.ObjectMeta `pulumi:"metadata"`
	// APISpec describes the API.
	Spec *APISpec `pulumi:"spec"`
	// The current status of this API.
	Status *APIStatus `pulumi:"status"`
}

// The set of arguments for constructing a API resource.
type APIArgs struct {
	ApiVersion pulumi.StringPtrInput
	Kind       pulumi.StringPtrInput
	Metadata   v1.ObjectMetaPtrInput
	// APISpec describes the API.
	Spec APISpecPtrInput
	// The current status of this API.
	Status APIStatusPtrInput
}

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

type APIInput interface {
	pulumi.Input

	ToAPIOutput() APIOutput
	ToAPIOutputWithContext(ctx context.Context) APIOutput
}

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

func (i *API) ToAPIOutput() APIOutput {
	return i.ToAPIOutputWithContext(context.Background())
}

func (i *API) ToAPIOutputWithContext(ctx context.Context) APIOutput {
	return pulumi.ToOutputWithContext(ctx, i).(APIOutput)
}

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

type APIOutput struct{ *pulumi.OutputState }

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

func (o APIOutput) ToAPIOutput() APIOutput {
	return o
}

func (o APIOutput) ToAPIOutputWithContext(ctx context.Context) APIOutput {
	return o
}

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

func (o APIOutput) ApiVersion() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *API) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}

func (o APIOutput) Kind() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *API) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}

func (o APIOutput) Metadata() v1.ObjectMetaPtrOutput {
	return o.ApplyT(func(v *API) v1.ObjectMetaPtrOutput { return v.Metadata }).(v1.ObjectMetaPtrOutput)
}

// APISpec describes the API.
func (o APIOutput) Spec() APISpecPtrOutput {
	return o.ApplyT(func(v *API) APISpecPtrOutput { return v.Spec }).(APISpecPtrOutput)
}

// The current status of this API.
func (o APIOutput) Status() APIStatusPtrOutput {
	return o.ApplyT(func(v *API) APIStatusPtrOutput { return v.Status }).(APIStatusPtrOutput)
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*APIInput)(nil)).Elem(), &API{})
	pulumi.RegisterOutputType(APIOutput{})
}
