mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
fix: credentials bugfix
Signed-off-by: allanice001 <allanice001@gmail.com>
This commit is contained in:
@@ -9,18 +9,18 @@ import (
|
|||||||
|
|
||||||
type Credential struct {
|
type Credential struct {
|
||||||
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
||||||
OrganizationID uuid.UUID `gorm:"type:uuid;not null;uniqueIndex:idx_credentials_org_provider" json:"organization_id"`
|
OrganizationID uuid.UUID `gorm:"type:uuid;not null;index" json:"organization_id"`
|
||||||
Organization Organization `gorm:"foreignKey:OrganizationID;constraint:OnDelete:CASCADE" json:"organization"`
|
Organization Organization `gorm:"foreignKey:OrganizationID;constraint:OnDelete:CASCADE" json:"organization"`
|
||||||
Provider string `gorm:"type:varchar(50);not null;index"`
|
Provider string `gorm:"type:varchar(50);not null;uniqueIndex:uniq_org_provider_scopekind_scope,priority:2;index:idx_provider_kind"`
|
||||||
Kind string `gorm:"type:varchar(50);not null;index"` // "aws_access_key", "api_token", "basic_auth", ...
|
Kind string `gorm:"type:varchar(50);not null;index:idx_provider_kind;index:idx_kind_scope"`
|
||||||
|
ScopeKind string `gorm:"type:varchar(20);not null;uniqueIndex:uniq_org_provider_scopekind_scope,priority:3"`
|
||||||
|
Scope datatypes.JSON `gorm:"type:jsonb;not null;default:'{}';index:idx_kind_scope"`
|
||||||
|
ScopeFingerprint string `gorm:"type:char(64);not null;uniqueIndex:uniq_org_provider_scopekind_scope,priority:4;index"`
|
||||||
SchemaVersion int `gorm:"not null;default:1"`
|
SchemaVersion int `gorm:"not null;default:1"`
|
||||||
Name string `gorm:"type:varchar(100);not null;default:''"` // human label, lets you have multiple for same service
|
Name string `gorm:"type:varchar(100);not null;default:''"`
|
||||||
ScopeKind string `gorm:"type:varchar(20);not null"` // "provider" | "service" | "resource"
|
|
||||||
Scope datatypes.JSON `gorm:"type:jsonb;not null;default:'{}'"` // e.g. {"service":"route53"} or {"arn":"arn:aws:s3:::my-bucket"}
|
|
||||||
ScopeVersion int `gorm:"not null;default:1"`
|
ScopeVersion int `gorm:"not null;default:1"`
|
||||||
AccountID string `gorm:"type:varchar(32)"` // AWS account ID if applicable
|
AccountID string `gorm:"type:varchar(32)"`
|
||||||
Region string `gorm:"type:varchar(32)"` // default region (non-secret)
|
Region string `gorm:"type:varchar(32)"`
|
||||||
ScopeFingerprint string `gorm:"type:char(64);not null;index"`
|
|
||||||
EncryptedData string `gorm:"not null"`
|
EncryptedData string `gorm:"not null"`
|
||||||
IV string `gorm:"not null"`
|
IV string `gorm:"not null"`
|
||||||
Tag string `gorm:"not null"`
|
Tag string `gorm:"not null"`
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ const updateCredentialSchema = createCredentialSchema.partial().extend({
|
|||||||
|
|
||||||
function pretty(obj: unknown) {
|
function pretty(obj: unknown) {
|
||||||
try {
|
try {
|
||||||
return JSON.stringify(obj, null, 2)
|
return JSON.stringify(JSON.parse(obj), null, 2)
|
||||||
} catch {
|
} catch {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user