mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #97884 from lauchokyip/fixlint1
Fix golint errors for kubectl/pkg/cmd/certificates/certificates.go
This commit is contained in:
commit
60cb99909f
@ -413,7 +413,6 @@ staging/src/k8s.io/kubectl/pkg/cmd/annotate
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/apply
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/attach
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/autoscale
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/certificates
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/clusterinfo
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/create
|
||||
staging/src/k8s.io/kubectl/pkg/cmd/debug
|
||||
|
@ -41,6 +41,7 @@ import (
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
// NewCmdCertificate returns `certificate` Cobra command
|
||||
func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "certificate SUBCOMMAND",
|
||||
@ -58,6 +59,7 @@ func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
||||
return cmd
|
||||
}
|
||||
|
||||
// CertificateOptions declares the arguments accepted by the certificate command
|
||||
type CertificateOptions struct {
|
||||
resource.FilenameOptions
|
||||
|
||||
@ -73,7 +75,7 @@ type CertificateOptions struct {
|
||||
genericclioptions.IOStreams
|
||||
}
|
||||
|
||||
// NewCertificateOptions creates the options for certificate
|
||||
// NewCertificateOptions creates CertificateOptions struct for `certificate` command
|
||||
func NewCertificateOptions(ioStreams genericclioptions.IOStreams, operation string) *CertificateOptions {
|
||||
return &CertificateOptions{
|
||||
PrintFlags: genericclioptions.NewPrintFlags(operation).WithTypeSetter(scheme.Scheme),
|
||||
@ -81,6 +83,7 @@ func NewCertificateOptions(ioStreams genericclioptions.IOStreams, operation stri
|
||||
}
|
||||
}
|
||||
|
||||
// Complete loads data from the command environment
|
||||
func (o *CertificateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
o.csrNames = args
|
||||
o.outputStyle = cmdutil.GetFlagString(cmd, "output")
|
||||
@ -104,6 +107,7 @@ func (o *CertificateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, arg
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks if the provided `certificate` arguments are valid
|
||||
func (o *CertificateOptions) Validate() error {
|
||||
if len(o.csrNames) < 1 && cmdutil.IsFilenameSliceEmpty(o.Filenames, o.Kustomize) {
|
||||
return fmt.Errorf("one or more CSRs must be specified as <name> or -f <filename>")
|
||||
@ -111,6 +115,7 @@ func (o *CertificateOptions) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCmdCertificateApprove returns the `certificate approve` Cobra command
|
||||
func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
|
||||
o := NewCertificateOptions(ioStreams, "approved")
|
||||
|
||||
@ -145,6 +150,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS
|
||||
return cmd
|
||||
}
|
||||
|
||||
// RunCertificateApprove approves a certificate signing request
|
||||
func (o *CertificateOptions) RunCertificateApprove(force bool) error {
|
||||
return o.modifyCertificateCondition(
|
||||
o.builder,
|
||||
@ -154,6 +160,7 @@ func (o *CertificateOptions) RunCertificateApprove(force bool) error {
|
||||
)
|
||||
}
|
||||
|
||||
// NewCmdCertificateDeny returns the `certificate deny` Cobra command
|
||||
func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
|
||||
o := NewCertificateOptions(ioStreams, "denied")
|
||||
|
||||
@ -183,6 +190,7 @@ func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
||||
return cmd
|
||||
}
|
||||
|
||||
// RunCertificateDeny denies a certificate signing request
|
||||
func (o *CertificateOptions) RunCertificateDeny(force bool) error {
|
||||
return o.modifyCertificateCondition(
|
||||
o.builder,
|
||||
|
Loading…
Reference in New Issue
Block a user