Skip to content

Commit 4660cb2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add examples to Reference Tables API documentation, update cloud file and local file metadata (#1003)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 9606b1e commit 4660cb2

File tree

48 files changed

+385
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+385
-544
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 181 additions & 152 deletions
Large diffs are not rendered by default.

examples/v2_reference-tables_UpdateReferenceTable.rs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,48 @@ async fn main() {
1818
let body =
1919
PatchTableRequest
2020
::new().data(
21-
PatchTableRequestData::new(PatchTableRequestDataType::REFERENCE_TABLE)
22-
.attributes(
23-
PatchTableRequestDataAttributes::new()
24-
.description("this is a cloud table generated via a cloud bucket sync".to_string())
25-
.file_metadata(
26-
PatchTableRequestDataAttributesFileMetadata
27-
::PatchTableRequestDataAttributesFileMetadataCloudStorage(
28-
Box::new(
29-
PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
30-
.access_details(
31-
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
32-
::new().aws_detail(
33-
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
34-
::new()
35-
.aws_account_id("test-account-id".to_string())
36-
.aws_bucket_name("test-bucket".to_string())
37-
.file_path("test_rt.csv".to_string()),
38-
),
39-
)
40-
.sync_enabled(true),
41-
),
42-
),
43-
)
44-
.schema(
45-
PatchTableRequestDataAttributesSchema::new(
46-
vec![
47-
PatchTableRequestDataAttributesSchemaFieldsItems::new(
48-
"id".to_string(),
49-
ReferenceTableSchemaFieldType::INT32,
50-
),
51-
PatchTableRequestDataAttributesSchemaFieldsItems::new(
52-
"name".to_string(),
53-
ReferenceTableSchemaFieldType::STRING,
21+
PatchTableRequestData::new(
22+
PatchTableRequestDataType::REFERENCE_TABLE,
23+
).attributes(
24+
PatchTableRequestDataAttributes::new()
25+
.description("this is a cloud table generated via a cloud bucket sync".to_string())
26+
.file_metadata(
27+
PatchTableRequestDataAttributesFileMetadata
28+
::PatchTableRequestDataAttributesFileMetadataCloudStorage(
29+
Box::new(
30+
PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
31+
.access_details(
32+
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
33+
::new().aws_detail(
34+
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
35+
::new()
36+
.aws_account_id("test-account-id".to_string())
37+
.aws_bucket_name("test-bucket".to_string())
38+
.file_path("test_rt.csv".to_string()),
39+
),
5440
)
55-
],
56-
vec!["id".to_string()],
41+
.sync_enabled(true),
5742
),
58-
)
59-
.sync_enabled(false)
60-
.tags(vec!["test_tag".to_string()]),
61-
)
62-
.id("00000000-0000-0000-0000-000000000000".to_string()),
43+
),
44+
)
45+
.schema(
46+
PatchTableRequestDataAttributesSchema::new(
47+
vec![
48+
PatchTableRequestDataAttributesSchemaFieldsItems::new(
49+
"id".to_string(),
50+
ReferenceTableSchemaFieldType::INT32,
51+
),
52+
PatchTableRequestDataAttributesSchemaFieldsItems::new(
53+
"name".to_string(),
54+
ReferenceTableSchemaFieldType::STRING,
55+
)
56+
],
57+
vec!["id".to_string()],
58+
),
59+
)
60+
.sync_enabled(false)
61+
.tags(vec!["test_tag".to_string()]),
62+
),
6363
);
6464
let configuration = datadog::Configuration::new();
6565
let api = ReferenceTablesAPI::with_config(configuration);

src/datadogV2/api/api_reference_tables.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct ListTablesOptionalParams {
1818
pub page_limit: Option<i64>,
1919
/// Number of tables to skip for pagination.
2020
pub page_offset: Option<i64>,
21-
/// Sort field and direction. Use field name for ascending, prefix with "-" for descending.
21+
/// Sort field and direction for the list of reference tables. Use field name for ascending, prefix with "-" for descending.
2222
pub sort: Option<crate::datadogV2::model::ReferenceTableSortType>,
2323
/// Filter by table status.
2424
pub filter_status: Option<String>,
@@ -39,7 +39,7 @@ impl ListTablesOptionalParams {
3939
self.page_offset = Some(value);
4040
self
4141
}
42-
/// Sort field and direction. Use field name for ascending, prefix with "-" for descending.
42+
/// Sort field and direction for the list of reference tables. Use field name for ascending, prefix with "-" for descending.
4343
pub fn sort(mut self, value: crate::datadogV2::model::ReferenceTableSortType) -> Self {
4444
self.sort = Some(value);
4545
self
@@ -182,7 +182,11 @@ impl ReferenceTablesAPI {
182182
Self { config, client }
183183
}
184184

185-
/// Create a new reference table. You can provide data in two ways: 1) Call POST api/v2/reference-tables/upload first to get an upload ID, then PUT chunks of CSV data to each provided URL, and finally call this POST endpoint with the upload_id in file_metadata, OR 2) Provide access_details in file_metadata pointing to a CSV file in cloud storage (Amazon S3, Azure Blob Storage, or GCP Cloud Storage).
185+
/// Creates a reference table. You can provide data in two ways:
186+
/// 1. Call POST /api/v2/reference-tables/upload to get an upload ID. Then, PUT the CSV data
187+
/// (not the file itself) in chunks to each URL in the request body. Finally, call this
188+
/// POST endpoint with `upload_id` in `file_metadata`.
189+
/// 2. Provide `access_details` in `file_metadata` pointing to a CSV file in cloud storage.
186190
pub async fn create_reference_table(
187191
&self,
188192
body: crate::datadogV2::model::CreateTableRequest,
@@ -202,7 +206,11 @@ impl ReferenceTablesAPI {
202206
}
203207
}
204208

205-
/// Create a new reference table. You can provide data in two ways: 1) Call POST api/v2/reference-tables/upload first to get an upload ID, then PUT chunks of CSV data to each provided URL, and finally call this POST endpoint with the upload_id in file_metadata, OR 2) Provide access_details in file_metadata pointing to a CSV file in cloud storage (Amazon S3, Azure Blob Storage, or GCP Cloud Storage).
209+
/// Creates a reference table. You can provide data in two ways:
210+
/// 1. Call POST /api/v2/reference-tables/upload to get an upload ID. Then, PUT the CSV data
211+
/// (not the file itself) in chunks to each URL in the request body. Finally, call this
212+
/// POST endpoint with `upload_id` in `file_metadata`.
213+
/// 2. Provide `access_details` in `file_metadata` pointing to a CSV file in cloud storage.
206214
pub async fn create_reference_table_with_http_info(
207215
&self,
208216
body: crate::datadogV2::model::CreateTableRequest,

src/datadogV2/model/model_create_table_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// The definition of `CreateTableRequest` object.
9+
/// Request body for creating a new reference table from a local file or cloud storage.
1010
#[non_exhaustive]
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequest {
14-
/// The definition of `CreateTableRequestData` object.
14+
/// The data object containing the table definition.
1515
#[serde(rename = "data")]
1616
pub data: Option<crate::datadogV2::model::CreateTableRequestData>,
1717
#[serde(flatten)]

src/datadogV2/model/model_create_table_request_data.rs

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// The definition of `CreateTableRequestData` object.
9+
/// The data object containing the table definition.
1010
#[non_exhaustive]
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequestData {
14-
/// The definition of `CreateTableRequestDataAttributes` object.
14+
/// Attributes that define the reference table's configuration and properties.
1515
#[serde(rename = "attributes")]
1616
pub attributes: Option<crate::datadogV2::model::CreateTableRequestDataAttributes>,
17-
/// The ID of the reference table.
18-
#[serde(rename = "id")]
19-
pub id: Option<String>,
2017
/// Reference table resource type.
2118
#[serde(rename = "type")]
2219
pub type_: crate::datadogV2::model::CreateTableRequestDataType,
23-
#[serde(flatten)]
24-
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
2520
#[serde(skip)]
2621
#[serde(default)]
2722
pub(crate) _unparsed: bool,
@@ -33,9 +28,7 @@ impl CreateTableRequestData {
3328
) -> CreateTableRequestData {
3429
CreateTableRequestData {
3530
attributes: None,
36-
id: None,
3731
type_,
38-
additional_properties: std::collections::BTreeMap::new(),
3932
_unparsed: false,
4033
}
4134
}
@@ -47,19 +40,6 @@ impl CreateTableRequestData {
4740
self.attributes = Some(value);
4841
self
4942
}
50-
51-
pub fn id(mut self, value: String) -> Self {
52-
self.id = Some(value);
53-
self
54-
}
55-
56-
pub fn additional_properties(
57-
mut self,
58-
value: std::collections::BTreeMap<String, serde_json::Value>,
59-
) -> Self {
60-
self.additional_properties = value;
61-
self
62-
}
6343
}
6444

6545
impl<'de> Deserialize<'de> for CreateTableRequestData {
@@ -82,12 +62,7 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
8262
let mut attributes: Option<
8363
crate::datadogV2::model::CreateTableRequestDataAttributes,
8464
> = None;
85-
let mut id: Option<String> = None;
8665
let mut type_: Option<crate::datadogV2::model::CreateTableRequestDataType> = None;
87-
let mut additional_properties: std::collections::BTreeMap<
88-
String,
89-
serde_json::Value,
90-
> = std::collections::BTreeMap::new();
9166
let mut _unparsed = false;
9267

9368
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
@@ -98,12 +73,6 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
9873
}
9974
attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
10075
}
101-
"id" => {
102-
if v.is_null() {
103-
continue;
104-
}
105-
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
106-
}
10776
"type" => {
10877
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
10978
if let Some(ref _type_) = type_ {
@@ -116,19 +85,17 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
11685
}
11786
}
11887
&_ => {
119-
if let Ok(value) = serde_json::from_value(v.clone()) {
120-
additional_properties.insert(k, value);
121-
}
88+
return Err(serde::de::Error::custom(
89+
"Additional properties not allowed",
90+
));
12291
}
12392
}
12493
}
12594
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
12695

12796
let content = CreateTableRequestData {
12897
attributes,
129-
id,
13098
type_,
131-
additional_properties,
13299
_unparsed,
133100
};
134101

src/datadogV2/model/model_create_table_request_data_attributes.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// The definition of `CreateTableRequestDataAttributes` object.
9+
/// Attributes that define the reference table's configuration and properties.
1010
#[non_exhaustive]
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequestDataAttributes {
14-
/// The description of the reference table.
14+
/// Optional text describing the purpose or contents of this reference table.
1515
#[serde(rename = "description")]
1616
pub description: Option<String>,
17-
/// The definition of `CreateTableRequestDataAttributesFileMetadata` object.
17+
/// Metadata specifying where and how to access the reference table's data file.
1818
#[serde(rename = "file_metadata")]
1919
pub file_metadata:
2020
Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadata>,
21-
/// The definition of `CreateTableRequestDataAttributesSchema` object.
21+
/// Schema defining the structure and columns of the reference table.
2222
#[serde(rename = "schema")]
2323
pub schema: crate::datadogV2::model::CreateTableRequestDataAttributesSchema,
2424
/// The source type for creating reference table data. Only these source types can be created through this API.
2525
#[serde(rename = "source")]
2626
pub source: crate::datadogV2::model::ReferenceTableCreateSourceType,
27-
/// The name of the reference table.
27+
/// Name to identify this reference table.
2828
#[serde(rename = "table_name")]
2929
pub table_name: String,
30-
/// The tags of the reference table.
30+
/// Tags for organizing and filtering reference tables.
3131
#[serde(rename = "tags")]
3232
pub tags: Option<Vec<String>>,
3333
#[serde(flatten)]

src/datadogV2/model/model_create_table_request_data_attributes_file_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright 2019-Present Datadog, Inc.
44
use serde::{Deserialize, Deserializer, Serialize};
55

6-
/// The definition of `CreateTableRequestDataAttributesFileMetadata` object.
6+
/// Metadata specifying where and how to access the reference table's data file.
77
#[non_exhaustive]
88
#[derive(Clone, Debug, PartialEq, Serialize)]
99
#[serde(untagged)]

src/datadogV2/model/model_create_table_request_data_attributes_file_metadata_cloud_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequestDataAttributesFileMetadataCloudStorage {
14-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails` object.
14+
/// Cloud storage access configuration for the reference table data file.
1515
#[serde(rename = "access_details")]
1616
pub access_details:
1717
crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails,

src/datadogV2/model/model_create_table_request_data_attributes_file_metadata_one_of_access_details.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails` object.
9+
/// Cloud storage access configuration for the reference table data file.
1010
#[non_exhaustive]
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails {
14-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail` object.
14+
/// Amazon Web Services S3 storage access configuration.
1515
#[serde(rename = "aws_detail")]
1616
pub aws_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail>,
17-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail` object.
17+
/// Azure Blob Storage access configuration.
1818
#[serde(rename = "azure_detail")]
1919
pub azure_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail>,
20-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail` object.
20+
/// Google Cloud Platform storage access configuration.
2121
#[serde(rename = "gcp_detail")]
2222
pub gcp_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail>,
2323
#[serde(flatten)]

src/datadogV2/model/model_create_table_request_data_attributes_file_metadata_one_of_access_details_aws_detail.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail` object.
9+
/// Amazon Web Services S3 storage access configuration.
1010
#[non_exhaustive]
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail {
14-
/// The ID of the AWS account.
14+
/// AWS account ID where the S3 bucket is located.
1515
#[serde(rename = "aws_account_id")]
1616
pub aws_account_id: String,
17-
/// The name of the Amazon S3 bucket.
17+
/// S3 bucket containing the CSV file.
1818
#[serde(rename = "aws_bucket_name")]
1919
pub aws_bucket_name: String,
2020
/// The relative file path from the S3 bucket root to the CSV file.

0 commit comments

Comments
 (0)