handlers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Overview

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	// -- ADMIN --
	BUCKET_ADMIN = "_admin"

	// BUCKET_PROJECTS will have list of all projects inside a
	// sailor instance, this bucket lives inside [BUCKET_ADMIN]
	BUCKET_PROJECTS = "projects"

	// BUCKET_USERS is used to store all the users and their
	// roles and permissions, this bucket lives inside [BUCKET_ADMIN]
	BUCKET_USERS = "users"

	// BUCKET_SETTING is collection of sailor wide settings this
	// buckect lives inside [BUCKET_ADMIN]
	BUCKET_SETTING = "settings"

	// KEY_SETTING is used to save sailor wide settings this
	// key lives inside [BUCKET_ADMIN]
	KEY_SETTING = "settings"

	// -- PROJECT --
	// BUCKET_META contains meta information about a project.
	// Each project will have a meta bucket and it will contain:
	//
	// 1. access key
	// 2. secret key
	// 3. current deployed version of all resources
	BUCKET_META = "_meta"

	// KEY_ACCESS_KEY has the access key for a sailor project
	// this key lives inside [BUCKET_META]
	KEY_ACCESS_KEY = "access_key"

	// KEY_SECRET_KEY has the secret key for a sailor project
	// which is mainly used to encrypt and decrypt a secret
	// resource
	KEY_SECRET_KEY = "secret_key"

	// BUCKET_RESOURCE contains all the resources present in a project
	BUCKET_RESOURCE = "resource"

	// BUCKET_DEPLOYMENT contains buckets for each resource
	// 		- config
	// 		- secret
	// 		- {key}-misc
	// and each sub-bucket will contain list of deployments per resource
	BUCKET_DEPLOYMENT = "deployments"

	// --- AUDIT ---
	// BUCKET_AUDIT contains audit trail of each action taken
	// by an user
	BUCKET_AUDIT = "_audit"

	// BUCKET_AUDIT_TRAIL is a bucket inside the AUDIT sail
	BUCKET_AUDIT_TRAIL = "audit_trail"

	BUCKET_BACKUP = "backup"

	KEY_S3 = "s3"

	// db extension used by sailor
	DB_EXT = ".sail"

	// decoded sailor claims from request
	SAILOR_CLAIMS_KEY = "__sailor_claims"
)
View Source
const (
	KindConfig = "config"
	KindSecret = "secret"
	KindMisc   = "misc"
)

-- RESOURCE TYPES INSIDE SAILOR --

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltResource added in v0.0.4

type BuiltResource struct {
	Content string `json:"content"`
	Version uint32 `json:"version"`
}

type CreateDeploymentRequest

type CreateDeploymentRequest struct {
	Description  string            `json:"desc"`
	ConfigData   map[string]any    `json:"config_data"`
	MiscData     string            `json:"misc_data"`
	SecretData   map[string]string `json:"secret_data"`
	LocalVersion int               `json:"local_version"`
}

type DBUser

type DBUser struct {
	Email       string   `json:"email"`
	Username    string   `json:"username"`
	Password    [32]byte `json:"password"`
	Permissions []string `json:"permissions"`
	Roles       []string `json:"roles"`
	AllowedApps []string `json:"allowed_apps"`
	Token       string   `json:"token"`
	Fingerprint string   `json:"fp"`
}

DBUser is the user object stored in the database

type DeployResourceRequest

type DeployResourceRequest struct {
	Version string `json:"version"`
}

type FirstConfig

type FirstConfig struct {
	App string `json:"app"`
}

type Project

type Project struct {
	Ns  string `json:"ns"`
	App string `json:"app"`
}

type ResourceKind

type ResourceKind string

func (ResourceKind) IsConfig

func (rk ResourceKind) IsConfig() bool

func (ResourceKind) IsMisc

func (rk ResourceKind) IsMisc() bool

func (ResourceKind) IsOneOf

func (rk ResourceKind) IsOneOf(kinds ...ResourceKind) bool

func (ResourceKind) IsSecret

func (rk ResourceKind) IsSecret() bool

func (ResourceKind) ResourceKey

func (rk ResourceKind) ResourceKey(name string) string

type ResponseMessage

type ResponseMessage struct {
	Message string `json:"message"`
}

type SailorCore

type SailorCore struct {
	Log *zap.Logger

	// TODO :: we need to abstract all sail operations behind this
	// single interface
	SailorSail sail.Sail
	// contains filtered or unexported fields
}

func NewSailorCore

func NewSailorCore() *SailorCore

func (*SailorCore) AuthBasicHandler

func (sc *SailorCore) AuthBasicHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) AuthCallbackHandler

func (sc *SailorCore) AuthCallbackHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) AuthOIDCHandler

func (sc *SailorCore) AuthOIDCHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) AuthRBACHandler

func (sc *SailorCore) AuthRBACHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) Authenticated

func (*SailorCore) ChangePasswordHandler

func (sc *SailorCore) ChangePasswordHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) ClientCallable

func (sc *SailorCore) ClientCallable(next fasthttp.RequestHandler) fasthttp.RequestHandler

func (*SailorCore) CreateDeploymentHandler

func (sc *SailorCore) CreateDeploymentHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) CreateProjectHandler

func (sc *SailorCore) CreateProjectHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) CreateResourceHandler

func (sc *SailorCore) CreateResourceHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) CreateUserHandler

func (sc *SailorCore) CreateUserHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) DeployResourceHandler

func (sc *SailorCore) DeployResourceHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetAuditEvents added in v0.0.3

func (c *SailorCore) GetAuditEvents(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetDeploymentHandler

func (sc *SailorCore) GetDeploymentHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetKeyPairHandler added in v0.0.4

func (sc *SailorCore) GetKeyPairHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetManifestHandler

func (sc *SailorCore) GetManifestHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetResourceHandler

func (sc *SailorCore) GetResourceHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetResourceSchemaHandler

func (sc *SailorCore) GetResourceSchemaHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetResourceSetting

func (sc *SailorCore) GetResourceSetting(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetSailorSettingHandler

func (sc *SailorCore) GetSailorSettingHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) GetTokenHandler

func (sc *SailorCore) GetTokenHandler(ctx *fasthttp.RequestCtx)

GetTokenHandler gives sailor specific token to the user, to interact with the resource APIs, the /token call happens after oidc callback

func (*SailorCore) GetUserHandler

func (sc *SailorCore) GetUserHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) K8sAdmissionHookHandler added in v0.0.4

func (sc *SailorCore) K8sAdmissionHookHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) SailorSettingHandler

func (sc *SailorCore) SailorSettingHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) UpdateManifestHandler

func (sc *SailorCore) UpdateManifestHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) UpdateResourceSchemaHandler

func (sc *SailorCore) UpdateResourceSchemaHandler(ctx *fasthttp.RequestCtx)

func (*SailorCore) UpdateResourceSetting

func (sc *SailorCore) UpdateResourceSetting(ctx *fasthttp.RequestCtx)

func (*SailorCore) VersionHandler

func (sc *SailorCore) VersionHandler(w http.ResponseWriter, r *http.Request)

VersionHandler ... TODO :: need to create version API for efficient pulls

type SailorParams

type SailorParams struct {
	ProjectKey string
	Ns         string
	App        string

	// ResourceName is used incase of Misc Resource
	ResourceName string
	Kind         ResourceKind
	Body         []byte

	// authentication
	Token string

	// deployment related
	RequestedVersion string
}

type User

type User struct {
	Email       string   `json:"email"`
	Password    string   `json:"pass"`
	Permissions []string `json:"permissions"`
	Roles       []string `json:"roles"`
	AllowedApps []string `json:"allowed_apps"`
}

User is the user object returned to the client

Jump to

Keyboard shortcuts

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