Updated on 2026-08-03 GMT+08:00

Viewing Event Notification Settings (SDK for C)

You can call get_notification_configuration to view event notification settings of a bucket.

Method

void get_notification_configuration(const obs_options *options,
        obs_smn_handler *handler,  void *callback_data);

Parameter Description

Field

Type

Mandatory or Optional

Description

options

Request for the context of the bucket, see Configuring option (SDK for C)

Mandatory

Bucket parameter

handler

obs_smn_handler *

Mandatory

Callback function

callback_data

void *

Optional

Callback data

The following table describes the callback function types of obs_smn_handler.

Field

Type

Description

response_handler

obs_response_handler

Callback function handler for response

get_smn_callback_func

obs_smn_callback *

Callback function for obtaining the notification configuration of a bucket

Code Examples

static void test_get_notification_configuration()
{
    obs_options option; 
    obs_status  ret_status = OBS_STATUS_BUTT;
    // Set option.
    init_obs_options(&option);
    option->bucket_options.hostName = "<your-endpoint>";
    option->bucket_options.bucketName = "<Your bucketname>";

    // Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables ACCESS_KEY_ID and SECRET_ACCESS_KEY.
    // Obtain an AK/SK pair on the management console. For details, see https://support.huaweicloud.com/intl/en-us/usermanual-ca/ca_01_0003.html.
    option.bucket_options.access_key = getenv("ACCESS_KEY_ID");
    option.bucket_options.secret_access_key = getenv("SECRET_ACCESS_KEY");

    // Set callback function.
    obs_smn_handler notification_handler_info =
    {
        {&response_properties_callback, &response_complete_callback},
        &get_notification_info_callback
    };
    get_notification_configuration(&option, &notification_handler_info, &ret_status);
    if (OBS_STATUS_OK == ret_status) {
        printf("get_notification_config success.\n");
    }
    else {
        printf("get_notification_config failed(%s).\n", obs_get_status_name(ret_status));
    }
}