All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Implements ReprovisionNotifyHost to migrate a project's email sending from an old notify host to a new one (e.g., from project-name-based to slug-based host). Preserves the project's notify account and send key. - Adds ReprovisionNotifyHost to port.NotifyProvisioner interface - Implements revokeHostAccess on notifyAdminAPI + adminClient - Implements Provisioner.ReprovisionNotifyHost (12-step migration) in provisioner_reprovision.go (split to keep provisioner.go < 500 lines) - Adds NotifyHandler.Reprovision handler (POST /notify/reprovision) - Updates OpenAPI spec with reprovision endpoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
2.4 KiB
Go
46 lines
2.4 KiB
Go
package port
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/orchard9/rdev/internal/domain"
|
|
)
|
|
|
|
// NotifyProvisioner manages per-project email delivery on the notify service.
|
|
// Each project gets its own isolated sending host (mail.{slug}.threesix.ai),
|
|
// Resend domain with DKIM/SPF, and a dedicated notify account with send key.
|
|
type NotifyProvisioner interface {
|
|
// CreateProjectNotify provisions a notify host, Resend domain, DNS records,
|
|
// and account with send key for the project.
|
|
CreateProjectNotify(ctx context.Context, projectID, slug string) (*domain.NotifyCredentials, error)
|
|
|
|
// DeleteProjectNotify removes all notify resources for a project:
|
|
// the notify account, the per-project host, the Resend domain, and DNS records.
|
|
DeleteProjectNotify(ctx context.Context, projectID, slug, resendDomainID string) error
|
|
|
|
// GetProjectNotify returns notify credentials for a project, or nil if not provisioned.
|
|
GetProjectNotify(ctx context.Context, projectID string) (*domain.NotifyCredentials, error)
|
|
|
|
// TestConnection verifies the admin API key and notify service are reachable.
|
|
TestConnection(ctx context.Context) error
|
|
|
|
// VerifyProjectNotify triggers Resend domain verification for the given resend domain ID.
|
|
// Should be called after DNS records have had time to propagate.
|
|
VerifyProjectNotify(ctx context.Context, projectID, resendDomainID string) error
|
|
|
|
// GetNotifyDomainStatus returns the Resend verification status for the project's email domain.
|
|
GetNotifyDomainStatus(ctx context.Context, host, resendDomainID string) (*domain.NotifyDomainStatus, error)
|
|
|
|
// ProvisionNotifyDomain creates the Resend domain for an existing notify host,
|
|
// adds DKIM/SPF DNS records, and starts async verification.
|
|
// Use this to repair projects where steps 7-9 of CreateProjectNotify failed.
|
|
// Returns the Resend domain ID for storage in the credential store.
|
|
ProvisionNotifyDomain(ctx context.Context, projectID, host string) (resendDomainID string, err error)
|
|
|
|
// ReprovisionNotifyHost migrates a project's notify setup to a new sending host.
|
|
// Tears down oldHost's notify host entry, Resend domain, and DNS records, then
|
|
// creates new ones for newHost. The project's account and send key are preserved.
|
|
// Returns partial credentials (Host, From, ResendDomainID) for storage in the credential store.
|
|
ReprovisionNotifyHost(ctx context.Context, projectID, oldHost, oldResendDomainID, newHost string) (*domain.NotifyCredentials, error)
|
|
}
|