aclutil

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 12 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

This section is empty.

Functions

func BuildInstructions added in v0.36.5

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 added in v0.36.0

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 added in v0.36.0

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 added in v0.36.0

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 added in v0.36.0

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 added in v0.36.0

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 added in v0.36.0

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 added in v0.36.2

func GetResourceTypeMap() map[string]kafkainstanceclient.AclResourceType

GetResourceTypeMap gets the mappings for ACL resource types

func GetReversedOperationMap added in v0.36.1

func GetReversedOperationMap() map[kafkainstanceclient.AclOperation]string

GetReversedOperationMap returns a map of operations with the SDK enums as the keys

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

func ValidateAndSetResources added in v0.36.0

func ValidateAndSetResources(opts *CrudOptions, resourceTypeFlagEntries []*localize.TemplateEntry) error

ValidateAndSetResources validates and sets resources options

Types

type CrudOptions added in v0.36.0

type CrudOptions struct {
	Config     config.IConfig
	Connection factory.ConnectionFunc
	Logger     logging.Logger
	IO         *iostreams.IOStreams
	Localizer  localize.Localizer
	Context    context.Context

	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