func NewSetLastAppliedOptions(ioStreams genericclioptions.IOStreams) *SetLastAppliedOptions {
	return &SetLastAppliedOptions{
		PrintFlags: genericclioptions.NewPrintFlags("configured").WithTypeSetter(scheme.Scheme),
		IOStreams:  ioStreams,
	}
}
NewSetLastAppliedOptions takes option arguments from a CLI stream and returns it at SetLastAppliedOptions type.
package apply
import (
	"bytes"
	"fmt"
	"github.com/spf13/cobra"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/cli-runtime/pkg/printers"
	"k8s.io/cli-runtime/pkg/resource"
	cmdutil "k8s.io/kubectl/pkg/cmd/util"
	"k8s.io/kubectl/pkg/cmd/util/editor"
	"k8s.io/kubectl/pkg/scheme"
	"k8s.io/kubectl/pkg/util"
	"k8s.io/kubectl/pkg/util/i18n"
	"k8s.io/kubectl/pkg/util/templates"
)
type SetLastAppliedOptions struct {
	CreateAnnotation bool
	PrintFlags *genericclioptions.PrintFlags
	PrintObj   printers.ResourcePrinterFunc
	FilenameOptions resource.FilenameOptions
	infoList                     []*resource.Info
	namespace                    string
	enforceNamespace             bool
	dryRunStrategy               cmdutil.DryRunStrategy
	dryRunVerifier               *resource.DryRunVerifier
	shortOutput                  bool
	output                       string
	patchBufferList              []PatchBuffer
	builder                      *resource.Builder
	unstructuredClientForMapping func(mapping *meta.RESTMapping) (resource.RESTClient, error)
	genericclioptions.IOStreams
}
type PatchBuffer struct {
	Patch     []byte
	PatchType types.PatchType
}
var (
	applySetLastAppliedLong = templates.LongDesc(i18n.T(`
		Set the latest last-applied-configuration annotations by setting it to match the contents of a file.
		This results in the last-applied-configuration being updated as though 'kubectl apply -f <file>' was run,
		without updating any other parts of the object.`))
	applySetLastAppliedExample = templates.Examples(i18n.T(`
		# Set the last-applied-configuration of a resource to match the contents of a file
		kubectl apply set-last-applied -f deploy.yaml
		# Execute set-last-applied against each configuration file in a directory
		kubectl apply set-last-applied -f path/
		# Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist
		kubectl apply set-last-applied -f deploy.yaml --create-annotation=true
		`))
)