Documentation
¶
Overview ¶
Package constants defines shared context key types used throughout the mailing list service.
Package constants defines global constants used throughout the mailing list service.
Package constants defines OpenFGA relation constants used throughout the mailing list service.
Package constants defines validation constants and formats for the mailing list service.
Index ¶
Constants ¶
const ( // ProjectGetSlugSubject is the NATS subject for getting project slug ProjectGetSlugSubject = "lfx.projects-api.get_slug" // ProjectGetNameSubject is the NATS subject for getting project name ProjectGetNameSubject = "lfx.projects-api.get_name" // CommitteeGetNameSubject is the NATS subject for getting committee name CommitteeGetNameSubject = "lfx.committee-api.get_name" )
NATS messaging subjects
const ( // EnvNATSURL is the environment variable for NATS server URL EnvNATSURL = "NATS_URL" // EnvNATSCredentials is the environment variable for NATS credentials EnvNATSCredentials = "NATS_CREDENTIALS" )
Environment variables
const ( // ResourceTypeService represents a GroupsIO service resource ResourceTypeService = "service" // ResourceTypeMember represents a GroupsIO member resource ResourceTypeMember = "member" // ResourceTypeMailingList represents a GroupsIO mailing list resource ResourceTypeMailingList = "mailing_list" )
Resource type constants for domain resolution
const ( // RelationProject defines the project relation used for inheritance RelationProject = "project" // RelationCommittee defines the committee relation used for committee-based authorization RelationCommittee = "committee" // RelationGroupsIOService defines the parent service relation used for service-level authorization inheritance RelationGroupsIOService = "groupsio_service" // RelationMailingList defines the parent mailing list relation used for member-level authorization inheritance RelationMailingList = "groupsio_mailing_list" // RelationViewer defines the viewer permission level RelationViewer = "viewer" // RelationWriter defines the writer permission level RelationWriter = "writer" // RelationOwner defines the owner permission level RelationOwner = "owner" // RelationMember defines the member permission level RelationMember = "member" // RelationAuditor defines the auditor permission level RelationAuditor = "auditor" )
OpenFGA relation constants for authorization and access control
const ( // ObjectTypeGroupsIOService defines the object type for GroupsIO services ObjectTypeGroupsIOService = "groupsio_service" // ObjectTypeGroupsIOMailingList defines the object type for GroupsIO mailing lists ObjectTypeGroupsIOMailingList = "groupsio_mailing_list" // ObjectTypeUser defines the object type for users ObjectTypeUser = "user" )
OpenFGA object type constants
const ( // ModStatusNone indicates a regular member with no special privileges ModStatusNone = "none" // ModStatusModerator indicates a member with moderation privileges (writer permissions) ModStatusModerator = "moderator" // ModStatusOwner indicates a member with owner privileges (owner permissions) ModStatusOwner = "owner" )
Member moderation status constants
const ( ServiceTypePrimary = "primary" ServiceTypeFormation = "formation" )
Service types for GroupsIO services
const ( // SourceAPI indicates the operation originated from our REST API SourceAPI = "api" // SourceWebhook indicates the operation originated from a Groups.io webhook SourceWebhook = "webhook" // SourceMock indicates the operation originated from mock/test infrastructure SourceMock = "mock" )
Source constants define the origin of operations for business logic tracking
const ( // KVBucketNameGroupsIOServices is the name of the KV bucket for services. KVBucketNameGroupsIOServices = "groupsio-services" // KVBucketNameGroupsIOMailingLists is the name of the KV bucket for mailing lists. KVBucketNameGroupsIOMailingLists = "groupsio-mailing-lists" // KVBucketNameGroupsIOMembers is the name of the KV bucket for members. KVBucketNameGroupsIOMembers = "groupsio-members" // Lookup key patterns for unique constraints // KVLookupGroupsIOServicePrefix is the key pattern for unique constraint lookups KVLookupGroupsIOServicePrefix = "lookup/groupsio-services/%s" // Service secondary index key patterns for external GroupsIO IDs // KVLookupGroupsIOServiceByGroupIDPrefix is the key pattern for GroupID index (lookup by Groups.io group ID) KVLookupGroupsIOServiceByGroupIDPrefix = "lookup/groupsio-service-groupid/%d" // Mailing list secondary index key patterns // KVLookupMailingListServicePrefix is the key pattern for service index KVLookupGroupsIOMailingListServicePrefix = "lookup/groupsio-mailing-list-service/%s" // KVLookupMailingListCommitteePrefix is the key pattern for committee index KVLookupGroupsIOMailingListCommitteePrefix = "lookup/groupsio-mailing-list-committee/%s" // KVLookupMailingListProjectPrefix is the key pattern for project index KVLookupGroupsIOMailingListProjectPrefix = "lookup/groupsio-mailing-list-project/%s" // KVLookupMailingListConstraintPrefix is the key pattern for uniqueness constraint (hashed service_id + group_name) KVLookupGroupsIOMailingListConstraintPrefix = "lookup/groupsio-mailing-list-name/%s" // KVLookupGroupsIOMailingListBySubgroupIDPrefix is the key pattern for SubgroupID index (lookup by Groups.io subgroup ID) KVLookupGroupsIOMailingListBySubgroupIDPrefix = "lookup/groupsio-mailing-list-subgroupid/%d" // Member lookup key patterns // KVLookupGroupsIOMemberPrefix is the key pattern for member unique constraint lookups (email per mailing list) KVLookupGroupsIOMemberPrefix = "lookup/groupsio-members/%s" // KVLookupGroupsIOMemberConstraintPrefix is the key pattern for member uniqueness constraint (mailing_list_uid + email) KVLookupGroupsIOMemberConstraintPrefix = "lookup/groupsio-member-email/%s" // KVLookupGroupsIOMemberByMemberIDPrefix is the key pattern for GroupsIOMemberID index (lookup by Groups.io member ID) KVLookupGroupsIOMemberByMemberIDPrefix = "lookup/groupsio-member-memberid/%d" // KVLookupGroupsIOMemberByGroupIDPrefix is the key pattern for GroupsIOGroupID index (lookup by Groups.io group ID) KVLookupGroupsIOMemberByGroupIDPrefix = "lookup/groupsio-member-groupid/%d" // Key prefixes for bucket detection // GroupsIOMailingListKeyPrefix is the common prefix for all mailing list related keys GroupsIOMailingListKeyPrefix = "lookup/groupsio-mailing-list/" // GroupsIOServiceLookupKeyPrefix is the prefix for service lookup keys GroupsIOServiceLookupKeyPrefix = "lookup/groupsio-services/" // GroupsIOMemberLookupKeyPrefix is the prefix for member lookup keys GroupsIOMemberLookupKeyPrefix = "lookup/groupsio-members/" )
const ( // Indexing subjects for search and discovery IndexGroupsIOServiceSubject = "lfx.index.groupsio_service" IndexGroupsIOMailingListSubject = "lfx.index.groupsio_mailing_list" IndexGroupsIOMemberSubject = "lfx.index.groupsio_member" // Access control subjects for OpenFGA integration UpdateAccessGroupsIOServiceSubject = "lfx.update_access.groupsio_service" DeleteAllAccessGroupsIOServiceSubject = "lfx.delete_all_access.groupsio_service" UpdateAccessGroupsIOMailingListSubject = "lfx.update_access.groupsio_mailing_list" DeleteAllAccessGroupsIOMailingListSubject = "lfx.delete_all_access.groupsio_mailing_list" )
NATS subject constants for message publishing
const ( // TimestampFormat defines the standard timestamp format for the system (RFC3339) TimestampFormat = "2006-01-02T15:04:05Z07:00" // TimestampFormatName is the human-readable name for the timestamp format TimestampFormatName = "RFC3339" )
const ( ErrInvalidTimestampFormat = "invalid timestamp format, expected RFC3339 (2006-01-02T15:04:05Z07:00)" ErrEmptyTimestamp = "timestamp cannot be empty" )
Validation error messages
const ( SubGroupCreatedEvent = "created_subgroup" SubGroupDeletedEvent = "deleted_subgroup" SubGroupMemberAddedEvent = "added_member" SubGroupMemberRemovedEvent = "removed_member" SubGroupMemberBannedEvent = "ban_members" )
Webhook event types from Groups.io
const ( WebhookMaxRetries = 3 WebhookRetryBaseDelay = 100 // milliseconds WebhookRetryMaxDelay = 5000 // milliseconds )
Webhook retry configuration
const AuthorizationHeader string = "authorization"
AuthorizationHeader is the header name for the authorization
const (
// RequestIDHeader is the HTTP header name for request ID
RequestIDHeader = "X-Request-Id"
)
HTTP header constants
const (
// ServiceName is the name of this service
ServiceName = "mailing-list"
)
Service constants
const (
WebhookSignatureHeader = "x-groupsio-signature"
)
Webhook header
const XOnBehalfOfHeader string = "x-on-behalf-of"
XOnBehalfOfHeader is the header name for the on behalf of principal
Variables ¶
This section is empty.
Functions ¶
func SourceDescription ¶
SourceDescription returns human-readable description of source behavior
func ValidSources ¶
func ValidSources() []string
ValidSources returns list of all valid sources for documentation
func ValidateSource ¶
ValidateSource validates that the source is one of the allowed values
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is the unified type for all context keys to prevent type mismatches
const ( // PrincipalContextID is the context key for the principal PrincipalContextID ContextKey = "principal" // AuthorizationContextID is the context key for the authorization AuthorizationContextID ContextKey = "authorization" // OnBehalfContextID is the context key for the on-behalf-of principal OnBehalfContextID ContextKey = "x-on-behalf-of" // RequestIDContextKey is the context key for request ID RequestIDContextKey ContextKey = "request-id" // GrpsIOWebhookBodyContextKey is the context key for raw GroupsIO webhook body GrpsIOWebhookBodyContextKey ContextKey = "grpsio-webhook-body" )
Context keys for various middleware and service contexts