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

package v1alpha3

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

// A Certificate resource should be created to ensure an up to date and signed x509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`.
//
//	The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`).
type Certificate struct {
	pulumi.CustomResourceState

	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
	Kind       pulumi.StringPtrOutput `pulumi:"kind"`
	Metadata   v1.ObjectMetaPtrOutput `pulumi:"metadata"`
	// Desired state of the Certificate resource.
	Spec CertificateSpecPtrOutput `pulumi:"spec"`
	// Status of the Certificate. This is set and managed automatically.
	Status CertificateStatusPtrOutput `pulumi:"status"`
}

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

	args.ApiVersion = pulumi.StringPtr("cert-manager.io/v1alpha3")
	args.Kind = pulumi.StringPtr("Certificate")
	opts = internal.PkgResourceDefaultOpts(opts)
	var resource Certificate
	err := ctx.RegisterResource("kubernetes:cert-manager.io/v1alpha3:Certificate", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

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

// Input properties used for looking up and filtering Certificate resources.
type certificateState struct {
}

type CertificateState struct {
}

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

type certificateArgs struct {
	ApiVersion *string        `pulumi:"apiVersion"`
	Kind       *string        `pulumi:"kind"`
	Metadata   *v1.ObjectMeta `pulumi:"metadata"`
	// Desired state of the Certificate resource.
	Spec *CertificateSpec `pulumi:"spec"`
	// Status of the Certificate. This is set and managed automatically.
	Status *CertificateStatus `pulumi:"status"`
}

// The set of arguments for constructing a Certificate resource.
type CertificateArgs struct {
	ApiVersion pulumi.StringPtrInput
	Kind       pulumi.StringPtrInput
	Metadata   v1.ObjectMetaPtrInput
	// Desired state of the Certificate resource.
	Spec CertificateSpecPtrInput
	// Status of the Certificate. This is set and managed automatically.
	Status CertificateStatusPtrInput
}

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

type CertificateInput interface {
	pulumi.Input

	ToCertificateOutput() CertificateOutput
	ToCertificateOutputWithContext(ctx context.Context) CertificateOutput
}

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

func (i *Certificate) ToCertificateOutput() CertificateOutput {
	return i.ToCertificateOutputWithContext(context.Background())
}

func (i *Certificate) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
	return pulumi.ToOutputWithContext(ctx, i).(CertificateOutput)
}

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

type CertificateOutput struct{ *pulumi.OutputState }

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

func (o CertificateOutput) ToCertificateOutput() CertificateOutput {
	return o
}

func (o CertificateOutput) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
	return o
}

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

func (o CertificateOutput) ApiVersion() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}

func (o CertificateOutput) Kind() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}

func (o CertificateOutput) Metadata() v1.ObjectMetaPtrOutput {
	return o.ApplyT(func(v *Certificate) v1.ObjectMetaPtrOutput { return v.Metadata }).(v1.ObjectMetaPtrOutput)
}

// Desired state of the Certificate resource.
func (o CertificateOutput) Spec() CertificateSpecPtrOutput {
	return o.ApplyT(func(v *Certificate) CertificateSpecPtrOutput { return v.Spec }).(CertificateSpecPtrOutput)
}

// Status of the Certificate. This is set and managed automatically.
func (o CertificateOutput) Status() CertificateStatusPtrOutput {
	return o.ApplyT(func(v *Certificate) CertificateStatusPtrOutput { return v.Status }).(CertificateStatusPtrOutput)
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*CertificateInput)(nil)).Elem(), &Certificate{})
	pulumi.RegisterOutputType(CertificateOutput{})
}