When developing a custom provider I need to prefetch resources via a REST API and support purging.
Our current process has been to set the connection information as a param default on the resource type.
my_resource{
url => 'http://localhost:1234/api'
}
Then in the prefetch method get the 'url' parameter from one of the resource instances passed in. However, this breaks down when there are resources of the custom type that need to be purged but no resources of the custom type declared in the catalog. Custom provider does not know how to connect to the API to find any existing resources.
Is there a way to pass data from a manifest to the prefetch method of the provider in order to find existing resources when no resources of the custom type are defined in the catalog?
I would like to do something like
resources{'my_resource':
purge => true,
url => 'http://localhost:1234/api',
}
And then reference the url from this.prefetch in the provider. Obviously this doesn't work but could be an approach that would solve the issue. Suggestions?
↧