Viewing Bucket Tags
If you have any questions during development, post them on the Issues page of GitHub.
You can call get_bucket_tagging to view bucket tags.
Parameter Description
Field |
Type |
Mandatory or Optional |
Description |
---|---|---|---|
options |
The context of the bucket. For details, see Configuring option. |
Mandatory |
Bucket parameter |
handler |
obs_get_bucket_tagging_handler * |
Mandatory |
Callback function |
callback_data |
void * |
Optional |
Callback data |
The following table describes the callback function types of obs_get_bucket_tagging_handler.
Field |
Type |
Description |
---|---|---|
response_handler |
obs_response_handler |
Callback function handler for response |
get_bucket_tagging_callback |
obs_get_bucket_tagging_callback * |
Callback function for obtaining bucket tags |
Sample Code
static void test_get_bucket_tagging() { // Create and initialize option. obs_options option; init_obs_options(&option); option.bucket_options.host_name = "<your-endpoint>"; option.bucket_options.bucket_name = "<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 response callback function. obs_get_bucket_tagging_handler response_handler = { {&response_properties_callback, &get_bucket_tagging_complete_callback}, &get_bucket_tagging_callback }; // Create callback data. TaggingInfo tagging_info; memset(&tagging_info, 0, sizeof(TaggingInfo)); tagging_info.ret_status = OBS_STATUS_BUTT; // Obtain bucket tags get_bucket_tagging(&option, &response_handler, &tagging_info); if (OBS_STATUS_OK == tagging_info.ret_status) { printf("get bucket tagging successfully.\n"); } else { printf("get bucket tagging failed(%s).\n", obs_get_status_name(tagging_info.ret_status)); } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot