Skip to main content

Profile Handler

The Profile Handler is an ABAP class which inherits from class ZCL_PENG_AZOAI_CENTRALCONTROL or one of its sub-classes. The profile handler is responsible for evaluating the profile parameters and enforcing the policies. Once developed, the profile handler class is registered with the profile configuration.

The AI SDK provides 2 profile handler classes out-of-the-box:

  • ZCL_PENG_AZOAI_CENTRALCONTROL : This profile handler allows all operations.
  • ZCL_PENG_AZOAI_CTRL_DENYALL : This profile handler denies all operations.

For organizations using enterprise control feature, chances are, the above profile handlers will not be sufficient. Instead, organizations will need to develop their own profile handler classes to enforce the policies that are required.

Profile Handler Programming Model.

Start by creating an ABAP class which inherits from either ZCL_PENG_AZOAI_CENTRALCONTROL or ZCL_PENG_AZOAI_CTRL_DENYALL, depending on how many operations are needed to be permitted or denied. The profile handler class must override the following methods as required:

Method NameDescription
START_SDKCheck if SDK use is permitted.
INITIALIZE_SDKCOMPONENTCheck if SDK Component (Model, Deployment, File, Fine-Tune, Completion) creation is permitted.
PERFORM_OPERATIONCheck if SDK Component operation is permitted.
tip

A typical profile handler implementation will override one or more of the above methods, and in the method logic, use a combinatoin of authorization checks for the UserID (SY-UNAME), as well as any other look up values from custom tables (as an example) - along with the parameters provided through the method interface.


START_SDK Method

This method is called prior to SDK initialization, and is used to check if SDK use is permitted. The method has the following signature:

start_sdk
IMPORTING
api_version TYPE string
api_base TYPE string
api_type TYPE string
sdkprofile TYPE ztaisdkrunprofil
init_params TYPE tihttpnvp
RAISING
zcx_peng_azoai_sdk_exception.

The implementation can then check the parameters available and decide if SDK use is permitted. Any additional parameters passed in params parameter during SDK instantiation is available in the init_params table type inbound parameter on this method.

The init

To block/deny the SDK instantiation, raise an exception of type ZCX_PENG_AZOAI_SDK_EXCEPTION. You can refer to the class ZCL_PENG_AZOAI_CTRL_DENYALL for an example.


INITIALIZE_SDKCOMPONENT Method

This method is called by SDK runtime, prior to instantiating sub-components. The method has the following signature:

initialize_sdkcomponent
IMPORTING
component_type TYPE string
RAISING
zcx_peng_azoai_sdk_exception

AI SDK organizes the operations into "Components". For example, operations in Models are implemented in a "MODELS" component, with component type identifier as "MODELS". The component identifier for each module is documented in the respective module documentation. But, for reference, the component identifiers and operations are listed in this page.

tip

In most use cases, the organization policy will be to restrict/allow all operations using a specific component for targetted user groups. This method is best suited for such use cases. If an entire component is blocked, then there is no reason to implement the higher granular PERFORM_OPERATION method for the same component.


PERFORM_OPERATION Method

Of the 3 methods, this one is the most granular method, and is called by SDK runtime, prior to performing any operation. This method is typically implemented when organization policy is to allow/deny specific operations of a component for specific user groups. In general, if the entire component itself should be blocked, a more appropriate method to implement is INITIALIZE_SDKCOMPONENT.

The method has the following signature:

perform_operation
IMPORTING
component_type TYPE string
operation TYPE string
RAISING
zcx_peng_azoai_sdk_exception.

Each component of the SDK has operations as documented in the respective components documentation page. For example, MODEL component has operations "GET" and "LIST". To block a specific operation for a component, raise an exception of type ZCX_PENG_AZOAI_SDK_EXCEPTION.


Component Identifiers and Operations.

Select appropriate tab to view the operations for the component:

Component Identifier : MODEL / zif_peng_azoai_sdk_constants=>c_component_type-model

Operation IDSDK Constant (recommended)Description
GETzif_peng_azoai_sdk_constants=>c_component_operations-getGet a model by ID
LISTzif_peng_azoai_sdk_constants=>c_component_operations-listList all models