rbac

package
v1.20.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance(i Ops)

SetInstance replaces the instance with the provided one. Should be used only for testing purposes.

Types

type Client

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

Client is a wrapper for the kubernetes rbac client.

func New

func New(client rbacv1client.RbacV1Interface) *Client

New builds a new rbac client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

NewForConfig builds a new rbac client for the given config.

func (*Client) CreateClusterRole

func (c *Client) CreateClusterRole(role *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)

CreateClusterRole creates the given cluster role

func (*Client) CreateClusterRoleBinding

func (c *Client) CreateClusterRoleBinding(binding *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error)

CreateClusterRoleBinding creates the given cluster role binding

func (*Client) CreateRole

func (c *Client) CreateRole(role *rbac_v1.Role) (*rbac_v1.Role, error)

CreateRole creates the given role

func (*Client) CreateRoleBinding

func (c *Client) CreateRoleBinding(binding *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)

CreateRoleBinding creates the given role binding

func (*Client) DeleteClusterRole

func (c *Client) DeleteClusterRole(roleName string) error

DeleteClusterRole deletes the given cluster role

func (*Client) DeleteClusterRoleBinding

func (c *Client) DeleteClusterRoleBinding(bindingName string) error

DeleteClusterRoleBinding deletes the given cluster role binding

func (*Client) DeleteRole

func (c *Client) DeleteRole(name, namespace string) error

DeleteRole deletes the given role

func (*Client) DeleteRoleBinding

func (c *Client) DeleteRoleBinding(name, namespace string) error

DeleteRoleBinding deletes the given role binding

func (*Client) GetClusterRole

func (c *Client) GetClusterRole(name string) (*rbacv1.ClusterRole, error)

GetClusterRole gets the given cluster role

func (*Client) GetClusterRoleBinding

func (c *Client) GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)

GetClusterRoleBinding gets the given cluster role binding

func (*Client) GetRole

func (c *Client) GetRole(name, namespace string) (*rbac_v1.Role, error)

GetRole gets the given role

func (*Client) GetRoleBinding

func (c *Client) GetRoleBinding(name, namespace string) (*rbacv1.RoleBinding, error)

GetRoleBinding gets the given role binding

func (*Client) ListClusterRoleBindings

func (c *Client) ListClusterRoleBindings() (*rbacv1.ClusterRoleBindingList, error)

ListClusterRoleBindings lists the cluster role bindings

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client

func (*Client) UpdateClusterRole

func (c *Client) UpdateClusterRole(role *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)

UpdateClusterRole updates the given cluster role

func (*Client) UpdateClusterRoleBinding

func (c *Client) UpdateClusterRoleBinding(binding *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error)

UpdateClusterRoleBinding updates the given cluster role binding

func (*Client) UpdateRole

func (c *Client) UpdateRole(role *rbac_v1.Role) (*rbac_v1.Role, error)

UpdateRole updates the given role

func (*Client) UpdateRoleBinding

func (c *Client) UpdateRoleBinding(binding *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)

UpdateRoleBinding updates the given role binding

type ClusterRoleBindingOps

type ClusterRoleBindingOps interface {
	// GetClusterRoleBinding gets the given cluster role binding
	GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)
	// ListClusterRoleBindings lists the cluster role bindings
	ListClusterRoleBindings() (*rbacv1.ClusterRoleBindingList, error)
	// CreateClusterRoleBinding creates the given cluster role binding
	CreateClusterRoleBinding(role *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error)
	// UpdateClusterRoleBinding updates the given cluster role binding
	UpdateClusterRoleBinding(role *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error)
	// DeleteClusterRoleBinding deletes the given cluster role binding
	DeleteClusterRoleBinding(roleName string) error
}

ClusterRoleBindingOps is an interface to perform operations on ClusterRoleBinding resources.

type ClusterRoleOps

type ClusterRoleOps interface {
	// CreateClusterRole creates the given cluster role
	CreateClusterRole(role *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)
	// GetClusterRole gets the given cluster role
	GetClusterRole(name string) (*rbacv1.ClusterRole, error)
	// UpdateClusterRole updates the given cluster role
	UpdateClusterRole(role *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)
	// DeleteClusterRole deletes the given cluster role
	DeleteClusterRole(roleName string) error
}

ClusterRoleOps is an interface to perform operations on ClusterRole resources.

type Ops

type Ops interface {
	ClusterRoleBindingOps
	ClusterRoleOps
	RoleBindingOps
	RoleOps

	// SetConfig sets the config and resets the client
	SetConfig(config *rest.Config)
}

Ops is an interface to perform kubernetes related operations on the rbac resources.

func Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

type RoleBindingOps

type RoleBindingOps interface {
	// CreateRoleBinding creates the given role binding
	CreateRoleBinding(role *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)
	// UpdateRoleBinding updates the given role binding
	UpdateRoleBinding(role *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)
	// GetRoleBinding gets the given role binding
	GetRoleBinding(name, namespace string) (*rbacv1.RoleBinding, error)
	// DeleteRoleBinding deletes the given role binding
	DeleteRoleBinding(name, namespace string) error
}

RoleBindingOps is an interface to perform operations on RoleBinding resources.

type RoleOps

type RoleOps interface {
	// CreateRole creates the given role
	CreateRole(role *rbac_v1.Role) (*rbac_v1.Role, error)
	// UpdateRole updates the given role
	UpdateRole(role *rbac_v1.Role) (*rbac_v1.Role, error)
	// GetRole gets the given role
	GetRole(name, namespace string) (*rbac_v1.Role, error)
	// DeleteRole deletes the given role
	DeleteRole(name, namespace string) error
}

RoleOps is an interface to perform operations on role resources.

Jump to

Keyboard shortcuts

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