spaces

package
v2.11.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package spaces contains the kf sub-commands for manipulating spaces.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffWrapper

func DiffWrapper(w io.Writer, mutator spaces.Mutator) spaces.Mutator

DiffWrapper wraps a mutator and prints out the diff between the original object and the one it returns if there's no error.

Example (Changes)
obj := &v1alpha1.Space{}
obj.Name = "opaque"

contents := &bytes.Buffer{}
wrapper := DiffWrapper(contents, func(obj *v1alpha1.Space) error {
	obj.Name = "docker-creds"
	return nil
})

fmt.Println("Error:", wrapper(obj))
firstLine := strings.Split(contents.String(), "\n")[0]
fmt.Println("First line:", firstLine)
Output:

Error: <nil>
First line: Space Diff (-old +new):
Example (Err)
obj := &v1alpha1.Space{}

wrapper := DiffWrapper(os.Stdout, func(_ *v1alpha1.Space) error {
	return errors.New("some-error")
})

fmt.Println(wrapper(obj))
Output:

some-error
Example (NoDiff)
obj := &v1alpha1.Space{}

wrapper := DiffWrapper(os.Stdout, func(s *v1alpha1.Space) error {
	// don't mutate the object
	return nil
})

wrapper(obj)
Output:

No changes

func FormatDiff

func FormatDiff(w io.Writer, leftName, rightName string, left, right *v1alpha1.Space)

FormatDiff creates a diff between two v1alpha1.Spaces and writes it to the given writer.

func NewConfigSpaceCommand

func NewConfigSpaceCommand(p *config.KfParams, client spaces.Client) *cobra.Command

NewConfigSpaceCommand creates a command that can set facets of a space.

func NewCreateSpaceCommand

func NewCreateSpaceCommand(p *config.KfParams, client spaces.Client) *cobra.Command

NewCreateSpaceCommand allows users to create spaces.

func NewDeleteSpaceCommand

func NewDeleteSpaceCommand(p *config.KfParams) *cobra.Command

NewDeleteSpaceCommand allows users to delete spaces.

func NewDomainsCommand

func NewDomainsCommand(p *config.KfParams, client spaces.Client) *cobra.Command

NewDomainsCommand allows developers to list domains for a Space.

func NewGetSpaceCommand

func NewGetSpaceCommand(p *config.KfParams) *cobra.Command

NewGetSpaceCommand allows users to create spaces.

func NewListSpacesCommand

func NewListSpacesCommand(p *config.KfParams) *cobra.Command

NewListSpacesCommand allows users to list spaces.

func NewSetSpaceRoleCommand

func NewSetSpaceRoleCommand(p *config.KfParams, kubeClient kubernetes.Interface) *cobra.Command

NewSetSpaceRoleCommand allows users to assign role to a subject.

func NewSpaceUsersCommand

func NewSpaceUsersCommand(p *config.KfParams, kubeClient kubernetes.Interface) *cobra.Command

NewSpaceUsersCommand allows users to list users for a Space.

func NewUnsetSpaceRoleCommand

func NewUnsetSpaceRoleCommand(p *config.KfParams, kubeClient kubernetes.Interface) *cobra.Command

NewUnsetSpaceRoleCommand allows users to un-assign role to a subject.

Types

type Subject

type Subject struct {
	Name  string
	Kind  string
	Roles []string
}

Subject is the reverse index of User to Roles mapping.

Jump to

Keyboard shortcuts

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