Documentation
¶
Index ¶
- type AccessControlType
- type AllowList
- type AllowListEntry
- type AllowListUpdateRequest
- type AllowListUpdateRequestRecord
- type AllowListUpdateResponse
- type AllowListUpdateResponseRecord
- type GrantDurationType
- type Owner
- type PolicyDecisionRequest
- type PolicyDecisionRequestRecord
- type PolicyDecisionResponse
- type PolicyDecisionResponseFieldRecord
- type PolicyMetadata
- type PolicyMetadataCreateRequest
- type PolicyMetadataCreateRequestRecord
- type PolicyMetadataCreateResponse
- type PolicyMetadataResponse
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControlType ¶
type AccessControlType string
AccessControlType represents the access control type enum
const ( AccessControlTypePublic AccessControlType = "public" AccessControlTypeRestricted AccessControlType = "restricted" )
func (*AccessControlType) Scan ¶
func (act *AccessControlType) Scan(value interface{}) error
Scan implements the sql.Scanner interface for AccessControlType
type AllowList ¶
type AllowList map[string]AllowListEntry
AllowList represents the JSONB allow list as a HashMap with custom scanning Key: application_id, Value: AllowListEntry
type AllowListEntry ¶
type AllowListEntry struct {
ExpiresAt time.Time `json:"expires_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AllowListEntry represents an entry in the allow list
type AllowListUpdateRequest ¶
type AllowListUpdateRequest struct {
ApplicationID string `json:"applicationId" validate:"required"`
Records []AllowListUpdateRequestRecord `json:"records" validate:"required,dive"`
GrantDuration GrantDurationType `json:"grantDuration" validate:"required,grant_duration_type_enum"`
}
AllowListUpdateRequest represents the request to update allow list
type AllowListUpdateRequestRecord ¶
type AllowListUpdateRequestRecord struct {
FieldName string `json:"fieldName" validate:"required"`
SchemaID string `json:"schemaId" validate:"required"`
}
AllowListUpdateRequestRecord represents the one record of request to update allow list
type AllowListUpdateResponse ¶
type AllowListUpdateResponse struct {
Records []AllowListUpdateResponseRecord `json:"records"`
}
AllowListUpdateResponse represents the response from allow list update
type AllowListUpdateResponseRecord ¶
type AllowListUpdateResponseRecord struct {
FieldName string `json:"fieldName"`
SchemaID string `json:"schemaId"`
ExpiresAt string `json:"expiresAt"`
UpdatedAt string `json:"updatedAt"`
}
AllowListUpdateResponseRecord represents one record in the allow list update response
type GrantDurationType ¶
type GrantDurationType string
GrantDurationType represents the grant type enum
const ( GrantDurationTypeOneMonth GrantDurationType = "30d" GrantDurationTypeOneYear GrantDurationType = "365d" )
type Owner ¶
type Owner string
Owner represents the owner enum
const (
OwnerCitizen Owner = "citizen"
)
type PolicyDecisionRequest ¶
type PolicyDecisionRequest struct {
ApplicationID string `json:"applicationId" validate:"required"`
RequiredFields []PolicyDecisionRequestRecord `json:"requiredFields" validate:"required,dive"`
}
PolicyDecisionRequest represents a policy decision request
type PolicyDecisionRequestRecord ¶
type PolicyDecisionRequestRecord struct {
FieldName string `json:"fieldName"`
SchemaID string `json:"schemaId"`
}
PolicyDecisionRequestRecord represents a policy decision request record
type PolicyDecisionResponse ¶
type PolicyDecisionResponse struct {
AppAuthorized bool `json:"appAuthorized"`
AppAccessExpired bool `json:"appAccessExpired"`
ExpiredFields []PolicyDecisionResponseFieldRecord `json:"expiredFields"`
AppRequiresOwnerConsent bool `json:"appRequiresOwnerConsent"`
ConsentRequiredFields []PolicyDecisionResponseFieldRecord `json:"consentRequiredFields"`
}
PolicyDecisionResponse represents a policy decision response
type PolicyDecisionResponseFieldRecord ¶
type PolicyDecisionResponseFieldRecord struct {
FieldName string `json:"fieldName"`
SchemaID string `json:"schemaId"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Owner *Owner `json:"owner,omitempty"`
}
PolicyDecisionResponseFieldRecord represents a policy decision response record
type PolicyMetadata ¶
type PolicyMetadata struct {
ID uuid.UUID `gorm:"column:id;type:uuid;primaryKey;default:gen_random_uuid()" json:"id"`
SchemaID string `gorm:"column:schema_id;type:varchar(255);not null;uniqueIndex:idx_policy_metadata_schema_field;" json:"schemaId"`
FieldName string `gorm:"column:field_name;type:text;not null;uniqueIndex:idx_policy_metadata_schema_field" json:"fieldName"`
DisplayName *string `gorm:"column:display_name;type:text" json:"displayName,omitempty"`
Description *string `gorm:"column:description;type:text" json:"description,omitempty"`
Source Source `gorm:"column:source;type:source_enum;not null;default:'fallback'" json:"source"`
IsOwner bool `gorm:"column:is_owner;type:boolean;default:false;not null" json:"isOwner"`
AccessControlType AccessControlType `gorm:"column:access_control_type;type:access_control_type_enum;not null;default:'restricted'" json:"accessControlType"`
AllowList AllowList `gorm:"column:allow_list;type:jsonb;not null;default:'{}'" json:"allowList"`
Owner *Owner `gorm:"column:owner;type:owner_enum;" json:"owner"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP" json:"updatedAt"`
}
PolicyMetadata represents the policy_metadata table
func (*PolicyMetadata) BeforeCreate ¶
func (pm *PolicyMetadata) BeforeCreate(tx *gorm.DB) error
BeforeCreate validates the model before creating
func (*PolicyMetadata) BeforeUpdate ¶
func (pm *PolicyMetadata) BeforeUpdate(tx *gorm.DB) error
BeforeUpdate validates the model before updating
func (PolicyMetadata) TableName ¶
func (PolicyMetadata) TableName() string
TableName specifies the table name for GORM
func (*PolicyMetadata) ToResponse ¶
func (pm *PolicyMetadata) ToResponse() PolicyMetadataResponse
ToResponse converts PolicyMetadata to PolicyMetadataResponse
type PolicyMetadataCreateRequest ¶
type PolicyMetadataCreateRequest struct {
SchemaID string `json:"schemaId" validate:"required"`
Records []PolicyMetadataCreateRequestRecord `json:"records" validate:"required,dive"`
}
PolicyMetadataCreateRequest represents the request to create policy metadata
type PolicyMetadataCreateRequestRecord ¶
type PolicyMetadataCreateRequestRecord struct {
FieldName string `json:"fieldName" validate:"required"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Source Source `json:"source" validate:"required,source_enum"`
IsOwner bool `json:"isOwner" validate:"required"`
AccessControlType AccessControlType `json:"accessControlType" validate:"required,access_control_type_enum"`
Owner *Owner `json:"owner,omitempty" validate:"omitempty,owner_enum"`
}
PolicyMetadataCreateRequestRecord represents the request to create policy metadata
type PolicyMetadataCreateResponse ¶
type PolicyMetadataCreateResponse struct {
Records []PolicyMetadataResponse `json:"records"`
}
PolicyMetadataCreateResponse represents the response from policy metadata creation
type PolicyMetadataResponse ¶
type PolicyMetadataResponse struct {
ID string `json:"id"`
SchemaID string `json:"schemaId"`
FieldName string `json:"fieldName"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Source Source `json:"source"`
IsOwner bool `json:"isOwner"`
AccessControlType AccessControlType `json:"accessControlType"`
AllowList AllowList `json:"allowList"`
Owner *Owner `json:"owner,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
PolicyMetadataResponse represents the response from policy metadata operations