client

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemberTypeUser  = "User"
	MemberTypeGroup = "Group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Reader
	Writer
}

func NewClient

func NewClient(serverURL, token string) Client

NewClient returns a Rancher API client

type Entity

type Entity struct {
	ID   string
	Name string
}

Brief Rancher entity information

type Member

type Member struct {
	ID             string `yaml:"id"`
	Type           string `yaml:"type"`
	PrincipalID    string `yaml:"principalId,omitempty"`
	RoleTemplateID string `yaml:"roleTemplateId,omitempty"`
}

func (Member) Compare

func (m Member) Compare(p Member) bool

compare does the comparision but ignores the ID field

type Project

type Project struct {
	ID                  string        `yaml:"id"`
	Name                string        `yaml:"name"`
	Description         string        `yaml:"description,omitempty"`
	PodSecurityPolicyID string        `yaml:"podSecurityPolicyId,omitempty"`
	Members             []Member      `yaml:"members,omitempty"`
	ResourceQuotas      ProjectQuotas `yaml:"projectQuotas,omitempty"`
}

type ProjectList

type ProjectList struct {
	Projects []Project `yaml:"projects"`
}

func ReadProjects

func ReadProjects(yamlFile string) (*ProjectList, error)

ReadProjects reads the YAML file containing list of projects

type ProjectQuotas

type ProjectQuotas struct {
	Project   Quotas `yaml:"project,omitempty"`
	Namespace Quotas `yaml:"namespace,omitempty"`
}

type Quotas

type Quotas map[string]string

type Reader

type Reader interface {
	// Returns all clusters in Rancher
	GetClusters() ([]Entity, error)

	// Return all namespaces of the cluster
	GetNamespaces(clusterID string) ([]string, error)

	// Return all projects in the cluster
	GetProjects(clusterID string) ([]Entity, error)

	// Return list of namespaces of the project
	GetProjectNamespaces(clusterID, projectID string) ([]string, error)

	// Return LDAP groups binding to the project
	GetProjectGroups(projectID string) ([]string, error)

	// Return quotas set in the project, e.g. CPU, memory, storage, etc.
	GetProjectQuotas(projectID string) (*ProjectQuotas, error)

	// Return members of project
	GetProjectMembers(projectID string) ([]Member, error)

	GetProjectDetail(projectID string) (*Project, error)
}

Reader is to query Rancher concepts from Rancher gateway

type Writer

type Writer interface {
	CreateProject(clusterID string, project Project) (string, error)

	UpdateProject(clusterID, projectID string, project Project) error

	AddProjectMember(projectID string, member Member) (err error)
}

Jump to

Keyboard shortcuts

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