Skip to content
Open
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
54 changes: 27 additions & 27 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16201,6 +16201,30 @@ components:
required:
- data
type: object
CaseInvestigationNotebookCreateData:
description: Case investigation notebook creation data.
properties:
type:
$ref: "#/components/schemas/CaseInvestigationNotebookResourceType"
required:
- type
type: object
CaseInvestigationNotebookCreateRequest:
description: Case investigation notebook creation request.
properties:
data:
$ref: "#/components/schemas/CaseInvestigationNotebookCreateData"
required:
- data
type: object
CaseInvestigationNotebookResourceType:
description: Case investigation notebook resource type.
enum:
- notebook
example: notebook
type: string
x-enum-varnames:
- NOTEBOOK
CaseLink:
description: "A directional link representing a relationship between two entities. At least one entity must be a case."
properties:
Expand Down Expand Up @@ -65373,30 +65397,6 @@ components:
type: string
x-enum-varnames:
- GET_NODE_TYPES_RESPONSE
NotebookCreateData:
description: Notebook creation data
properties:
type:
$ref: "#/components/schemas/NotebookResourceType"
required:
- type
type: object
NotebookCreateRequest:
description: Notebook creation request
properties:
data:
$ref: "#/components/schemas/NotebookCreateData"
required:
- data
type: object
NotebookResourceType:
description: Notebook resource type
enum:
- notebook
example: notebook
type: string
x-enum-varnames:
- NOTEBOOK
NotebookTriggerWrapper:
description: "Schema for a Notebook-based trigger."
properties:
Expand Down Expand Up @@ -124493,7 +124493,7 @@ paths:
- Case Management
/api/v2/cases/{case_id}/relationships/notebook:
post:
description: Create a new investigation notebook and link it to a case
description: Create a new investigation notebook and link it to a case.
operationId: CreateCaseNotebook
parameters:
- $ref: "#/components/parameters/CaseIDPathParameter"
Expand All @@ -124506,8 +124506,8 @@ paths:
data:
type: notebook
schema:
$ref: "#/components/schemas/NotebookCreateRequest"
description: Notebook creation request
$ref: "#/components/schemas/CaseInvestigationNotebookCreateRequest"
description: Case investigation notebook creation request.
required: true
responses:
"204":
Expand Down
10 changes: 6 additions & 4 deletions examples/v2_case-management_CreateCaseNotebook.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Create investigation notebook for case returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
use datadog_api_client::datadogV2::model::NotebookCreateData;
use datadog_api_client::datadogV2::model::NotebookCreateRequest;
use datadog_api_client::datadogV2::model::NotebookResourceType;
use datadog_api_client::datadogV2::model::CaseInvestigationNotebookCreateData;
use datadog_api_client::datadogV2::model::CaseInvestigationNotebookCreateRequest;
use datadog_api_client::datadogV2::model::CaseInvestigationNotebookResourceType;

#[tokio::main]
async fn main() {
let body = NotebookCreateRequest::new(NotebookCreateData::new(NotebookResourceType::NOTEBOOK));
let body = CaseInvestigationNotebookCreateRequest::new(
CaseInvestigationNotebookCreateData::new(CaseInvestigationNotebookResourceType::NOTEBOOK),
);
let configuration = datadog::Configuration::new();
let api = CaseManagementAPI::with_config(configuration);
let resp = api.create_case_notebook("case_id".to_string(), body).await;
Expand Down
8 changes: 4 additions & 4 deletions src/datadogV2/api/api_case_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2363,11 +2363,11 @@ impl CaseManagementAPI {
}
}

/// Create a new investigation notebook and link it to a case
/// Create a new investigation notebook and link it to a case.
pub async fn create_case_notebook(
&self,
case_id: String,
body: crate::datadogV2::model::NotebookCreateRequest,
body: crate::datadogV2::model::CaseInvestigationNotebookCreateRequest,
) -> Result<(), datadog::Error<CreateCaseNotebookError>> {
match self
.create_case_notebook_with_http_info(case_id, body)
Expand All @@ -2378,11 +2378,11 @@ impl CaseManagementAPI {
}
}

/// Create a new investigation notebook and link it to a case
/// Create a new investigation notebook and link it to a case.
pub async fn create_case_notebook_with_http_info(
&self,
case_id: String,
body: crate::datadogV2::model::NotebookCreateRequest,
body: crate::datadogV2::model::CaseInvestigationNotebookCreateRequest,
) -> Result<datadog::ResponseContent<()>, datadog::Error<CreateCaseNotebookError>> {
let local_configuration = &self.config;
let operation_id = "v2.create_case_notebook";
Expand Down
12 changes: 6 additions & 6 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1876,12 +1876,12 @@ pub mod model_jira_issue_create_data;
pub use self::model_jira_issue_create_data::JiraIssueCreateData;
pub mod model_jira_issue_create_attributes;
pub use self::model_jira_issue_create_attributes::JiraIssueCreateAttributes;
pub mod model_notebook_create_request;
pub use self::model_notebook_create_request::NotebookCreateRequest;
pub mod model_notebook_create_data;
pub use self::model_notebook_create_data::NotebookCreateData;
pub mod model_notebook_resource_type;
pub use self::model_notebook_resource_type::NotebookResourceType;
pub mod model_case_investigation_notebook_create_request;
pub use self::model_case_investigation_notebook_create_request::CaseInvestigationNotebookCreateRequest;
pub mod model_case_investigation_notebook_create_data;
pub use self::model_case_investigation_notebook_create_data::CaseInvestigationNotebookCreateData;
pub mod model_case_investigation_notebook_resource_type;
pub use self::model_case_investigation_notebook_resource_type::CaseInvestigationNotebookResourceType;
pub mod model_service_now_ticket_create_request;
pub use self::model_service_now_ticket_create_request::ServiceNowTicketCreateRequest;
pub mod model_service_now_ticket_create_data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// Notebook creation data
/// Case investigation notebook creation data.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct NotebookCreateData {
/// Notebook resource type
pub struct CaseInvestigationNotebookCreateData {
/// Case investigation notebook resource type.
#[serde(rename = "type")]
pub type_: crate::datadogV2::model::NotebookResourceType,
pub type_: crate::datadogV2::model::CaseInvestigationNotebookResourceType,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl NotebookCreateData {
pub fn new(type_: crate::datadogV2::model::NotebookResourceType) -> NotebookCreateData {
NotebookCreateData {
impl CaseInvestigationNotebookCreateData {
pub fn new(
type_: crate::datadogV2::model::CaseInvestigationNotebookResourceType,
) -> CaseInvestigationNotebookCreateData {
CaseInvestigationNotebookCreateData {
type_,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand All @@ -39,14 +41,14 @@ impl NotebookCreateData {
}
}

impl<'de> Deserialize<'de> for NotebookCreateData {
impl<'de> Deserialize<'de> for CaseInvestigationNotebookCreateData {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct NotebookCreateDataVisitor;
impl<'a> Visitor<'a> for NotebookCreateDataVisitor {
type Value = NotebookCreateData;
struct CaseInvestigationNotebookCreateDataVisitor;
impl<'a> Visitor<'a> for CaseInvestigationNotebookCreateDataVisitor {
type Value = CaseInvestigationNotebookCreateData;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
Expand All @@ -56,7 +58,9 @@ impl<'de> Deserialize<'de> for NotebookCreateData {
where
M: MapAccess<'a>,
{
let mut type_: Option<crate::datadogV2::model::NotebookResourceType> = None;
let mut type_: Option<
crate::datadogV2::model::CaseInvestigationNotebookResourceType,
> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand All @@ -69,7 +73,7 @@ impl<'de> Deserialize<'de> for NotebookCreateData {
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _type_) = type_ {
match _type_ {
crate::datadogV2::model::NotebookResourceType::UnparsedObject(_type_) => {
crate::datadogV2::model::CaseInvestigationNotebookResourceType::UnparsedObject(_type_) => {
_unparsed = true;
},
_ => {}
Expand All @@ -85,7 +89,7 @@ impl<'de> Deserialize<'de> for NotebookCreateData {
}
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;

let content = NotebookCreateData {
let content = CaseInvestigationNotebookCreateData {
type_,
additional_properties,
_unparsed,
Expand All @@ -95,6 +99,6 @@ impl<'de> Deserialize<'de> for NotebookCreateData {
}
}

deserializer.deserialize_any(NotebookCreateDataVisitor)
deserializer.deserialize_any(CaseInvestigationNotebookCreateDataVisitor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// Notebook creation request
/// Case investigation notebook creation request.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct NotebookCreateRequest {
/// Notebook creation data
pub struct CaseInvestigationNotebookCreateRequest {
/// Case investigation notebook creation data.
#[serde(rename = "data")]
pub data: crate::datadogV2::model::NotebookCreateData,
pub data: crate::datadogV2::model::CaseInvestigationNotebookCreateData,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl NotebookCreateRequest {
pub fn new(data: crate::datadogV2::model::NotebookCreateData) -> NotebookCreateRequest {
NotebookCreateRequest {
impl CaseInvestigationNotebookCreateRequest {
pub fn new(
data: crate::datadogV2::model::CaseInvestigationNotebookCreateData,
) -> CaseInvestigationNotebookCreateRequest {
CaseInvestigationNotebookCreateRequest {
data,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand All @@ -39,14 +41,14 @@ impl NotebookCreateRequest {
}
}

impl<'de> Deserialize<'de> for NotebookCreateRequest {
impl<'de> Deserialize<'de> for CaseInvestigationNotebookCreateRequest {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct NotebookCreateRequestVisitor;
impl<'a> Visitor<'a> for NotebookCreateRequestVisitor {
type Value = NotebookCreateRequest;
struct CaseInvestigationNotebookCreateRequestVisitor;
impl<'a> Visitor<'a> for CaseInvestigationNotebookCreateRequestVisitor {
type Value = CaseInvestigationNotebookCreateRequest;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
Expand All @@ -56,7 +58,8 @@ impl<'de> Deserialize<'de> for NotebookCreateRequest {
where
M: MapAccess<'a>,
{
let mut data: Option<crate::datadogV2::model::NotebookCreateData> = None;
let mut data: Option<crate::datadogV2::model::CaseInvestigationNotebookCreateData> =
None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand All @@ -77,7 +80,7 @@ impl<'de> Deserialize<'de> for NotebookCreateRequest {
}
let data = data.ok_or_else(|| M::Error::missing_field("data"))?;

let content = NotebookCreateRequest {
let content = CaseInvestigationNotebookCreateRequest {
data,
additional_properties,
_unparsed,
Expand All @@ -87,6 +90,6 @@ impl<'de> Deserialize<'de> for NotebookCreateRequest {
}
}

deserializer.deserialize_any(NotebookCreateRequestVisitor)
deserializer.deserialize_any(CaseInvestigationNotebookCreateRequestVisitor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[non_exhaustive]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum NotebookResourceType {
pub enum CaseInvestigationNotebookResourceType {
NOTEBOOK,
UnparsedObject(crate::datadog::UnparsedObject),
}

impl ToString for NotebookResourceType {
impl ToString for CaseInvestigationNotebookResourceType {
fn to_string(&self) -> String {
match self {
Self::NOTEBOOK => String::from("notebook"),
Expand All @@ -20,7 +20,7 @@ impl ToString for NotebookResourceType {
}
}

impl Serialize for NotebookResourceType {
impl Serialize for CaseInvestigationNotebookResourceType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -32,7 +32,7 @@ impl Serialize for NotebookResourceType {
}
}

impl<'de> Deserialize<'de> for NotebookResourceType {
impl<'de> Deserialize<'de> for CaseInvestigationNotebookResourceType {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
Expand Down
Loading