diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 07cf64fab..c8ae4742c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -310,6 +310,13 @@ components: required: true schema: type: string + ConnectionGroupId: + description: The ID of the connection group. + in: path + name: connection_group_id + required: true + schema: + type: string ConnectionId: description: The ID of the action connection in: path @@ -2555,6 +2562,22 @@ components: example: true type: boolean type: object + AWSSecretManager: + description: AWS Secrets Manager configuration. + properties: + connection_id: + description: The ID of the connection used to access AWS Secrets Manager. + example: afda2727-c55e-4258-b4c6-e170c32be1dd + format: uuid + type: string + region: + description: The AWS region where the secret is stored. + example: us-east-1 + type: string + required: + - connection_id + - region + type: object AWSTracesConfig: description: AWS Traces Collection config. properties: @@ -12573,6 +12596,82 @@ components: - connectionId - label type: object + ConnectionDataAttributesResponse: + description: Attributes of an action connection. + properties: + acting_user_can_resolve: + description: Indicates if the acting user can resolve the connection. + example: true + type: boolean + created_at: + description: The creation timestamp of the connection. + example: '1970-01-01T00:02:03.000000456Z' + format: date-time + type: string + created_by: + $ref: '#/components/schemas/CreatedBy' + description: + description: The description of the connection. + example: A test connection for AWS integrations + type: string + external_secrets_manager: + $ref: '#/components/schemas/ExternalSecretsManager' + nullable: true + integration: + description: Integration configuration details. + example: + credentials: + account_id: '123456789012' + role: role + type: AWSAssumeRole + type: AWS + type: object + is_favorite: + description: Indicates if the connection is marked as favorite. + example: false + type: boolean + last_updated: + description: The last updated timestamp of the connection. + example: '1970-01-01T00:02:03.000000456Z' + format: date-time + type: string + name: + description: The name of the connection. + example: My Connection + type: string + private_actions_runner: + $ref: '#/components/schemas/PrivateActionsRunner' + runner_id: + description: The ID of the runner associated with the connection. + type: string + tags: + description: Tags associated with the connection. + items: + type: string + type: array + required: + - acting_user_can_resolve + - integration + - external_secrets_manager + - is_favorite + - name + type: object + ConnectionDataResponse: + description: Data object for an action connection. + properties: + attributes: + $ref: '#/components/schemas/ConnectionDataAttributesResponse' + id: + description: The unique identifier of the connection. + example: afda2727-c55e-4258-b4c6-e170c32be1dd + type: string + type: + $ref: '#/components/schemas/ActionConnectionDataType' + required: + - id + - type + - attributes + type: object ConnectionEnv: description: A list of connections or connection groups used in the workflow. properties: @@ -12622,6 +12721,129 @@ components: - label - tags type: object + ConnectionGroupDataAttributesRequest: + description: Attributes for updating a connection group. + properties: + connections: + description: List of connection IDs associated with the connection group. + items: + type: string + type: array + description: + description: The description of the connection group. + example: An updated test connection group for AWS integrations + type: string + integration_type: + description: The integration type of the connection group. + type: string + name: + description: The name of the connection group. + example: My Connection Group Updated + type: string + policy_attributes: + description: Policy attributes for the connection group. + type: string + tag_keys: + description: Tag keys associated with the connection group. + items: + type: string + type: array + type: object + ConnectionGroupDataAttributesResponse: + description: Attributes of a connection group. + properties: + connections: + description: List of connection IDs associated with the connection group. + example: + - connection1 + - connection2 + items: + type: string + type: array + created_at: + description: The creation timestamp of the connection group. + example: '1970-01-01T00:02:03.000000456Z' + format: date-time + type: string + description: + description: The description of the connection group. + example: A test connection group for AWS integrations + type: string + integration_type: + description: The integration type of the connection group. + example: AWS + type: string + is_favorite: + description: Indicates if the connection group is marked as favorite. + example: false + type: boolean + last_updated_at: + description: The last updated timestamp of the connection group. + example: '1970-01-01T00:02:03.000000456Z' + format: date-time + type: string + name: + description: The name of the connection group. + example: My Connection Group + type: string + tag_keys: + description: Tag keys associated with the connection group. + example: + - env + - service + items: + type: string + type: array + required: + - name + - tag_keys + - integration_type + - created_at + - last_updated_at + - is_favorite + type: object + ConnectionGroupDataRequest: + description: Data object for updating a connection group. + properties: + attributes: + $ref: '#/components/schemas/ConnectionGroupDataAttributesRequest' + type: + $ref: '#/components/schemas/ConnectionGroupType' + required: + - type + type: object + ConnectionGroupDataResponse: + description: Data object for a connection group. + properties: + attributes: + $ref: '#/components/schemas/ConnectionGroupDataAttributesResponse' + id: + description: The unique identifier of the connection group. + example: afda2727-c55e-4258-b4c6-e170c32be1dd + type: string + relationships: + $ref: '#/components/schemas/ConnectionGroupRelationships' + type: + $ref: '#/components/schemas/ConnectionGroupType' + required: + - id + - type + - attributes + type: object + ConnectionGroupRelationships: + description: Relationships for a connection group. + properties: + created_by: + $ref: '#/components/schemas/CreatedByRelationship' + type: object + ConnectionGroupType: + description: The definition of `ConnectionGroupType` object. + enum: + - connection_group + example: connection_group + type: string + x-enum-varnames: + - CONNECTION_GROUP ConnectionsPagePagination: description: Page-based pagination metadata. properties: @@ -15586,6 +15808,37 @@ components: required: - data type: object + CreatedBy: + description: Information about the user who created the resource. + properties: + id: + description: The unique identifier of the user. + example: '' + type: string + required: + - id + type: object + CreatedByRelationship: + description: Relationship to the user who created the resource. + properties: + data: + $ref: '#/components/schemas/CreatedByRelationshipData' + type: object + CreatedByRelationshipData: + description: Data for the created_by relationship. + properties: + id: + description: The unique identifier of the user. + example: 2a10fb69-5ee6-47c8-96f5-d30e18bf883d + type: string + type: + description: The type of the relationship. + example: created_by + type: string + required: + - id + - type + type: object Creator: description: Creator of the object. properties: @@ -23369,6 +23622,17 @@ components: from the other indexes. type: string type: object + ExternalSecretsManager: + description: External secrets manager configuration. + oneOf: + - $ref: '#/components/schemas/ExternalSecretsManagerOneOf' + ExternalSecretsManagerOneOf: + properties: + aws: + $ref: '#/components/schemas/AWSSecretManager' + required: + - aws + type: object FacetInfoRequest: example: data: @@ -31342,6 +31606,21 @@ components: type: string type: array type: object + IntegrationCounts: + description: Count of integrations by type. + properties: + filtered_count: + description: The filtered count of integrations. + format: int64 + type: integer + integration_type: + description: The integration type. + type: string + total_count: + description: The total count of integrations. + format: int64 + type: integer + type: object IntegrationIncident: description: Incident integration settings properties: @@ -33540,6 +33819,42 @@ components: format: int64 type: integer type: object + ListActionConnectionsResponse: + description: Response for listing action connections. + properties: + data: + description: An array of action connections. + items: + $ref: '#/components/schemas/ConnectionDataResponse' + type: array + meta: + $ref: '#/components/schemas/ListActionConnectionsResponseMeta' + required: + - data + type: object + ListActionConnectionsResponseMeta: + description: Metadata for the list connections response. + properties: + integration_counts: + description: Count of integrations by type. + items: + $ref: '#/components/schemas/IntegrationCounts' + nullable: true + type: array + total: + description: The total number of connections. + example: 1 + format: int64 + type: integer + total_filtered: + description: The total number of connections that match the specified filters. + example: 1 + format: int64 + type: integer + required: + - total + - total_filtered + type: object ListAppKeyRegistrationsResponse: description: A paginated list of app key registrations. properties: @@ -33687,6 +34002,43 @@ components: required: - data type: object + ListConnectionGroupsResponse: + description: Response for listing connection groups. + properties: + data: + description: An array of connection groups. + items: + $ref: '#/components/schemas/ConnectionGroupDataResponse' + type: array + meta: + $ref: '#/components/schemas/ListConnectionGroupsResponseMeta' + required: + - data + type: object + ListConnectionGroupsResponseMeta: + description: Metadata for the list connection groups response. + properties: + integration_counts: + description: Count of integrations by type. + items: + $ref: '#/components/schemas/IntegrationCounts' + nullable: true + type: array + total: + description: The total number of connection groups. + example: 1 + format: int64 + type: integer + total_filtered: + description: The total number of connection groups that match the specified + filters. + example: 1 + format: int64 + type: integer + required: + - total + - total_filtered + type: object ListConnectionsResponse: example: data: @@ -46110,6 +46462,16 @@ components: required: - type type: object + PrivateActionsRunner: + description: Information about the private actions runner. + properties: + id: + description: The unique identifier of the runner. + example: '' + type: string + required: + - id + type: object ProcessSummariesMeta: description: Response metadata object. properties: @@ -64963,6 +65325,22 @@ components: description: The display name of the datastore. type: string type: object + UpdateConnectionGroupRequest: + description: Request for updating a connection group. + properties: + data: + $ref: '#/components/schemas/ConnectionGroupDataRequest' + required: + - data + type: object + UpdateConnectionGroupResponse: + description: Response for updating a connection group. + properties: + data: + $ref: '#/components/schemas/ConnectionGroupDataResponse' + required: + - data + type: object UpdateConnectionRequest: example: data: @@ -69556,6 +69934,125 @@ paths: - user_app_keys - service_account_write /api/v2/actions/connections: + get: + description: List all action connections for the organization. This endpoint + supports filtering by integration type, tags, environment, and search strings. + Pagination is supported using page size and page number parameters. + operationId: ListActionConnections + parameters: + - description: The number of connections to return per page. + in: query + name: page[size] + required: false + schema: + default: 50 + example: 1 + format: int64 + type: integer + - description: The page number to return. + in: query + name: page[number] + required: false + schema: + default: 0 + example: 10 + format: int64 + type: integer + - description: Filter by integration type. + explode: true + in: query + name: filter[integration] + required: false + schema: + items: + type: string + type: array + style: form + - description: Filter by tags. + explode: true + in: query + name: filter[tags] + required: false + schema: + items: + type: string + type: array + style: form + - description: Filter by environment. + in: query + name: filter[environment] + required: false + schema: + type: string + - description: Filter by connection IDs. + explode: true + in: query + name: filter[connection_ids] + required: false + schema: + items: + type: string + type: array + style: form + - description: Filter by creator IDs. + explode: true + in: query + name: filter[creator_ids] + required: false + schema: + items: + type: string + type: array + style: form + - description: Search string to filter connections. + in: query + name: filter[search] + required: false + schema: + type: string + - description: Sort parameters. + explode: true + in: query + name: sort + required: false + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListActionConnectionsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: List action connections + tags: + - Action Connection + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: description: Create a new Action Connection. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). @@ -69594,6 +70091,176 @@ paths: summary: Create a new Action Connection tags: - Action Connection + /api/v2/actions/connections/groups: + get: + description: List all connection groups for the organization. This endpoint + supports filtering by integration type, environment, connection group IDs, + and search strings. Pagination is supported using page size and page number + parameters. + operationId: ListConnectionGroups + parameters: + - description: The number of connection groups to return per page. + in: query + name: page[size] + required: false + schema: + default: 50 + example: 1 + format: int64 + type: integer + - description: The page number to return. + in: query + name: page[number] + required: false + schema: + default: 0 + example: 10 + format: int64 + type: integer + - description: Filter by integration type. + explode: true + in: query + name: filter[integration] + required: false + schema: + items: + type: string + type: array + style: form + - description: Filter by environment. + in: query + name: filter[environment] + required: false + schema: + type: string + - description: Filter by connection group IDs. + explode: true + in: query + name: filter[connection_group_ids] + required: false + schema: + items: + type: string + type: array + style: form + - description: Filter by creator ID. + in: query + name: filter[creator_id] + required: false + schema: + type: string + - description: Filter by creator IDs. + explode: true + in: query + name: filter[creator_ids] + required: false + schema: + items: + type: string + type: array + style: form + - description: Search string to filter connection groups. + in: query + name: filter[search] + required: false + schema: + type: string + - description: Sort parameters. + explode: true + in: query + name: sort + required: false + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListConnectionGroupsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: List connection groups + tags: + - Action Connection + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/actions/connections/groups/{connection_group_id}: + patch: + description: Update an existing connection group by ID. This endpoint allows + updating the name, description, tag keys, integration type, connections, and + policy attributes of a connection group. + operationId: UpdateConnectionGroup + parameters: + - $ref: '#/components/parameters/ConnectionGroupId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConnectionGroupRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConnectionGroupResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: Update a connection group + tags: + - Action Connection + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/actions/connections/{connection_id}: delete: description: Delete an existing Action Connection. This API requires a [registered diff --git a/examples/v2_action-connection_ListActionConnections.rs b/examples/v2_action-connection_ListActionConnections.rs new file mode 100644 index 000000000..2dd657f0c --- /dev/null +++ b/examples/v2_action-connection_ListActionConnections.rs @@ -0,0 +1,19 @@ +// List action connections returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_action_connection::ActionConnectionAPI; +use datadog_api_client::datadogV2::api_action_connection::ListActionConnectionsOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListActionConnections", true); + let api = ActionConnectionAPI::with_config(configuration); + let resp = api + .list_action_connections(ListActionConnectionsOptionalParams::default()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_action-connection_ListConnectionGroups.rs b/examples/v2_action-connection_ListConnectionGroups.rs new file mode 100644 index 000000000..11766ab7f --- /dev/null +++ b/examples/v2_action-connection_ListConnectionGroups.rs @@ -0,0 +1,19 @@ +// List connection groups returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_action_connection::ActionConnectionAPI; +use datadog_api_client::datadogV2::api_action_connection::ListConnectionGroupsOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListConnectionGroups", true); + let api = ActionConnectionAPI::with_config(configuration); + let resp = api + .list_connection_groups(ListConnectionGroupsOptionalParams::default()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_action-connection_UpdateConnectionGroup.rs b/examples/v2_action-connection_UpdateConnectionGroup.rs new file mode 100644 index 000000000..3eaed7d5b --- /dev/null +++ b/examples/v2_action-connection_UpdateConnectionGroup.rs @@ -0,0 +1,31 @@ +// Update a connection group returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_action_connection::ActionConnectionAPI; +use datadog_api_client::datadogV2::model::ConnectionGroupDataAttributesRequest; +use datadog_api_client::datadogV2::model::ConnectionGroupDataRequest; +use datadog_api_client::datadogV2::model::ConnectionGroupType; +use datadog_api_client::datadogV2::model::UpdateConnectionGroupRequest; + +#[tokio::main] +async fn main() { + let body = UpdateConnectionGroupRequest::new( + ConnectionGroupDataRequest::new(ConnectionGroupType::CONNECTION_GROUP).attributes( + ConnectionGroupDataAttributesRequest::new() + .connections(vec![]) + .description("An updated test connection group for AWS integrations".to_string()) + .name("My Connection Group Updated".to_string()) + .tag_keys(vec![]), + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateConnectionGroup", true); + let api = ActionConnectionAPI::with_config(configuration); + let resp = api + .update_connection_group("connection_group_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index d00ab9a63..9bbc32440 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -136,6 +136,9 @@ impl Default for Configuration { ("v2.list_fleet_schedules".to_owned(), false), ("v2.trigger_fleet_schedule".to_owned(), false), ("v2.update_fleet_schedule".to_owned(), false), + ("v2.list_action_connections".to_owned(), false), + ("v2.list_connection_groups".to_owned(), false), + ("v2.update_connection_group".to_owned(), false), ("v2.create_open_api".to_owned(), false), ("v2.delete_open_api".to_owned(), false), ("v2.get_open_api".to_owned(), false), diff --git a/src/datadogV2/api/api_action_connection.rs b/src/datadogV2/api/api_action_connection.rs index 1b3c8d5b5..f8f9fa45b 100644 --- a/src/datadogV2/api/api_action_connection.rs +++ b/src/datadogV2/api/api_action_connection.rs @@ -6,10 +6,83 @@ use flate2::{ write::{GzEncoder, ZlibEncoder}, Compression, }; +use log::warn; use reqwest::header::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use std::io::Write; +/// ListActionConnectionsOptionalParams is a struct for passing parameters to the method [`ActionConnectionAPI::list_action_connections`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListActionConnectionsOptionalParams { + /// The number of connections to return per page. + pub page_size: Option, + /// The page number to return. + pub page_number: Option, + /// Filter by integration type. + pub filter_integration: Option>, + /// Filter by tags. + pub filter_tags: Option>, + /// Filter by environment. + pub filter_environment: Option, + /// Filter by connection IDs. + pub filter_connection_ids: Option>, + /// Filter by creator IDs. + pub filter_creator_ids: Option>, + /// Search string to filter connections. + pub filter_search: Option, + /// Sort parameters. + pub sort: Option>, +} + +impl ListActionConnectionsOptionalParams { + /// The number of connections to return per page. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// The page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } + /// Filter by integration type. + pub fn filter_integration(mut self, value: Vec) -> Self { + self.filter_integration = Some(value); + self + } + /// Filter by tags. + pub fn filter_tags(mut self, value: Vec) -> Self { + self.filter_tags = Some(value); + self + } + /// Filter by environment. + pub fn filter_environment(mut self, value: String) -> Self { + self.filter_environment = Some(value); + self + } + /// Filter by connection IDs. + pub fn filter_connection_ids(mut self, value: Vec) -> Self { + self.filter_connection_ids = Some(value); + self + } + /// Filter by creator IDs. + pub fn filter_creator_ids(mut self, value: Vec) -> Self { + self.filter_creator_ids = Some(value); + self + } + /// Search string to filter connections. + pub fn filter_search(mut self, value: String) -> Self { + self.filter_search = Some(value); + self + } + /// Sort parameters. + pub fn sort(mut self, value: Vec) -> Self { + self.sort = Some(value); + self + } +} + /// ListAppKeyRegistrationsOptionalParams is a struct for passing parameters to the method [`ActionConnectionAPI::list_app_key_registrations`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -33,6 +106,78 @@ impl ListAppKeyRegistrationsOptionalParams { } } +/// ListConnectionGroupsOptionalParams is a struct for passing parameters to the method [`ActionConnectionAPI::list_connection_groups`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListConnectionGroupsOptionalParams { + /// The number of connection groups to return per page. + pub page_size: Option, + /// The page number to return. + pub page_number: Option, + /// Filter by integration type. + pub filter_integration: Option>, + /// Filter by environment. + pub filter_environment: Option, + /// Filter by connection group IDs. + pub filter_connection_group_ids: Option>, + /// Filter by creator ID. + pub filter_creator_id: Option, + /// Filter by creator IDs. + pub filter_creator_ids: Option>, + /// Search string to filter connection groups. + pub filter_search: Option, + /// Sort parameters. + pub sort: Option>, +} + +impl ListConnectionGroupsOptionalParams { + /// The number of connection groups to return per page. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// The page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } + /// Filter by integration type. + pub fn filter_integration(mut self, value: Vec) -> Self { + self.filter_integration = Some(value); + self + } + /// Filter by environment. + pub fn filter_environment(mut self, value: String) -> Self { + self.filter_environment = Some(value); + self + } + /// Filter by connection group IDs. + pub fn filter_connection_group_ids(mut self, value: Vec) -> Self { + self.filter_connection_group_ids = Some(value); + self + } + /// Filter by creator ID. + pub fn filter_creator_id(mut self, value: String) -> Self { + self.filter_creator_id = Some(value); + self + } + /// Filter by creator IDs. + pub fn filter_creator_ids(mut self, value: Vec) -> Self { + self.filter_creator_ids = Some(value); + self + } + /// Search string to filter connection groups. + pub fn filter_search(mut self, value: String) -> Self { + self.filter_search = Some(value); + self + } + /// Sort parameters. + pub fn sort(mut self, value: Vec) -> Self { + self.sort = Some(value); + self + } +} + /// CreateActionConnectionError is a struct for typed errors of method [`ActionConnectionAPI::create_action_connection`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -65,6 +210,15 @@ pub enum GetAppKeyRegistrationError { UnknownValue(serde_json::Value), } +/// ListActionConnectionsError is a struct for typed errors of method [`ActionConnectionAPI::list_action_connections`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListActionConnectionsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListAppKeyRegistrationsError is a struct for typed errors of method [`ActionConnectionAPI::list_app_key_registrations`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -73,6 +227,15 @@ pub enum ListAppKeyRegistrationsError { UnknownValue(serde_json::Value), } +/// ListConnectionGroupsError is a struct for typed errors of method [`ActionConnectionAPI::list_connection_groups`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListConnectionGroupsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// RegisterAppKeyError is a struct for typed errors of method [`ActionConnectionAPI::register_app_key`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -97,6 +260,15 @@ pub enum UpdateActionConnectionError { UnknownValue(serde_json::Value), } +/// UpdateConnectionGroupError is a struct for typed errors of method [`ActionConnectionAPI::update_connection_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateConnectionGroupError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// Action connections extend your installed integrations and allow you to take action in your third-party systems /// (e.g. AWS, GitLab, and Statuspage) with Datadog’s Workflow Automation and App Builder products. /// @@ -638,6 +810,179 @@ impl ActionConnectionAPI { } } + /// List all action connections for the organization. This endpoint supports filtering by integration type, tags, environment, and search strings. Pagination is supported using page size and page number parameters. + pub async fn list_action_connections( + &self, + params: ListActionConnectionsOptionalParams, + ) -> Result< + crate::datadogV2::model::ListActionConnectionsResponse, + datadog::Error, + > { + match self.list_action_connections_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all action connections for the organization. This endpoint supports filtering by integration type, tags, environment, and search strings. Pagination is supported using page size and page number parameters. + pub async fn list_action_connections_with_http_info( + &self, + params: ListActionConnectionsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_action_connections"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_action_connections' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let filter_integration = params.filter_integration; + let filter_tags = params.filter_tags; + let filter_environment = params.filter_environment; + let filter_connection_ids = params.filter_connection_ids; + let filter_creator_ids = params.filter_creator_ids; + let filter_search = params.filter_search; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/actions/connections", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_integration { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[integration]", ¶m.to_string())]); + } + }; + if let Some(ref local) = filter_tags { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[tags]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = filter_environment { + local_req_builder = + local_req_builder.query(&[("filter[environment]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_connection_ids { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[connection_ids]", ¶m.to_string())]); + } + }; + if let Some(ref local) = filter_creator_ids { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[creator_ids]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = filter_search { + local_req_builder = + local_req_builder.query(&[("filter[search]", &local_query_param.to_string())]); + }; + if let Some(ref local) = sort { + for param in local { + local_req_builder = local_req_builder.query(&[("sort", ¶m.to_string())]); + } + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// List App Key Registrations pub async fn list_app_key_registrations( &self, @@ -759,6 +1104,177 @@ impl ActionConnectionAPI { } } + /// List all connection groups for the organization. This endpoint supports filtering by integration type, environment, connection group IDs, and search strings. Pagination is supported using page size and page number parameters. + pub async fn list_connection_groups( + &self, + params: ListConnectionGroupsOptionalParams, + ) -> Result< + crate::datadogV2::model::ListConnectionGroupsResponse, + datadog::Error, + > { + match self.list_connection_groups_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all connection groups for the organization. This endpoint supports filtering by integration type, environment, connection group IDs, and search strings. Pagination is supported using page size and page number parameters. + pub async fn list_connection_groups_with_http_info( + &self, + params: ListConnectionGroupsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_connection_groups"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_connection_groups' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let filter_integration = params.filter_integration; + let filter_environment = params.filter_environment; + let filter_connection_group_ids = params.filter_connection_group_ids; + let filter_creator_id = params.filter_creator_id; + let filter_creator_ids = params.filter_creator_ids; + let filter_search = params.filter_search; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/actions/connections/groups", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_integration { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[integration]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = filter_environment { + local_req_builder = + local_req_builder.query(&[("filter[environment]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_connection_group_ids { + for param in local { + local_req_builder = local_req_builder + .query(&[("filter[connection_group_ids]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = filter_creator_id { + local_req_builder = + local_req_builder.query(&[("filter[creator_id]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_creator_ids { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[creator_ids]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = filter_search { + local_req_builder = + local_req_builder.query(&[("filter[search]", &local_query_param.to_string())]); + }; + if let Some(ref local) = sort { + for param in local { + local_req_builder = local_req_builder.query(&[("sort", ¶m.to_string())]); + } + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Register a new App Key pub async fn register_app_key( &self, @@ -1113,4 +1629,172 @@ impl ActionConnectionAPI { Err(datadog::Error::ResponseError(local_error)) } } + + /// Update an existing connection group by ID. This endpoint allows updating the name, description, tag keys, integration type, connections, and policy attributes of a connection group. + pub async fn update_connection_group( + &self, + connection_group_id: String, + body: crate::datadogV2::model::UpdateConnectionGroupRequest, + ) -> Result< + crate::datadogV2::model::UpdateConnectionGroupResponse, + datadog::Error, + > { + match self + .update_connection_group_with_http_info(connection_group_id, body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Update an existing connection group by ID. This endpoint allows updating the name, description, tag keys, integration type, connections, and policy attributes of a connection group. + pub async fn update_connection_group_with_http_info( + &self, + connection_group_id: String, + body: crate::datadogV2::model::UpdateConnectionGroupRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_connection_group"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_connection_group' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/actions/connections/groups/{connection_group_id}", + local_configuration.get_operation_host(operation_id), + connection_group_id = datadog::urlencode(connection_group_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } } diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 5ab80a825..603752a44 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -218,6 +218,28 @@ pub mod model_get_app_key_registration_response; pub use self::model_get_app_key_registration_response::GetAppKeyRegistrationResponse; pub mod model_register_app_key_response; pub use self::model_register_app_key_response::RegisterAppKeyResponse; +pub mod model_list_action_connections_response; +pub use self::model_list_action_connections_response::ListActionConnectionsResponse; +pub mod model_connection_data_response; +pub use self::model_connection_data_response::ConnectionDataResponse; +pub mod model_connection_data_attributes_response; +pub use self::model_connection_data_attributes_response::ConnectionDataAttributesResponse; +pub mod model_created_by; +pub use self::model_created_by::CreatedBy; +pub mod model_external_secrets_manager_one_of; +pub use self::model_external_secrets_manager_one_of::ExternalSecretsManagerOneOf; +pub mod model_aws_secret_manager; +pub use self::model_aws_secret_manager::AWSSecretManager; +pub mod model_external_secrets_manager; +pub use self::model_external_secrets_manager::ExternalSecretsManager; +pub mod model_private_actions_runner; +pub use self::model_private_actions_runner::PrivateActionsRunner; +pub mod model_action_connection_data_type; +pub use self::model_action_connection_data_type::ActionConnectionDataType; +pub mod model_list_action_connections_response_meta; +pub use self::model_list_action_connections_response_meta::ListActionConnectionsResponseMeta; +pub mod model_integration_counts; +pub use self::model_integration_counts::IntegrationCounts; pub mod model_create_action_connection_request; pub use self::model_create_action_connection_request::CreateActionConnectionRequest; pub mod model_action_connection_data; @@ -480,10 +502,32 @@ pub mod model_virus_total_integration_type; pub use self::model_virus_total_integration_type::VirusTotalIntegrationType; pub mod model_action_connection_integration; pub use self::model_action_connection_integration::ActionConnectionIntegration; -pub mod model_action_connection_data_type; -pub use self::model_action_connection_data_type::ActionConnectionDataType; pub mod model_create_action_connection_response; pub use self::model_create_action_connection_response::CreateActionConnectionResponse; +pub mod model_list_connection_groups_response; +pub use self::model_list_connection_groups_response::ListConnectionGroupsResponse; +pub mod model_connection_group_data_response; +pub use self::model_connection_group_data_response::ConnectionGroupDataResponse; +pub mod model_connection_group_data_attributes_response; +pub use self::model_connection_group_data_attributes_response::ConnectionGroupDataAttributesResponse; +pub mod model_connection_group_relationships; +pub use self::model_connection_group_relationships::ConnectionGroupRelationships; +pub mod model_created_by_relationship; +pub use self::model_created_by_relationship::CreatedByRelationship; +pub mod model_created_by_relationship_data; +pub use self::model_created_by_relationship_data::CreatedByRelationshipData; +pub mod model_connection_group_type; +pub use self::model_connection_group_type::ConnectionGroupType; +pub mod model_list_connection_groups_response_meta; +pub use self::model_list_connection_groups_response_meta::ListConnectionGroupsResponseMeta; +pub mod model_update_connection_group_request; +pub use self::model_update_connection_group_request::UpdateConnectionGroupRequest; +pub mod model_connection_group_data_request; +pub use self::model_connection_group_data_request::ConnectionGroupDataRequest; +pub mod model_connection_group_data_attributes_request; +pub use self::model_connection_group_data_attributes_request::ConnectionGroupDataAttributesRequest; +pub mod model_update_connection_group_response; +pub use self::model_update_connection_group_response::UpdateConnectionGroupResponse; pub mod model_get_action_connection_response; pub use self::model_get_action_connection_response::GetActionConnectionResponse; pub mod model_update_action_connection_request; diff --git a/src/datadogV2/model/model_aws_secret_manager.rs b/src/datadogV2/model/model_aws_secret_manager.rs new file mode 100644 index 000000000..f419983bb --- /dev/null +++ b/src/datadogV2/model/model_aws_secret_manager.rs @@ -0,0 +1,104 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS Secrets Manager configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSSecretManager { + /// The ID of the connection used to access AWS Secrets Manager. + #[serde(rename = "connection_id")] + pub connection_id: uuid::Uuid, + /// The AWS region where the secret is stored. + #[serde(rename = "region")] + pub region: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSSecretManager { + pub fn new(connection_id: uuid::Uuid, region: String) -> AWSSecretManager { + AWSSecretManager { + connection_id, + region, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSSecretManager { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSSecretManagerVisitor; + impl<'a> Visitor<'a> for AWSSecretManagerVisitor { + type Value = AWSSecretManager; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connection_id: Option = None; + let mut region: Option = 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::()? { + match k.as_str() { + "connection_id" => { + connection_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "region" => { + region = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let connection_id = + connection_id.ok_or_else(|| M::Error::missing_field("connection_id"))?; + let region = region.ok_or_else(|| M::Error::missing_field("region"))?; + + let content = AWSSecretManager { + connection_id, + region, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSSecretManagerVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_data_attributes_response.rs b/src/datadogV2/model/model_connection_data_attributes_response.rs new file mode 100644 index 000000000..99f9c0705 --- /dev/null +++ b/src/datadogV2/model/model_connection_data_attributes_response.rs @@ -0,0 +1,284 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of an action connection. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionDataAttributesResponse { + /// Indicates if the acting user can resolve the connection. + #[serde(rename = "acting_user_can_resolve")] + pub acting_user_can_resolve: bool, + /// The creation timestamp of the connection. + #[serde(rename = "created_at")] + pub created_at: Option>, + /// Information about the user who created the resource. + #[serde(rename = "created_by")] + pub created_by: Option, + /// The description of the connection. + #[serde(rename = "description")] + pub description: Option, + /// External secrets manager configuration. + #[serde(rename = "external_secrets_manager")] + pub external_secrets_manager: crate::datadogV2::model::ExternalSecretsManager, + /// Integration configuration details. + #[serde(rename = "integration")] + pub integration: std::collections::BTreeMap, + /// Indicates if the connection is marked as favorite. + #[serde(rename = "is_favorite")] + pub is_favorite: bool, + /// The last updated timestamp of the connection. + #[serde(rename = "last_updated")] + pub last_updated: Option>, + /// The name of the connection. + #[serde(rename = "name")] + pub name: String, + /// Information about the private actions runner. + #[serde(rename = "private_actions_runner")] + pub private_actions_runner: Option, + /// The ID of the runner associated with the connection. + #[serde(rename = "runner_id")] + pub runner_id: Option, + /// Tags associated with the connection. + #[serde(rename = "tags")] + pub tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionDataAttributesResponse { + pub fn new( + acting_user_can_resolve: bool, + external_secrets_manager: crate::datadogV2::model::ExternalSecretsManager, + integration: std::collections::BTreeMap, + is_favorite: bool, + name: String, + ) -> ConnectionDataAttributesResponse { + ConnectionDataAttributesResponse { + acting_user_can_resolve, + created_at: None, + created_by: None, + description: None, + external_secrets_manager, + integration, + is_favorite, + last_updated: None, + name, + private_actions_runner: None, + runner_id: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + pub fn created_by(mut self, value: crate::datadogV2::model::CreatedBy) -> Self { + self.created_by = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn last_updated(mut self, value: chrono::DateTime) -> Self { + self.last_updated = Some(value); + self + } + + pub fn private_actions_runner( + mut self, + value: crate::datadogV2::model::PrivateActionsRunner, + ) -> Self { + self.private_actions_runner = Some(value); + self + } + + pub fn runner_id(mut self, value: String) -> Self { + self.runner_id = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConnectionDataAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionDataAttributesResponseVisitor; + impl<'a> Visitor<'a> for ConnectionDataAttributesResponseVisitor { + type Value = ConnectionDataAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut acting_user_can_resolve: Option = None; + let mut created_at: Option> = None; + let mut created_by: Option = None; + let mut description: Option = None; + let mut external_secrets_manager: Option< + crate::datadogV2::model::ExternalSecretsManager, + > = None; + let mut integration: Option> = + None; + let mut is_favorite: Option = None; + let mut last_updated: Option> = None; + let mut name: Option = None; + let mut private_actions_runner: Option< + crate::datadogV2::model::PrivateActionsRunner, + > = None; + let mut runner_id: Option = None; + let mut tags: Option> = 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::()? { + match k.as_str() { + "acting_user_can_resolve" => { + acting_user_can_resolve = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + if v.is_null() { + continue; + } + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "external_secrets_manager" => { + external_secrets_manager = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _external_secrets_manager) = external_secrets_manager { + match _external_secrets_manager { + crate::datadogV2::model::ExternalSecretsManager::UnparsedObject(_external_secrets_manager) => { + _unparsed = true; + }, + _ => {} + } + } + } + "integration" => { + integration = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_favorite" => { + is_favorite = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_updated" => { + if v.is_null() { + continue; + } + last_updated = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "private_actions_runner" => { + if v.is_null() { + continue; + } + private_actions_runner = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "runner_id" => { + if v.is_null() { + continue; + } + runner_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let acting_user_can_resolve = acting_user_can_resolve + .ok_or_else(|| M::Error::missing_field("acting_user_can_resolve"))?; + let external_secrets_manager = external_secrets_manager + .ok_or_else(|| M::Error::missing_field("external_secrets_manager"))?; + let integration = + integration.ok_or_else(|| M::Error::missing_field("integration"))?; + let is_favorite = + is_favorite.ok_or_else(|| M::Error::missing_field("is_favorite"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = ConnectionDataAttributesResponse { + acting_user_can_resolve, + created_at, + created_by, + description, + external_secrets_manager, + integration, + is_favorite, + last_updated, + name, + private_actions_runner, + runner_id, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionDataAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_data_response.rs b/src/datadogV2/model/model_connection_data_response.rs new file mode 100644 index 000000000..a25302c22 --- /dev/null +++ b/src/datadogV2/model/model_connection_data_response.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for an action connection. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionDataResponse { + /// Attributes of an action connection. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::ConnectionDataAttributesResponse, + /// The unique identifier of the connection. + #[serde(rename = "id")] + pub id: String, + /// The definition of `ActionConnectionDataType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ActionConnectionDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionDataResponse { + pub fn new( + attributes: crate::datadogV2::model::ConnectionDataAttributesResponse, + id: String, + type_: crate::datadogV2::model::ActionConnectionDataType, + ) -> ConnectionDataResponse { + ConnectionDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConnectionDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionDataResponseVisitor; + impl<'a> Visitor<'a> for ConnectionDataResponseVisitor { + type Value = ConnectionDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::ConnectionDataAttributesResponse, + > = None; + let mut id: Option = None; + let mut type_: Option = 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::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + 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_ { + match _type_ { + crate::datadogV2::model::ActionConnectionDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConnectionDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_data_attributes_request.rs b/src/datadogV2/model/model_connection_group_data_attributes_request.rs new file mode 100644 index 000000000..a9fc93dfe --- /dev/null +++ b/src/datadogV2/model/model_connection_group_data_attributes_request.rs @@ -0,0 +1,194 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for updating a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionGroupDataAttributesRequest { + /// List of connection IDs associated with the connection group. + #[serde(rename = "connections")] + pub connections: Option>, + /// The description of the connection group. + #[serde(rename = "description")] + pub description: Option, + /// The integration type of the connection group. + #[serde(rename = "integration_type")] + pub integration_type: Option, + /// The name of the connection group. + #[serde(rename = "name")] + pub name: Option, + /// Policy attributes for the connection group. + #[serde(rename = "policy_attributes")] + pub policy_attributes: Option, + /// Tag keys associated with the connection group. + #[serde(rename = "tag_keys")] + pub tag_keys: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionGroupDataAttributesRequest { + pub fn new() -> ConnectionGroupDataAttributesRequest { + ConnectionGroupDataAttributesRequest { + connections: None, + description: None, + integration_type: None, + name: None, + policy_attributes: None, + tag_keys: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn integration_type(mut self, value: String) -> Self { + self.integration_type = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn policy_attributes(mut self, value: String) -> Self { + self.policy_attributes = Some(value); + self + } + + pub fn tag_keys(mut self, value: Vec) -> Self { + self.tag_keys = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ConnectionGroupDataAttributesRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupDataAttributesRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionGroupDataAttributesRequestVisitor; + impl<'a> Visitor<'a> for ConnectionGroupDataAttributesRequestVisitor { + type Value = ConnectionGroupDataAttributesRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut description: Option = None; + let mut integration_type: Option = None; + let mut name: Option = None; + let mut policy_attributes: Option = None; + let mut tag_keys: Option> = 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::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "integration_type" => { + if v.is_null() { + continue; + } + integration_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "policy_attributes" => { + if v.is_null() { + continue; + } + policy_attributes = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tag_keys" => { + if v.is_null() { + continue; + } + tag_keys = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ConnectionGroupDataAttributesRequest { + connections, + description, + integration_type, + name, + policy_attributes, + tag_keys, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionGroupDataAttributesRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_data_attributes_response.rs b/src/datadogV2/model/model_connection_group_data_attributes_response.rs new file mode 100644 index 000000000..123c6f80d --- /dev/null +++ b/src/datadogV2/model/model_connection_group_data_attributes_response.rs @@ -0,0 +1,191 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionGroupDataAttributesResponse { + /// List of connection IDs associated with the connection group. + #[serde(rename = "connections")] + pub connections: Option>, + /// The creation timestamp of the connection group. + #[serde(rename = "created_at")] + pub created_at: chrono::DateTime, + /// The description of the connection group. + #[serde(rename = "description")] + pub description: Option, + /// The integration type of the connection group. + #[serde(rename = "integration_type")] + pub integration_type: String, + /// Indicates if the connection group is marked as favorite. + #[serde(rename = "is_favorite")] + pub is_favorite: bool, + /// The last updated timestamp of the connection group. + #[serde(rename = "last_updated_at")] + pub last_updated_at: chrono::DateTime, + /// The name of the connection group. + #[serde(rename = "name")] + pub name: String, + /// Tag keys associated with the connection group. + #[serde(rename = "tag_keys")] + pub tag_keys: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionGroupDataAttributesResponse { + pub fn new( + created_at: chrono::DateTime, + integration_type: String, + is_favorite: bool, + last_updated_at: chrono::DateTime, + name: String, + tag_keys: Vec, + ) -> ConnectionGroupDataAttributesResponse { + ConnectionGroupDataAttributesResponse { + connections: None, + created_at, + description: None, + integration_type, + is_favorite, + last_updated_at, + name, + tag_keys, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn connections(mut self, value: Vec) -> Self { + self.connections = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupDataAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionGroupDataAttributesResponseVisitor; + impl<'a> Visitor<'a> for ConnectionGroupDataAttributesResponseVisitor { + type Value = ConnectionGroupDataAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut connections: Option> = None; + let mut created_at: Option> = None; + let mut description: Option = None; + let mut integration_type: Option = None; + let mut is_favorite: Option = None; + let mut last_updated_at: Option> = None; + let mut name: Option = None; + let mut tag_keys: Option> = 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::()? { + match k.as_str() { + "connections" => { + if v.is_null() { + continue; + } + connections = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "integration_type" => { + integration_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_favorite" => { + is_favorite = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_updated_at" => { + last_updated_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tag_keys" => { + tag_keys = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let is_favorite = + is_favorite.ok_or_else(|| M::Error::missing_field("is_favorite"))?; + let last_updated_at = + last_updated_at.ok_or_else(|| M::Error::missing_field("last_updated_at"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let tag_keys = tag_keys.ok_or_else(|| M::Error::missing_field("tag_keys"))?; + + let content = ConnectionGroupDataAttributesResponse { + connections, + created_at, + description, + integration_type, + is_favorite, + last_updated_at, + name, + tag_keys, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionGroupDataAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_data_request.rs b/src/datadogV2/model/model_connection_group_data_request.rs new file mode 100644 index 000000000..dfae98bbf --- /dev/null +++ b/src/datadogV2/model/model_connection_group_data_request.rs @@ -0,0 +1,122 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for updating a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionGroupDataRequest { + /// Attributes for updating a connection group. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The definition of `ConnectionGroupType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConnectionGroupType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionGroupDataRequest { + pub fn new(type_: crate::datadogV2::model::ConnectionGroupType) -> ConnectionGroupDataRequest { + ConnectionGroupDataRequest { + attributes: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::ConnectionGroupDataAttributesRequest, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupDataRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionGroupDataRequestVisitor; + impl<'a> Visitor<'a> for ConnectionGroupDataRequestVisitor { + type Value = ConnectionGroupDataRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::ConnectionGroupDataAttributesRequest, + > = None; + let mut type_: Option = 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::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = 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_ { + match _type_ { + crate::datadogV2::model::ConnectionGroupType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConnectionGroupDataRequest { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionGroupDataRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_data_response.rs b/src/datadogV2/model/model_connection_group_data_response.rs new file mode 100644 index 000000000..26209cb13 --- /dev/null +++ b/src/datadogV2/model/model_connection_group_data_response.rs @@ -0,0 +1,149 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionGroupDataResponse { + /// Attributes of a connection group. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::ConnectionGroupDataAttributesResponse, + /// The unique identifier of the connection group. + #[serde(rename = "id")] + pub id: String, + /// Relationships for a connection group. + #[serde(rename = "relationships")] + pub relationships: Option, + /// The definition of `ConnectionGroupType` object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ConnectionGroupType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionGroupDataResponse { + pub fn new( + attributes: crate::datadogV2::model::ConnectionGroupDataAttributesResponse, + id: String, + type_: crate::datadogV2::model::ConnectionGroupType, + ) -> ConnectionGroupDataResponse { + ConnectionGroupDataResponse { + attributes, + id, + relationships: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn relationships( + mut self, + value: crate::datadogV2::model::ConnectionGroupRelationships, + ) -> Self { + self.relationships = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionGroupDataResponseVisitor; + impl<'a> Visitor<'a> for ConnectionGroupDataResponseVisitor { + type Value = ConnectionGroupDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::ConnectionGroupDataAttributesResponse, + > = None; + let mut id: Option = None; + let mut relationships: Option< + crate::datadogV2::model::ConnectionGroupRelationships, + > = None; + let mut type_: Option = 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::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationships" => { + if v.is_null() { + continue; + } + relationships = + 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_ { + match _type_ { + crate::datadogV2::model::ConnectionGroupType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ConnectionGroupDataResponse { + attributes, + id, + relationships, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionGroupDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_relationships.rs b/src/datadogV2/model/model_connection_group_relationships.rs new file mode 100644 index 000000000..8c2f62b03 --- /dev/null +++ b/src/datadogV2/model/model_connection_group_relationships.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Relationships for a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ConnectionGroupRelationships { + /// Relationship to the user who created the resource. + #[serde(rename = "created_by")] + pub created_by: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ConnectionGroupRelationships { + pub fn new() -> ConnectionGroupRelationships { + ConnectionGroupRelationships { + created_by: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_by(mut self, value: crate::datadogV2::model::CreatedByRelationship) -> Self { + self.created_by = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for ConnectionGroupRelationships { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupRelationships { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ConnectionGroupRelationshipsVisitor; + impl<'a> Visitor<'a> for ConnectionGroupRelationshipsVisitor { + type Value = ConnectionGroupRelationships; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_by: Option = 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::()? { + match k.as_str() { + "created_by" => { + if v.is_null() { + continue; + } + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = ConnectionGroupRelationships { + created_by, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ConnectionGroupRelationshipsVisitor) + } +} diff --git a/src/datadogV2/model/model_connection_group_type.rs b/src/datadogV2/model/model_connection_group_type.rs new file mode 100644 index 000000000..16f6c92cb --- /dev/null +++ b/src/datadogV2/model/model_connection_group_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ConnectionGroupType { + CONNECTION_GROUP, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for ConnectionGroupType { + fn to_string(&self) -> String { + match self { + Self::CONNECTION_GROUP => String::from("connection_group"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for ConnectionGroupType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for ConnectionGroupType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "connection_group" => Self::CONNECTION_GROUP, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_created_by.rs b/src/datadogV2/model/model_created_by.rs new file mode 100644 index 000000000..e84253f73 --- /dev/null +++ b/src/datadogV2/model/model_created_by.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Information about the user who created the resource. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreatedBy { + /// The unique identifier of the user. + #[serde(rename = "id")] + pub id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreatedBy { + pub fn new(id: String) -> CreatedBy { + CreatedBy { + id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreatedBy { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreatedByVisitor; + impl<'a> Visitor<'a> for CreatedByVisitor { + type Value = CreatedBy; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = 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::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + + let content = CreatedBy { + id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreatedByVisitor) + } +} diff --git a/src/datadogV2/model/model_created_by_relationship.rs b/src/datadogV2/model/model_created_by_relationship.rs new file mode 100644 index 000000000..65fa8f68d --- /dev/null +++ b/src/datadogV2/model/model_created_by_relationship.rs @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Relationship to the user who created the resource. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreatedByRelationship { + /// Data for the created_by relationship. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreatedByRelationship { + pub fn new() -> CreatedByRelationship { + CreatedByRelationship { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::CreatedByRelationshipData) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for CreatedByRelationship { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for CreatedByRelationship { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreatedByRelationshipVisitor; + impl<'a> Visitor<'a> for CreatedByRelationshipVisitor { + type Value = CreatedByRelationship; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = 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::()? { + match k.as_str() { + "data" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = CreatedByRelationship { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreatedByRelationshipVisitor) + } +} diff --git a/src/datadogV2/model/model_created_by_relationship_data.rs b/src/datadogV2/model/model_created_by_relationship_data.rs new file mode 100644 index 000000000..4339a4101 --- /dev/null +++ b/src/datadogV2/model/model_created_by_relationship_data.rs @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data for the created_by relationship. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CreatedByRelationshipData { + /// The unique identifier of the user. + #[serde(rename = "id")] + pub id: String, + /// The type of the relationship. + #[serde(rename = "type")] + pub type_: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CreatedByRelationshipData { + pub fn new(id: String, type_: String) -> CreatedByRelationshipData { + CreatedByRelationshipData { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CreatedByRelationshipData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CreatedByRelationshipDataVisitor; + impl<'a> Visitor<'a> for CreatedByRelationshipDataVisitor { + type Value = CreatedByRelationshipData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = 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::()? { + match k.as_str() { + "id" => { + 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 Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CreatedByRelationshipData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CreatedByRelationshipDataVisitor) + } +} diff --git a/src/datadogV2/model/model_external_secrets_manager.rs b/src/datadogV2/model/model_external_secrets_manager.rs new file mode 100644 index 000000000..49db7f20c --- /dev/null +++ b/src/datadogV2/model/model_external_secrets_manager.rs @@ -0,0 +1,34 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::{Deserialize, Deserializer, Serialize}; + +/// External secrets manager configuration. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum ExternalSecretsManager { + ExternalSecretsManagerOneOf(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for ExternalSecretsManager { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ExternalSecretsManager::ExternalSecretsManagerOneOf(_v)); + } + } + + return Ok(ExternalSecretsManager::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_external_secrets_manager_one_of.rs b/src/datadogV2/model/model_external_secrets_manager_one_of.rs new file mode 100644 index 000000000..e09509cc7 --- /dev/null +++ b/src/datadogV2/model/model_external_secrets_manager_one_of.rs @@ -0,0 +1,91 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ExternalSecretsManagerOneOf { + /// AWS Secrets Manager configuration. + #[serde(rename = "aws")] + pub aws: crate::datadogV2::model::AWSSecretManager, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ExternalSecretsManagerOneOf { + pub fn new(aws: crate::datadogV2::model::AWSSecretManager) -> ExternalSecretsManagerOneOf { + ExternalSecretsManagerOneOf { + aws, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ExternalSecretsManagerOneOf { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ExternalSecretsManagerOneOfVisitor; + impl<'a> Visitor<'a> for ExternalSecretsManagerOneOfVisitor { + type Value = ExternalSecretsManagerOneOf; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut aws: Option = 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::()? { + match k.as_str() { + "aws" => { + aws = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let aws = aws.ok_or_else(|| M::Error::missing_field("aws"))?; + + let content = ExternalSecretsManagerOneOf { + aws, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ExternalSecretsManagerOneOfVisitor) + } +} diff --git a/src/datadogV2/model/model_integration_counts.rs b/src/datadogV2/model/model_integration_counts.rs new file mode 100644 index 000000000..c88b807fe --- /dev/null +++ b/src/datadogV2/model/model_integration_counts.rs @@ -0,0 +1,142 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Count of integrations by type. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct IntegrationCounts { + /// The filtered count of integrations. + #[serde(rename = "filtered_count")] + pub filtered_count: Option, + /// The integration type. + #[serde(rename = "integration_type")] + pub integration_type: Option, + /// The total count of integrations. + #[serde(rename = "total_count")] + pub total_count: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl IntegrationCounts { + pub fn new() -> IntegrationCounts { + IntegrationCounts { + filtered_count: None, + integration_type: None, + total_count: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn filtered_count(mut self, value: i64) -> Self { + self.filtered_count = Some(value); + self + } + + pub fn integration_type(mut self, value: String) -> Self { + self.integration_type = Some(value); + self + } + + pub fn total_count(mut self, value: i64) -> Self { + self.total_count = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for IntegrationCounts { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for IntegrationCounts { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct IntegrationCountsVisitor; + impl<'a> Visitor<'a> for IntegrationCountsVisitor { + type Value = IntegrationCounts; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut filtered_count: Option = None; + let mut integration_type: Option = None; + let mut total_count: Option = 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::()? { + match k.as_str() { + "filtered_count" => { + if v.is_null() { + continue; + } + filtered_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "integration_type" => { + if v.is_null() { + continue; + } + integration_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "total_count" => { + if v.is_null() { + continue; + } + total_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = IntegrationCounts { + filtered_count, + integration_type, + total_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(IntegrationCountsVisitor) + } +} diff --git a/src/datadogV2/model/model_list_action_connections_response.rs b/src/datadogV2/model/model_list_action_connections_response.rs new file mode 100644 index 000000000..5177795aa --- /dev/null +++ b/src/datadogV2/model/model_list_action_connections_response.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response for listing action connections. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListActionConnectionsResponse { + /// An array of action connections. + #[serde(rename = "data")] + pub data: Vec, + /// Metadata for the list connections response. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListActionConnectionsResponse { + pub fn new( + data: Vec, + ) -> ListActionConnectionsResponse { + ListActionConnectionsResponse { + data, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn meta( + mut self, + value: crate::datadogV2::model::ListActionConnectionsResponseMeta, + ) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListActionConnectionsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListActionConnectionsResponseVisitor; + impl<'a> Visitor<'a> for ListActionConnectionsResponseVisitor { + type Value = ListActionConnectionsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut meta: Option = + 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::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = ListActionConnectionsResponse { + data, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListActionConnectionsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_list_action_connections_response_meta.rs b/src/datadogV2/model/model_list_action_connections_response_meta.rs new file mode 100644 index 000000000..cc64d8e4e --- /dev/null +++ b/src/datadogV2/model/model_list_action_connections_response_meta.rs @@ -0,0 +1,128 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Metadata for the list connections response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListActionConnectionsResponseMeta { + /// Count of integrations by type. + #[serde( + rename = "integration_counts", + default, + with = "::serde_with::rust::double_option" + )] + pub integration_counts: Option>>, + /// The total number of connections. + #[serde(rename = "total")] + pub total: i64, + /// The total number of connections that match the specified filters. + #[serde(rename = "total_filtered")] + pub total_filtered: i64, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListActionConnectionsResponseMeta { + pub fn new(total: i64, total_filtered: i64) -> ListActionConnectionsResponseMeta { + ListActionConnectionsResponseMeta { + integration_counts: None, + total, + total_filtered, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn integration_counts( + mut self, + value: Option>, + ) -> Self { + self.integration_counts = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListActionConnectionsResponseMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListActionConnectionsResponseMetaVisitor; + impl<'a> Visitor<'a> for ListActionConnectionsResponseMetaVisitor { + type Value = ListActionConnectionsResponseMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut integration_counts: Option< + Option>, + > = None; + let mut total: Option = None; + let mut total_filtered: Option = 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::()? { + match k.as_str() { + "integration_counts" => { + integration_counts = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "total" => { + total = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "total_filtered" => { + total_filtered = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let total = total.ok_or_else(|| M::Error::missing_field("total"))?; + let total_filtered = + total_filtered.ok_or_else(|| M::Error::missing_field("total_filtered"))?; + + let content = ListActionConnectionsResponseMeta { + integration_counts, + total, + total_filtered, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListActionConnectionsResponseMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_list_connection_groups_response.rs b/src/datadogV2/model/model_list_connection_groups_response.rs new file mode 100644 index 000000000..a8ad0bbcf --- /dev/null +++ b/src/datadogV2/model/model_list_connection_groups_response.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response for listing connection groups. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListConnectionGroupsResponse { + /// An array of connection groups. + #[serde(rename = "data")] + pub data: Vec, + /// Metadata for the list connection groups response. + #[serde(rename = "meta")] + pub meta: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListConnectionGroupsResponse { + pub fn new( + data: Vec, + ) -> ListConnectionGroupsResponse { + ListConnectionGroupsResponse { + data, + meta: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn meta( + mut self, + value: crate::datadogV2::model::ListConnectionGroupsResponseMeta, + ) -> Self { + self.meta = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListConnectionGroupsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListConnectionGroupsResponseVisitor; + impl<'a> Visitor<'a> for ListConnectionGroupsResponseVisitor { + type Value = ListConnectionGroupsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut meta: Option = + 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::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + if v.is_null() { + continue; + } + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = ListConnectionGroupsResponse { + data, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListConnectionGroupsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_list_connection_groups_response_meta.rs b/src/datadogV2/model/model_list_connection_groups_response_meta.rs new file mode 100644 index 000000000..0a702b7cb --- /dev/null +++ b/src/datadogV2/model/model_list_connection_groups_response_meta.rs @@ -0,0 +1,128 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Metadata for the list connection groups response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ListConnectionGroupsResponseMeta { + /// Count of integrations by type. + #[serde( + rename = "integration_counts", + default, + with = "::serde_with::rust::double_option" + )] + pub integration_counts: Option>>, + /// The total number of connection groups. + #[serde(rename = "total")] + pub total: i64, + /// The total number of connection groups that match the specified filters. + #[serde(rename = "total_filtered")] + pub total_filtered: i64, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ListConnectionGroupsResponseMeta { + pub fn new(total: i64, total_filtered: i64) -> ListConnectionGroupsResponseMeta { + ListConnectionGroupsResponseMeta { + integration_counts: None, + total, + total_filtered, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn integration_counts( + mut self, + value: Option>, + ) -> Self { + self.integration_counts = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ListConnectionGroupsResponseMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ListConnectionGroupsResponseMetaVisitor; + impl<'a> Visitor<'a> for ListConnectionGroupsResponseMetaVisitor { + type Value = ListConnectionGroupsResponseMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut integration_counts: Option< + Option>, + > = None; + let mut total: Option = None; + let mut total_filtered: Option = 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::()? { + match k.as_str() { + "integration_counts" => { + integration_counts = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "total" => { + total = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "total_filtered" => { + total_filtered = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let total = total.ok_or_else(|| M::Error::missing_field("total"))?; + let total_filtered = + total_filtered.ok_or_else(|| M::Error::missing_field("total_filtered"))?; + + let content = ListConnectionGroupsResponseMeta { + integration_counts, + total, + total_filtered, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ListConnectionGroupsResponseMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_private_actions_runner.rs b/src/datadogV2/model/model_private_actions_runner.rs new file mode 100644 index 000000000..52fd17463 --- /dev/null +++ b/src/datadogV2/model/model_private_actions_runner.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Information about the private actions runner. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PrivateActionsRunner { + /// The unique identifier of the runner. + #[serde(rename = "id")] + pub id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PrivateActionsRunner { + pub fn new(id: String) -> PrivateActionsRunner { + PrivateActionsRunner { + id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for PrivateActionsRunner { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PrivateActionsRunnerVisitor; + impl<'a> Visitor<'a> for PrivateActionsRunnerVisitor { + type Value = PrivateActionsRunner; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = 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::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + + let content = PrivateActionsRunner { + id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PrivateActionsRunnerVisitor) + } +} diff --git a/src/datadogV2/model/model_update_connection_group_request.rs b/src/datadogV2/model/model_update_connection_group_request.rs new file mode 100644 index 000000000..2345c1852 --- /dev/null +++ b/src/datadogV2/model/model_update_connection_group_request.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request for updating a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateConnectionGroupRequest { + /// Data object for updating a connection group. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::ConnectionGroupDataRequest, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateConnectionGroupRequest { + pub fn new( + data: crate::datadogV2::model::ConnectionGroupDataRequest, + ) -> UpdateConnectionGroupRequest { + UpdateConnectionGroupRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateConnectionGroupRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateConnectionGroupRequestVisitor; + impl<'a> Visitor<'a> for UpdateConnectionGroupRequestVisitor { + type Value = UpdateConnectionGroupRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = 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::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = UpdateConnectionGroupRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateConnectionGroupRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_update_connection_group_response.rs b/src/datadogV2/model/model_update_connection_group_response.rs new file mode 100644 index 000000000..c02217686 --- /dev/null +++ b/src/datadogV2/model/model_update_connection_group_response.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response for updating a connection group. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct UpdateConnectionGroupResponse { + /// Data object for a connection group. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::ConnectionGroupDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl UpdateConnectionGroupResponse { + pub fn new( + data: crate::datadogV2::model::ConnectionGroupDataResponse, + ) -> UpdateConnectionGroupResponse { + UpdateConnectionGroupResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for UpdateConnectionGroupResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct UpdateConnectionGroupResponseVisitor; + impl<'a> Visitor<'a> for UpdateConnectionGroupResponseVisitor { + type Value = UpdateConnectionGroupResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = 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::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = UpdateConnectionGroupResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(UpdateConnectionGroupResponseVisitor) + } +} diff --git a/tests/scenarios/features/v2/action_connection.feature b/tests/scenarios/features/v2/action_connection.feature index 759615a8f..1686cae1d 100644 --- a/tests/scenarios/features/v2/action_connection.feature +++ b/tests/scenarios/features/v2/action_connection.feature @@ -97,6 +97,34 @@ Feature: Action Connection When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/action-platform + Scenario: List action connections returns "Bad Request" response + Given operation "ListActionConnections" enabled + And new "ListActionConnections" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/action-platform + Scenario: List action connections returns "OK" response + Given operation "ListActionConnections" enabled + And new "ListActionConnections" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/action-platform + Scenario: List connection groups returns "Bad Request" response + Given operation "ListConnectionGroups" enabled + And new "ListConnectionGroups" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/action-platform + Scenario: List connection groups returns "OK" response + Given operation "ListConnectionGroups" enabled + And new "ListConnectionGroups" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/workflow-automation-dev Scenario: Register a new App Key returns "Bad request" response Given new "RegisterAppKey" request @@ -132,6 +160,33 @@ Feature: Action Connection When the request is sent Then the response status is 404 Not found + @generated @skip @team:DataDog/action-platform + Scenario: Update a connection group returns "Bad Request" response + Given operation "UpdateConnectionGroup" enabled + And new "UpdateConnectionGroup" request + And request contains "connection_group_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"connections": [], "description": "An updated test connection group for AWS integrations", "name": "My Connection Group Updated", "tag_keys": []}, "type": "connection_group"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/action-platform + Scenario: Update a connection group returns "Not Found" response + Given operation "UpdateConnectionGroup" enabled + And new "UpdateConnectionGroup" request + And request contains "connection_group_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"connections": [], "description": "An updated test connection group for AWS integrations", "name": "My Connection Group Updated", "tag_keys": []}, "type": "connection_group"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/action-platform + Scenario: Update a connection group returns "OK" response + Given operation "UpdateConnectionGroup" enabled + And new "UpdateConnectionGroup" request + And request contains "connection_group_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"connections": [], "description": "An updated test connection group for AWS integrations", "name": "My Connection Group Updated", "tag_keys": []}, "type": "connection_group"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/workflow-automation-dev Scenario: Update an existing Action Connection returns "Bad Request" response Given new "UpdateActionConnection" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 75d0d7f71..4e618c42c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -202,6 +202,12 @@ "type": "idempotent" } }, + "ListActionConnections": { + "tag": "Action Connection", + "undo": { + "type": "safe" + } + }, "CreateActionConnection": { "tag": "Action Connection", "undo": { @@ -215,6 +221,18 @@ "type": "unsafe" } }, + "ListConnectionGroups": { + "tag": "Action Connection", + "undo": { + "type": "safe" + } + }, + "UpdateConnectionGroup": { + "tag": "Action Connection", + "undo": { + "type": "idempotent" + } + }, "DeleteActionConnection": { "tag": "Action Connection", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 144f43821..32a7b5e4c 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -2048,10 +2048,22 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.RegisterAppKey".into(), test_v2_register_app_key); + world.function_mappings.insert( + "v2.ListActionConnections".into(), + test_v2_list_action_connections, + ); world.function_mappings.insert( "v2.CreateActionConnection".into(), test_v2_create_action_connection, ); + world.function_mappings.insert( + "v2.ListConnectionGroups".into(), + test_v2_list_connection_groups, + ); + world.function_mappings.insert( + "v2.UpdateConnectionGroup".into(), + test_v2_update_connection_group, + ); world.function_mappings.insert( "v2.DeleteActionConnection".into(), test_v2_delete_action_connection, @@ -13233,6 +13245,68 @@ fn test_v2_register_app_key(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_action_connection + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_integration = _parameters + .get("filter[integration]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_tags = _parameters + .get("filter[tags]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_environment = _parameters + .get("filter[environment]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connection_ids = _parameters + .get("filter[connection_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_creator_ids = _parameters + .get("filter[creator_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_search = _parameters + .get("filter[search]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let sort = _parameters + .get("sort") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = + datadogV2::api_action_connection::ListActionConnectionsOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + params.filter_integration = filter_integration; + params.filter_tags = filter_tags; + params.filter_environment = filter_environment; + params.filter_connection_ids = filter_connection_ids; + params.filter_creator_ids = filter_creator_ids; + params.filter_search = filter_search; + params.sort = sort; + let response = match block_on(api.list_action_connections_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_create_action_connection( world: &mut DatadogWorld, _parameters: &HashMap, @@ -13261,6 +13335,96 @@ fn test_v2_create_action_connection( world.response.code = response.status.as_u16(); } +fn test_v2_list_connection_groups(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_action_connection + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_integration = _parameters + .get("filter[integration]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_environment = _parameters + .get("filter[environment]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connection_group_ids = _parameters + .get("filter[connection_group_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_creator_id = _parameters + .get("filter[creator_id]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_creator_ids = _parameters + .get("filter[creator_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_search = _parameters + .get("filter[search]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let sort = _parameters + .get("sort") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = + datadogV2::api_action_connection::ListConnectionGroupsOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + params.filter_integration = filter_integration; + params.filter_environment = filter_environment; + params.filter_connection_group_ids = filter_connection_group_ids; + params.filter_creator_id = filter_creator_id; + params.filter_creator_ids = filter_creator_ids; + params.filter_search = filter_search; + params.sort = sort; + let response = match block_on(api.list_connection_groups_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_connection_group(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_action_connection + .as_ref() + .expect("api instance not found"); + let connection_group_id = + serde_json::from_value(_parameters.get("connection_group_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.update_connection_group_with_http_info(connection_group_id, body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_delete_action_connection( world: &mut DatadogWorld, _parameters: &HashMap,