opendal/services/cloudflare_kv/
model.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18// use std::collections::HashMap;
19
20use serde::{Deserialize, Serialize};
21
22#[derive(Debug, Deserialize)]
23pub struct CfKvResponse {
24    pub errors: Vec<CfKvError>,
25}
26
27#[derive(Debug, Clone, Deserialize, Serialize)]
28pub struct CfKvMetadata {
29    pub etag: String,
30    pub last_modified: String,
31    pub content_length: usize,
32    pub is_dir: bool,
33}
34
35#[derive(Debug, Deserialize)]
36pub struct CfKvError {
37    pub code: i32,
38}
39
40#[derive(Debug, Deserialize)]
41pub struct CfKvDeleteResult {
42    pub successful_key_count: usize,
43    pub unsuccessful_keys: Vec<String>,
44}
45
46#[derive(Debug, Deserialize)]
47pub struct CfKvDeleteResponse {
48    pub success: bool,
49    pub result: Option<CfKvDeleteResult>,
50}
51
52#[derive(Debug, Deserialize)]
53pub struct CfKvListKey {
54    pub name: String,
55    pub metadata: CfKvMetadata,
56    // expiration: Option<u32>,
57}
58
59#[derive(Debug, Deserialize)]
60pub struct CfKvListResultInfo {
61    // pub count: Option<usize>,
62    pub cursor: Option<String>,
63}
64
65#[derive(Debug, Deserialize)]
66pub struct CfKvListResponse {
67    pub success: bool,
68    pub result_info: Option<CfKvListResultInfo>,
69    pub result: Option<Vec<CfKvListKey>>,
70}
71
72#[derive(Debug, Deserialize)]
73pub struct CfKvStatResponse {
74    pub success: bool,
75    pub result: Option<CfKvMetadata>,
76}