ac

package
v0.0.0-...-f5eb53a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAccessRestrictionHandler

func WithAccessRestrictionHandler(ctx context.Context, fn AccessRestrictionHandler) context.Context

WithAccessRestrictionHandler returns a copy of parent context to which the given AccessRestrictionHandler function has been added.

Types

type AccessRestriction

type AccessRestriction struct {
	// Key is the identifier of an access restriction
	Key string `json:"key,omitempty"`
	// NotifyIf controls which value the annotation must have for a notification to be sent
	NotifyIf bool `json:"notifyIf,omitempty"`
	// Msg is the notification text that is sent
	Msg string `json:"msg,omitempty"`
	// Options is a list of access restriction options
	Options []AccessRestrictionOption `json:"options,omitempty"`
}

AccessRestriction is used to define an access restriction.

type AccessRestrictionHandler

type AccessRestrictionHandler func(AccessRestrictionMessages) bool

AccessRestrictionHandler is a function that should display a single AccessRestrictionMessage to the user. The typical implementation of this function looks like this:

func(messages AccessRestrictionMessages) { message.Render(os.Stdout) }

func AccessRestrictionHandlerFromContext

func AccessRestrictionHandlerFromContext(ctx context.Context) AccessRestrictionHandler

AccessRestrictionHandlerFromContext extracts an AccessRestrictionHandler function from the context.

func NewAccessRestrictionHandler

func NewAccessRestrictionHandler(r io.Reader, w io.Writer, askForConfirmation bool) AccessRestrictionHandler

NewAccessRestrictionHandler create an access restriction handler function.

type AccessRestrictionMessage

type AccessRestrictionMessage struct {
	Header string
	Items  []string
}

AccessRestrictionMessage collects all messages for an access restriction in order to display them to the user.

type AccessRestrictionMessages

type AccessRestrictionMessages []*AccessRestrictionMessage

AccessRestrictionMessages is a list of access restriction messages.

func CheckAccessRestrictions

func CheckAccessRestrictions(accessRestrictions []AccessRestriction, shoot *gardencorev1beta1.Shoot) (messages AccessRestrictionMessages)

CheckAccessRestrictions returns a list of access restriction messages for a given shoot cluster.

func (AccessRestrictionMessages) Confirm

func (messages AccessRestrictionMessages) Confirm(r io.Reader, w io.Writer) bool

Confirm asks for confirmation to continue.

func (AccessRestrictionMessages) Render

func (messages AccessRestrictionMessages) Render(w io.Writer)

Render displays the access restriction messages.

func (AccessRestrictionMessages) String

func (messages AccessRestrictionMessages) String() string

type AccessRestrictionOption

type AccessRestrictionOption struct {
	// Key is the identifier of an access restriction option
	Key string `json:"key,omitempty"`
	// NotifyIf controls which value the annotation must have for a notification to be sent
	NotifyIf bool `json:"notifyIf,omitempty"`
	// Msg is the notification text that is sent
	Msg string `json:"msg,omitempty"`
}

AccessRestrictionOption is used to define an access restriction option.

Jump to

Keyboard shortcuts

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