registerCapability method

Future<RegisterCapabilityResponse> registerCapability({
  1. required String applicationId,
  2. required CapabilityBaseRequestConfig capabilityConfig,
  3. required String capabilityName,
})

Registers a capability for an OpenSearch UI application. Use this operation to enable specific capabilities, such as AI features, for a given application. The capability configuration defines the type and settings of the capability to register. For more information about the AI features, see Agentic AI for OpenSearch UI.

May throw AccessDeniedException. May throw ConflictException. May throw DisabledOperationException. May throw InternalException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter applicationId : The unique identifier of the OpenSearch UI application to register the capability for.

Parameter capabilityConfig : The configuration settings for the capability being registered. This includes capability-specific settings such as AI configuration.

Parameter capabilityName : The name of the capability to register. Must be between 3 and 30 characters and contain only alphanumeric characters and hyphens. This identifies the type of capability being enabled for the application. For registering AI Assistant capability, use ai-capability

Implementation

Future<RegisterCapabilityResponse> registerCapability({
  required String applicationId,
  required CapabilityBaseRequestConfig capabilityConfig,
  required String capabilityName,
}) async {
  final $payload = <String, dynamic>{
    'capabilityConfig': capabilityConfig,
    'capabilityName': capabilityName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2021-01-01/opensearch/application/${Uri.encodeComponent(applicationId)}/capability/register',
    exceptionFnMap: _exceptionFns,
  );
  return RegisterCapabilityResponse.fromJson(response);
}