Documentation
¶
Overview ¶
Package console provides a source implementation to integrate with Mia Platform Console webhooks.
Index ¶
Constants ¶
const (
MessageInvalidWebhookPath = "CONSOLE_WEBHOOK_PATH must start with '/'"
)
Variables ¶
var ( ErrSourceCreation = errors.New("source creation error") ErrUnmarshalingEvent = errors.New("error unmarshaling event") ErrEventChainProcessing = errors.New("error in event processing chain") ErrSignatureMismatch = errors.New("webhook signature mismatch") ErrRetrievingAssets = errors.New("error retrieving assets") ErrWebhookSecretMissing = errors.New("webhook secret not configured") )
var (
ErrWebhookConfigNotValid = errors.New("console source configuration not valid")
)
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements source.WebhookSource and source.SyncableSource for the Mia Platform Console. It can both poll all assets via the Console API and receive real-time mutations through a signed webhook.
func NewSource ¶
NewSource constructs a Source by reading its configuration from environment variables and initialising the underlying Console API client. It returns ErrSourceCreation if either the webhook config or the API client cannot be created.
func (*Source) GetWebhook ¶
func (s *Source) GetWebhook(ctx context.Context, typesToStream map[string]source.Extra, results chan<- source.Data) (source.Webhook, error)
GetWebhook returns a source.Webhook that validates incoming Console webhook requests against a shared secret and dispatches matching events to results asynchronously. It returns ErrWebhookSecretMissing when no secret is configured.
func (*Source) StartSyncProcess ¶
func (s *Source) StartSyncProcess(ctx context.Context, typesToSync map[string]source.Extra, results chan<- source.Data) error
StartSyncProcess performs a full synchronisation of the requested resource types by listing all matching assets from the Console API and sending them to results. It blocks until every item has been written to the channel.