Documentation ¶
Index ¶
- Constants
- Variables
- func DetectContentType(fileName string, initialBytes []byte) string
- func RandomID(n int) string
- type App
- type AppAuthzResult
- type CertDataEntry
- type CredentialID
- type CredentialIDKind
- type CredentialIndexKey
- type Deployment
- type DeploymentMetadata
- type Domain
- type FileEntry
- type Site
- type TokenClaims
- type TokenSubject
- type TokenSubjectKind
- type User
- type UserCredential
- type UserCredentialData
Constants ¶
View Source
const MaxFiles = 10000
Variables ¶
View Source
var ErrAccessDenied = errors.New("access denied")
View Source
var ErrAppNotFound = errors.New("app not found")
View Source
var ErrAppUsedID = errors.New("used app ID")
View Source
var ErrCertificateDataLocked = errors.New("cert locked")
View Source
var ErrCertificateDataNotFound = errors.New("cert data not found")
View Source
var ErrDeploymentAlreadyUploaded = errors.New("deployment is already uploaded")
View Source
var ErrDeploymentExpired = errors.New("deployment expired")
View Source
var ErrDeploymentNotFound = errors.New("deployment not found")
View Source
var ErrDeploymentNotUploaded = errors.New("deployment is not uploaded")
View Source
var ErrDeploymentUsedName = errors.New("used deployment name")
View Source
var ErrDomainNotFound = errors.New("domain not found")
View Source
var ErrDomainUsedName = errors.New("used domain name")
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrSiteNotFound = errors.New("site not found")
View Source
var ErrUndefinedDomain = errors.New("undefined domain")
View Source
var ErrUndefinedSite = errors.New("undefined site")
View Source
var ErrUserNotFound = errors.New("user not found")
Functions ¶
func DetectContentType ¶
Types ¶
type App ¶
type App struct { ID string `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"` OwnerUserID string `json:"ownerUserID" db:"owner_user_id"` Config *config.AppConfig `json:"config" db:"config"` }
func (*App) CheckAuthz ¶
func (a *App) CheckAuthz(level config.AccessLevel, userID string, credentials []CredentialID) (*AppAuthzResult, error)
func (*App) CredentialIndexKeys ¶
func (a *App) CredentialIndexKeys() []CredentialIndexKey
type AppAuthzResult ¶
type AppAuthzResult struct { CredentialID CredentialID Rule *config.ACLSubjectRule // nil => is owner }
func CheckACLAuthz ¶
func CheckACLAuthz(access config.ACL, credentials []CredentialID) (*AppAuthzResult, error)
func (*AppAuthzResult) MatchedRule ¶
func (i *AppAuthzResult) MatchedRule() string
type CertDataEntry ¶
type CertDataEntry struct { Key string `db:"key"` UpdatedAt time.Time `db:"updated_at"` Value string `db:"value"` }
func NewCertDataEntry ¶
func NewCertDataEntry(key string, value string, now time.Time) *CertDataEntry
type CredentialID ¶
type CredentialID string
func CredentialGitHubRepositoryActions ¶
func CredentialGitHubRepositoryActions(repo string) CredentialID
func CredentialGitHubUser ¶
func CredentialGitHubUser(username string) CredentialID
func CredentialIP ¶
func CredentialIP(ip string) CredentialID
func CredentialUserID ¶
func CredentialUserID(id string) CredentialID
func (CredentialID) Matches ¶
func (c CredentialID) Matches(r *config.ACLSubjectRule) bool
type CredentialIDKind ¶
type CredentialIDKind string
const ( CredentialIDKindUserID CredentialIDKind = "" CredentialIDKindGitHubUser CredentialIDKind = "github" CredentialIDGitHubRepositoryActions CredentialIDKind = "github-repo-actions" CredentialIDIP CredentialIDKind = "ip" )
type CredentialIndexKey ¶
type CredentialIndexKey string
func CollectCredentialIDIndexKeys ¶
func CollectCredentialIDIndexKeys(ids []CredentialID) []CredentialIndexKey
func MakeCredentialIDIndexKeys ¶
func MakeCredentialIDIndexKeys(id CredentialID) []CredentialIndexKey
func MakeCredentialRuleIndexKeys ¶
func MakeCredentialRuleIndexKeys(r *config.ACLSubjectRule) []CredentialIndexKey
type Deployment ¶
type Deployment struct { ID string `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"` Name string `json:"name" db:"name"` AppID string `json:"appID" db:"app_id"` StorageKeyPrefix string `json:"-" db:"storage_key_prefix"` Metadata *DeploymentMetadata `json:"metadata" db:"metadata"` UploadedAt *time.Time `json:"uploadedAt" db:"uploaded_at"` ExpireAt *time.Time `json:"expireAt" db:"expire_at"` }
func NewDeployment ¶
func NewDeployment( now time.Time, name string, appID string, storageKeyPrefix string, metadata *DeploymentMetadata, ) *Deployment
func (*Deployment) CheckAlive ¶
func (d *Deployment) CheckAlive(now time.Time) error
type DeploymentMetadata ¶
type DeploymentMetadata struct { Files []FileEntry `json:"files,omitempty"` Config config.SiteConfig `json:"config"` }
func (*DeploymentMetadata) Scan ¶
func (m *DeploymentMetadata) Scan(val any) error
type Domain ¶ added in v0.5.0
type Domain struct { ID string `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"` Domain string `json:"domain" db:"domain"` AppID string `json:"appID" db:"app_id"` SiteName string `json:"siteName" db:"site_name"` }
type Site ¶
type Site struct { ID string `json:"id" db:"id"` AppID string `json:"appID" db:"app_id"` Name string `json:"name" db:"name"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"` DeploymentID *string `json:"deploymentID" db:"deployment_id"` }
type TokenClaims ¶
type TokenClaims struct { Name string `json:"name,omitempty"` Credentials []CredentialID `json:"credentials,omitempty"` jwt.RegisteredClaims }
func NewTokenClaims ¶
func NewTokenClaims(sub TokenSubject, name string) *TokenClaims
type TokenSubject ¶
type TokenSubject string
func TokenSubjectGitHubActions ¶
func TokenSubjectGitHubActions(jti string) TokenSubject
func TokenSubjectUser ¶
func TokenSubjectUser(id string) TokenSubject
func (TokenSubject) Parse ¶
func (s TokenSubject) Parse() (TokenSubjectKind, string, bool)
type TokenSubjectKind ¶
type TokenSubjectKind string
const ( TokenSubjectKindUser TokenSubjectKind = "" TokenSubjectKindGitHubActions TokenSubjectKind = "github-actions" )
func (TokenSubjectKind) IsValid ¶
func (k TokenSubjectKind) IsValid() bool
type User ¶
type UserCredential ¶
type UserCredential struct { ID CredentialID `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"` UserID string `json:"userID" db:"user_id"` Data *UserCredentialData `json:"data" db:"data"` }
func NewUserCredential ¶
func NewUserCredential(now time.Time, userID string, id CredentialID, data *UserCredentialData) *UserCredential
type UserCredentialData ¶
type UserCredentialData struct {
KeyFingerprint string `json:"keyFingerprint,omitempty"`
}
func (*UserCredentialData) Scan ¶
func (d *UserCredentialData) Scan(val any) error
Click to show internal directories.
Click to hide internal directories.