Class AzureOpenAIResourceProviderService
- Namespace
 - FoundationaLLM.AzureOpenAI.ResourceProviders
 
- Assembly
 - FoundationaLLM.AzureOpenAI.dll
 
Implements the FoundationaLLM.AzureOpenAI resource provider.
public class AzureOpenAIResourceProviderService : ResourceProviderServiceBase<ResourceReference>, IResourceProviderService, IManagementProviderService
  - Inheritance
 - 
      
      
      AzureOpenAIResourceProviderService
 
- Implements
 
- Inherited Members
 
- Extension Methods
 
Constructors
AzureOpenAIResourceProviderService(IOptions<InstanceSettings>, IOptions<ResourceProviderCacheSettings>, IAuthorizationServiceClient, IEventService, IResourceValidatorFactory, IAzureCosmosDBService, IServiceProvider, ILogger<AzureOpenAIResourceProviderService>, bool)
Implements the FoundationaLLM.AzureOpenAI resource provider.
public AzureOpenAIResourceProviderService(IOptions<InstanceSettings> instanceOptions, IOptions<ResourceProviderCacheSettings> cacheOptions, IAuthorizationServiceClient authorizationService, IEventService eventService, IResourceValidatorFactory resourceValidatorFactory, IAzureCosmosDBService cosmosDBService, IServiceProvider serviceProvider, ILogger<AzureOpenAIResourceProviderService> logger, 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.
eventServiceIEventServiceThe IEventService providing event services.
resourceValidatorFactoryIResourceValidatorFactoryThe IResourceValidatorFactory providing the factory to create resource validators.
cosmosDBServiceIAzureCosmosDBServiceThe IAzureCosmosDBService providing Cosmos DB services.
serviceProviderIServiceProviderThe IServiceProvider of the main dependency injection container.
loggerILogger<AzureOpenAIResourceProviderService>The ILogger used 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
ExecuteResourceActionAsyncInternal<T, TAction, TResult>(ResourcePath, ResourcePathAuthorizationResult, TAction, UnifiedUserIdentity)
The internal implementation of ExecuteResourceActionAsync. Must be overridden in derived classes.
protected override Task<TResult> ExecuteResourceActionAsyncInternal<T, TAction, TResult>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, TAction actionPayload, UnifiedUserIdentity userIdentity) where T : ResourceBase where TAction : class? where TResult : ResourceProviderActionResult
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
actionPayloadTActionThe
TActionobject containing details about the action to be executed.userIdentityUnifiedUserIdentityThe UnifiedUserIdentity with details about the identity of the user.
Returns
- Task<TResult>
 A
TResultobject with the result of the action.
Type Parameters
TTActionTResult
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.
InitializeInternal()
The internal implementation of Initialize. Must be overridden in derived classes.
protected override Task InitializeInternal()
  Returns
ResourceExistsAsyncInternal<T>(ResourcePath, ResourcePathAuthorizationResult, UnifiedUserIdentity)
The internal implementation of ResourceExistsAsync. Must be overridden in derived classes.
protected override Task<(bool Exists, bool Deleted)> ResourceExistsAsyncInternal<T>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, UnifiedUserIdentity userIdentity) where T : ResourceBase
  Parameters
resourcePathResourcePathThe 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.
Returns
- Task<(bool Exists, bool Deleted)>
 A tuple indicating whether the resource exists or not and whether it is logically deleted or not.
Type Parameters
TThe type of resource being checked.
Remarks
If a resource was logically deleted but not purged, this method will return True, indicating the existence of the resource.
UpsertResourceAsyncInternal<T, TResult>(ResourcePath, ResourcePathAuthorizationResult, T, UnifiedUserIdentity, ResourceProviderUpsertOptions?)
The internal implementation of UpsertResourceAsync. Must be overridden in derived classes.
protected override Task<TResult> UpsertResourceAsyncInternal<T, TResult>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, T resource, UnifiedUserIdentity userIdentity, ResourceProviderUpsertOptions? options = null) where T : ResourceBase where TResult : ResourceProviderUpsertResult<T>
  Parameters
resourcePathResourcePathA ResourcePath containing information about the resource path.
authorizationResultResourcePathAuthorizationResultThe ResourcePathAuthorizationResult containing the result of the resource path authorization request.
resourceTThe instance of the resource being created or updated.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
optionsResourceProviderUpsertOptionsThe ResourceProviderUpsertOptions which provides operation parameters.
Returns
- Task<TResult>
 
Type Parameters
TThe type of the resource being created or updated.
TResultThe type of the result returned.