Skip to content

Commit b0d2ce9

Browse files
authored
feat: Add response key hack to the BS quota resources (#1397)
Pull whichever other changes are also there. Change-Id: Ib4ca6f2fce19425aae4485915612c17e0a12565e Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com> Changes are triggered by https://review.opendev.org/959334
1 parent caeda01 commit b0d2ce9

File tree

21 files changed

+11784
-113
lines changed

21 files changed

+11784
-113
lines changed

openstack_cli/src/compute/v2/server/volume_attachment/set_20.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ use openstack_types::compute::v2::server::volume_attachment::response::set::Volu
3434

3535
/// Update a volume attachment.
3636
///
37-
/// Policy default role is ‘rule:system_admin_or_owner’, its scope is \[system,
38-
/// project\], which allow project members or system admins to change the
39-
/// fields of an attached volume of a server. Policy defaults enable only users
40-
/// with the administrative role to change `volumeId` via this operation. Cloud
41-
/// providers can change these permissions through the `policy.json` file.
42-
///
43-
/// Updating, or what is commonly referred to as “swapping”, volume attachments
44-
/// with volumes that have more than one read/write attachment, is not
45-
/// supported.
37+
/// Policy default role is ‘rule:admin_or_owner’, its scope is [project], which
38+
/// allow project members or admins to change the fields of an attached volume
39+
/// of a server. Cloud providers can change these permissions through the
40+
/// `policy.yaml` file.
4641
///
4742
/// Normal response codes: 202
4843
///
@@ -94,7 +89,7 @@ struct PathParameters {
9489
/// VolumeAttachment Body data
9590
#[derive(Args, Clone)]
9691
struct VolumeAttachment {
97-
/// The UUID of the volume to attach instead of the attached volume.
92+
/// The UUID of the attached volume.
9893
#[arg(help_heading = "Body parameters", long)]
9994
volume_id: String,
10095
}

openstack_cli/src/compute/v2/server/volume_attachment/set_285.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ use openstack_types::compute::v2::server::volume_attachment::response::set::Volu
3434

3535
/// Update a volume attachment.
3636
///
37-
/// Policy default role is ‘rule:system_admin_or_owner’, its scope is \[system,
38-
/// project\], which allow project members or system admins to change the
39-
/// fields of an attached volume of a server. Policy defaults enable only users
40-
/// with the administrative role to change `volumeId` via this operation. Cloud
41-
/// providers can change these permissions through the `policy.json` file.
42-
///
43-
/// Updating, or what is commonly referred to as “swapping”, volume attachments
44-
/// with volumes that have more than one read/write attachment, is not
45-
/// supported.
37+
/// Policy default role is ‘rule:admin_or_owner’, its scope is [project], which
38+
/// allow project members or admins to change the fields of an attached volume
39+
/// of a server. Cloud providers can change these permissions through the
40+
/// `policy.yaml` file.
4641
///
4742
/// Normal response codes: 202
4843
///
@@ -129,7 +124,7 @@ struct VolumeAttachment {
129124
#[arg(help_heading = "Body parameters", long)]
130125
tag: Option<String>,
131126

132-
/// The UUID of the volume to attach instead of the attached volume.
127+
/// The UUID of the attached volume.
133128
#[arg(help_heading = "Body parameters", long)]
134129
volume_id: String,
135130
}

openstack_cli/src/image/v2/image/file/upload.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ use openstack_sdk::api::image::v2::image::file::upload;
4646
/// is returned. When the header is not present, the image data is placed into
4747
/// the default backing store.
4848
///
49+
/// An optional `x-openstack-image-size` header may be added to the request.
50+
/// When present, the server will validate that the uploaded data size matches
51+
/// this value. If the actual size does not match the expected size, a 400 (Bad
52+
/// Request) response is returned. When not present, the server will calculate
53+
/// the image size based on the actual request body size.
54+
///
4955
/// Example call:
5056
///
5157
/// **Preconditions**

openstack_sdk/src/api/block_storage/v3/quota_class_set/get.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl RestEndpoint for Request<'_> {
8585
}
8686

8787
fn response_key(&self) -> Option<Cow<'static, str>> {
88-
None
88+
Some("quota_class_set".into())
8989
}
9090

9191
/// Returns headers to be set into the request
@@ -120,7 +120,10 @@ mod tests {
120120

121121
#[test]
122122
fn test_response_key() {
123-
assert!(Request::builder().build().unwrap().response_key().is_none())
123+
assert_eq!(
124+
Request::builder().build().unwrap().response_key().unwrap(),
125+
"quota_class_set"
126+
);
124127
}
125128

126129
#[cfg(feature = "sync")]
@@ -134,7 +137,7 @@ mod tests {
134137

135138
then.status(200)
136139
.header("content-type", "application/json")
137-
.json_body(json!({ "dummy": {} }));
140+
.json_body(json!({ "quota_class_set": {} }));
138141
});
139142

140143
let endpoint = Request::builder().id("id").build().unwrap();
@@ -154,7 +157,7 @@ mod tests {
154157
.header("not_foo", "not_bar");
155158
then.status(200)
156159
.header("content-type", "application/json")
157-
.json_body(json!({ "dummy": {} }));
160+
.json_body(json!({ "quota_class_set": {} }));
158161
});
159162

160163
let endpoint = Request::builder()

openstack_sdk/src/api/block_storage/v3/quota_class_set/set.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl RestEndpoint for Request<'_> {
112112
}
113113

114114
fn response_key(&self) -> Option<Cow<'static, str>> {
115-
None
115+
Some("quota_class_set".into())
116116
}
117117

118118
/// Returns headers to be set into the request
@@ -151,12 +151,15 @@ mod tests {
151151

152152
#[test]
153153
fn test_response_key() {
154-
assert!(Request::builder()
155-
.quota_class_set(BTreeMap::<String, i32>::new().into_iter())
156-
.build()
157-
.unwrap()
158-
.response_key()
159-
.is_none())
154+
assert_eq!(
155+
Request::builder()
156+
.quota_class_set(BTreeMap::<String, i32>::new().into_iter())
157+
.build()
158+
.unwrap()
159+
.response_key()
160+
.unwrap(),
161+
"quota_class_set"
162+
);
160163
}
161164

162165
#[cfg(feature = "sync")]
@@ -170,7 +173,7 @@ mod tests {
170173

171174
then.status(200)
172175
.header("content-type", "application/json")
173-
.json_body(json!({ "dummy": {} }));
176+
.json_body(json!({ "quota_class_set": {} }));
174177
});
175178

176179
let endpoint = Request::builder()
@@ -194,7 +197,7 @@ mod tests {
194197
.header("not_foo", "not_bar");
195198
then.status(200)
196199
.header("content-type", "application/json")
197-
.json_body(json!({ "dummy": {} }));
200+
.json_body(json!({ "quota_class_set": {} }));
198201
});
199202

200203
let endpoint = Request::builder()

openstack_sdk/src/api/block_storage/v3/quota_set/defaults.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl RestEndpoint for Request<'_> {
8585
}
8686

8787
fn response_key(&self) -> Option<Cow<'static, str>> {
88-
None
88+
Some("quota_set".into())
8989
}
9090

9191
/// Returns headers to be set into the request
@@ -120,7 +120,10 @@ mod tests {
120120

121121
#[test]
122122
fn test_response_key() {
123-
assert!(Request::builder().build().unwrap().response_key().is_none())
123+
assert_eq!(
124+
Request::builder().build().unwrap().response_key().unwrap(),
125+
"quota_set"
126+
);
124127
}
125128

126129
#[cfg(feature = "sync")]
@@ -134,7 +137,7 @@ mod tests {
134137

135138
then.status(200)
136139
.header("content-type", "application/json")
137-
.json_body(json!({ "dummy": {} }));
140+
.json_body(json!({ "quota_set": {} }));
138141
});
139142

140143
let endpoint = Request::builder().id("id").build().unwrap();
@@ -154,7 +157,7 @@ mod tests {
154157
.header("not_foo", "not_bar");
155158
then.status(200)
156159
.header("content-type", "application/json")
157-
.json_body(json!({ "dummy": {} }));
160+
.json_body(json!({ "quota_set": {} }));
158161
});
159162

160163
let endpoint = Request::builder()

openstack_sdk/src/api/block_storage/v3/quota_set/get.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl RestEndpoint for Request<'_> {
9090
}
9191

9292
fn response_key(&self) -> Option<Cow<'static, str>> {
93-
None
93+
Some("quota_set".into())
9494
}
9595

9696
/// Returns headers to be set into the request
@@ -125,7 +125,10 @@ mod tests {
125125

126126
#[test]
127127
fn test_response_key() {
128-
assert!(Request::builder().build().unwrap().response_key().is_none())
128+
assert_eq!(
129+
Request::builder().build().unwrap().response_key().unwrap(),
130+
"quota_set"
131+
);
129132
}
130133

131134
#[cfg(feature = "sync")]
@@ -139,7 +142,7 @@ mod tests {
139142

140143
then.status(200)
141144
.header("content-type", "application/json")
142-
.json_body(json!({ "dummy": {} }));
145+
.json_body(json!({ "quota_set": {} }));
143146
});
144147

145148
let endpoint = Request::builder().id("id").build().unwrap();
@@ -159,7 +162,7 @@ mod tests {
159162
.header("not_foo", "not_bar");
160163
then.status(200)
161164
.header("content-type", "application/json")
162-
.json_body(json!({ "dummy": {} }));
165+
.json_body(json!({ "quota_set": {} }));
163166
});
164167

165168
let endpoint = Request::builder()

openstack_sdk/src/api/block_storage/v3/quota_set/set.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl RestEndpoint for Request<'_> {
116116
}
117117

118118
fn response_key(&self) -> Option<Cow<'static, str>> {
119-
None
119+
Some("quota_set".into())
120120
}
121121

122122
/// Returns headers to be set into the request
@@ -155,12 +155,15 @@ mod tests {
155155

156156
#[test]
157157
fn test_response_key() {
158-
assert!(Request::builder()
159-
.quota_set(BTreeMap::<String, Value>::new().into_iter())
160-
.build()
161-
.unwrap()
162-
.response_key()
163-
.is_none())
158+
assert_eq!(
159+
Request::builder()
160+
.quota_set(BTreeMap::<String, Value>::new().into_iter())
161+
.build()
162+
.unwrap()
163+
.response_key()
164+
.unwrap(),
165+
"quota_set"
166+
);
164167
}
165168

166169
#[cfg(feature = "sync")]
@@ -174,7 +177,7 @@ mod tests {
174177

175178
then.status(200)
176179
.header("content-type", "application/json")
177-
.json_body(json!({ "dummy": {} }));
180+
.json_body(json!({ "quota_set": {} }));
178181
});
179182

180183
let endpoint = Request::builder()
@@ -198,7 +201,7 @@ mod tests {
198201
.header("not_foo", "not_bar");
199202
then.status(200)
200203
.header("content-type", "application/json")
201-
.json_body(json!({ "dummy": {} }));
204+
.json_body(json!({ "quota_set": {} }));
202205
});
203206

204207
let endpoint = Request::builder()

openstack_sdk/src/api/compute/v2/server/volume_attachment/set_20.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@
1717

1818
//! Update a volume attachment.
1919
//!
20-
//! Policy default role is ‘rule:system_admin_or_owner’, its scope is \[system,
21-
//! project\], which allow project members or system admins to change the
22-
//! fields of an attached volume of a server. Policy defaults enable only users
23-
//! with the administrative role to change `volumeId` via this operation. Cloud
24-
//! providers can change these permissions through the `policy.json` file.
25-
//!
26-
//! Updating, or what is commonly referred to as “swapping”, volume attachments
27-
//! with volumes that have more than one read/write attachment, is not
28-
//! supported.
20+
//! Policy default role is ‘rule:admin_or_owner’, its scope is [project], which
21+
//! allow project members or admins to change the fields of an attached volume
22+
//! of a server. Cloud providers can change these permissions through the
23+
//! `policy.yaml` file.
2924
//!
3025
//! Normal response codes: 202
3126
//!
@@ -47,7 +42,7 @@ use std::borrow::Cow;
4742
#[derive(Builder, Debug, Deserialize, Clone, Serialize)]
4843
#[builder(setter(strip_option))]
4944
pub struct VolumeAttachment<'a> {
50-
/// The UUID of the volume to attach instead of the attached volume.
45+
/// The UUID of the attached volume.
5146
#[serde(rename = "volumeId")]
5247
#[builder(setter(into))]
5348
pub(crate) volume_id: Cow<'a, str>,

openstack_sdk/src/api/compute/v2/server/volume_attachment/set_285.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@
1717

1818
//! Update a volume attachment.
1919
//!
20-
//! Policy default role is ‘rule:system_admin_or_owner’, its scope is \[system,
21-
//! project\], which allow project members or system admins to change the
22-
//! fields of an attached volume of a server. Policy defaults enable only users
23-
//! with the administrative role to change `volumeId` via this operation. Cloud
24-
//! providers can change these permissions through the `policy.json` file.
25-
//!
26-
//! Updating, or what is commonly referred to as “swapping”, volume attachments
27-
//! with volumes that have more than one read/write attachment, is not
28-
//! supported.
20+
//! Policy default role is ‘rule:admin_or_owner’, its scope is [project], which
21+
//! allow project members or admins to change the fields of an attached volume
22+
//! of a server. Cloud providers can change these permissions through the
23+
//! `policy.yaml` file.
2924
//!
3025
//! Normal response codes: 202
3126
//!
@@ -83,7 +78,7 @@ pub struct VolumeAttachment<'a> {
8378
#[builder(default, setter(into))]
8479
pub(crate) tag: Option<Cow<'a, str>>,
8580

86-
/// The UUID of the volume to attach instead of the attached volume.
81+
/// The UUID of the attached volume.
8782
#[serde(rename = "volumeId")]
8883
#[builder(setter(into))]
8984
pub(crate) volume_id: Cow<'a, str>,

0 commit comments

Comments
 (0)