void oss_init_object_request(const oss_request_options_t *options, const aos_string_t *bucket, const aos_string_t *object, http_method_e method, aos_http_request_t **req, aos_table_t *params, aos_table_t *headers, aos_http_response_t **resp) { oss_init_request(options, method, req, params, headers, resp); oss_get_object_uri(options, bucket, object, *req); }
char *oss_gen_signed_url(const oss_request_options_t *options, const aos_string_t *bucket, const aos_string_t *object, int64_t expires, aos_http_request_t *req) { aos_string_t signed_url; char *expires_str = NULL; aos_string_t expires_time; int res = AOSE_OK; expires_str = apr_psprintf(options->pool, "%" APR_INT64_T_FMT, expires); aos_str_set(&expires_time, expires_str); oss_get_object_uri(options, bucket, object, req); res = oss_get_signed_url(options, req, &expires_time, &signed_url); if (res != AOSE_OK) { return NULL; } return signed_url.data; }
aos_status_t *oss_delete_object(const oss_request_options_t *options, const aos_string_t *bucket, const aos_string_t *object, aos_table_t **resp_headers) { aos_status_t *s = NULL; aos_http_request_t *req = NULL; aos_http_response_t *resp = NULL; aos_table_t *headers = NULL; aos_table_t *query_params = NULL; headers = aos_table_create_if_null(options, headers, 0); query_params = aos_table_create_if_null(options, query_params, 0); oss_init_object_request(options, bucket, object, HTTP_DELETE, &req, query_params, headers, &resp); oss_get_object_uri(options, bucket, object, req); s = oss_process_request(options, req, resp); *resp_headers = resp->headers; return s; }