Documentation
¶
Overview ¶
Package validate supplies the amp-yaml-validator library with project-specific data (destinations, provider apps) fetched from the Ampersand API. The library exposes these as dependency-injected "checker" hooks so that the same validation logic can run client-side (here, against the API) or server-side (against the database).
Index ¶
- type CatalogProvider
- func (c *CatalogProvider) GetModuleInfo(ctx context.Context, providerName string, moduleID string) (*providers.ModuleInfo, error)
- func (c *CatalogProvider) GetProviderInfo(_ context.Context, providerName string) (*providers.ProviderInfo, error)
- func (c *CatalogProvider) GetProviderSupport(ctx context.Context, providerName string) (*providers.Support, error)
- func (c *CatalogProvider) ListObjects(_ context.Context, _ string, _ string) ([]string, error)
- func (c *CatalogProvider) Ping(_ context.Context) error
- type DestinationChecker
- type ProviderAppChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogProvider ¶
type CatalogProvider struct {
// contains filtered or unexported fields
}
CatalogProvider implements the validator's catalog.CatalogProvider interface using the Ampersand API's live provider catalog (the "dynamic catalog"), which is updated several times a day. Backing validation with this keeps provider, module, and capability checks current instead of relying on the catalog compiled into the connectors library, which goes stale between releases.
It holds a snapshot fetched once so repeated lookups during a single validation run don't re-hit the API. When the fetch fails, callers should fall back to the embedded catalog (catalog.NewDefaultCatalogProvider) so validation still works offline.
func NewCatalogProvider ¶
func NewCatalogProvider(ctx context.Context) (*CatalogProvider, error)
NewCatalogProvider fetches the live provider catalog from the API and returns a provider backed by that snapshot. The catalog endpoint is public, so this works even without a configured project or an active login session.
func (*CatalogProvider) GetModuleInfo ¶
func (c *CatalogProvider) GetModuleInfo( ctx context.Context, providerName string, moduleID string, ) (*providers.ModuleInfo, error)
GetModuleInfo retrieves module information for a given provider and module ID.
func (*CatalogProvider) GetProviderInfo ¶
func (c *CatalogProvider) GetProviderInfo( _ context.Context, providerName string, ) (*providers.ProviderInfo, error)
GetProviderInfo retrieves provider information from the fetched catalog.
func (*CatalogProvider) GetProviderSupport ¶
func (c *CatalogProvider) GetProviderSupport( ctx context.Context, providerName string, ) (*providers.Support, error)
GetProviderSupport retrieves the provider's capabilities from the fetched catalog.
func (*CatalogProvider) ListObjects ¶
ListObjects reports ErrNotSupported: the provider catalog does not expose object schemas, matching the connectors default implementation.
type DestinationChecker ¶
type DestinationChecker struct {
// contains filtered or unexported fields
}
DestinationChecker verifies that destinations referenced by a manifest exist in the project. It holds a snapshot of the project's destinations fetched once, so repeated CheckDestination calls during validation don't hit the API again.
func NewDestinationChecker ¶
func NewDestinationChecker(ctx context.Context, client *request.APIClient) (*DestinationChecker, error)
NewDestinationChecker fetches the project's destinations and returns a checker backed by that snapshot.
func (*DestinationChecker) CheckDestination ¶
func (c *DestinationChecker) CheckDestination(_ context.Context, destinationName string) error
CheckDestination reports checker.ErrDestinationNotFound if the named destination is not present in the project, and nil otherwise.
type ProviderAppChecker ¶
type ProviderAppChecker struct {
// contains filtered or unexported fields
}
ProviderAppChecker verifies that a provider app (OAuth credentials) is configured for the providers referenced by a manifest. Like DestinationChecker it works off a one-time snapshot of the project's provider apps.
func NewProviderAppChecker ¶
func NewProviderAppChecker(ctx context.Context, client *request.APIClient) (*ProviderAppChecker, error)
NewProviderAppChecker fetches the project's provider apps and returns a checker backed by that snapshot.
func (*ProviderAppChecker) CheckProviderApp ¶
func (c *ProviderAppChecker) CheckProviderApp(_ context.Context, providerName string) error
CheckProviderApp reports checker.ErrProviderAppNotFound if no provider app is configured for the given provider, and nil otherwise.