tenants

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Create function is used to implement the create tenant request. The request is an http POST request with the tenant description provided as json structure in the request body

func CreateRenewedToken added in v1.14.3

func CreateRenewedToken(apiKey string, msg string, code int) ([]byte, error)

CreateRenewedToken constructs a message resposne with the renewed token

func CreateUser

func CreateUser(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

CreateUser function is used to implement the create user request. The request is an http POST request with the user description provided as json structure in the request body

func Delete

func Delete(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Delete function used to implement remove tenant request

func DeleteUser

func DeleteUser(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

DeleteUser implements deletion and removal of user from tenant

func GetUser

func GetUser(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

GetUser gets a specific user in a specific tenant

func GetUserByID

func GetUserByID(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

GetUserByID returns user by id given

func HandleSubrouter

func HandleSubrouter(s *mux.Router, confhandler *respond.ConfHandler)

HandleSubrouter uses the subrouter for a specific calls and creates a tree of sorts handling each route with a different subrouter

func List

func List(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

List function that implements the http GET request that retrieves all avaiable tenant information

func ListOne

func ListOne(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListOne function implement an http GET request that accepts a name parameter urlvar and retrieves information only for the specific tenant

func ListReady added in v1.14.3

func ListReady(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListReady shows tenant's readines

func ListStatus

func ListStatus(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListStatus show tenant status

func ListUsers

func ListUsers(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

ListUsers function that implements the http GET request that retrieves all avaiable users in tenant

func NodeSet added in v1.14.3

func NodeSet(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

NodeSet function used set the tenant as a node

func NodeUnset added in v1.14.3

func NodeUnset(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

NodeUnset function used unset the tenant from being a node

func Options

func Options(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

func RefreshToken

func RefreshToken(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Refresh token renews user's api key

func Update

func Update(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Update function used to implement update tenant request. This is an http PUT request that gets a specific tenant's name as a urlvar parameter input and a json structure in the request body in order to update the datastore document for the specific tenant

func UpdateDbConf added in v1.14.3

func UpdateDbConf(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Update Db conf function used to update only the db_conf part of a tenant

func UpdateInfo added in v1.14.3

func UpdateInfo(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

Update Info function used to update only the info part of a tenant

func UpdateReady added in v1.14.3

func UpdateReady(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

func UpdateStatus

func UpdateStatus(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

func UpdateTopology added in v1.14.3

func UpdateTopology(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

UpdateTopology function used to update only the topology part of a tenant

func UpdateUser

func UpdateUser(r *http.Request, cfg config.Config) (int, http.Header, []byte, error)

UpdateUser function is used to implement the update user request. The request is an http PUT request with the user description provided as json structure in the request body

func ValidateTenantUsers added in v1.14.3

func ValidateTenantUsers(tenant Tenant, tenantCol *mongo.Collection) (string, int)

validateTenantUsers validates the uniqueness of the tenant's users' keys

Types

type DetailsAMS

type DetailsAMS struct {
	MetricData NodeAMS `bson:"metric_data" json:"metric_data"`
	SyncData   NodeAMS `bson:"sync_data" json:"sync_data"`
}

type DetailsHDFS

type DetailsHDFS struct {
	MetricData bool                    `bson:"metric_data" json:"metric_data"`
	SyncData   map[string]SyncDataHDFS `bson:"sync_data" json:"sync_data,omitempty"`
}
type Links struct {
	Self string `json:"self"`
}

Links struct to hold links

type NodeAMS

type NodeAMS struct {
	Ingestion       bool  `bson:"ingestion" json:"ingestion"`
	Publishing      bool  `bson:"publishing" json:"publishing"`
	StatusStreaming bool  `bson:"status_streaming" json:"status_streaming"`
	MsgArrived      int64 `bson:"messages_arrived" json:"messages_arrived"`
}

type ReadyCheck added in v1.14.3

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

type ReadyChecks added in v1.14.3

type ReadyChecks struct {
	Data      ReadyCheck `bson:"data" json:"data"`
	Topology  ReadyCheck `bson:"topology" json:"topology"`
	Reports   ReadyCheck `bson:"reports" json:"reports"`
	LastCheck string     `bson:"last_check" json:"last_check"`
}

type SelfReference

type SelfReference struct {
	ID    string `json:"id" bson:"id,omitempty"`
	Links Links  `json:"links"`
}

SelfReference to hold links and id

type StatusDetail

type StatusDetail struct {
	TotalStatus  bool        `json:"total_status"`
	AMS          DetailsAMS  `bson:"ams" json:"ams"`
	HDFS         DetailsHDFS `bson:"hdfs" json:"hdfs"`
	EngineConfig bool        `bson:"engine_config" json:"engine_config"`
	LastCheck    string      `bson:"last_check" json:"last_check"`
}

type SyncDataHDFS

type SyncDataHDFS struct {
	AggregationProf bool `bson:"aggregation_profile" json:"aggregation_profile"`
	Recomp          bool `bson:"blank_recomputation" json:"blank_recomputation"`
	ConfigProf      bool `bson:"configuration_profile" json:"configuration_profile"`
	Donwtimes       bool `bson:"downtimes" json:"downtimes"`
	GroupEndpoints  bool `bson:"group_endpoints" json:"group_endpoints"`
	GroupGroups     bool `bson:"group_groups" json:"group_groups"`
	MetricProf      bool `bson:"metric_profile" json:"metric_profile"`
	OpsProf         bool `bson:"operations_profile" json:"operations_profile"`
	Weight          bool `bson:"weights" json:"weights"`
}

type Tenant

type Tenant struct {
	ID       string         `bson:"id" json:"id"`
	Info     TenantInfo     `bson:"info" json:"info"`
	DbConf   []TenantDbConf `bson:"db_conf" json:"db_conf,omitempty"`
	Topology TopologyInfo   `bson:"topology" json:"topology"`
	Users    []TenantUser   `bson:"users" json:"users,omitempty"`
	Node     bool           `bson:"node" json:"node,omitempty"`
}

Tenant structure holds information about tenant information including db conf and users. Used in

type TenantDbConf

type TenantDbConf struct {
	Store    string `bson:"store" json:"store"`
	Server   string `bson:"server" json:"server"`
	Port     int    `bson:"port" json:"port"`
	Database string `bson:"database" json:"database"`
	Username string `bson:"username" json:"username"`
	Password string `bson:"password" json:"password"`
}

TenantDbConf structure holds information about tenant's database configuration

type TenantInfo

type TenantInfo struct {
	Name        string `bson:"name" json:"name"`
	Email       string `bson:"email" json:"email"`
	Description string `bson:"description" json:"description"`
	Image       string `bson:"image" json:"image"`
	Website     string `bson:"website" json:"website"`
	Created     string `bson:"created" json:"created"`
	Updated     string `bson:"updated" json:"updated"`
}

TenantInfo struct holds information about tenant name, contact details

type TenantReadyData added in v1.14.3

type TenantReadyData struct {
	ID    string      `bson:"id" json:"id"`
	Info  TenantInfo  `bson:"info" json:"info"`
	Ready ReadyChecks `bson:"ready" json:"ready,omitempty"`
}

type TenantReadyOut added in v1.14.3

type TenantReadyOut struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Ready     bool       `json:"ready"`
	Data      ReadyCheck `json:"data"`
	Topology  ReadyCheck `json:"topology"`
	Reports   ReadyCheck `json:"reports"`
	LastCheck string     `json:"last_check"`
}

type TenantStatus

type TenantStatus struct {
	ID     string       `bson:"id" json:"id"`
	Info   TenantInfo   `bson:"info" json:"info"`
	Status StatusDetail `bson:"status" json:"status,omitempty"`
}

type TenantUser

type TenantUser struct {
	ID        string   `bson:"id" json:"id"`
	Name      string   `bson:"name"       json:"name"`
	Email     string   `bson:"email"      json:"email"`
	APIkey    string   `bson:"api_key"    json:"api_key"`
	Roles     []string `bson:"roles,omitempty"      json:"roles,omitempty"`
	Component string   `bson:"component,omitempty" json:"component,omitempty"`
}

TenantUser structure holds information about tenant's user

type Token

type Token struct {
	APIkey string `json:"api_key"`
}

type TopologyInfo

type TopologyInfo struct {
	TopoType string `bson:"type" json:"type"`
	Feed     string `bson:"feed" json:"feed"`
}

TopologyInfo contains topology feed information

Jump to

Keyboard shortcuts

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