models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestStateNew            RequestStateType = "NEW"
	RequestStateApproved       RequestStateType = "APPROVED"
	RequestStateRejected       RequestStateType = "REJECTED"
	RequestAddToGroup          RequestType      = "GROUP"
	RequestExitFromGroup       RequestType      = "GROUP_EXIT"
	RequestExtendServiceExpiry RequestType      = "SERVICE_EXPIRY"
)

Variables

View Source
var ExcludeGroups []string

ExcludeGroups is a list of groups to exclude from the list of groups

Functions

This section is empty.

Types

type Capacity

type Capacity struct {
	CPU    float64 `json:"cpu" bson:"cpu,omitempty"`
	Memory int     `json:"memory" bson:"memory,omitempty"`
}

type Catalog

type Catalog struct {
	ID          string        `json:"id"`
	Type        string        `json:"type"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Capacity    Capacity      `json:"capacity"`
	Retired     bool          `json:"retired"`
	Expiry      int           `json:"expiry"`
	VM          VM            `json:"vm"`
	Status      CatalogStatus `json:"status"`
}

type CatalogStatus

type CatalogStatus struct {
	Ready   bool   `json:"ready"`
	Message string `json:"message,omitempty"`
}

type Group

type Group struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// Membership is a flag to indicate if the user is a member of the group
	Membership bool     `json:"membership"`
	Quota      Capacity `json:"quota"`
}

func FilterExcludedGroups

func FilterExcludedGroups(groups []Group) []Group

FilterExcludedGroups filters out groups that are excluded

type GroupAdmission

type GroupAdmission struct {
	GroupID   string `json:"group_id" bson:"group_id,omitempty"`
	Group     string `json:"group" bson:"group,omitempty"`
	Requester string `json:"requester" bson:"requester,omitempty"`
}

type Key

type Key struct {
	ID      primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	UserID  string             `json:"user_id" bson:"user_id,omitempty"`
	Name    string             `json:"name" bson:"name,omitempty"`
	Content string             `json:"content" bson:"content,omitempty"`
}

func GetNewKey

func GetNewKey() Key

type NewRequest

type NewRequest struct {
	Justification string `json:"justification"`
}

func GetNewRequest

func GetNewRequest() NewRequest

type Quota

type Quota struct {
	ID       primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	GroupID  string             `json:"group_id" bson:"group_id"`
	Capacity Capacity           `json:"capacity" bson:"capacity"`
}

type Request

type Request struct {
	ID             primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	UserID         string             `json:"user_id" bson:"user_id,omitempty"`
	Justification  string             `json:"justification" bson:"justification,omitempty"`
	Comment        string             `json:"comment" bson:"comment,omitempty"`
	CreatedAt      time.Time          `json:"created_at" bson:"created_at,omitempty"`
	State          RequestStateType   `json:"state" bson:"state,omitempty"`
	RequestType    RequestType        `json:"type" bson:"type,omitempty"`
	GroupAdmission *GroupAdmission    `json:"group,omitempty" bson:"group,omitempty"`
	ServiceExpiry  *ServiceExpiry     `json:"service,omitempty" bson:"service,omitempty"`
}

func GetRequest

func GetRequest() Request

func GetRequests

func GetRequests() []Request

type RequestStateType

type RequestStateType string

type RequestType

type RequestType string

type Service

type Service struct {
	ID          string        `json:"id"`
	UserID      string        `json:"user_id"`
	Name        string        `json:"name"`
	DisplayName string        `json:"display_name"`
	CatalogName string        `json:"catalog_name"`
	Expiry      time.Time     `json:"expiry"`
	Status      ServiceStatus `json:"status"`
}

Service will have the details of the user provisioned service from catalog

type ServiceExpiry

type ServiceExpiry struct {
	Name   string    `json:"name" bson:"name,omitempty"`
	Expiry time.Time `json:"expiry" bson:"expiry,omitempty"`
}

type ServiceStatus

type ServiceStatus struct {
	State      string `json:"state"`
	Message    string `json:"message"`
	AccessInfo string `json:"access_info"`
}

type User

type User struct {
	ID        string   `json:"id"`
	Username  string   `json:"username"`
	FirstName string   `json:"firstname"`
	LastName  string   `json:"lastname"`
	Email     string   `json:"email"`
	Groups    []string `json:"groups"`
}

type VM

type VM struct {
	CRN           string   `json:"crn"`
	ProcessorType string   `json:"processor_type"`
	SystemType    string   `json:"system_type"`
	Image         string   `json:"image"`
	Network       string   `json:"network"`
	Capacity      Capacity `json:"capacity"`
}

Jump to

Keyboard shortcuts

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