aclcmdutil

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Wildcard     = "*"
	KafkaCluster = "kafka-cluster"
	AllAlias     = "all"
)
View Source
const (
	ResourceTypeANY              = "any"
	ResourceTypeTOPIC            = "topic"
	ResourceTypeCLUSTER          = "cluster"
	ResourceTypeGROUP            = "group"
	ResourceTypeTRANSACTIONAL_ID = "transactional-id"
)
View Source
const (
	PermissionALLOW = "allow"
	PermissionDENY  = "deny"
	PermissionANY   = "any"
)
View Source
const (
	OperationALL              = "all"
	OperationREAD             = "read"
	OperationWRITE            = "write"
	OperationCREATE           = "create"
	OperationDELETE           = "delete"
	OperationALTER            = "alter"
	OperationDESCRIBE         = "describe"
	OperationDESCRIBE_CONFIGS = "describe-configs"
	OperationALTER_CONFIGS    = "alter-configs"
)
View Source
const (
	PatternTypeLITERAL = "literal"
	PatternTypePREFIX  = "prefix"
	PatternTypeANY     = "any"
)

Variables

Functions

func BuildInstructions

func BuildInstructions(errorCollection []error) error

BuildInstructions accepts a slice of errors and creates a single formatted error object

func ExecuteACLRuleCreate

func ExecuteACLRuleCreate(req kafkainstanceclient.ApiCreateAclRequest, localizer localize.Localizer, kafkaInstanceName string) error

ExecuteACLRuleCreate makes request to create an ACL rule

func FormatPrincipal

func FormatPrincipal(userID string) string

FormatPrincipal formats the provided principal ID to "User:principal"

func GetMappedOperationFilterValue

func GetMappedOperationFilterValue(operation string) kafkainstanceclient.AclOperationFilter

GetMappedOperationFilterValue gets the mapped operation filter value

func GetMappedOperationValue

func GetMappedOperationValue(operation string) kafkainstanceclient.AclOperation

GetMappedOperationValue gets the mapped operation value

func GetMappedPatternTypeFilterValue

func GetMappedPatternTypeFilterValue(patternType string) kafkainstanceclient.AclPatternTypeFilter

GetMappedPatternTypeFilterValue gets the mapped pattern type filter value

func GetMappedPatternTypeValue

func GetMappedPatternTypeValue(patternType string) kafkainstanceclient.AclPatternType

GetMappedPatternTypeValue gets the mapped pattern type value

func GetMappedPermissionTypeFilterValue

func GetMappedPermissionTypeFilterValue(permission string) kafkainstanceclient.AclPermissionTypeFilter

GetMappedPermissionTypeFilterValue gets the mapped permission type filter value

func GetMappedPermissionTypeValue

func GetMappedPermissionTypeValue(permission string) kafkainstanceclient.AclPermissionType

GetMappedPermissionTypeValue gets the mapped permission type value

func GetMappedResourceTypeFilterValue

func GetMappedResourceTypeFilterValue(resourceType string) kafkainstanceclient.AclResourceTypeFilter

GetMappedResourceTypeFilterValue gets the mapped resource type filter value

func GetOperationFilterMap

func GetOperationFilterMap() map[string]kafkainstanceclient.AclOperationFilter

GetOperationTypeFilterMap gets the mappings for ACL type filters

func GetOperationMap

func GetOperationMap() map[string]kafkainstanceclient.AclOperation

func GetPatternTypeFilterMap

func GetPatternTypeFilterMap() map[string]kafkainstanceclient.AclPatternTypeFilter

GetPatternTypeFilterMap gets the mappings for ACL pattern type filters

func GetPatternTypeMap

func GetPatternTypeMap() map[string]kafkainstanceclient.AclPatternType

GetPatternTypeMap gets the mappings for ACL pattern type

func GetPermissionTypeFilterMap

func GetPermissionTypeFilterMap() map[string]kafkainstanceclient.AclPermissionTypeFilter

GetPermissionTypeFilterMap gets the mappings for ACL permission type filters

func GetPermissionTypeMap

func GetPermissionTypeMap() map[string]kafkainstanceclient.AclPermissionType

GetPermissionTypeMap gets the mappings for ACL permission types

func GetResourceName

func GetResourceName(resourceName string) string

GetResourceName returns the name of the resource transformed into a server recognized format

func GetResourceTypeFilterMap

func GetResourceTypeFilterMap() map[string]kafkainstanceclient.AclResourceTypeFilter

GetResourceTypeFilterMap gets the mappings for ACL resource type filters

func GetResourceTypeMap

func GetResourceTypeMap() map[string]kafkainstanceclient.AclResourceType

GetResourceTypeMap gets the mappings for ACL resource types

func IsValidResourceOperation

func IsValidResourceOperation(resourceType string, operation string, resourceOperationsMap map[string][]string) (bool, []string)

IsValidResourceOperation checks if the operation is valid, and returns the list valid operations when invalid

func MapACLsToTableRows

func MapACLsToTableRows(bindings []kafkainstanceclient.AclBinding, localizer localize.Localizer) []permissionsRow

MapACLsToTableRows converts a list of ACL bindings into a formatted table for printing

func RegisterGroupCompletionFunc

func RegisterGroupCompletionFunc(cmd *cobra.Command, f *factory.Factory) error

RegisterGroupCompletionFunc enables dynamic autocompletion for group flag

func RegisterTopicCompletionFunc

func RegisterTopicCompletionFunc(cmd *cobra.Command, f *factory.Factory) error

RegisterTopicCompletionFunc enables dynamic autocompletion for topic flag

func SetACLResources added in v0.38.6

func SetACLResources(opts *CrudOptions) int

SetACLResources sets resources options and returns number of changed resources

func ValidateAPIError

func ValidateAPIError(httpRes *http.Response, localizer localize.Localizer, err error, operation string, instanceName string) error

ValidateAPIError checks for a HTTP error and maps it to a user friendly error

Types

type CrudOptions

type CrudOptions struct {
	Connection     factory.ConnectionFunc
	Logger         logging.Logger
	IO             *iostreams.IOStreams
	Localizer      localize.Localizer
	Context        context.Context
	ServiceContext servicecontext.IContext

	Cluster         bool
	PatternType     string
	ResourceType    string
	ResourceName    string
	Permission      string
	Operation       string
	Group           string
	Topic           string
	TransactionalID string
	Principal       string

	SkipConfirm bool
	Output      string
	InstanceID  string
}

CrudOptions is the interface used for options of create and delete command

Jump to

Keyboard shortcuts

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