Documentation
¶
Index ¶
- Constants
- Variables
- func LogInjectGroups(ctx context.Context, groups []*Group) context.Context
- func LogInjectKey(ctx context.Context, key *Key) context.Context
- func LogInjectSystem(ctx context.Context, sys *System) context.Context
- func LogInjectTenant(ctx context.Context, tenant *Tenant) context.Context
- func NewIAMIdentifier(name string, tenantID string) string
- func ValidateAll(v ...Validator) error
- func WithLogInjectGroups(groups []*Group) cmkcontext.Opt
- func WithLogInjectKey(key *Key) cmkcontext.Opt
- func WithLogInjectSystem(sys *System) cmkcontext.Opt
- func WithLogInjectTenant(tenant *Tenant) cmkcontext.Opt
- type AutoTimeModel
- type BaseLabel
- type Certificate
- type CertificatePurpose
- type CertificateState
- type CertificateSubject
- type ClientCertificate
- type ClientCertificates
- type CryptoConfig
- type Event
- type Group
- type ImportParams
- type JoinSystem
- type Key
- func (m *Key) AfterFind(tx *gorm.DB) error
- func (m Key) CheckAuthz(ctx context.Context, ...) (bool, error)
- func (m *Key) GetCryptoAccessData() KeyAccessData
- func (m *Key) GetManagementAccessData() (cmkapi.KeyAccessDetailsRegion, error)
- func (Key) IsSharedModel() bool
- func (m Key) TableName() string
- func (m Key) TableResourceType() authz.RepoResourceType
- type KeyAccessData
- type KeyConfiguration
- func (m KeyConfiguration) CheckAuthz(ctx context.Context, ...) (bool, error)
- func (kc *KeyConfiguration) GetCreatorName(ctx context.Context, identityManager identitymanagement.IdentityManagement) (string, error)
- func (KeyConfiguration) IsSharedModel() bool
- func (kc *KeyConfiguration) SetID(id uuid.UUID)
- func (m KeyConfiguration) TableName() string
- func (m KeyConfiguration) TableResourceType() authz.RepoResourceType
- type KeyLabel
- type KeyVersion
- type Keystore
- type KeystoreAccessData
- type KeystoreConfig
- type ManagementConfig
- type RequestCertArgs
- type System
- func (m *System) AfterSave(tx *gorm.DB) error
- func (m *System) BeforeDelete(tx *gorm.DB) error
- func (m System) CheckAuthz(ctx context.Context, ...) (bool, error)
- func (System) IsSharedModel() bool
- func (m System) TableName() string
- func (m System) TableResourceType() authz.RepoResourceType
- func (m *System) UpdateSystemProperties(ctx context.Context, ...) (bool, error)
- type SystemProperty
- type Tag
- type Tenant
- type TenantConfig
- type TenantRole
- type TenantStatus
- type Validator
- type Workflow
- func (m Workflow) BeforeDelete(tx *gorm.DB) error
- func (m *Workflow) BeforeSave(tx *gorm.DB) error
- func (m Workflow) CheckAuthz(ctx context.Context, ...) (bool, error)
- func (m Workflow) Description(ctx context.Context, idm identitymanagement.IdentityManagement) (string, error)
- func (m Workflow) GetArtifactName() string
- func (w *Workflow) GetInitiatorName(ctx context.Context, identityManager identitymanagement.IdentityManagement) (string, error)
- func (Workflow) IsSharedModel() bool
- func (m Workflow) TableName() string
- func (m Workflow) TableResourceType() authz.RepoResourceType
- type WorkflowActionType
- type WorkflowApprover
- func (m WorkflowApprover) CheckAuthz(ctx context.Context, ...) (bool, error)
- func (m *WorkflowApprover) GetUserName(ctx context.Context, identityManager identitymanagement.IdentityManagement) (string, error)
- func (WorkflowApprover) IsSharedModel() bool
- func (m WorkflowApprover) TableName() string
- func (m WorkflowApprover) TableResourceType() authz.RepoResourceType
- type WorkflowApproverGroup
- type WorkflowArtifactType
- type WorkflowConfig
- type WorkflowState
Constants ¶
const ( CertificateStateActive CertificateState = "ACTIVE" CertificateStateExpired CertificateState = "EXPIRED" CertificateSubjectKey string = "certificateSubject" )
const ( MaxIAMIdentifierLength = 128 MaxNameLength = 64 // ValidTextPattern is a pattern matching // alphanumeric, "_" and "-" ValidTextPattern = `^[a-zA-Z0-9 _-]+$` )
const ( WorkflowStateInitial WorkflowState = "INITIAL" WorkflowStateRevoked WorkflowState = "REVOKED" WorkflowStateRejected WorkflowState = "REJECTED" WorkflowStateExpired WorkflowState = "EXPIRED" WorkflowStateWaitApproval WorkflowState = "WAIT_APPROVAL" WorkflowStateWaitConfirmation WorkflowState = "WAIT_CONFIRMATION" WorkflowStateExecuting WorkflowState = "EXECUTING" WorkflowStateSuccessful WorkflowState = "SUCCESSFUL" WorkflowStateFailed WorkflowState = "FAILED" WorkflowArtifactTypeKey WorkflowArtifactType = "KEY" WorkflowArtifactTypeKeyConfiguration WorkflowArtifactType = "KEY_CONFIGURATION" WorkflowArtifactTypeSystem WorkflowArtifactType = "SYSTEM" WorkflowActionTypeUpdateState WorkflowActionType = "UPDATE_STATE" WorkflowActionTypeUpdatePrimary WorkflowActionType = "UPDATE_PRIMARY" WorkflowActionTypeLink WorkflowActionType = "LINK" WorkflowActionTypeUnlink WorkflowActionType = "UNLINK" WorkflowActionTypeSwitch WorkflowActionType = "SWITCH" WorkflowActionTypeDelete WorkflowActionType = "DELETE" )
const ResourceID = "resource_id"
const WorkflowID = "workflow_id"
Variables ¶
var ( ErrInvalidIAMIdentifier = fmt.Errorf("%w: invalid group IAMIdentifier", ErrValidation) ErrInvalidName = fmt.Errorf("%w: invalid group name", ErrValidation) )
var ( ErrInvalidWorkflowState = fmt.Errorf("%w: invalid workflow state", ErrValidation) ErrInvalidWorkflowArtifactType = fmt.Errorf("%w: invalid workflow artifact type", ErrValidation) ErrInvalidWorkflowActionType = fmt.Errorf("%w: invalid workflow action type", ErrValidation) )
var (
ErrInvalidTenantRole = fmt.Errorf("%w: tenant role is not valid", ErrValidation)
)
var (
ErrInvalidTenantStatus = fmt.Errorf("%w: tenant status is not valid", ErrValidation)
)
var ErrValidation = errors.New("validation failed")
ErrValidation is the shared parent of all model-level validation errors. Every "invalid X" validation sentinel in this package wraps it, so callers can classify any validation failure with errors.Is(err, ErrValidation) without enumerating each specific error. Such failures are permanent: the input will never become valid on retry.
var SingletonCertificatePurposes = []CertificatePurpose{ CertificatePurposeHYOKManagement, CertificatePurposeRoleManagement, CertificatePurposeKeyManagement, }
SingletonCertificatePurposes defines the certificate purposes for which only one active certificate can exist at a time.
var WorkflowActionTypes = []WorkflowActionType{ WorkflowActionTypeUpdateState, WorkflowActionTypeUpdatePrimary, WorkflowActionTypeLink, WorkflowActionTypeUnlink, WorkflowActionTypeSwitch, WorkflowActionTypeDelete, }
var WorkflowArtifactTypes = []WorkflowArtifactType{ WorkflowArtifactTypeKey, WorkflowArtifactTypeKeyConfiguration, WorkflowArtifactTypeSystem, }
var WorkflowNonTerminalStates = []WorkflowState{ WorkflowStateInitial, WorkflowStateWaitApproval, WorkflowStateWaitConfirmation, WorkflowStateExecuting, }
var WorkflowStates = []WorkflowState{ WorkflowStateInitial, WorkflowStateRevoked, WorkflowStateRejected, WorkflowStateExpired, WorkflowStateWaitApproval, WorkflowStateWaitConfirmation, WorkflowStateExecuting, WorkflowStateSuccessful, WorkflowStateFailed, }
var WorkflowTerminalStates = []WorkflowState{ WorkflowStateRevoked, WorkflowStateRejected, WorkflowStateExpired, WorkflowStateSuccessful, WorkflowStateFailed, }
Functions ¶
func NewIAMIdentifier ¶
func ValidateAll ¶
ValidateAll goes through the given validators and calls their Validate method. It stops and returns at the first error encountered, if any. If all validate successfully, it returns nil.
func WithLogInjectGroups ¶ added in v0.4.0
func WithLogInjectGroups(groups []*Group) cmkcontext.Opt
func WithLogInjectKey ¶ added in v0.4.0
func WithLogInjectKey(key *Key) cmkcontext.Opt
func WithLogInjectSystem ¶ added in v0.4.0
func WithLogInjectSystem(sys *System) cmkcontext.Opt
func WithLogInjectTenant ¶ added in v0.4.0
func WithLogInjectTenant(tenant *Tenant) cmkcontext.Opt
Types ¶
type AutoTimeModel ¶
type AutoTimeModel struct {
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
func (*AutoTimeModel) BeforeCreate ¶
func (b *AutoTimeModel) BeforeCreate(_ *gorm.DB) error
BeforeCreate ensures timestamps are set before creating a record
func (*AutoTimeModel) BeforeUpdate ¶
func (b *AutoTimeModel) BeforeUpdate(_ *gorm.DB) error
BeforeUpdate ensures UpdatedAt is set before updating a record
type Certificate ¶
type Certificate struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Fingerprint string `gorm:"type:text;not null"`
CommonName string `gorm:"type:varchar(64);not null"`
State CertificateState `gorm:"type:varchar(255)"`
Purpose CertificatePurpose `gorm:"type:varchar(255)"`
CreationDate time.Time `gorm:"not null"`
ExpirationDate time.Time `gorm:"not null"`
CertPEM string `gorm:"type:text"` // Base64 encoded PEM certificate
PrivateKeyPEM string `gorm:"type:text"` // Base64 encoded PEM private key
AutoRotate bool `gorm:"not null;default:true"`
SupersedesID *uuid.UUID `gorm:"foreignKey:CertificateID"`
}
func (Certificate) CheckAuthz ¶ added in v0.5.0
func (m Certificate) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Certificate) IsSharedModel ¶
func (Certificate) IsSharedModel() bool
func (Certificate) TableName ¶
func (m Certificate) TableName() string
TableName returns the table name for Certificate
func (Certificate) TableResourceType ¶ added in v0.5.0
func (Certificate) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type CertificatePurpose ¶
type CertificatePurpose string
const ( CertificatePurposeGeneric CertificatePurpose = "GENERIC" CertificatePurposeHYOKManagement CertificatePurpose = "TENANT_DEFAULT" CertificatePurposeRoleManagement CertificatePurpose = "ROLE_MANAGEMENT" CertificatePurposeKeyManagement CertificatePurpose = "KEY_MANAGEMENT" CertificatePurposeCrypto CertificatePurpose = "CRYPTO" )
- Generic purpose is used as a fallback default purpose when no specific purpose is provided. - HYOKManagement purpose is used for managing tenant default HYOK certificates. The name is kept for backward compatibility. - RoleManagement purpose is used for managing other keystore roles. - KeyManagement purpose is used for managing BYOK/Managed key lifecycle. - Crypto purpose is used only for displaying purposes, not for creation.
type CertificateState ¶
type CertificateState string
type CertificateSubject ¶ added in v0.9.0
type CertificateSubject struct {
Locality []string `yaml:"locality"`
OrganizationalUnit []string `yaml:"organizationUnit"` //nolint:tagliatelle
Organization []string `yaml:"organization"`
Country []string `yaml:"country"`
CommonName string
}
CertificateSubject holds the subject fields of a client certificate.
func ToCertificateSubjectFromPKIX ¶ added in v0.9.0
func ToCertificateSubjectFromPKIX(subject pkix.Name) CertificateSubject
func (CertificateSubject) String ¶ added in v0.9.0
func (subject CertificateSubject) String() string
type ClientCertificate ¶ added in v0.9.0
type ClientCertificate struct {
Name string `yaml:"name"`
RootCA string `yaml:"rootCA"` //nolint:tagliatelle
Subject CertificateSubject `yaml:"subject"`
}
ClientCertificate represents a client certificate used for HYOK key management.
func NewClientCertificate ¶ added in v0.9.0
func NewClientCertificate(value config.CryptoCert, tenant string) ClientCertificate
type ClientCertificates ¶ added in v0.9.0
type ClientCertificates map[CertificatePurpose][]*ClientCertificate
type CryptoConfig ¶ added in v0.9.0
type CryptoConfig struct {
Subject string `yaml:"subject" json:"subject"`
AccessData KeystoreAccessData `yaml:"accessData" json:"accessData"`
}
type Event ¶
type Event struct {
AutoTimeModel
Identifier string `gorm:"type:varchar(255);primaryKey"`
Type string `gorm:"type:varchar(255);not null"`
Data json.RawMessage `gorm:"type:jsonb;not null"`
Status orbital.JobStatus `gorm:"type:varchar(255);not null"`
// Stores error content for failed events
// It's split from orbital error_message by ERROR_CODE:ErrorMessage
ErrorCode string `gorm:"type:varchar(255)"`
ErrorMessage string `gorm:"type:text"`
// PreviousItemStatus represents the state an item was before the event was sent
// This is used for cancel actions to recover an item to it's previous state
PreviousItemStatus string `gorm:"type:varchar(255)"`
}
Event is a model that holds the result of the latest sent events that terminated unsuccessfully
func (Event) CheckAuthz ¶ added in v0.5.0
func (m Event) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Event) IsSharedModel ¶
func (Event) TableResourceType ¶ added in v0.5.0
func (m Event) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type Group ¶
type Group struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Name string `gorm:"type:varchar(64);not null;unique"`
Description string `gorm:"type:text"`
Role constants.BusinessRole `gorm:"type:varchar(255);not null"`
IAMIdentifier string `gorm:"type:varchar(128);not null;unique"`
}
func (*Group) BeforeSave ¶
BeforeSave is ran before any creating/updating the group but before finishing the transaction If this step fails the transaction should be aborted
func (Group) CheckAuthz ¶ added in v0.5.0
func (m Group) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Group) IsSharedModel ¶
func (Group) TableResourceType ¶ added in v0.5.0
func (m Group) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type ImportParams ¶
type ImportParams struct {
AutoTimeModel
KeyID uuid.UUID `gorm:"type:uuid;primaryKey"`
WrappingAlg string `gorm:"type:varchar(50);not null"`
HashFunction string `gorm:"type:varchar(50);not null"`
PublicKeyPEM string `gorm:"type:text;not null"`
Expires *time.Time
ProviderParameters json.RawMessage `gorm:"type:jsonb"`
}
ImportParams represents the parameters for a Bring Your Own Key (BYOK) configuration.
func (ImportParams) CheckAuthz ¶ added in v0.5.0
func (m ImportParams) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (ImportParams) IsExpired ¶
func (b ImportParams) IsExpired() bool
IsExpired checks if the ImportParams has expired based on the Expires field.
func (ImportParams) IsSharedModel ¶
func (ImportParams) IsSharedModel() bool
func (ImportParams) TableName ¶
func (m ImportParams) TableName() string
TableName returns the table name for ImportParams
func (ImportParams) TableResourceType ¶ added in v0.5.0
func (m ImportParams) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type JoinSystem ¶
type JoinSystem struct {
System
KeyConfigurationName *string `gorm:"column:key_configuration_name"`
TargetKeyConfigurationName *string `gorm:"column:target_key_configuration_name"`
ErrorCode string `gorm:"column:error_code"`
ErrorMessage string `gorm:"column:error_message"`
Key string `gorm:"type:varchar(255);primaryKey"`
Value string `gorm:"type:varchar(255)"`
}
type Key ¶
type Key struct {
AutoTimeModel
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
KeyConfigurationID uuid.UUID `gorm:"type:uuid;not null;uniqueindex:keyname,priority:1"`
Name string `gorm:"type:varchar(255);not null;uniqueindex:keyname,priority:2"`
KeyType string `gorm:"type:varchar(50);not null"`
Description string `gorm:"type:text"`
Algorithm string `gorm:"type:varchar(50);not null"`
Provider string `gorm:"type:varchar(50);not null"`
Region string `gorm:"type:varchar(50);not null"`
State cmkapi.KeyState `gorm:"type:varchar(50);not null;default:'ENABLED'"`
KeyVersions []KeyVersion `gorm:"foreignKey:KeyID"`
ImportParams *ImportParams `gorm:"foreignKey:KeyID;references:ID;constraint:OnDelete:CASCADE"`
NativeID *string `gorm:"type:varchar(255)"`
KeyLabels []KeyLabel `gorm:"foreignKey:ResourceID"`
LastUsed *time.Time
ManagementAccessData json.RawMessage `gorm:"type:jsonb"`
CryptoAccessData json.RawMessage `gorm:"type:jsonb"`
UnderWorkflow bool `gorm:"type:bool"`
IsPrimary bool `gorm:"-:all"` // Loaded on the managear/get methods
EditableRegions map[string]bool `gorm:"-:all"`
}
func (Key) CheckAuthz ¶ added in v0.5.0
func (m Key) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (*Key) GetCryptoAccessData ¶
func (m *Key) GetCryptoAccessData() KeyAccessData
func (*Key) GetManagementAccessData ¶
func (m *Key) GetManagementAccessData() (cmkapi.KeyAccessDetailsRegion, error)
func (Key) IsSharedModel ¶
func (Key) TableResourceType ¶ added in v0.5.0
func (m Key) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type KeyAccessData ¶
type KeyAccessData map[string]cmkapi.KeyAccessDetailsRegion // Map of regions and their properties
type KeyConfiguration ¶
type KeyConfiguration struct {
AutoTimeModel
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Name string `gorm:"type:varchar(255);not null;unique"`
Description string `gorm:"type:text"`
AdminGroupID uuid.UUID `gorm:"type:uuid;not null"`
AdminGroup Group `gorm:"foreignKey:AdminGroupID"`
CreatorID string `gorm:"type:varchar(255);not null"`
PrimaryKeyID *uuid.UUID
TotalKeys int `gorm:"->;-:migration"`
TotalSystems int `gorm:"->;-:migration"`
// contains filtered or unexported fields
}
KeyConfiguration represents a key configuration in the database.
func (KeyConfiguration) CheckAuthz ¶ added in v0.5.0
func (m KeyConfiguration) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (*KeyConfiguration) GetCreatorName ¶ added in v0.9.0
func (kc *KeyConfiguration) GetCreatorName( ctx context.Context, identityManager identitymanagement.IdentityManagement, ) (string, error)
func (KeyConfiguration) IsSharedModel ¶
func (KeyConfiguration) IsSharedModel() bool
func (*KeyConfiguration) SetID ¶
func (kc *KeyConfiguration) SetID(id uuid.UUID)
func (KeyConfiguration) TableName ¶
func (m KeyConfiguration) TableName() string
TableName returns the table name for KeyConfiguration
func (KeyConfiguration) TableResourceType ¶ added in v0.5.0
func (m KeyConfiguration) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type KeyLabel ¶
type KeyLabel struct {
BaseLabel
AutoTimeModel
CryptoKey Key `gorm:"foreignKey:ResourceID"`
}
func (KeyLabel) CheckAuthz ¶ added in v0.5.0
func (m KeyLabel) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (KeyLabel) IsSharedModel ¶
func (KeyLabel) TableResourceType ¶ added in v0.5.0
func (m KeyLabel) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type KeyVersion ¶
type KeyVersion struct {
AutoTimeModel
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
NativeID string `gorm:"type:varchar(255);not null"`
KeyID uuid.UUID `gorm:"type:uuid;not null;index"`
RotatedAt time.Time `gorm:"type:timestamptz;not null"` // Rotation timestamp (latest = current version)
}
KeyVersion represents a version of a key in the database.
func (KeyVersion) CheckAuthz ¶ added in v0.5.0
func (m KeyVersion) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (KeyVersion) IsSharedModel ¶
func (KeyVersion) IsSharedModel() bool
func (KeyVersion) TableName ¶
func (m KeyVersion) TableName() string
TableName returns the table name for KeyVersion
func (KeyVersion) TableResourceType ¶ added in v0.5.0
func (m KeyVersion) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type Keystore ¶
type Keystore struct {
AutoTimeModel
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Provider string `gorm:"type:varchar(50);not null"`
Config json.RawMessage `gorm:"type:jsonb;not null;unique"`
}
Keystore is an internal entity of pool item that should be persisted.
func (Keystore) CheckAuthz ¶ added in v0.5.0
func (m Keystore) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Keystore) IsSharedModel ¶
func (Keystore) TableResourceType ¶ added in v0.5.0
func (m Keystore) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type KeystoreAccessData ¶
type KeystoreConfig ¶
type KeystoreConfig struct {
RoleManagementConfig ManagementConfig `yaml:"roleManagementConfig" json:"roleManagementConfig"`
KeyManagementConfig ManagementConfig `yaml:"keyManagementConfig" json:"keyManagementConfig"`
CryptoAccessData map[string]CryptoConfig `yaml:"cryptoAccessData" json:"cryptoAccessData"`
SupportedRegions []config.Region `yaml:"supportedRegions" json:"supportedRegions"`
// contains filtered or unexported fields
}
type ManagementConfig ¶ added in v0.9.0
type ManagementConfig struct {
LocalityID string `yaml:"localityId" json:"localityId"`
CommonName string `yaml:"commonName" json:"commonName"`
AccessData KeystoreAccessData `yaml:"accessData" json:"accessData"`
}
type RequestCertArgs ¶
type RequestCertArgs struct {
CertPurpose CertificatePurpose
Supersedes *uuid.UUID
CommonName string
Locality []string
}
type System ¶
type System struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Identifier string `gorm:"type:varchar(255);not null;uniqueindex:region_sys,priority:2"`
Region string `gorm:"type:varchar(50);not null;uniqueindex:region_sys,priority:1"`
Type string `gorm:"type:varchar(50);not null"`
KeyConfigurationID *uuid.UUID `gorm:"type:uuid"`
TargetKeyConfigurationID *uuid.UUID `gorm:"type:uuid"`
KeyConfigurationName *string `gorm:"-"`
TargetKeyConfigurationName *string `gorm:"-"`
Properties map[string]string `gorm:"-:all"`
// Status can be 'CONNECTED', 'DISCONNECTED', 'FAILED', or 'PROCESSING'
Status cmkapi.SystemStatus `gorm:"type:varchar(50);default:'DISCONNECTED'"`
UnderWorkflow bool `gorm:"type:bool"`
// Only set for failed systems by the event table
ErrorCode string `gorm:"-"`
ErrorMessage string `gorm:"-"`
}
func (*System) AfterSave ¶
AfterSave is ran before any creating/updating the system but before finishing the transaction If this step fails the transaction should be aborted
func (*System) BeforeDelete ¶
BeforeDelete is ran before deleting the system but before finishing the transaction If this step fails the transaction should be aborted
func (System) CheckAuthz ¶ added in v0.5.0
func (m System) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (System) IsSharedModel ¶
func (System) TableResourceType ¶ added in v0.5.0
func (m System) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
func (*System) UpdateSystemProperties ¶
func (m *System) UpdateSystemProperties( ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], props map[string]string, cfg *config.System, ) (bool, error)
UpdateSystemProperties if they are set and returns a bool if any field was updated
type SystemProperty ¶
type SystemProperty struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Key string `gorm:"type:varchar(255);primaryKey"`
Value string `gorm:"type:varchar(255)"`
}
func (SystemProperty) CheckAuthz ¶ added in v0.5.0
func (m SystemProperty) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (SystemProperty) IsSharedModel ¶
func (SystemProperty) IsSharedModel() bool
func (SystemProperty) TableName ¶
func (m SystemProperty) TableName() string
func (SystemProperty) TableResourceType ¶ added in v0.5.0
func (m SystemProperty) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type Tag ¶
type Tag struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"` // ID of the Item
Values json.RawMessage `gorm:"type:jsonb"`
}
func (Tag) CheckAuthz ¶ added in v0.5.0
func (m Tag) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Tag) IsSharedModel ¶
func (Tag) TableResourceType ¶ added in v0.5.0
func (m Tag) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type Tenant ¶
type Tenant struct {
multitenancy.TenantModel
ID string `gorm:"type:varchar(255);not null;unique"`
Name string `gorm:"type:varchar(255)"`
Status TenantStatus `gorm:"type:varchar(50);not null"`
OwnerType string `gorm:"type:varchar(50);not null;default:''"`
OwnerID string `gorm:"type:varchar(255);not null;default:''"`
IssuerURL string `gorm:"type:varchar(255);not null;default:''"`
Role TenantRole `gorm:"type:varchar(50);not null;default:''"`
}
func (Tenant) CheckAuthz ¶ added in v0.5.0
func (m Tenant) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Tenant) IsSharedModel ¶
func (Tenant) TableResourceType ¶ added in v0.5.0
func (m Tenant) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type TenantConfig ¶
type TenantConfig struct {
Key string `gorm:"type:varchar(255);primaryKey"`
Value json.RawMessage `gorm:"type:jsonb;not null"`
}
TenantConfig represents a key in the database.
func (TenantConfig) CheckAuthz ¶ added in v0.5.0
func (m TenantConfig) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (TenantConfig) IsSharedModel ¶
func (TenantConfig) IsSharedModel() bool
func (TenantConfig) TableName ¶
func (m TenantConfig) TableName() string
TableName returns the table name for Key
func (TenantConfig) TableResourceType ¶ added in v0.5.0
func (m TenantConfig) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type TenantRole ¶
type TenantRole string
TenantRole represents the role of the tenant.
func (TenantRole) Validate ¶
func (s TenantRole) Validate() error
Validate validates the given role of the tenant. Returns an error if the status is invalid.
type TenantStatus ¶
type TenantStatus string
TenantStatus represents the status of the tenant.
func (TenantStatus) Validate ¶
func (s TenantStatus) Validate() error
Validate validates the given status of the tenant. Returns an error if the status is invalid.
type Validator ¶
type Validator interface {
Validate() error
}
Validator defines the methods for validation.
type Workflow ¶
type Workflow struct {
AutoTimeModel
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
State WorkflowState `gorm:"type:varchar(50);not null"`
InitiatorID string `gorm:"type:varchar(255);not null"`
Approvers []WorkflowApprover `gorm:"foreignKey:WorkflowID"`
ApproverGroupIDs json.RawMessage `gorm:"type:jsonb"`
ArtifactType WorkflowArtifactType `gorm:"type:varchar(50);not null"`
ArtifactID uuid.UUID `gorm:"type:uuid;not null"`
ArtifactName *string `gorm:"type:varchar(255)"` // Currently a snapshot at time of creation
ActionType WorkflowActionType `gorm:"type:varchar(50);not null"`
Parameters string `gorm:"type:text"`
ParametersResourceName *string `gorm:"type:varchar(255)"`
ParametersResourceType *string `gorm:"type:varchar(50)"`
FailureReason string `gorm:"type:text"`
ExpiryDate *time.Time
MinimumApprovalCount int `gorm:"type:integer;default:2"` // Snapshot of minimum approvals at creation time
// contains filtered or unexported fields
}
Workflow is an action on a data model (artifact) and can be read as <Artifact><ActionType> Artifact type is the type of item, identified by ArtifactID and ActionType the executed action Parameters will have different values depending on the ActionType. Check API Yaml for possible Parameters
e.g. of a workflow System Link
func (Workflow) CheckAuthz ¶ added in v0.5.0
func (m Workflow) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (Workflow) Description ¶
func (m Workflow) Description( ctx context.Context, idm identitymanagement.IdentityManagement, ) (string, error)
Description generates a human-readable description of the workflow based on its action type
func (Workflow) GetArtifactName ¶
GetArtifactName returns the artifact name or a default value if nil
func (*Workflow) GetInitiatorName ¶ added in v0.9.0
func (w *Workflow) GetInitiatorName( ctx context.Context, identityManager identitymanagement.IdentityManagement, ) (string, error)
func (Workflow) IsSharedModel ¶
func (Workflow) TableResourceType ¶ added in v0.5.0
func (m Workflow) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type WorkflowActionType ¶ added in v0.9.0
type WorkflowActionType string
func (*WorkflowActionType) Scan ¶ added in v0.9.0
func (t *WorkflowActionType) Scan(src any) error
func (WorkflowActionType) String ¶ added in v0.9.0
func (t WorkflowActionType) String() string
func (WorkflowActionType) Valid ¶ added in v0.9.0
func (t WorkflowActionType) Valid() bool
type WorkflowApprover ¶
type WorkflowApprover struct {
WorkflowID uuid.UUID `gorm:"type:uuid;primaryKey"`
UserID string `gorm:"type:varchar(255);primaryKey"`
Workflow Workflow `gorm:"foreignKey:WorkflowID"`
Approved sql.NullBool `gorm:"default:null"`
// contains filtered or unexported fields
}
func (WorkflowApprover) CheckAuthz ¶ added in v0.5.0
func (m WorkflowApprover) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (*WorkflowApprover) GetUserName ¶ added in v0.9.0
func (m *WorkflowApprover) GetUserName( ctx context.Context, identityManager identitymanagement.IdentityManagement, ) (string, error)
func (WorkflowApprover) IsSharedModel ¶
func (WorkflowApprover) IsSharedModel() bool
func (WorkflowApprover) TableName ¶
func (m WorkflowApprover) TableName() string
func (WorkflowApprover) TableResourceType ¶ added in v0.5.0
func (m WorkflowApprover) TableResourceType() authz.RepoResourceType
TableResourceType return the authz resource type
type WorkflowApproverGroup ¶ added in v0.9.0
type WorkflowApproverGroup struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
WorkflowID uuid.UUID `gorm:"type:uuid;not null"`
GroupID uuid.UUID `gorm:"type:uuid;not null"`
}
WorkflowApproverGroup represents the many-to-many relationship between workflows and approver groups
func (WorkflowApproverGroup) CheckAuthz ¶ added in v0.9.0
func (w WorkflowApproverGroup) CheckAuthz(ctx context.Context, authzHandler *authz.Handler[authz.RepoResourceType, authz.RepoAction], action authz.RepoAction, ) (bool, error)
func (WorkflowApproverGroup) IsSharedModel ¶ added in v0.9.0
func (w WorkflowApproverGroup) IsSharedModel() bool
func (WorkflowApproverGroup) TableName ¶ added in v0.9.0
func (w WorkflowApproverGroup) TableName() string
func (WorkflowApproverGroup) TableResourceType ¶ added in v0.9.0
func (w WorkflowApproverGroup) TableResourceType() authz.RepoResourceType
type WorkflowArtifactType ¶ added in v0.9.0
type WorkflowArtifactType string
func (*WorkflowArtifactType) Scan ¶ added in v0.9.0
func (t *WorkflowArtifactType) Scan(src any) error
func (WorkflowArtifactType) String ¶ added in v0.9.0
func (t WorkflowArtifactType) String() string
func (WorkflowArtifactType) Valid ¶ added in v0.9.0
func (t WorkflowArtifactType) Valid() bool
type WorkflowConfig ¶
type WorkflowConfig struct {
// Enabled determines if workflows are enabled in controllers
Enabled bool
// MinimumApprovals is the minimum number of approvals required for a workflow
MinimumApprovals int
// RetentionPeriodDays is the number of days to retain workflow data
RetentionPeriodDays int
// DefaultExpiryPeriodDays is the default number of days after which pending workflows will expire
DefaultExpiryPeriodDays int
// MaxExpiryPeriodDays is the maximum settable value for the expiry period
MaxExpiryPeriodDays int
}
type WorkflowState ¶ added in v0.9.0
type WorkflowState string
func (*WorkflowState) Scan ¶ added in v0.9.0
func (s *WorkflowState) Scan(src any) error
func (WorkflowState) String ¶ added in v0.9.0
func (s WorkflowState) String() string
func (WorkflowState) Valid ¶ added in v0.9.0
func (s WorkflowState) Valid() bool