Skip to content

Commit 0abb277

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Query Parameters to ListOrgConnections Endpoint (#911)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent a99765f commit 0abb277

File tree

5 files changed

+121
-7
lines changed

5 files changed

+121
-7
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62417,6 +62417,39 @@ paths:
6241762417
get:
6241862418
description: Returns a list of org connections.
6241962419
operationId: ListOrgConnections
62420+
parameters:
62421+
- description: The Org ID of the sink org.
62422+
example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1
62423+
in: query
62424+
name: sink_org_id
62425+
required: false
62426+
schema:
62427+
type: string
62428+
- description: The Org ID of the source org.
62429+
example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1
62430+
in: query
62431+
name: source_org_id
62432+
required: false
62433+
schema:
62434+
type: string
62435+
- description: The limit of number of entries you want to return. Default is
62436+
1000.
62437+
example: 1000
62438+
in: query
62439+
name: limit
62440+
required: false
62441+
schema:
62442+
format: int64
62443+
type: integer
62444+
- description: The pagination offset which you want to query from. Default is
62445+
0.
62446+
example: 0
62447+
in: query
62448+
name: offset
62449+
required: false
62450+
schema:
62451+
format: int64
62452+
type: integer
6242062453
responses:
6242162454
'200':
6242262455
content:

LICENSE-3rdparty.csv

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,12 @@ web-sys,https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/web-sys,
177177
winapi,https://github.com/retep998/winapi-rs,MIT OR Apache-2.0,Peter Atashian <[email protected]>
178178
winapi-i686-pc-windows-gnu,https://github.com/retep998/winapi-rs,MIT OR Apache-2.0,Peter Atashian <[email protected]>
179179
winapi-x86_64-pc-windows-gnu,https://github.com/retep998/winapi-rs,MIT OR Apache-2.0,Peter Atashian <[email protected]>
180-
windows-core,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
180+
windows-core,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-core Authors
181181
windows-implement,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
182182
windows-interface,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
183-
windows-link,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
184183
windows-link,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-link Authors
185-
windows-result,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
186-
windows-strings,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
184+
windows-result,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-result Authors
185+
windows-strings,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-strings Authors
187186
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
188187
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-sys Authors
189188
windows-targets,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft

examples/v2_org-connections_ListOrgConnections.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
// List Org Connections returns "OK" response
22
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_org_connections::ListOrgConnectionsOptionalParams;
34
use datadog_api_client::datadogV2::api_org_connections::OrgConnectionsAPI;
45

56
#[tokio::main]
67
async fn main() {
78
let configuration = datadog::Configuration::new();
89
let api = OrgConnectionsAPI::with_config(configuration);
9-
let resp = api.list_org_connections().await;
10+
let resp = api
11+
.list_org_connections(ListOrgConnectionsOptionalParams::default())
12+
.await;
1013
if let Ok(value) = resp {
1114
println!("{:#?}", value);
1215
} else {

src/datadogV2/api/api_org_connections.rs

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,43 @@ use reqwest::header::{HeaderMap, HeaderValue};
1010
use serde::{Deserialize, Serialize};
1111
use std::io::Write;
1212

13+
/// ListOrgConnectionsOptionalParams is a struct for passing parameters to the method [`OrgConnectionsAPI::list_org_connections`]
14+
#[non_exhaustive]
15+
#[derive(Clone, Default, Debug)]
16+
pub struct ListOrgConnectionsOptionalParams {
17+
/// The Org ID of the sink org.
18+
pub sink_org_id: Option<String>,
19+
/// The Org ID of the source org.
20+
pub source_org_id: Option<String>,
21+
/// The limit of number of entries you want to return. Default is 1000.
22+
pub limit: Option<i64>,
23+
/// The pagination offset which you want to query from. Default is 0.
24+
pub offset: Option<i64>,
25+
}
26+
27+
impl ListOrgConnectionsOptionalParams {
28+
/// The Org ID of the sink org.
29+
pub fn sink_org_id(mut self, value: String) -> Self {
30+
self.sink_org_id = Some(value);
31+
self
32+
}
33+
/// The Org ID of the source org.
34+
pub fn source_org_id(mut self, value: String) -> Self {
35+
self.source_org_id = Some(value);
36+
self
37+
}
38+
/// The limit of number of entries you want to return. Default is 1000.
39+
pub fn limit(mut self, value: i64) -> Self {
40+
self.limit = Some(value);
41+
self
42+
}
43+
/// The pagination offset which you want to query from. Default is 0.
44+
pub fn offset(mut self, value: i64) -> Self {
45+
self.offset = Some(value);
46+
self
47+
}
48+
}
49+
1350
/// CreateOrgConnectionsError is a struct for typed errors of method [`OrgConnectionsAPI::create_org_connections`]
1451
#[derive(Debug, Clone, Serialize, Deserialize)]
1552
#[serde(untagged)]
@@ -355,11 +392,12 @@ impl OrgConnectionsAPI {
355392
/// Returns a list of org connections.
356393
pub async fn list_org_connections(
357394
&self,
395+
params: ListOrgConnectionsOptionalParams,
358396
) -> Result<
359397
crate::datadogV2::model::OrgConnectionListResponse,
360398
datadog::Error<ListOrgConnectionsError>,
361399
> {
362-
match self.list_org_connections_with_http_info().await {
400+
match self.list_org_connections_with_http_info(params).await {
363401
Ok(response_content) => {
364402
if let Some(e) = response_content.entity {
365403
Ok(e)
@@ -376,13 +414,20 @@ impl OrgConnectionsAPI {
376414
/// Returns a list of org connections.
377415
pub async fn list_org_connections_with_http_info(
378416
&self,
417+
params: ListOrgConnectionsOptionalParams,
379418
) -> Result<
380419
datadog::ResponseContent<crate::datadogV2::model::OrgConnectionListResponse>,
381420
datadog::Error<ListOrgConnectionsError>,
382421
> {
383422
let local_configuration = &self.config;
384423
let operation_id = "v2.list_org_connections";
385424

425+
// unbox and build optional parameters
426+
let sink_org_id = params.sink_org_id;
427+
let source_org_id = params.source_org_id;
428+
let limit = params.limit;
429+
let offset = params.offset;
430+
386431
let local_client = &self.client;
387432

388433
let local_uri_str = format!(
@@ -392,6 +437,23 @@ impl OrgConnectionsAPI {
392437
let mut local_req_builder =
393438
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
394439

440+
if let Some(ref local_query_param) = sink_org_id {
441+
local_req_builder =
442+
local_req_builder.query(&[("sink_org_id", &local_query_param.to_string())]);
443+
};
444+
if let Some(ref local_query_param) = source_org_id {
445+
local_req_builder =
446+
local_req_builder.query(&[("source_org_id", &local_query_param.to_string())]);
447+
};
448+
if let Some(ref local_query_param) = limit {
449+
local_req_builder =
450+
local_req_builder.query(&[("limit", &local_query_param.to_string())]);
451+
};
452+
if let Some(ref local_query_param) = offset {
453+
local_req_builder =
454+
local_req_builder.query(&[("offset", &local_query_param.to_string())]);
455+
};
456+
395457
// build headers
396458
let mut headers = HeaderMap::new();
397459
headers.insert("Accept", HeaderValue::from_static("application/json"));

tests/scenarios/function_mappings.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25488,7 +25488,24 @@ fn test_v2_list_org_connections(world: &mut DatadogWorld, _parameters: &HashMap<
2548825488
.v2_api_org_connections
2548925489
.as_ref()
2549025490
.expect("api instance not found");
25491-
let response = match block_on(api.list_org_connections_with_http_info()) {
25491+
let sink_org_id = _parameters
25492+
.get("sink_org_id")
25493+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
25494+
let source_org_id = _parameters
25495+
.get("source_org_id")
25496+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
25497+
let limit = _parameters
25498+
.get("limit")
25499+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
25500+
let offset = _parameters
25501+
.get("offset")
25502+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
25503+
let mut params = datadogV2::api_org_connections::ListOrgConnectionsOptionalParams::default();
25504+
params.sink_org_id = sink_org_id;
25505+
params.source_org_id = source_org_id;
25506+
params.limit = limit;
25507+
params.offset = offset;
25508+
let response = match block_on(api.list_org_connections_with_http_info(params)) {
2549225509
Ok(response) => response,
2549325510
Err(error) => {
2549425511
return match error {

0 commit comments

Comments
 (0)