common

package
v0.0.0-...-c46c694 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmpAPIGroup        = "compliance.openshift.io"
	CmpResourceVersion = "v1alpha1"
	RetryInterval      = time.Second * 2
	Timeout            = time.Minute * 20
)

Variables

This section is empty.

Functions

func GVR

func GVR(resource string) schema.GroupVersionResource

func GetRulesFromProfile

func GetRulesFromProfile(obj *unstructured.Unstructured) ([]string, error)

func GetScanNamesFromSuite

func GetScanNamesFromSuite(obj *unstructured.Unstructured) ([]string, error)

GetScanNamesFromSuite gets the scan names used in a ComplianceSuite

func PersistObjectToYaml

func PersistObjectToYaml(name string, obj *unstructured.Unstructured, w io.Writer, serializer *k8sserial.Serializer) error

func PersistObjectToYamlFile

func PersistObjectToYamlFile(fileNameBase string, obj *unstructured.Unstructured, outputDir string, serializer *k8sserial.Serializer) (string, error)

PersistObjectToYamlFile persists the given object to a yaml file in the given path

Types

type CommandContext

type CommandContext struct {
	ConfigFlags *genericclioptions.ConfigFlags

	Kuser KubeClientUser

	Helper ObjectHelper

	Args []string

	genericclioptions.IOStreams
}

func (*CommandContext) Complete

func (o *CommandContext) Complete(cmd *cobra.Command, args []string) error

Complete sets all information required for updating the current context

type ComplianceType

type ComplianceType int
const (
	ComplianceScan ComplianceType = iota
	ComplianceSuite
	ComplianceRemediation
	ScanSettingBinding
	Profile
	TailoredProfile
	Rule
	ComplianceCheckResult
	TypeUnknown
)

func GetValidObjType

func GetValidObjType(rawtype string) (ComplianceType, error)

type KubeClientUser

type KubeClientUser interface {
	DynamicClient() dynamic.Interface
	Clientset() kubernetes.Interface
	GetConfig() *rest.Config
	GetNamespace() string
}

KubeClientUser is an interface to use kubeclients on a specific namespace

func NewKubeClientUser

func NewKubeClientUser(cfgflags *genericclioptions.ConfigFlags, ns string) (KubeClientUser, error)

type ObjectHelper

type ObjectHelper interface {
	Handle() error
}

ObjectHelper is a generic interface to implement actions that are to be executed on an object

type ObjectReference

type ObjectReference struct {
	Type ComplianceType
	Name string
}

func ValidateManyObjectArgs

func ValidateManyObjectArgs(args []string) ([]ObjectReference, error)

func ValidateObjectArgs

func ValidateObjectArgs(args []string) (objref ObjectReference, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL