model

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package model holds the SSH credential entity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSHCredential

type SSHCredential struct {
	ID string `gorm:"column:ssh_credential_id;primaryKey;type:varchar(36)" json:"sshCredentialId"`

	SSHCredentialName string `gorm:"column:ssh_credential_name;type:varchar(255);not null" json:"sshCredentialName"`

	PublicKey  string  `gorm:"column:public_key;type:text;not null" json:"publicKey"`
	PrivateKey string  `gorm:"column:private_key;type:text;not null" json:"-"`
	Passphrase *string `gorm:"column:passphrase;type:varchar(255)" json:"-"`
	Password   *string `gorm:"column:password;type:varchar(255)" json:"-"`

	// Certificate based authentication. This indicates whether the SSH credential uses a certificate for authentication.
	IsCertificate bool `gorm:"column:is_certificate;not null" json:"isCertificate"`

	// FullInteractive indicates whether the SSH requires full interactive authentication.
	FullInteractive bool `gorm:"column:full_interactive;not null" json:"fullInteractive"`

	// OwnerID is varchar(255) to match users.user_id: a CILogon subject is far longer
	// than a UUID. RESTRICT, so a user who still owns keys cannot be deleted out from
	// under them.
	OwnerID string    `gorm:"column:owner_id;type:varchar(255);not null;index" json:"ownerId"`
	Owner   *iam.User `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
}

SSHCredential is a registered SSH credential.

PrivateKey and Passphrase are secrets: they are stored here but deliberately have no field on the read-side response DTO, so they cannot leak through a GET. Update paths must treat a blank incoming value as "unchanged" rather than "erase" — see ptr.NonBlank.

It belongs to whoever registered it, and — unlike every other owned record here — there is no sharing model to reach it by. A credential is the secret material itself rather than something reached with it, so a cluster config or a data storage may only present a credential its own owner registered. Sharing the config is how someone else submits under it; the credential never leaves its owner.

func (*SSHCredential) BeforeCreate

func (k *SSHCredential) BeforeCreate(*gorm.DB) error

BeforeCreate assigns a UUID when none was supplied, replacing Hibernate's @GeneratedValue(strategy = GenerationType.UUID).

func (*SSHCredential) OwnedBy

func (k *SSHCredential) OwnedBy(userID string) bool

func (SSHCredential) TableName

func (SSHCredential) TableName() string

TableName returns the table backing SSHCredential.

Jump to

Keyboard shortcuts

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