Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 181 additions & 152 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions examples/v2_reference-tables_UpdateReferenceTable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,48 @@ async fn main() {
let body =
PatchTableRequest
::new().data(
PatchTableRequestData::new(PatchTableRequestDataType::REFERENCE_TABLE)
.attributes(
PatchTableRequestDataAttributes::new()
.description("this is a cloud table generated via a cloud bucket sync".to_string())
.file_metadata(
PatchTableRequestDataAttributesFileMetadata
::PatchTableRequestDataAttributesFileMetadataCloudStorage(
Box::new(
PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
.access_details(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
::new().aws_detail(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
::new()
.aws_account_id("test-account-id".to_string())
.aws_bucket_name("test-bucket".to_string())
.file_path("test_rt.csv".to_string()),
),
)
.sync_enabled(true),
),
),
)
.schema(
PatchTableRequestDataAttributesSchema::new(
vec![
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"id".to_string(),
ReferenceTableSchemaFieldType::INT32,
),
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"name".to_string(),
ReferenceTableSchemaFieldType::STRING,
PatchTableRequestData::new(
PatchTableRequestDataType::REFERENCE_TABLE,
).attributes(
PatchTableRequestDataAttributes::new()
.description("this is a cloud table generated via a cloud bucket sync".to_string())
.file_metadata(
PatchTableRequestDataAttributesFileMetadata
::PatchTableRequestDataAttributesFileMetadataCloudStorage(
Box::new(
PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
.access_details(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
::new().aws_detail(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
::new()
.aws_account_id("test-account-id".to_string())
.aws_bucket_name("test-bucket".to_string())
.file_path("test_rt.csv".to_string()),
),
)
],
vec!["id".to_string()],
.sync_enabled(true),
),
)
.sync_enabled(false)
.tags(vec!["test_tag".to_string()]),
)
.id("00000000-0000-0000-0000-000000000000".to_string()),
),
)
.schema(
PatchTableRequestDataAttributesSchema::new(
vec![
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"id".to_string(),
ReferenceTableSchemaFieldType::INT32,
),
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"name".to_string(),
ReferenceTableSchemaFieldType::STRING,
)
],
vec!["id".to_string()],
),
)
.sync_enabled(false)
.tags(vec!["test_tag".to_string()]),
),
);
let configuration = datadog::Configuration::new();
let api = ReferenceTablesAPI::with_config(configuration);
Expand Down
16 changes: 12 additions & 4 deletions src/datadogV2/api/api_reference_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct ListTablesOptionalParams {
pub page_limit: Option<i64>,
/// Number of tables to skip for pagination.
pub page_offset: Option<i64>,
/// Sort field and direction. Use field name for ascending, prefix with "-" for descending.
/// Sort field and direction for the list of reference tables. Use field name for ascending, prefix with "-" for descending.
pub sort: Option<crate::datadogV2::model::ReferenceTableSortType>,
/// Filter by table status.
pub filter_status: Option<String>,
Expand All @@ -39,7 +39,7 @@ impl ListTablesOptionalParams {
self.page_offset = Some(value);
self
}
/// Sort field and direction. Use field name for ascending, prefix with "-" for descending.
/// Sort field and direction for the list of reference tables. Use field name for ascending, prefix with "-" for descending.
pub fn sort(mut self, value: crate::datadogV2::model::ReferenceTableSortType) -> Self {
self.sort = Some(value);
self
Expand Down Expand Up @@ -182,7 +182,11 @@ impl ReferenceTablesAPI {
Self { config, client }
}

/// 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).
/// Creates a reference table. You can provide data in two ways:
/// 1. Call POST /api/v2/reference-tables/upload to get an upload ID. Then, PUT the CSV data
/// (not the file itself) in chunks to each URL in the request body. Finally, call this
/// POST endpoint with `upload_id` in `file_metadata`.
/// 2. Provide `access_details` in `file_metadata` pointing to a CSV file in cloud storage.
pub async fn create_reference_table(
&self,
body: crate::datadogV2::model::CreateTableRequest,
Expand All @@ -202,7 +206,11 @@ impl ReferenceTablesAPI {
}
}

/// 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).
/// Creates a reference table. You can provide data in two ways:
/// 1. Call POST /api/v2/reference-tables/upload to get an upload ID. Then, PUT the CSV data
/// (not the file itself) in chunks to each URL in the request body. Finally, call this
/// POST endpoint with `upload_id` in `file_metadata`.
/// 2. Provide `access_details` in `file_metadata` pointing to a CSV file in cloud storage.
pub async fn create_reference_table_with_http_info(
&self,
body: crate::datadogV2::model::CreateTableRequest,
Expand Down
4 changes: 2 additions & 2 deletions src/datadogV2/model/model_create_table_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequest` object.
/// Request body for creating a new reference table from a local file or cloud storage.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequest {
/// The definition of `CreateTableRequestData` object.
/// The data object containing the table definition.
#[serde(rename = "data")]
pub data: Option<crate::datadogV2::model::CreateTableRequestData>,
#[serde(flatten)]
Expand Down
43 changes: 5 additions & 38 deletions src/datadogV2/model/model_create_table_request_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,17 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequestData` object.
/// The data object containing the table definition.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestData {
/// The definition of `CreateTableRequestDataAttributes` object.
/// Attributes that define the reference table's configuration and properties.
#[serde(rename = "attributes")]
pub attributes: Option<crate::datadogV2::model::CreateTableRequestDataAttributes>,
/// The ID of the reference table.
#[serde(rename = "id")]
pub id: Option<String>,
/// Reference table resource type.
#[serde(rename = "type")]
pub type_: crate::datadogV2::model::CreateTableRequestDataType,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
Expand All @@ -33,9 +28,7 @@ impl CreateTableRequestData {
) -> CreateTableRequestData {
CreateTableRequestData {
attributes: None,
id: None,
type_,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}
Expand All @@ -47,19 +40,6 @@ impl CreateTableRequestData {
self.attributes = Some(value);
self
}

pub fn id(mut self, value: String) -> Self {
self.id = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}

impl<'de> Deserialize<'de> for CreateTableRequestData {
Expand All @@ -82,12 +62,7 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
let mut attributes: Option<
crate::datadogV2::model::CreateTableRequestDataAttributes,
> = None;
let mut id: Option<String> = None;
let mut type_: Option<crate::datadogV2::model::CreateTableRequestDataType> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
> = std::collections::BTreeMap::new();
let mut _unparsed = false;

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
Expand All @@ -98,12 +73,6 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
}
attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"id" => {
if v.is_null() {
continue;
}
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"type" => {
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _type_) = type_ {
Expand All @@ -116,19 +85,17 @@ impl<'de> Deserialize<'de> for CreateTableRequestData {
}
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
}
return Err(serde::de::Error::custom(
"Additional properties not allowed",
));
}
}
}
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;

let content = CreateTableRequestData {
attributes,
id,
type_,
additional_properties,
_unparsed,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequestDataAttributes` object.
/// Attributes that define the reference table's configuration and properties.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestDataAttributes {
/// The description of the reference table.
/// Optional text describing the purpose or contents of this reference table.
#[serde(rename = "description")]
pub description: Option<String>,
/// The definition of `CreateTableRequestDataAttributesFileMetadata` object.
/// Metadata specifying where and how to access the reference table's data file.
#[serde(rename = "file_metadata")]
pub file_metadata:
Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadata>,
/// The definition of `CreateTableRequestDataAttributesSchema` object.
/// Schema defining the structure and columns of the reference table.
#[serde(rename = "schema")]
pub schema: crate::datadogV2::model::CreateTableRequestDataAttributesSchema,
/// The source type for creating reference table data. Only these source types can be created through this API.
#[serde(rename = "source")]
pub source: crate::datadogV2::model::ReferenceTableCreateSourceType,
/// The name of the reference table.
/// Name to identify this reference table.
#[serde(rename = "table_name")]
pub table_name: String,
/// The tags of the reference table.
/// Tags for organizing and filtering reference tables.
#[serde(rename = "tags")]
pub tags: Option<Vec<String>>,
#[serde(flatten)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Copyright 2019-Present Datadog, Inc.
use serde::{Deserialize, Deserializer, Serialize};

/// The definition of `CreateTableRequestDataAttributesFileMetadata` object.
/// Metadata specifying where and how to access the reference table's data file.
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Serialize)]
#[serde(untagged)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestDataAttributesFileMetadataCloudStorage {
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails` object.
/// Cloud storage access configuration for the reference table data file.
#[serde(rename = "access_details")]
pub access_details:
crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails` object.
/// Cloud storage access configuration for the reference table data file.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails {
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail` object.
/// Amazon Web Services S3 storage access configuration.
#[serde(rename = "aws_detail")]
pub aws_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail>,
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail` object.
/// Azure Blob Storage access configuration.
#[serde(rename = "azure_detail")]
pub azure_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail>,
/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail` object.
/// Google Cloud Platform storage access configuration.
#[serde(rename = "gcp_detail")]
pub gcp_detail: Option<crate::datadogV2::model::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsGcpDetail>,
#[serde(flatten)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail` object.
/// Amazon Web Services S3 storage access configuration.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail {
/// The ID of the AWS account.
/// AWS account ID where the S3 bucket is located.
#[serde(rename = "aws_account_id")]
pub aws_account_id: String,
/// The name of the Amazon S3 bucket.
/// S3 bucket containing the CSV file.
#[serde(rename = "aws_bucket_name")]
pub aws_bucket_name: String,
/// The relative file path from the S3 bucket root to the CSV file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The definition of `CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail` object.
/// Azure Blob Storage access configuration.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAzureDetail {
/// The Azure client ID.
/// Azure service principal (application) client ID with permissions to read from the container.
#[serde(rename = "azure_client_id")]
pub azure_client_id: String,
/// The name of the Azure container.
/// Azure Blob Storage container containing the CSV file.
#[serde(rename = "azure_container_name")]
pub azure_container_name: String,
/// The name of the Azure storage account.
/// Azure storage account where the container is located.
#[serde(rename = "azure_storage_account_name")]
pub azure_storage_account_name: String,
/// The ID of the Azure tenant.
/// Azure Active Directory tenant ID.
#[serde(rename = "azure_tenant_id")]
pub azure_tenant_id: String,
/// The relative file path from the Azure container root to the CSV file.
Expand Down
Loading