application

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	OrganizationID   string                 `json:"organization_id" validate:"required,uuid"`
	TemplateType     entity.TemplateType    `json:"template_type" validate:"required"`
	Customizations   map[string]interface{} `json:"customizations,omitempty"`
	AdminUserID      string                 `json:"admin_user_id" validate:"required,uuid"`
	OrganizationName string                 `json:"organization_name" validate:"required,min=2,max=100"`
}

CreateOrganizationRequest represents a request to create an organization

type CreateOrganizationResponse

type CreateOrganizationResponse struct {
	OrganizationConfig *entity.OrganizationConfig `json:"organization_config"`
	MonthlyPrice       float64                    `json:"monthly_price"`
	EnabledServices    []string                   `json:"enabled_services"`
	TemplateInfo       *service.TemplateInfo      `json:"template_info"`
	OnboardingSteps    []OnboardingStep           `json:"onboarding_steps"`
}

CreateOrganizationResponse represents the response from creating an organization

type OnboardingStep

type OnboardingStep struct {
	StepID      string `json:"step_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
	Completed   bool   `json:"completed"`
	Order       int    `json:"order"`
}

OnboardingStep represents a step in the organization onboarding process

type OrganizationSummary

type OrganizationSummary struct {
	OrganizationID  string               `json:"organization_id"`
	TemplateType    entity.TemplateType  `json:"template_type"`
	IsActive        bool                 `json:"is_active"`
	EnabledServices []string             `json:"enabled_services"`
	MonthlyPrice    float64              `json:"monthly_price"`
	TemplateInfo    service.TemplateInfo `json:"template_info"`
	ServiceCounts   ServiceCounts        `json:"service_counts"`
	CreatedAt       time.Time            `json:"created_at"`
	UpdatedAt       time.Time            `json:"updated_at"`
}

OrganizationSummary represents a summary of an organization

type OrganizationTemplateService

type OrganizationTemplateService struct {
	// contains filtered or unexported fields
}

OrganizationTemplateService handles organization template operations

func NewOrganizationTemplateService

func NewOrganizationTemplateService(serviceRegistry service.ServiceRegistryInterface, logger *logrus.Logger) *OrganizationTemplateService

NewOrganizationTemplateService creates a new organization template service

func (*OrganizationTemplateService) CreateOrganization

CreateOrganization creates a new organization with the specified template

func (*OrganizationTemplateService) GetAvailableTemplates

func (ots *OrganizationTemplateService) GetAvailableTemplates() []service.TemplateInfo

GetAvailableTemplates returns all available organization templates

func (*OrganizationTemplateService) GetOrganizationSummary

func (ots *OrganizationTemplateService) GetOrganizationSummary(ctx context.Context, organizationID string) (*OrganizationSummary, error)

GetOrganizationSummary returns a summary of an organization's configuration

func (*OrganizationTemplateService) MigrateOrganization

func (ots *OrganizationTemplateService) MigrateOrganization(ctx context.Context, organizationID string, newTemplateType entity.TemplateType, preserveCustomizations bool) (*CreateOrganizationResponse, error)

MigrateOrganization migrates an organization from one template to another

func (*OrganizationTemplateService) UpdateOrganizationServices

UpdateOrganizationServices updates the enabled services for an organization

type SecretMetadata

type SecretMetadata struct {
	Path        string                 `json:"path"`
	Version     int                    `json:"version"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Tags        map[string]string      `json:"tags"`
	Description string                 `json:"description"`
	Metadata    map[string]interface{} `json:"metadata"`
}

SecretMetadata contains metadata about a secret

type SecretRequest

type SecretRequest struct {
	Name        string            `json:"name" validate:"required"`
	Type        SecretType        `json:"type" validate:"required"`
	Data        map[string]string `json:"data" validate:"required"`
	Description string            `json:"description"`
	Tags        map[string]string `json:"tags"`
	TTL         time.Duration     `json:"ttl"`
}

SecretRequest represents a request to create or update a secret

type SecretResponse

type SecretResponse struct {
	Name     string            `json:"name"`
	Type     SecretType        `json:"type"`
	Data     map[string]string `json:"data,omitempty"`
	Metadata SecretMetadata    `json:"metadata"`
	HasData  bool              `json:"has_data"`
}

SecretResponse represents a secret response

type SecretType

type SecretType string

SecretType represents different types of secrets

const (
	SecretTypeDatabase   SecretType = "database"
	SecretTypeAPI        SecretType = "api"
	SecretTypeJWT        SecretType = "jwt"
	SecretTypeEncryption SecretType = "encryption"
	SecretTypeOAuth      SecretType = "oauth"
	SecretTypeWebhook    SecretType = "webhook"
	SecretTypeEmail      SecretType = "email"
	SecretTypePayment    SecretType = "payment"
	SecretTypeCustom     SecretType = "custom"
)

type SecretsService

type SecretsService struct {
	// contains filtered or unexported fields
}

SecretsService manages application secrets using HashiCorp Vault

func NewSecretsService

func NewSecretsService(vaultClient *vault.VaultClient, namespace string, logger *logrus.Logger) *SecretsService

NewSecretsService creates a new secrets service

func (*SecretsService) CreateSecret

func (ss *SecretsService) CreateSecret(ctx context.Context, req SecretRequest) (*SecretResponse, error)

CreateSecret creates a new secret

func (*SecretsService) DeleteSecret

func (ss *SecretsService) DeleteSecret(ctx context.Context, secretType SecretType, name string) error

DeleteSecret deletes a secret

func (*SecretsService) GenerateAPIKey

func (ss *SecretsService) GenerateAPIKey(ctx context.Context, name string, keyLength int) (*SecretResponse, error)

GenerateAPIKey generates a new API key

func (*SecretsService) GenerateEncryptionKey

func (ss *SecretsService) GenerateEncryptionKey(ctx context.Context, name string) (*SecretResponse, error)

GenerateEncryptionKey generates an encryption key

func (*SecretsService) GenerateJWTSecret

func (ss *SecretsService) GenerateJWTSecret(ctx context.Context, name string) (*SecretResponse, error)

GenerateJWTSecret generates a JWT signing secret

func (*SecretsService) GetSecret

func (ss *SecretsService) GetSecret(ctx context.Context, secretType SecretType, name string) (*SecretResponse, error)

GetSecret retrieves a secret

func (*SecretsService) GetSecretMetadata

func (ss *SecretsService) GetSecretMetadata(ctx context.Context, secretType SecretType, name string) (*SecretResponse, error)

GetSecretMetadata retrieves only metadata about a secret (no sensitive data)

func (*SecretsService) GetVaultClient

func (ss *SecretsService) GetVaultClient() *vault.VaultClient

GetVaultClient returns the underlying Vault client (for advanced operations)

func (*SecretsService) HealthCheck

func (ss *SecretsService) HealthCheck(ctx context.Context) error

HealthCheck verifies the secrets service is healthy

func (*SecretsService) ListSecrets

func (ss *SecretsService) ListSecrets(ctx context.Context, secretType SecretType) ([]SecretResponse, error)

ListSecrets lists all secrets of a given type

func (*SecretsService) RotateSecret

func (ss *SecretsService) RotateSecret(ctx context.Context, secretType SecretType, name string) (*SecretResponse, error)

RotateSecret creates a new version of a secret with new random data

func (*SecretsService) UpdateSecret

func (ss *SecretsService) UpdateSecret(ctx context.Context, secretType SecretType, name string, data map[string]string) (*SecretResponse, error)

UpdateSecret updates an existing secret

type ServiceCounts

type ServiceCounts struct {
	TotalServices   int `json:"total_services"`
	EnabledServices int `json:"enabled_services"`
	CoreServices    int `json:"core_services"`
	PremiumServices int `json:"premium_services"`
}

ServiceCounts represents counts of different service types

type UpdateOrganizationServicesRequest

type UpdateOrganizationServicesRequest struct {
	OrganizationID    string                 `json:"organization_id" validate:"required,uuid"`
	ServicesToEnable  []string               `json:"services_to_enable,omitempty"`
	ServicesToDisable []string               `json:"services_to_disable,omitempty"`
	Customizations    map[string]interface{} `json:"customizations,omitempty"`
	UpdatedByUserID   string                 `json:"updated_by_user_id" validate:"required,uuid"`
}

UpdateOrganizationServicesRequest represents a request to update organization services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL