Class AIModelResourceProviderService
- Namespace
 - FoundationaLLM.AIModel.ResourceProviders
 
- Assembly
 - FoundationaLLM.AIModel.dll
 
Implements the FoundationaLLM.AIModel resource provider.
public class AIModelResourceProviderService : ResourceProviderServiceBase<AIModelReference>, IResourceProviderService, IManagementProviderService
  - Inheritance
 - 
      
      
      AIModelResourceProviderService
 
- Implements
 
- Inherited Members
 
- Extension Methods
 
Constructors
AIModelResourceProviderService(IOptions<InstanceSettings>, IOptions<ResourceProviderCacheSettings>, IAuthorizationServiceClient, IStorageService, IEventService, IResourceValidatorFactory, IServiceProvider, ILoggerFactory, bool)
Implements the FoundationaLLM.AIModel resource provider.
public AIModelResourceProviderService(IOptions<InstanceSettings> instanceOptions, IOptions<ResourceProviderCacheSettings> cacheOptions, IAuthorizationServiceClient authorizationService, IStorageService storageService, IEventService eventService, IResourceValidatorFactory resourceValidatorFactory, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, bool proxyMode = false)
  Parameters
instanceOptionsIOptions<InstanceSettings>The options providing the InstanceSettings with instance settings.
cacheOptionsIOptions<ResourceProviderCacheSettings>The options providing the ResourceProviderCacheSettings with settings for the resource provider cache.
authorizationServiceIAuthorizationServiceClientThe IAuthorizationServiceClient providing authorization services.
storageServiceIStorageServiceThe IStorageService providing storage services.
eventServiceIEventServiceThe IEventService providing event services.
resourceValidatorFactoryIResourceValidatorFactoryThe IResourceValidatorFactory providing the factory to create resource validators.
serviceProviderIServiceProviderThe IServiceProvider of the main dependency injection container.
loggerFactoryILoggerFactoryThe ILoggerFactory used to provide loggers for logging.
proxyModeboolIndicates whether the resource provider is running in proxy mode.
Properties
_name
The name of the resource provider. Must be overridden in derived classes.
protected override string _name { get; }
  Property Value
Methods
DeleteResourceAsync(ResourcePath, UnifiedUserIdentity)
The internal implementation of DeleteResourceAsync. Must be overridden in derived classes.
protected override Task DeleteResourceAsync(ResourcePath resourcePath, UnifiedUserIdentity userIdentity)
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity with details about the identity of the user.
Returns
ExecuteActionAsync(ResourcePath, ResourcePathAuthorizationResult, string, UnifiedUserIdentity, Func<object, bool>?)
The internal implementation of ExecuteActionAsync. Must be overriden in derived classes.
protected override Task<object> ExecuteActionAsync(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, string serializedAction, UnifiedUserIdentity userIdentity, Func<object, bool>? requestPayloadValidator = null)
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
serializedActionstringThe serialized details of the action being executed.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity with details about the identity of the user.
requestPayloadValidatorFunc<object, bool>An optional validator used to perform additional validation on the action payload after deserialization.
Returns
Remarks
In the special case of the filter action, the override must handle the authorization result and return
the appropriate response as follows:
- The read action is authorized for the resource path itself. In this case, all matching resources must be returned according to the PBAC policies specified by the authorization result (if any).
 - The read action is denied for the resource path itself. In this case, only the matching resources specified in the subordinate authorized resource paths list of the authorization result should be returned (if any).
 
GetResourceAsyncInternal<T>(ResourcePath, ResourcePathAuthorizationResult, UnifiedUserIdentity, ResourceProviderGetOptions?, ResourceBase?)
The internal implementation of GetResource. Must be overridden in derived classes.
protected override Task<T> GetResourceAsyncInternal<T>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, UnifiedUserIdentity userIdentity, ResourceProviderGetOptions? options = null, ResourceBase? parentResourceInstance = null) where T : ResourceBase
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
optionsResourceProviderGetOptionsThe ResourceProviderGetOptions which provides operation parameters.
parentResourceInstanceResourceBaseThe optional parent resource of the resource identified by
resourcePath.
Returns
- Task<T>
 
Type Parameters
T
Remarks
When the parent resource instance is provided, and it specifies inheritable authorizable actions, the parent resource instance is used to authorize the request for any of those actions.
GetResourceTypes()
Gets the details about the resource types managed by the resource provider.
protected override Dictionary<string, ResourceTypeDescriptor> GetResourceTypes()
  Returns
- Dictionary<string, ResourceTypeDescriptor>
 A dictionary of ResourceTypeDescriptor objects with details about the resource types.
GetResourcesAsync(ResourcePath, ResourcePathAuthorizationResult, UnifiedUserIdentity, ResourceProviderGetOptions?)
The internal implementation of GetResourcesAsync. Must be overridden in derived classes.
protected override Task<object> GetResourcesAsync(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, UnifiedUserIdentity userIdentity, ResourceProviderGetOptions? options = null)
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity with details about the identity of the user.
optionsResourceProviderGetOptionsThe ResourceProviderGetOptions which provides operation parameters.
Returns
Remarks
The override implementation should return a list of resources or a single resource, depending on the resource path. It also must handle the authorization result and return the appropriate response as follows:
- The resource path refers to a single resource. In this case, the authorization is already confirmed and the specific resource should be returned.
 - The resource path refers to a resource type and the read action is authorized for the resource path itself. In this case, all resources must be returned according to the PBAC policies specified by the authorization result (if any).
 - The resource path refers to a resource type and the read action is denied for the resource path itself. In this case, only the resources specified in the subordinate authorized resource paths list of the authorization result should be returned (if any).
 
InitializeInternal()
The internal implementation of Initialize. Must be overridden in derived classes.
protected override Task InitializeInternal()
  Returns
UpsertResourceAsync(ResourcePath, string?, ResourceProviderFormFile?, ResourcePathAuthorizationResult, UnifiedUserIdentity, Func<object, bool>?)
The internal implementation of UpsertResourceAsync. Must be overridden in derived classes.
protected override Task<object> UpsertResourceAsync(ResourcePath resourcePath, string? serializedResource, ResourceProviderFormFile? formFile, ResourcePathAuthorizationResult authorizationResult, UnifiedUserIdentity userIdentity, Func<object, bool>? requestPayloadValidator = null)
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
serializedResourcestringThe optional serialized resource being created or updated.
formFileResourceProviderFormFileThe optional file attached to the request.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity with details about the identity of the user.
requestPayloadValidatorFunc<object, bool>An optional validator used to perform additional validation on the serialized resource after deserialization.