clients

package
v0.0.0-...-0707157 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultOpenShiftClient

type DefaultOpenShiftClient struct {
	// contains filtered or unexported fields
}

DefaultOpenShiftClient is the default impl of OpenShiftClient

func (*DefaultOpenShiftClient) ListNamespaces

func (c *DefaultOpenShiftClient) ListNamespaces(token string) (namespaces []Namespace, err error)

ListNamespaces associated with a given token

func (*DefaultOpenShiftClient) SubjectAccessReview

func (c *DefaultOpenShiftClient) SubjectAccessReview(groups []string, user, namespace, verb, resource, resourceAPIGroup string) (bool, error)

SubjectAccessReview performs a SAR and returns true if the user is allowed

func (*DefaultOpenShiftClient) TokenReview

func (c *DefaultOpenShiftClient) TokenReview(token string) (*TokenReview, error)

TokenReview performs a tokenreview for a given token submitting to the apiserver using the serviceaccount token. It returns a simplejson object of the response

type Namespace

type Namespace struct {
	Ns osprojectv1.Project
}

Namespace wrappers a core kube namespace type

func (*Namespace) Name

func (ns *Namespace) Name() string

Name get the name of a namespace

type OpenShiftClient

type OpenShiftClient interface {
	ListNamespaces(token string) ([]Namespace, error)

	//TokenReview performs a tokenreview for a given token submitting to the apiserver
	//using the serviceaccount token. It returns a simplejson object of the response
	TokenReview(token string) (*TokenReview, error)
	SubjectAccessReview(groups []string, user, namespace, verb, resource, resourceAPIGroup string) (bool, error)
}

OpenShiftClient abstracts kubeclient and calls

func NewOpenShiftClient

func NewOpenShiftClient() (OpenShiftClient, error)

NewOpenShiftClient returns a client for connecting to the api server.

type TokenReview

type TokenReview struct {
	*authenticationapi.TokenReview
}

TokenReview is simple struct wrapper around a kubernetes TokenReview

func (*TokenReview) Groups

func (t *TokenReview) Groups() []string

Groups returns the groups associated with a given token

func (*TokenReview) UserName

func (t *TokenReview) UserName() string

UserName returns the username associated with a given token

Jump to

Keyboard shortcuts

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