Table of Contents

Class ConversationResourceProviderService

Namespace
FoundationaLLM.Conversation.ResourceProviders
Assembly
FoundationaLLM.Conversation.dll

Implements the FoundationaLLM.Conversation resource provider.

public class ConversationResourceProviderService : ResourceProviderServiceBase<ResourceReference>, IResourceProviderService, IManagementProviderService
Inheritance
ConversationResourceProviderService
Implements
Inherited Members
Extension Methods

Constructors

ConversationResourceProviderService(IOptions<InstanceSettings>, IOptions<ResourceProviderCacheSettings>, IAuthorizationServiceClient, IEventService, IResourceValidatorFactory, IAzureCosmosDBService, IServiceProvider, ILogger<ConversationResourceProviderService>)

Implements the FoundationaLLM.Conversation resource provider.

public ConversationResourceProviderService(IOptions<InstanceSettings> instanceOptions, IOptions<ResourceProviderCacheSettings> cacheOptions, IAuthorizationServiceClient authorizationService, IEventService eventService, IResourceValidatorFactory resourceValidatorFactory, IAzureCosmosDBService cosmosDBService, IServiceProvider serviceProvider, ILogger<ConversationResourceProviderService> logger)

Parameters

instanceOptions IOptions<InstanceSettings>

The options providing the InstanceSettings with instance settings.

cacheOptions IOptions<ResourceProviderCacheSettings>

The options providing the ResourceProviderCacheSettings with settings for the resource provider cache.

authorizationService IAuthorizationServiceClient

The IAuthorizationServiceClient providing authorization services.

eventService IEventService

The IEventService providing event services.

resourceValidatorFactory IResourceValidatorFactory

The IResourceValidatorFactory providing the factory to create resource validators.

cosmosDBService IAzureCosmosDBService

The IAzureCosmosDBService providing Cosmos DB services.

serviceProvider IServiceProvider

The IServiceProvider of the main dependency injection container.

logger ILogger<ConversationResourceProviderService>

The ILogger used for logging.

Properties

_name

The name of the resource provider. Must be overridden in derived classes.

protected override string _name { get; }

Property Value

string

Methods

DeleteResourceAsyncInternal<T>(ResourcePath, ResourcePathAuthorizationResult, UnifiedUserIdentity)

The internal implementation of DeleteResourceAsync. Must be overridden in derived classes.

protected override Task DeleteResourceAsyncInternal<T>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, UnifiedUserIdentity userIdentity) where T : ResourceBase

Parameters

resourcePath ResourcePath

The ResourcePath containing information about the resource path.

authorizationResult ResourcePathAuthorizationResult

The ResourcePathAuthorizationResult containing the result of the resource path authorization request.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing information about the calling user identity.

Returns

Task

Type Parameters

T

The type of the resource being deleted.

Exceptions

NotImplementedException

GetResourceAsyncInternal<T>(ResourcePath, ResourcePathAuthorizationResult, UnifiedUserIdentity, ResourceProviderGetOptions?)

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) where T : ResourceBase

Parameters

resourcePath ResourcePath

A ResourcePath containing information about the resource path.

authorizationResult ResourcePathAuthorizationResult

The ResourcePathAuthorizationResult containing the result of the resource path authorization request.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing information about the calling user identity.

options ResourceProviderGetOptions

The ResourceProviderGetOptions which provides operation parameters.

Returns

Task<T>

Type Parameters

T

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

resourcePath ResourcePath

A ResourcePath containing information about the resource path.

authorizationResult ResourcePathAuthorizationResult

The ResourcePathAuthorizationResult containing the result of the resource path authorization request.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity with details about the identity of the user.

options ResourceProviderGetOptions

The ResourceProviderGetOptions which provides operation parameters.

Returns

Task<object>

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:

  1. The resource path refers to a single resource. In this case, the authorization is already confirmed and the specific resource should be returned.
  2. 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).
  3. 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

Task

UpdateResourcePropertiesAsyncInternal<T, TResult>(ResourcePath, ResourcePathAuthorizationResult, Dictionary<string, object?>, UnifiedUserIdentity)

The internal implementation of UpdateResourcePropertiesAsync. Must be overridden in derived classes.

protected override Task<TResult> UpdateResourcePropertiesAsyncInternal<T, TResult>(ResourcePath resourcePath, ResourcePathAuthorizationResult authorizationResult, Dictionary<string, object?> propertyValues, UnifiedUserIdentity userIdentity) where T : ResourceBase where TResult : ResourceProviderUpsertResult<T>

Parameters

resourcePath ResourcePath

The ResourcePath containing information about the resource path.

authorizationResult ResourcePathAuthorizationResult

The ResourcePathAuthorizationResult containing the result of the resource path authorization request.

propertyValues Dictionary<string, object>

The dictionary with propery names and values to update.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing information about the calling user identity.

Returns

Task<TResult>

Type Parameters

T

The type of the resource being updated.

TResult

The type of the result returned.

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

resourcePath ResourcePath

A ResourcePath containing information about the resource path.

authorizationResult ResourcePathAuthorizationResult

The ResourcePathAuthorizationResult containing the result of the resource path authorization request.

resource T

The instance of the resource being created or updated.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing information about the calling user identity.

options ResourceProviderUpsertOptions

The ResourceProviderUpsertOptions which provides operation parameters.

Returns

Task<TResult>

Type Parameters

T

The type of the resource being created or updated.

TResult

The type of the result returned.