1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//! Redis Data Integration workspace operations.
//!
//! The Redis Cloud API exposes Data Integration as an opaque JSON workspace
//! service. The published schema intentionally models request and response
//! bodies as arbitrary JSON, so this handler provides structured routing while
//! preserving payloads as [`serde_json::Value`].
use crate::{CloudClient, Result};
use serde_json::Value;
/// Handler for Data Integration workspace and proxy operations.
pub struct DataIntegrationHandler {
client: CloudClient,
}
impl DataIntegrationHandler {
/// Create a Data Integration handler.
#[must_use]
pub fn new(client: CloudClient) -> Self {
Self { client }
}
/// List Data Integration workspaces visible to the account.
pub async fn list_workspaces(&self) -> Result<Value> {
self.client.get_raw("/data-integration-workspaces").await
}
/// Get the root Data Integration workspace document for a subscription.
pub async fn get_workspace(&self, subscription_id: i32) -> Result<Value> {
self.client
.get_raw(&format!(
"/subscriptions/{subscription_id}/data-integration-workspace"
))
.await
}
/// POST an opaque JSON document to a subscription's workspace root.
pub async fn post_workspace(&self, subscription_id: i32, body: Value) -> Result<Value> {
self.client
.post_raw(
&format!("/subscriptions/{subscription_id}/data-integration-workspace"),
body,
)
.await
}
/// Replace a subscription's workspace root with an opaque JSON document.
pub async fn put_workspace(&self, subscription_id: i32, body: Value) -> Result<Value> {
self.client
.put_raw(
&format!("/subscriptions/{subscription_id}/data-integration-workspace"),
body,
)
.await
}
/// Patch a subscription's workspace root with an opaque JSON document.
pub async fn patch_workspace(&self, subscription_id: i32, body: Value) -> Result<Value> {
self.client
.patch_raw(
&format!("/subscriptions/{subscription_id}/data-integration-workspace"),
body,
)
.await
}
/// DELETE a subscription's workspace root with an opaque JSON document.
pub async fn delete_workspace(&self, subscription_id: i32, body: Value) -> Result<Value> {
self.client
.delete_with_body(
&format!("/subscriptions/{subscription_id}/data-integration-workspace"),
body,
)
.await
}
/// GET an arbitrary path below a subscription's Data Integration workspace.
pub async fn get_workspace_path(
&self,
subscription_id: i32,
workspace_path: &str,
) -> Result<Value> {
let workspace_path = workspace_path.trim_matches('/');
self.client
.get_raw(&format!(
"/subscriptions/{subscription_id}/data-integration-workspace/{workspace_path}"
))
.await
}
/// POST an opaque JSON document to an arbitrary workspace path.
pub async fn post_workspace_path(
&self,
subscription_id: i32,
workspace_path: &str,
body: Value,
) -> Result<Value> {
let workspace_path = workspace_path.trim_matches('/');
self.client
.post_raw(
&format!(
"/subscriptions/{subscription_id}/data-integration-workspace/{workspace_path}"
),
body,
)
.await
}
/// PUT an opaque JSON document at an arbitrary workspace path.
pub async fn put_workspace_path(
&self,
subscription_id: i32,
workspace_path: &str,
body: Value,
) -> Result<Value> {
let workspace_path = workspace_path.trim_matches('/');
self.client
.put_raw(
&format!(
"/subscriptions/{subscription_id}/data-integration-workspace/{workspace_path}"
),
body,
)
.await
}
/// PATCH an arbitrary workspace path with an opaque JSON document.
pub async fn patch_workspace_path(
&self,
subscription_id: i32,
workspace_path: &str,
body: Value,
) -> Result<Value> {
let workspace_path = workspace_path.trim_matches('/');
self.client
.patch_raw(
&format!(
"/subscriptions/{subscription_id}/data-integration-workspace/{workspace_path}"
),
body,
)
.await
}
/// DELETE an arbitrary workspace path with an opaque JSON document.
pub async fn delete_workspace_path(
&self,
subscription_id: i32,
workspace_path: &str,
body: Value,
) -> Result<Value> {
let workspace_path = workspace_path.trim_matches('/');
self.client
.delete_with_body(
&format!(
"/subscriptions/{subscription_id}/data-integration-workspace/{workspace_path}"
),
body,
)
.await
}
}