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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
//! OpenStack API bindings
//!
//! This module provides implementation for the individual APIs as well as the necessary logic
//!
//! ## Query/QueryAsync trait
//!
//! API requests that return data should be invoked using [Query] or [QueryAsync] style.
//!
//! ```
//! use openstack_sdk::api::QueryAsync;
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::get::Request::builder().build().unwrap();
//! let data_raw: serde_json::Value = ep.query_async(&client).await?;
//! # Ok(())
//! # }
//! ```
//! ## RawQuery/RawQueryAsync trait
//!
//! It may be sometimes desired to get the raw API response for example to access headers. It is
//! possible using [RawQuery]/[RawQueryAsync] trait on such endpoints.
//!
//! ```
//! use openstack_sdk::api::RawQueryAsync;
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # use http::{Response};
//! # use bytes::Bytes;
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::get::Request::builder().build().unwrap();
//! let rsp: Response<Bytes> = ep.raw_query_async(&client).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Find combinator
//!
//! Finding resource by `name` or `id` is possible using [`find`](fn@find) combinator. First a API
//! request to get resource directly by the identified (i.e. `flavors/<VALUE>`) is done. When it
//! returns positive data it is used as a find response. Otherwise list API call is invoked
//! (passing name filter parameter when available). Single operation return entry is used as find
//! result otherwise an error is returned. Only endpoints implementing
//! [`Findable`] trait support that.
//!
//! ```
//! use openstack_sdk::api::QueryAsync;
//! use openstack_sdk::api::find;
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # use http::Response;
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::find::Request::builder().build().unwrap();
//! let data_raw: serde_json::Value = find(ep).query_async(&client).await?;
//! # Ok(())
//! # }
//! ```
//!
//! When identifier is clearly known to be `name` [`find`](fn@find_by_name) is more useful and is
//! saving unnecessary API roundtrip for attempting to query resource by the identifier and
//! immediately triggers listing operation.
//!
//! ```
//! use openstack_sdk::api::QueryAsync;
//! use openstack_sdk::api::find_by_name;
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # use http::Response;
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::find::Request::builder().build().unwrap();
//! let data_raw: serde_json::Value = find_by_name(ep).query_async(&client).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Pagination combinator
//!
//! Support for querying paginated resources is covered using [`paged`](fn@paged) combinator. The
//! endpoint must implement [`Pageable`] trait to support this combinator.
//!
//! ```
//! use openstack_sdk::api::{QueryAsync, Pagination};
//! use openstack_sdk::api::paged;
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::list::Request::builder().build().unwrap();
//! let data: Vec<serde_json::Value> = paged(ep, Pagination::Limit(100))
//! .query_async(&client)
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Ignoring response combinator
//!
//! Some APIs natively do not return any response. Trying to use [Query]/[QueryAsync] trait on them
//! result in an error while casing the data. When API do not return any response or it is
//! explicitly uninteresting a [`ignore`](fn@ignore) combinator can be used. When API returned an
//! error it is properly thrown.
//!
//! ```
//! use openstack_sdk::api::{ignore, QueryAsync};
//! # use openstack_sdk::{AsyncOpenStack, config::ConfigFile, OpenStackError};
//! # async fn func() -> Result<(), OpenStackError> {
//! # let cfg = ConfigFile::new().unwrap();
//! # let profile = cfg.get_cloud_config("devstack").unwrap().unwrap();
//! # let client = AsyncOpenStack::new(&profile).await?;
//! # let ep = openstack_sdk::api::compute::v2::flavor::delete::Request::builder().build().unwrap();
//! ignore(ep).query_async(&client).await?;
//! # Ok(())
//! # }
//! ```
//!
pub
pub
pub use ApiError;
pub use BodyError;
pub use RestClient;
pub use check_response_error;
pub use RestEndpoint;
pub use AsyncClient;
pub use Client;
pub use Query;
pub use QueryAsync;
pub use RawQuery;
pub use RawQueryAsync;
pub use paged;
pub use Pageable;
pub use Paged;
pub use Pagination;
pub use PaginationError;
pub use ;
pub use JsonBodyParams;
pub use ParamValue;
pub use QueryParams;
pub use ignore;
pub use Ignore;