Documentation
¶
Index ¶
- Constants
- func RegisterInternalResourcePlugin(scheme *runtime.Scheme, r *ResourceRegistry, plugin Repository, ...) error
- func RegisterResourcePlugin[T runtime.Typed](proto T, plugin v1.ReadWriteResourcePluginContract, ...) error
- type Repository
- type RepositoryPlugin
- func (p *RepositoryPlugin) AddGlobalResource(ctx context.Context, req *v1.AddGlobalResourceRequest, ...) (*v1.AddGlobalResourceResponse, error)
- func (p *RepositoryPlugin) GetGlobalResource(ctx context.Context, req *v1.GetGlobalResourceRequest, ...) (*v1.GetGlobalResourceResponse, error)
- func (p *RepositoryPlugin) GetIdentity(ctx context.Context, request *v1.GetIdentityRequest[runtime.Typed]) (*v1.GetIdentityResponse, error)
- func (p *RepositoryPlugin) Ping(ctx context.Context) error
- type ResourceRegistry
- func (r *ResourceRegistry) AddPlugin(plugin types.Plugin, constructionType runtime.Type) error
- func (r *ResourceRegistry) GetResourcePlugin(ctx context.Context, spec runtime.Typed) (Repository, error)
- func (r *ResourceRegistry) ResourceScheme() *runtime.Scheme
- func (r *ResourceRegistry) Shutdown(ctx context.Context) error
Constants ¶
const ( // GetIdentity provides the identity of a type supported by the plugin. GetIdentity = "/identity" // GetGlobalResource defines the endpoint to get a global resource. GetGlobalResource = "/resource/get" // AddGlobalResource defines the endpoint to add a global resource. AddGlobalResource = "/resource/add" )
Variables ¶
This section is empty.
Functions ¶
func RegisterInternalResourcePlugin ¶
func RegisterInternalResourcePlugin( scheme *runtime.Scheme, r *ResourceRegistry, plugin Repository, proto runtime.Typed, ) error
RegisterInternalResourcePlugin is called to register an internal implementation for a resource plugin.
func RegisterResourcePlugin ¶
func RegisterResourcePlugin[T runtime.Typed]( proto T, plugin v1.ReadWriteResourcePluginContract, c *endpoints.EndpointBuilder, ) error
RegisterResourcePlugin registers the resource plugin endpoints with the endpoint builder. It sets up HTTP handlers for identity, get resource, and add resource operations.
Types ¶
type Repository ¶
type Repository interface { // GetResourceCredentialConsumerIdentity resolves the identity of the given [descriptor.Resource] to use for credential resolution. GetResourceCredentialConsumerIdentity(ctx context.Context, resource *descriptor.Resource) (runtime.Identity, error) // DownloadResource downloads a [descriptor.Resource] from the repository. DownloadResource(ctx context.Context, res *descriptor.Resource, credentials map[string]string) (blob.ReadOnlyBlob, error) }
Repository defines the interface for storing and retrieving OCM resources independently of component versions from a Store Implementation
type RepositoryPlugin ¶
type RepositoryPlugin struct { ID string // contains filtered or unexported fields }
RepositoryPlugin implements the v1.ReadWriteResourceRepositoryPluginContract interface.
func NewResourceRepositoryPlugin ¶
func NewResourceRepositoryPlugin( client *http.Client, id string, path string, config types.Config, location string, jsonSchema []byte, ) *RepositoryPlugin
NewResourceRepositoryPlugin creates a new RepositoryPlugin.
func (*RepositoryPlugin) AddGlobalResource ¶
func (p *RepositoryPlugin) AddGlobalResource(ctx context.Context, req *v1.AddGlobalResourceRequest, credentials map[string]string) (*v1.AddGlobalResourceResponse, error)
AddGlobalResource adds a global resource.
func (*RepositoryPlugin) GetGlobalResource ¶
func (p *RepositoryPlugin) GetGlobalResource(ctx context.Context, req *v1.GetGlobalResourceRequest, credentials map[string]string) (*v1.GetGlobalResourceResponse, error)
GetGlobalResource retrieves a global resource.
func (*RepositoryPlugin) GetIdentity ¶
func (p *RepositoryPlugin) GetIdentity(ctx context.Context, request *v1.GetIdentityRequest[runtime.Typed]) (*v1.GetIdentityResponse, error)
type ResourceRegistry ¶
type ResourceRegistry struct {
// contains filtered or unexported fields
}
ResourceRegistry holds all plugins that implement capabilities corresponding to RepositoryPlugin operations.
func NewResourceRegistry ¶
func NewResourceRegistry(ctx context.Context) *ResourceRegistry
NewResourceRegistry creates a new registry and initializes maps.
func (*ResourceRegistry) AddPlugin ¶
AddPlugin takes a plugin discovered by the manager and puts it into the relevant internal map for tracking the plugin.
func (*ResourceRegistry) GetResourcePlugin ¶
func (r *ResourceRegistry) GetResourcePlugin(ctx context.Context, spec runtime.Typed) (Repository, error)
GetResourcePlugin returns Resource plugins for a specific type.
func (*ResourceRegistry) ResourceScheme ¶
func (r *ResourceRegistry) ResourceScheme() *runtime.Scheme
ResourceScheme returns the scheme used by the Resource registry.
func (*ResourceRegistry) Shutdown ¶
func (r *ResourceRegistry) Shutdown(ctx context.Context) error
Shutdown will loop through all _STARTED_ plugins and will send an Interrupt signal to them. All plugins should handle interrupt signals gracefully. For Go, this is done automatically by the plugin SDK.