diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ee899f506..ed984a56d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -88799,6 +88799,69 @@ components: $ref: "#/components/schemas/SecurityMonitoringCriticalAsset" type: array type: object + SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes: + description: The attributes of a CrowdStrike entity context sync configuration to create. + properties: + domain: + description: The domain associated with the external entity source. + example: api.crowdstrike.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeCrowdStrike" + name: + description: The display name for the entity context sync configuration. + example: My CrowdStrike Integration + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigCrowdStrikeSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + - domain + - name + - secrets + type: object + SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes: + description: Fields to update on a CrowdStrike entity context sync configuration. + properties: + domain: + description: The new domain associated with the external entity source. + example: api.crowdstrike.com + type: string + enabled: + description: Whether the entity context sync should be enabled. + example: true + type: boolean + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeCrowdStrike" + name: + description: The new display name for the entity context sync configuration. + example: My CrowdStrike Integration (renamed) + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigCrowdStrikeSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + type: object + SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes: + description: The CrowdStrike credentials to validate against the external entity source. + properties: + domain: + description: The domain associated with the external entity source. + example: api.crowdstrike.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeCrowdStrike" + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigCrowdStrikeSecrets" + required: + - integration_type + - domain + - secrets + type: object SecurityMonitoringDatasetAttributesRequest: description: The attributes of a dataset create or update request. properties: @@ -89357,6 +89420,61 @@ components: required: - data type: object + SecurityMonitoringEntraIdIntegrationConfigCreateAttributes: + description: The attributes of an Entra ID entity context sync configuration to create. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeEntraId" + name: + description: The display name for the entity context sync configuration. + example: My Entra ID Integration + type: string + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + - domain + - name + type: object + SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes: + description: Fields to update on an Entra ID entity context sync configuration. + properties: + domain: + description: The new domain associated with the external entity source. + example: siem-test.com + type: string + enabled: + description: Whether the entity context sync should be enabled. + example: true + type: boolean + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeEntraId" + name: + description: The new display name for the entity context sync configuration. + example: My Entra ID Integration (renamed) + type: string + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + type: object + SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes: + description: The Entra ID credentials to validate against the external entity source. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeEntraId" + required: + - integration_type + - domain + type: object SecurityMonitoringFilter: description: The rule's suppression filter. properties: @@ -89375,6 +89493,69 @@ components: x-enum-varnames: - REQUIRE - SUPPRESS + SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes: + description: The attributes of a Google Workspace entity context sync configuration to create. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeGoogleWorkspace" + name: + description: The display name for the entity context sync configuration. + example: My GWS Integration + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + - domain + - name + - secrets + type: object + SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes: + description: Fields to update on a Google Workspace entity context sync configuration. + properties: + domain: + description: The new domain associated with the external entity source. + example: siem-test.com + type: string + enabled: + description: Whether the entity context sync should be enabled. + example: true + type: boolean + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeGoogleWorkspace" + name: + description: The new display name for the entity context sync configuration. + example: My GWS Integration (renamed) + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + type: object + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes: + description: The Google Workspace credentials to validate against the external entity source. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeGoogleWorkspace" + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets" + required: + - integration_type + - domain + - secrets + type: object SecurityMonitoringIntegrationActivateAttributes: description: Overrides applied when activating the integration. All fields are optional. properties: @@ -89450,26 +89631,20 @@ components: type: object SecurityMonitoringIntegrationConfigCreateAttributes: description: The attributes of the entity context sync configuration to create. - properties: - domain: - description: The domain associated with the external entity source. - example: siem-test.com - type: string - integration_type: - $ref: "#/components/schemas/SecurityMonitoringIntegrationType" - name: - description: The display name for the entity context sync configuration. - example: My GWS Integration - type: string - secrets: - $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSecrets" - settings: - $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" - required: - - integration_type - - domain - - name - type: object + discriminator: + mapping: + CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes" + ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigCreateAttributes" + GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes" + OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigCreateAttributes" + SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes" + propertyName: integration_type + oneOf: + - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigCreateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigCreateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes" SecurityMonitoringIntegrationConfigCreateData: description: The entity context sync configuration to create. properties: @@ -89489,6 +89664,21 @@ components: required: - data type: object + SecurityMonitoringIntegrationConfigCrowdStrikeSecrets: + description: Credentials for a CrowdStrike entity context sync. + properties: + client_id: + description: The CrowdStrike API client ID. + example: abcdef0123456789abcdef0123456789 + type: string + client_secret: + description: The CrowdStrike API client secret. + example: aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABCDEF + type: string + required: + - client_id + - client_secret + type: object SecurityMonitoringIntegrationConfigData: description: An entity context sync configuration. properties: @@ -89505,6 +89695,54 @@ components: - type - attributes type: object + SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets: + description: Credentials for a Google Workspace entity context sync. + properties: + admin_email: + description: The admin email to impersonate for domain-wide delegation. + example: admin@example.com + type: string + service_account_json: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount" + required: + - service_account_json + type: object + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount: + additionalProperties: {} + description: The Google Cloud service account JSON used to authenticate against the Google Workspace Admin SDK. Additional keys beyond those documented are preserved. + properties: + client_email: + description: The service account client email. + example: svc@my-project.iam.gserviceaccount.com + type: string + private_key: + description: The service account private key. + example: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----" + type: string + project_id: + description: The Google Cloud project ID that owns the service account. + example: my-project + type: string + type: + description: The service account type. Must be `service_account`. + example: service_account + type: string + required: + - type + - project_id + - private_key + - client_email + type: object + SecurityMonitoringIntegrationConfigOktaSecrets: + description: Credentials for an Okta entity context sync. + properties: + api_token: + description: The Okta API token used to authenticate against the Okta API. + example: 00aBcDeFgHiJkLmNoPqRsTuVwXyZ + type: string + required: + - api_token + type: object SecurityMonitoringIntegrationConfigResourceType: default: integration_config description: The type of the resource. The value should always be `integration_config`. @@ -89522,13 +89760,15 @@ components: required: - data type: object - SecurityMonitoringIntegrationConfigSecrets: - additionalProperties: {} - description: |- - The secrets used to authenticate against the external entity source. The accepted keys depend on the source type - (for example, `admin_email` for Google Workspace). Not required for source types that do not use secrets (for example, `ENTRA_ID`). - example: - admin_email: test@example.com + SecurityMonitoringIntegrationConfigSentinelOneSecrets: + description: Credentials for a SentinelOne entity context sync. + properties: + api_token: + description: The SentinelOne API token. + example: aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789 + type: string + required: + - api_token type: object SecurityMonitoringIntegrationConfigSettings: additionalProperties: {} @@ -89549,27 +89789,21 @@ components: - INVALID - INITIALIZING SecurityMonitoringIntegrationConfigUpdateAttributes: - description: Fields to update on the entity context sync configuration. All fields are optional. - properties: - domain: - description: The new domain associated with the external entity source. - example: siem-test.com - type: string - enabled: - description: Whether the entity context sync should be enabled. - example: true - type: boolean - integration_type: - $ref: "#/components/schemas/SecurityMonitoringIntegrationType" - name: - description: The new display name for the entity context sync configuration. - example: My GWS Integration (renamed) - type: string - secrets: - $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSecrets" - settings: - $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" - type: object + description: Fields to update on the entity context sync configuration. All fields other than the integration type are optional. + discriminator: + mapping: + CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes" + ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes" + GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes" + OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigUpdateAttributes" + SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes" + propertyName: integration_type + oneOf: + - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigUpdateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes" SecurityMonitoringIntegrationConfigUpdateData: description: The entity context sync configuration fields to update. properties: @@ -89602,19 +89836,20 @@ components: type: object SecurityMonitoringIntegrationCredentialsValidateAttributes: description: The credentials to validate against the external entity source. - properties: - domain: - description: The domain associated with the external entity source. - example: siem-test.com - type: string - integration_type: - $ref: "#/components/schemas/SecurityMonitoringIntegrationType" - secrets: - $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSecrets" - required: - - integration_type - - domain - type: object + discriminator: + mapping: + CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes" + ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes" + GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes" + OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationCredentialsValidateAttributes" + SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes" + propertyName: integration_type + oneOf: + - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationCredentialsValidateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes" + - $ref: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes" SecurityMonitoringIntegrationCredentialsValidateData: description: The credentials to validate. properties: @@ -89640,12 +89875,56 @@ components: - GOOGLE_WORKSPACE - OKTA - ENTRA_ID + - CROWDSTRIKE + - SENTINELONE example: GOOGLE_WORKSPACE type: string x-enum-varnames: - GOOGLE_WORKSPACE - OKTA - ENTRA_ID + - CROWDSTRIKE + - SENTINELONE + SecurityMonitoringIntegrationTypeCrowdStrike: + description: The source type for a CrowdStrike entity context sync. + enum: + - CROWDSTRIKE + example: CROWDSTRIKE + type: string + x-enum-varnames: + - CROWDSTRIKE + SecurityMonitoringIntegrationTypeEntraId: + description: The source type for an Entra ID entity context sync. + enum: + - ENTRA_ID + example: ENTRA_ID + type: string + x-enum-varnames: + - ENTRA_ID + SecurityMonitoringIntegrationTypeGoogleWorkspace: + description: The source type for a Google Workspace entity context sync. + enum: + - GOOGLE_WORKSPACE + example: GOOGLE_WORKSPACE + type: string + x-enum-varnames: + - GOOGLE_WORKSPACE + SecurityMonitoringIntegrationTypeOkta: + description: The source type for an Okta entity context sync. + enum: + - OKTA + example: OKTA + type: string + x-enum-varnames: + - OKTA + SecurityMonitoringIntegrationTypeSentinelOne: + description: The source type for a SentinelOne entity context sync. + enum: + - SENTINELONE + example: SENTINELONE + type: string + x-enum-varnames: + - SENTINELONE SecurityMonitoringListRulesResponse: description: List of rules. properties: @@ -89657,6 +89936,69 @@ components: meta: $ref: "#/components/schemas/ResponseMetaAttributes" type: object + SecurityMonitoringOktaIntegrationConfigCreateAttributes: + description: The attributes of an Okta entity context sync configuration to create. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeOkta" + name: + description: The display name for the entity context sync configuration. + example: My Okta Integration + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigOktaSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + - domain + - name + - secrets + type: object + SecurityMonitoringOktaIntegrationConfigUpdateAttributes: + description: Fields to update on an Okta entity context sync configuration. + properties: + domain: + description: The new domain associated with the external entity source. + example: siem-test.com + type: string + enabled: + description: Whether the entity context sync should be enabled. + example: true + type: boolean + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeOkta" + name: + description: The new display name for the entity context sync configuration. + example: My Okta Integration (renamed) + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigOktaSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + type: object + SecurityMonitoringOktaIntegrationCredentialsValidateAttributes: + description: The Okta credentials to validate against the external entity source. + properties: + domain: + description: The domain associated with the external entity source. + example: siem-test.com + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeOkta" + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigOktaSecrets" + required: + - integration_type + - domain + - secrets + type: object SecurityMonitoringPaginatedSuppressionsResponse: description: Response object containing the available suppression rules with pagination metadata. properties: @@ -90617,6 +90959,69 @@ components: example: America/New_York type: string type: object + SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes: + description: The attributes of a SentinelOne entity context sync configuration to create. + properties: + domain: + description: The domain associated with the external entity source. + example: acme.sentinelone.net + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeSentinelOne" + name: + description: The display name for the entity context sync configuration. + example: My SentinelOne Integration + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSentinelOneSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + - domain + - name + - secrets + type: object + SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes: + description: Fields to update on a SentinelOne entity context sync configuration. + properties: + domain: + description: The new domain associated with the external entity source. + example: acme.sentinelone.net + type: string + enabled: + description: Whether the entity context sync should be enabled. + example: true + type: boolean + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeSentinelOne" + name: + description: The new display name for the entity context sync configuration. + example: My SentinelOne Integration (renamed) + type: string + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSentinelOneSecrets" + settings: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSettings" + required: + - integration_type + type: object + SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes: + description: The SentinelOne credentials to validate against the external entity source. + properties: + domain: + description: The domain associated with the external entity source. + example: acme.sentinelone.net + type: string + integration_type: + $ref: "#/components/schemas/SecurityMonitoringIntegrationTypeSentinelOne" + secrets: + $ref: "#/components/schemas/SecurityMonitoringIntegrationConfigSentinelOneSecrets" + required: + - integration_type + - domain + - secrets + type: object SecurityMonitoringSignal: description: Object description of a security signal. properties: diff --git a/examples/v2_security-monitoring_CreateSecurityMonitoringIntegrationConfig.rs b/examples/v2_security-monitoring_CreateSecurityMonitoringIntegrationConfig.rs index e5bc7fdcf..3c6c850bf 100644 --- a/examples/v2_security-monitoring_CreateSecurityMonitoringIntegrationConfig.rs +++ b/examples/v2_security-monitoring_CreateSecurityMonitoringIntegrationConfig.rs @@ -1,34 +1,45 @@ // Create an entity context sync configuration returns "OK" response use datadog_api_client::datadog; use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigCreateAttributes; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigCreateData; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigCreateRequest; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigResourceType; -use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationType; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace; use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] async fn main() { - let body = SecurityMonitoringIntegrationConfigCreateRequest::new( - SecurityMonitoringIntegrationConfigCreateData::new( - SecurityMonitoringIntegrationConfigCreateAttributes::new( - "siem-test.com".to_string(), - SecurityMonitoringIntegrationType::GOOGLE_WORKSPACE, - "My GWS Integration".to_string(), - ) - .secrets(BTreeMap::from([( - "admin_email".to_string(), - Value::from("test@example.com"), - )])) - .settings(BTreeMap::from([( - "setting1".to_string(), - Value::from("value1"), - )])), - SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, - ), - ); + let body = + SecurityMonitoringIntegrationConfigCreateRequest::new( + SecurityMonitoringIntegrationConfigCreateData::new( + SecurityMonitoringIntegrationConfigCreateAttributes + ::SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes( + Box::new( + SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes::new( + "siem-test.com".to_string(), + SecurityMonitoringIntegrationTypeGoogleWorkspace::GOOGLE_WORKSPACE, + "My GWS Integration".to_string(), + SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets::new( + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount::new( + "svc@my-project.iam.gserviceaccount.com".to_string(), + r#"-----BEGIN PRIVATE KEY----- +... +-----END PRIVATE KEY-----"#.to_string(), + "my-project".to_string(), + "service_account".to_string(), + ), + ).admin_email("admin@example.com".to_string()), + ).settings(BTreeMap::from([("setting1".to_string(), Value::from("value1"))])), + ), + ), + SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, + ), + ); let mut configuration = datadog::Configuration::new(); configuration .set_unstable_operation_enabled("v2.CreateSecurityMonitoringIntegrationConfig", true); diff --git a/examples/v2_security-monitoring_UpdateSecurityMonitoringIntegrationConfig.rs b/examples/v2_security-monitoring_UpdateSecurityMonitoringIntegrationConfig.rs index 3baba5b6e..755960120 100644 --- a/examples/v2_security-monitoring_UpdateSecurityMonitoringIntegrationConfig.rs +++ b/examples/v2_security-monitoring_UpdateSecurityMonitoringIntegrationConfig.rs @@ -1,34 +1,49 @@ // Update an entity context sync configuration returns "OK" response use datadog_api_client::datadog; use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigResourceType; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigUpdateAttributes; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigUpdateData; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigUpdateRequest; -use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationType; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace; use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] async fn main() { - let body = SecurityMonitoringIntegrationConfigUpdateRequest::new( - SecurityMonitoringIntegrationConfigUpdateData::new( - SecurityMonitoringIntegrationConfigUpdateAttributes::new() - .domain("siem-test.com".to_string()) - .enabled(true) - .integration_type(SecurityMonitoringIntegrationType::GOOGLE_WORKSPACE) - .name("My GWS Integration (renamed)".to_string()) - .secrets(BTreeMap::from([( - "admin_email".to_string(), - Value::from("test@example.com"), - )])) - .settings(BTreeMap::from([( - "setting1".to_string(), - Value::from("value1"), - )])), - SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, - ), - ); + let body = + SecurityMonitoringIntegrationConfigUpdateRequest::new( + SecurityMonitoringIntegrationConfigUpdateData::new( + SecurityMonitoringIntegrationConfigUpdateAttributes + ::SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes( + Box::new( + SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes::new( + SecurityMonitoringIntegrationTypeGoogleWorkspace::GOOGLE_WORKSPACE, + ) + .domain("siem-test.com".to_string()) + .enabled(true) + .name("My GWS Integration (renamed)".to_string()) + .secrets( + SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets::new( + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount::new( + "svc@my-project.iam.gserviceaccount.com".to_string(), + r#"-----BEGIN PRIVATE KEY----- +... +-----END PRIVATE KEY-----"#.to_string(), + "my-project".to_string(), + "service_account".to_string(), + ), + ).admin_email("admin@example.com".to_string()), + ) + .settings(BTreeMap::from([("setting1".to_string(), Value::from("value1"))])), + ), + ), + SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, + ), + ); let mut configuration = datadog::Configuration::new(); configuration .set_unstable_operation_enabled("v2.UpdateSecurityMonitoringIntegrationConfig", true); diff --git a/examples/v2_security-monitoring_ValidateSecurityMonitoringIntegrationCredentials.rs b/examples/v2_security-monitoring_ValidateSecurityMonitoringIntegrationCredentials.rs index 4f7ec2552..27a608735 100644 --- a/examples/v2_security-monitoring_ValidateSecurityMonitoringIntegrationCredentials.rs +++ b/examples/v2_security-monitoring_ValidateSecurityMonitoringIntegrationCredentials.rs @@ -1,29 +1,42 @@ // Validate entity context sync credentials returns "OK" response use datadog_api_client::datadog; use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationConfigResourceType; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationCredentialsValidateAttributes; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationCredentialsValidateData; use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationCredentialsValidateRequest; -use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationType; -use serde_json::Value; -use std::collections::BTreeMap; +use datadog_api_client::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace; #[tokio::main] async fn main() { - let body = SecurityMonitoringIntegrationCredentialsValidateRequest::new( - SecurityMonitoringIntegrationCredentialsValidateData::new( - SecurityMonitoringIntegrationCredentialsValidateAttributes::new( - "siem-test.com".to_string(), - SecurityMonitoringIntegrationType::GOOGLE_WORKSPACE, - ) - .secrets(BTreeMap::from([( - "admin_email".to_string(), - Value::from("test@example.com"), - )])), - SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, - ), - ); + let body = + SecurityMonitoringIntegrationCredentialsValidateRequest::new( + SecurityMonitoringIntegrationCredentialsValidateData::new( + SecurityMonitoringIntegrationCredentialsValidateAttributes + ::SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes( + Box::new( + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes::new( + "siem-test.com".to_string(), + SecurityMonitoringIntegrationTypeGoogleWorkspace::GOOGLE_WORKSPACE, + SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets::new( + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount::new( + "svc@my-project.iam.gserviceaccount.com".to_string(), + r#"-----BEGIN PRIVATE KEY----- +... +-----END PRIVATE KEY-----"#.to_string(), + "my-project".to_string(), + "service_account".to_string(), + ), + ).admin_email("admin@example.com".to_string()), + ), + ), + ), + SecurityMonitoringIntegrationConfigResourceType::INTEGRATION_CONFIG, + ), + ); let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled( "v2.ValidateSecurityMonitoringIntegrationCredentials", diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 52d11a5ae..448df5bc7 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -10730,6 +10730,36 @@ pub mod model_security_monitoring_integration_config_create_request; pub use self::model_security_monitoring_integration_config_create_request::SecurityMonitoringIntegrationConfigCreateRequest; pub mod model_security_monitoring_integration_config_create_data; pub use self::model_security_monitoring_integration_config_create_data::SecurityMonitoringIntegrationConfigCreateData; +pub mod model_security_monitoring_google_workspace_integration_config_create_attributes; +pub use self::model_security_monitoring_google_workspace_integration_config_create_attributes::SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes; +pub mod model_security_monitoring_integration_type_google_workspace; +pub use self::model_security_monitoring_integration_type_google_workspace::SecurityMonitoringIntegrationTypeGoogleWorkspace; +pub mod model_security_monitoring_integration_config_google_workspace_secrets; +pub use self::model_security_monitoring_integration_config_google_workspace_secrets::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets; +pub mod model_security_monitoring_integration_config_google_workspace_service_account; +pub use self::model_security_monitoring_integration_config_google_workspace_service_account::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount; +pub mod model_security_monitoring_okta_integration_config_create_attributes; +pub use self::model_security_monitoring_okta_integration_config_create_attributes::SecurityMonitoringOktaIntegrationConfigCreateAttributes; +pub mod model_security_monitoring_integration_type_okta; +pub use self::model_security_monitoring_integration_type_okta::SecurityMonitoringIntegrationTypeOkta; +pub mod model_security_monitoring_integration_config_okta_secrets; +pub use self::model_security_monitoring_integration_config_okta_secrets::SecurityMonitoringIntegrationConfigOktaSecrets; +pub mod model_security_monitoring_entra_id_integration_config_create_attributes; +pub use self::model_security_monitoring_entra_id_integration_config_create_attributes::SecurityMonitoringEntraIdIntegrationConfigCreateAttributes; +pub mod model_security_monitoring_integration_type_entra_id; +pub use self::model_security_monitoring_integration_type_entra_id::SecurityMonitoringIntegrationTypeEntraId; +pub mod model_security_monitoring_crowd_strike_integration_config_create_attributes; +pub use self::model_security_monitoring_crowd_strike_integration_config_create_attributes::SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes; +pub mod model_security_monitoring_integration_type_crowd_strike; +pub use self::model_security_monitoring_integration_type_crowd_strike::SecurityMonitoringIntegrationTypeCrowdStrike; +pub mod model_security_monitoring_integration_config_crowd_strike_secrets; +pub use self::model_security_monitoring_integration_config_crowd_strike_secrets::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets; +pub mod model_security_monitoring_sentinel_one_integration_config_create_attributes; +pub use self::model_security_monitoring_sentinel_one_integration_config_create_attributes::SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes; +pub mod model_security_monitoring_integration_type_sentinel_one; +pub use self::model_security_monitoring_integration_type_sentinel_one::SecurityMonitoringIntegrationTypeSentinelOne; +pub mod model_security_monitoring_integration_config_sentinel_one_secrets; +pub use self::model_security_monitoring_integration_config_sentinel_one_secrets::SecurityMonitoringIntegrationConfigSentinelOneSecrets; pub mod model_security_monitoring_integration_config_create_attributes; pub use self::model_security_monitoring_integration_config_create_attributes::SecurityMonitoringIntegrationConfigCreateAttributes; pub mod model_security_monitoring_integration_config_response; @@ -10748,12 +10778,32 @@ pub mod model_security_monitoring_integration_credentials_validate_request; pub use self::model_security_monitoring_integration_credentials_validate_request::SecurityMonitoringIntegrationCredentialsValidateRequest; pub mod model_security_monitoring_integration_credentials_validate_data; pub use self::model_security_monitoring_integration_credentials_validate_data::SecurityMonitoringIntegrationCredentialsValidateData; +pub mod model_security_monitoring_google_workspace_integration_credentials_validate_attributes; +pub use self::model_security_monitoring_google_workspace_integration_credentials_validate_attributes::SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes; +pub mod model_security_monitoring_okta_integration_credentials_validate_attributes; +pub use self::model_security_monitoring_okta_integration_credentials_validate_attributes::SecurityMonitoringOktaIntegrationCredentialsValidateAttributes; +pub mod model_security_monitoring_entra_id_integration_credentials_validate_attributes; +pub use self::model_security_monitoring_entra_id_integration_credentials_validate_attributes::SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes; +pub mod model_security_monitoring_crowd_strike_integration_credentials_validate_attributes; +pub use self::model_security_monitoring_crowd_strike_integration_credentials_validate_attributes::SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes; +pub mod model_security_monitoring_sentinel_one_integration_credentials_validate_attributes; +pub use self::model_security_monitoring_sentinel_one_integration_credentials_validate_attributes::SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes; pub mod model_security_monitoring_integration_credentials_validate_attributes; pub use self::model_security_monitoring_integration_credentials_validate_attributes::SecurityMonitoringIntegrationCredentialsValidateAttributes; pub mod model_security_monitoring_integration_config_update_request; pub use self::model_security_monitoring_integration_config_update_request::SecurityMonitoringIntegrationConfigUpdateRequest; pub mod model_security_monitoring_integration_config_update_data; pub use self::model_security_monitoring_integration_config_update_data::SecurityMonitoringIntegrationConfigUpdateData; +pub mod model_security_monitoring_google_workspace_integration_config_update_attributes; +pub use self::model_security_monitoring_google_workspace_integration_config_update_attributes::SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes; +pub mod model_security_monitoring_okta_integration_config_update_attributes; +pub use self::model_security_monitoring_okta_integration_config_update_attributes::SecurityMonitoringOktaIntegrationConfigUpdateAttributes; +pub mod model_security_monitoring_entra_id_integration_config_update_attributes; +pub use self::model_security_monitoring_entra_id_integration_config_update_attributes::SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes; +pub mod model_security_monitoring_crowd_strike_integration_config_update_attributes; +pub use self::model_security_monitoring_crowd_strike_integration_config_update_attributes::SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes; +pub mod model_security_monitoring_sentinel_one_integration_config_update_attributes; +pub use self::model_security_monitoring_sentinel_one_integration_config_update_attributes::SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes; pub mod model_security_monitoring_integration_config_update_attributes; pub use self::model_security_monitoring_integration_config_update_attributes::SecurityMonitoringIntegrationConfigUpdateAttributes; pub mod model_security_monitoring_integration_activate_request; diff --git a/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_create_attributes.rs new file mode 100644 index 000000000..d3ea3cba1 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_create_attributes.rs @@ -0,0 +1,163 @@ +// 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}; + +/// The attributes of a CrowdStrike entity context sync configuration to create. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a CrowdStrike entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + /// The display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: String, + /// Credentials for a CrowdStrike entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + name: String, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + ) -> SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributesVisitor { + type Value = SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + > = None; + let mut settings: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_update_attributes.rs new file mode 100644 index 000000000..5a9680c57 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_config_update_attributes.rs @@ -0,0 +1,202 @@ +// 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}; + +/// Fields to update on a CrowdStrike entity context sync configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + /// The new domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: Option, + /// Whether the entity context sync should be enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The source type for a CrowdStrike entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + /// The new display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: Option, + /// Credentials for a CrowdStrike entity context sync. + #[serde(rename = "secrets")] + pub secrets: + Option, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + pub fn new( + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + ) -> SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + domain: None, + enabled: None, + integration_type, + name: None, + secrets: None, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn secrets( + mut self, + value: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + ) -> Self { + self.secrets = Some(value); + self + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributesVisitor { + type Value = SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes; + + 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 domain: Option = None; + let mut enabled: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + > = None; + let mut settings: 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() { + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + if v.is_null() { + continue; + } + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes { + domain, + enabled, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_credentials_validate_attributes.rs new file mode 100644 index 000000000..5f03b6aab --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_crowd_strike_integration_credentials_validate_attributes.rs @@ -0,0 +1,137 @@ +// 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}; + +/// The CrowdStrike credentials to validate against the external entity source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a CrowdStrike entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + /// Credentials for a CrowdStrike entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + ) -> SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes { + SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + 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 SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributesVisitor; + impl<'a> Visitor<'a> + for SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributesVisitor + { + type Value = SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike, + > = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigCrowdStrikeSecrets, + > = 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeCrowdStrike::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "secrets" => { + secrets = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = + SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributesVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_create_attributes.rs new file mode 100644 index 000000000..d65d5f288 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_create_attributes.rs @@ -0,0 +1,150 @@ +// 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}; + +/// The attributes of an Entra ID entity context sync configuration to create. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for an Entra ID entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + /// The display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: String, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + name: String, + ) -> SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringEntraIdIntegrationConfigCreateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringEntraIdIntegrationConfigCreateAttributesVisitor { + type Value = SecurityMonitoringEntraIdIntegrationConfigCreateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + > = None; + let mut name: Option = None; + let mut settings: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + + let content = SecurityMonitoringEntraIdIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringEntraIdIntegrationConfigCreateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_update_attributes.rs new file mode 100644 index 000000000..042c57654 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_entra_id_integration_config_update_attributes.rs @@ -0,0 +1,179 @@ +// 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}; + +/// Fields to update on an Entra ID entity context sync configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + /// The new domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: Option, + /// Whether the entity context sync should be enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The source type for an Entra ID entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + /// The new display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: Option, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + pub fn new( + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + ) -> SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + domain: None, + enabled: None, + integration_type, + name: None, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringEntraIdIntegrationConfigUpdateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringEntraIdIntegrationConfigUpdateAttributesVisitor { + type Value = SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes; + + 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 domain: Option = None; + let mut enabled: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + > = None; + let mut name: Option = None; + let mut settings: 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() { + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes { + domain, + enabled, + integration_type, + name, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringEntraIdIntegrationConfigUpdateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_entra_id_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_entra_id_integration_credentials_validate_attributes.rs new file mode 100644 index 000000000..41f537204 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_entra_id_integration_credentials_validate_attributes.rs @@ -0,0 +1,119 @@ +// 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}; + +/// The Entra ID credentials to validate against the external entity source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for an Entra ID entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + ) -> SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + domain, + integration_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 SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributesVisitor { + type Value = SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId, + > = 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeEntraId::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes { + domain, + integration_type, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributesVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_create_attributes.rs new file mode 100644 index 000000000..186cfb221 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_create_attributes.rs @@ -0,0 +1,162 @@ +// 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}; + +/// The attributes of a Google Workspace entity context sync configuration to create. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a Google Workspace entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + /// The display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: String, + /// Credentials for a Google Workspace entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + name: String, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets, + ) -> SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributesVisitor { + type Value = SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + > = None; + let mut name: Option = None; + let mut secrets: Option = None; + let mut settings: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributesVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_update_attributes.rs new file mode 100644 index 000000000..df1595c9f --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_config_update_attributes.rs @@ -0,0 +1,201 @@ +// 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}; + +/// Fields to update on a Google Workspace entity context sync configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + /// The new domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: Option, + /// Whether the entity context sync should be enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The source type for a Google Workspace entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + /// The new display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: Option, + /// Credentials for a Google Workspace entity context sync. + #[serde(rename = "secrets")] + pub secrets: + Option, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + pub fn new( + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + ) -> SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + domain: None, + enabled: None, + integration_type, + name: None, + secrets: None, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn secrets( + mut self, + value: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets, + ) -> Self { + self.secrets = Some(value); + self + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributesVisitor { + type Value = SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes; + + 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 domain: Option = None; + let mut enabled: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + > = None; + let mut name: Option = None; + let mut secrets: Option = None; + let mut settings: 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() { + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + if v.is_null() { + continue; + } + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes { + domain, + enabled, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributesVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_google_workspace_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_credentials_validate_attributes.rs new file mode 100644 index 000000000..d443ed3d1 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_google_workspace_integration_credentials_validate_attributes.rs @@ -0,0 +1,135 @@ +// 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}; + +/// The Google Workspace credentials to validate against the external entity source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a Google Workspace entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + /// Credentials for a Google Workspace entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets, + ) -> SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + 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 SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributesVisitor; + impl<'a> Visitor<'a> + for SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributesVisitor + { + type Value = SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace, + > = None; + let mut secrets: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeGoogleWorkspace::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "secrets" => { + secrets = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributesVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_integration_config_create_attributes.rs index 836b12e5b..6f08032a6 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_config_create_attributes.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_config_create_attributes.rs @@ -1,76 +1,19 @@ // 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}; /// The attributes of the entity context sync configuration to create. #[non_exhaustive] -#[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct SecurityMonitoringIntegrationConfigCreateAttributes { - /// The domain associated with the external entity source. - #[serde(rename = "domain")] - pub domain: String, - /// The type of external source that provides entities to Cloud SIEM. - #[serde(rename = "integration_type")] - pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationType, - /// The display name for the entity context sync configuration. - #[serde(rename = "name")] - pub name: String, - /// The secrets used to authenticate against the external entity source. The accepted keys depend on the source type - /// (for example, `admin_email` for Google Workspace). Not required for source types that do not use secrets (for example, `ENTRA_ID`). - #[serde(rename = "secrets")] - pub secrets: Option>, - /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. - #[serde(rename = "settings")] - pub settings: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl SecurityMonitoringIntegrationConfigCreateAttributes { - pub fn new( - domain: String, - integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationType, - name: String, - ) -> SecurityMonitoringIntegrationConfigCreateAttributes { - SecurityMonitoringIntegrationConfigCreateAttributes { - domain, - integration_type, - name, - secrets: None, - settings: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn secrets(mut self, value: std::collections::BTreeMap) -> Self { - self.secrets = Some(value); - self - } - - pub fn settings( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.settings = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } +#[serde(untagged)] +pub enum SecurityMonitoringIntegrationConfigCreateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes(Box), + SecurityMonitoringOktaIntegrationConfigCreateAttributes(Box), + SecurityMonitoringEntraIdIntegrationConfigCreateAttributes(Box), + SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes(Box), + SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes(Box), + UnparsedObject(crate::datadog::UnparsedObject), } impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigCreateAttributes { @@ -78,91 +21,45 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigCreateAttribut where D: Deserializer<'de>, { - struct SecurityMonitoringIntegrationConfigCreateAttributesVisitor; - impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigCreateAttributesVisitor { - type Value = SecurityMonitoringIntegrationConfigCreateAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigCreateAttributes::SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes(_v)); } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut domain: Option = None; - let mut integration_type: Option< - crate::datadogV2::model::SecurityMonitoringIntegrationType, - > = None; - let mut name: Option = None; - let mut secrets: Option> = - None; - let mut settings: 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() { - "domain" => { - domain = 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)?); - if let Some(ref _integration_type) = integration_type { - match _integration_type { - crate::datadogV2::model::SecurityMonitoringIntegrationType::UnparsedObject(_integration_type) => { - _unparsed = true; - }, - _ => {} - } - } - } - "name" => { - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "secrets" => { - if v.is_null() { - continue; - } - secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "settings" => { - if v.is_null() { - continue; - } - settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; - let integration_type = - integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; - let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - - let content = SecurityMonitoringIntegrationConfigCreateAttributes { - domain, - integration_type, - name, - secrets, - settings, - additional_properties, - _unparsed, - }; - - Ok(content) + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigCreateAttributes::SecurityMonitoringOktaIntegrationConfigCreateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box< + crate::datadogV2::model::SecurityMonitoringEntraIdIntegrationConfigCreateAttributes, + >, + >(value.clone()) + { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigCreateAttributes::SecurityMonitoringEntraIdIntegrationConfigCreateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigCreateAttributes::SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigCreateAttributes::SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes(_v)); } } - deserializer.deserialize_any(SecurityMonitoringIntegrationConfigCreateAttributesVisitor) + return Ok( + SecurityMonitoringIntegrationConfigCreateAttributes::UnparsedObject( + crate::datadog::UnparsedObject { value }, + ), + ); } } diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_create_data.rs b/src/datadogV2/model/model_security_monitoring_integration_config_create_data.rs index 94b7f0059..c8d9cadcc 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_config_create_data.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_config_create_data.rs @@ -79,6 +79,14 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigCreateData { match k.as_str() { "attributes" => { attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _attributes) = attributes { + match _attributes { + crate::datadogV2::model::SecurityMonitoringIntegrationConfigCreateAttributes::UnparsedObject(_attributes) => { + _unparsed = true; + }, + _ => {} + } + } } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_crowd_strike_secrets.rs b/src/datadogV2/model/model_security_monitoring_integration_config_crowd_strike_secrets.rs new file mode 100644 index 000000000..4f9bf11aa --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_config_crowd_strike_secrets.rs @@ -0,0 +1,107 @@ +// 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}; + +/// Credentials for a CrowdStrike entity context sync. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + /// The CrowdStrike API client ID. + #[serde(rename = "client_id")] + pub client_id: String, + /// The CrowdStrike API client secret. + #[serde(rename = "client_secret")] + pub client_secret: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + pub fn new( + client_id: String, + client_secret: String, + ) -> SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + client_id, + client_secret, + 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 SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringIntegrationConfigCrowdStrikeSecretsVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigCrowdStrikeSecretsVisitor { + type Value = SecurityMonitoringIntegrationConfigCrowdStrikeSecrets; + + 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 client_id: Option = None; + let mut client_secret: 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() { + "client_id" => { + client_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "client_secret" => { + client_secret = + 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 client_id = client_id.ok_or_else(|| M::Error::missing_field("client_id"))?; + let client_secret = + client_secret.ok_or_else(|| M::Error::missing_field("client_secret"))?; + + let content = SecurityMonitoringIntegrationConfigCrowdStrikeSecrets { + client_id, + client_secret, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityMonitoringIntegrationConfigCrowdStrikeSecretsVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_secrets.rs b/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_secrets.rs new file mode 100644 index 000000000..7b1af7695 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_secrets.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}; + +/// Credentials for a Google Workspace entity context sync. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + /// The admin email to impersonate for domain-wide delegation. + #[serde(rename = "admin_email")] + pub admin_email: Option, + /// The Google Cloud service account JSON used to authenticate against the Google Workspace Admin SDK. Additional keys beyond those documented are preserved. + #[serde(rename = "service_account_json")] + pub service_account_json: + crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + pub fn new( + service_account_json: crate::datadogV2::model::SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount, + ) -> SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + admin_email: None, + service_account_json, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn admin_email(mut self, value: String) -> Self { + self.admin_email = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringIntegrationConfigGoogleWorkspaceSecretsVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigGoogleWorkspaceSecretsVisitor { + type Value = SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets; + + 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 admin_email: Option = None; + let mut service_account_json: 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() { + "admin_email" => { + if v.is_null() { + continue; + } + admin_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "service_account_json" => { + service_account_json = + 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 service_account_json = service_account_json + .ok_or_else(|| M::Error::missing_field("service_account_json"))?; + + let content = SecurityMonitoringIntegrationConfigGoogleWorkspaceSecrets { + admin_email, + service_account_json, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringIntegrationConfigGoogleWorkspaceSecretsVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_service_account.rs b/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_service_account.rs new file mode 100644 index 000000000..18d30f989 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_config_google_workspace_service_account.rs @@ -0,0 +1,133 @@ +// 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}; + +/// The Google Cloud service account JSON used to authenticate against the Google Workspace Admin SDK. Additional keys beyond those documented are preserved. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + /// The service account client email. + #[serde(rename = "client_email")] + pub client_email: String, + /// The service account private key. + #[serde(rename = "private_key")] + pub private_key: String, + /// The Google Cloud project ID that owns the service account. + #[serde(rename = "project_id")] + pub project_id: String, + /// The service account type. Must be `service_account`. + #[serde(rename = "type")] + pub type_: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + pub fn new( + client_email: String, + private_key: String, + project_id: String, + type_: String, + ) -> SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + client_email, + private_key, + project_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 SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccountVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccountVisitor { + type Value = SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount; + + 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 client_email: Option = None; + let mut private_key: Option = None; + let mut project_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() { + "client_email" => { + client_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "private_key" => { + private_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_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 client_email = + client_email.ok_or_else(|| M::Error::missing_field("client_email"))?; + let private_key = + private_key.ok_or_else(|| M::Error::missing_field("private_key"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccount { + client_email, + private_key, + project_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringIntegrationConfigGoogleWorkspaceServiceAccountVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_okta_secrets.rs b/src/datadogV2/model/model_security_monitoring_integration_config_okta_secrets.rs new file mode 100644 index 000000000..23cc25bf8 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_config_okta_secrets.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}; + +/// Credentials for an Okta entity context sync. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringIntegrationConfigOktaSecrets { + /// The Okta API token used to authenticate against the Okta API. + #[serde(rename = "api_token")] + pub api_token: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringIntegrationConfigOktaSecrets { + pub fn new(api_token: String) -> SecurityMonitoringIntegrationConfigOktaSecrets { + SecurityMonitoringIntegrationConfigOktaSecrets { + api_token, + 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 SecurityMonitoringIntegrationConfigOktaSecrets { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringIntegrationConfigOktaSecretsVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigOktaSecretsVisitor { + type Value = SecurityMonitoringIntegrationConfigOktaSecrets; + + 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 api_token: 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() { + "api_token" => { + api_token = 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 api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + + let content = SecurityMonitoringIntegrationConfigOktaSecrets { + api_token, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityMonitoringIntegrationConfigOktaSecretsVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_sentinel_one_secrets.rs b/src/datadogV2/model/model_security_monitoring_integration_config_sentinel_one_secrets.rs new file mode 100644 index 000000000..82b502268 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_config_sentinel_one_secrets.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}; + +/// Credentials for a SentinelOne entity context sync. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringIntegrationConfigSentinelOneSecrets { + /// The SentinelOne API token. + #[serde(rename = "api_token")] + pub api_token: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringIntegrationConfigSentinelOneSecrets { + pub fn new(api_token: String) -> SecurityMonitoringIntegrationConfigSentinelOneSecrets { + SecurityMonitoringIntegrationConfigSentinelOneSecrets { + api_token, + 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 SecurityMonitoringIntegrationConfigSentinelOneSecrets { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringIntegrationConfigSentinelOneSecretsVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigSentinelOneSecretsVisitor { + type Value = SecurityMonitoringIntegrationConfigSentinelOneSecrets; + + 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 api_token: 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() { + "api_token" => { + api_token = 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 api_token = api_token.ok_or_else(|| M::Error::missing_field("api_token"))?; + + let content = SecurityMonitoringIntegrationConfigSentinelOneSecrets { + api_token, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityMonitoringIntegrationConfigSentinelOneSecretsVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_integration_config_update_attributes.rs index 9945e6cd2..a818f514f 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_config_update_attributes.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_config_update_attributes.rs @@ -1,105 +1,19 @@ // 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}; -/// Fields to update on the entity context sync configuration. All fields are optional. +/// Fields to update on the entity context sync configuration. All fields other than the integration type are optional. #[non_exhaustive] -#[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct SecurityMonitoringIntegrationConfigUpdateAttributes { - /// The new domain associated with the external entity source. - #[serde(rename = "domain")] - pub domain: Option, - /// Whether the entity context sync should be enabled. - #[serde(rename = "enabled")] - pub enabled: Option, - /// The type of external source that provides entities to Cloud SIEM. - #[serde(rename = "integration_type")] - pub integration_type: Option, - /// The new display name for the entity context sync configuration. - #[serde(rename = "name")] - pub name: Option, - /// The secrets used to authenticate against the external entity source. The accepted keys depend on the source type - /// (for example, `admin_email` for Google Workspace). Not required for source types that do not use secrets (for example, `ENTRA_ID`). - #[serde(rename = "secrets")] - pub secrets: Option>, - /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. - #[serde(rename = "settings")] - pub settings: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl SecurityMonitoringIntegrationConfigUpdateAttributes { - pub fn new() -> SecurityMonitoringIntegrationConfigUpdateAttributes { - SecurityMonitoringIntegrationConfigUpdateAttributes { - domain: None, - enabled: None, - integration_type: None, - name: None, - secrets: None, - settings: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn domain(mut self, value: String) -> Self { - self.domain = Some(value); - self - } - - pub fn enabled(mut self, value: bool) -> Self { - self.enabled = Some(value); - self - } - - pub fn integration_type( - mut self, - value: crate::datadogV2::model::SecurityMonitoringIntegrationType, - ) -> Self { - self.integration_type = Some(value); - self - } - - pub fn name(mut self, value: String) -> Self { - self.name = Some(value); - self - } - - pub fn secrets(mut self, value: std::collections::BTreeMap) -> Self { - self.secrets = Some(value); - self - } - - pub fn settings( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.settings = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for SecurityMonitoringIntegrationConfigUpdateAttributes { - fn default() -> Self { - Self::new() - } +#[serde(untagged)] +pub enum SecurityMonitoringIntegrationConfigUpdateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes(Box), + SecurityMonitoringOktaIntegrationConfigUpdateAttributes(Box), + SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes(Box), + SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes(Box), + SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes(Box), + UnparsedObject(crate::datadog::UnparsedObject), } impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigUpdateAttributes { @@ -107,104 +21,45 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigUpdateAttribut where D: Deserializer<'de>, { - struct SecurityMonitoringIntegrationConfigUpdateAttributesVisitor; - impl<'a> Visitor<'a> for SecurityMonitoringIntegrationConfigUpdateAttributesVisitor { - type Value = SecurityMonitoringIntegrationConfigUpdateAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigUpdateAttributes::SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes(_v)); } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut domain: Option = None; - let mut enabled: Option = None; - let mut integration_type: Option< - crate::datadogV2::model::SecurityMonitoringIntegrationType, - > = None; - let mut name: Option = None; - let mut secrets: Option> = - None; - let mut settings: 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() { - "domain" => { - if v.is_null() { - continue; - } - domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "enabled" => { - if v.is_null() { - continue; - } - enabled = 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)?); - if let Some(ref _integration_type) = integration_type { - match _integration_type { - crate::datadogV2::model::SecurityMonitoringIntegrationType::UnparsedObject(_integration_type) => { - _unparsed = true; - }, - _ => {} - } - } - } - "name" => { - if v.is_null() { - continue; - } - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "secrets" => { - if v.is_null() { - continue; - } - secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "settings" => { - if v.is_null() { - continue; - } - settings = 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 = SecurityMonitoringIntegrationConfigUpdateAttributes { - domain, - enabled, - integration_type, - name, - secrets, - settings, - additional_properties, - _unparsed, - }; - - Ok(content) + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigUpdateAttributes::SecurityMonitoringOktaIntegrationConfigUpdateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box< + crate::datadogV2::model::SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes, + >, + >(value.clone()) + { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigUpdateAttributes::SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigUpdateAttributes::SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationConfigUpdateAttributes::SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes(_v)); } } - deserializer.deserialize_any(SecurityMonitoringIntegrationConfigUpdateAttributesVisitor) + return Ok( + SecurityMonitoringIntegrationConfigUpdateAttributes::UnparsedObject( + crate::datadog::UnparsedObject { value }, + ), + ); } } diff --git a/src/datadogV2/model/model_security_monitoring_integration_config_update_data.rs b/src/datadogV2/model/model_security_monitoring_integration_config_update_data.rs index d32cc8cd4..eb58987dc 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_config_update_data.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_config_update_data.rs @@ -11,7 +11,7 @@ use std::fmt::{self, Formatter}; #[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] pub struct SecurityMonitoringIntegrationConfigUpdateData { - /// Fields to update on the entity context sync configuration. All fields are optional. + /// Fields to update on the entity context sync configuration. All fields other than the integration type are optional. #[serde(rename = "attributes")] pub attributes: crate::datadogV2::model::SecurityMonitoringIntegrationConfigUpdateAttributes, /// The type of the resource. The value should always be `integration_config`. @@ -79,6 +79,14 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationConfigUpdateData { match k.as_str() { "attributes" => { attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _attributes) = attributes { + match _attributes { + crate::datadogV2::model::SecurityMonitoringIntegrationConfigUpdateAttributes::UnparsedObject(_attributes) => { + _unparsed = true; + }, + _ => {} + } + } } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); diff --git a/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_attributes.rs index 2e628fcd4..bdd8c6d60 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_attributes.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_attributes.rs @@ -1,59 +1,19 @@ // 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}; /// The credentials to validate against the external entity source. #[non_exhaustive] -#[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct SecurityMonitoringIntegrationCredentialsValidateAttributes { - /// The domain associated with the external entity source. - #[serde(rename = "domain")] - pub domain: String, - /// The type of external source that provides entities to Cloud SIEM. - #[serde(rename = "integration_type")] - pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationType, - /// The secrets used to authenticate against the external entity source. The accepted keys depend on the source type - /// (for example, `admin_email` for Google Workspace). Not required for source types that do not use secrets (for example, `ENTRA_ID`). - #[serde(rename = "secrets")] - pub secrets: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl SecurityMonitoringIntegrationCredentialsValidateAttributes { - pub fn new( - domain: String, - integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationType, - ) -> SecurityMonitoringIntegrationCredentialsValidateAttributes { - SecurityMonitoringIntegrationCredentialsValidateAttributes { - domain, - integration_type, - secrets: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn secrets(mut self, value: std::collections::BTreeMap) -> Self { - self.secrets = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } +#[serde(untagged)] +pub enum SecurityMonitoringIntegrationCredentialsValidateAttributes { + SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes(Box), + SecurityMonitoringOktaIntegrationCredentialsValidateAttributes(Box), + SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes(Box), + SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes(Box), + SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes(Box), + UnparsedObject(crate::datadog::UnparsedObject), } impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationCredentialsValidateAttributes { @@ -61,77 +21,37 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationCredentialsValidateA where D: Deserializer<'de>, { - struct SecurityMonitoringIntegrationCredentialsValidateAttributesVisitor; - impl<'a> Visitor<'a> for SecurityMonitoringIntegrationCredentialsValidateAttributesVisitor { - type Value = SecurityMonitoringIntegrationCredentialsValidateAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationCredentialsValidateAttributes::SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes(_v)); } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut domain: Option = None; - let mut integration_type: Option< - crate::datadogV2::model::SecurityMonitoringIntegrationType, - > = None; - let mut secrets: 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() { - "domain" => { - domain = 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)?); - if let Some(ref _integration_type) = integration_type { - match _integration_type { - crate::datadogV2::model::SecurityMonitoringIntegrationType::UnparsedObject(_integration_type) => { - _unparsed = true; - }, - _ => {} - } - } - } - "secrets" => { - if v.is_null() { - continue; - } - secrets = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; - let integration_type = - integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; - - let content = SecurityMonitoringIntegrationCredentialsValidateAttributes { - domain, - integration_type, - secrets, - additional_properties, - _unparsed, - }; - - Ok(content) + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationCredentialsValidateAttributes::SecurityMonitoringOktaIntegrationCredentialsValidateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationCredentialsValidateAttributes::SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationCredentialsValidateAttributes::SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(SecurityMonitoringIntegrationCredentialsValidateAttributes::SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes(_v)); } } - deserializer - .deserialize_any(SecurityMonitoringIntegrationCredentialsValidateAttributesVisitor) + return Ok( + SecurityMonitoringIntegrationCredentialsValidateAttributes::UnparsedObject( + crate::datadog::UnparsedObject { value }, + ), + ); } } diff --git a/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_data.rs b/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_data.rs index 8205ccd85..3a31a40b3 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_data.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_credentials_validate_data.rs @@ -78,6 +78,14 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationCredentialsValidateD match k.as_str() { "attributes" => { attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _attributes) = attributes { + match _attributes { + crate::datadogV2::model::SecurityMonitoringIntegrationCredentialsValidateAttributes::UnparsedObject(_attributes) => { + _unparsed = true; + }, + _ => {} + } + } } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); diff --git a/src/datadogV2/model/model_security_monitoring_integration_type.rs b/src/datadogV2/model/model_security_monitoring_integration_type.rs index ba4ad2128..1c8dc3fac 100644 --- a/src/datadogV2/model/model_security_monitoring_integration_type.rs +++ b/src/datadogV2/model/model_security_monitoring_integration_type.rs @@ -10,6 +10,8 @@ pub enum SecurityMonitoringIntegrationType { GOOGLE_WORKSPACE, OKTA, ENTRA_ID, + CROWDSTRIKE, + SENTINELONE, UnparsedObject(crate::datadog::UnparsedObject), } @@ -19,6 +21,8 @@ impl ToString for SecurityMonitoringIntegrationType { Self::GOOGLE_WORKSPACE => String::from("GOOGLE_WORKSPACE"), Self::OKTA => String::from("OKTA"), Self::ENTRA_ID => String::from("ENTRA_ID"), + Self::CROWDSTRIKE => String::from("CROWDSTRIKE"), + Self::SENTINELONE => String::from("SENTINELONE"), Self::UnparsedObject(v) => v.value.to_string(), } } @@ -46,6 +50,8 @@ impl<'de> Deserialize<'de> for SecurityMonitoringIntegrationType { "GOOGLE_WORKSPACE" => Self::GOOGLE_WORKSPACE, "OKTA" => Self::OKTA, "ENTRA_ID" => Self::ENTRA_ID, + "CROWDSTRIKE" => Self::CROWDSTRIKE, + "SENTINELONE" => Self::SENTINELONE, _ => Self::UnparsedObject(crate::datadog::UnparsedObject { value: serde_json::Value::String(s.into()), }), diff --git a/src/datadogV2/model/model_security_monitoring_integration_type_crowd_strike.rs b/src/datadogV2/model/model_security_monitoring_integration_type_crowd_strike.rs new file mode 100644 index 000000000..ac77ef63d --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_type_crowd_strike.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 SecurityMonitoringIntegrationTypeCrowdStrike { + CROWDSTRIKE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityMonitoringIntegrationTypeCrowdStrike { + fn to_string(&self) -> String { + match self { + Self::CROWDSTRIKE => String::from("CROWDSTRIKE"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityMonitoringIntegrationTypeCrowdStrike { + 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 SecurityMonitoringIntegrationTypeCrowdStrike { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "CROWDSTRIKE" => Self::CROWDSTRIKE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_type_entra_id.rs b/src/datadogV2/model/model_security_monitoring_integration_type_entra_id.rs new file mode 100644 index 000000000..1a46fa80b --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_type_entra_id.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 SecurityMonitoringIntegrationTypeEntraId { + ENTRA_ID, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityMonitoringIntegrationTypeEntraId { + fn to_string(&self) -> String { + match self { + Self::ENTRA_ID => String::from("ENTRA_ID"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityMonitoringIntegrationTypeEntraId { + 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 SecurityMonitoringIntegrationTypeEntraId { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ENTRA_ID" => Self::ENTRA_ID, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_type_google_workspace.rs b/src/datadogV2/model/model_security_monitoring_integration_type_google_workspace.rs new file mode 100644 index 000000000..26a023e13 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_type_google_workspace.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 SecurityMonitoringIntegrationTypeGoogleWorkspace { + GOOGLE_WORKSPACE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityMonitoringIntegrationTypeGoogleWorkspace { + fn to_string(&self) -> String { + match self { + Self::GOOGLE_WORKSPACE => String::from("GOOGLE_WORKSPACE"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityMonitoringIntegrationTypeGoogleWorkspace { + 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 SecurityMonitoringIntegrationTypeGoogleWorkspace { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "GOOGLE_WORKSPACE" => Self::GOOGLE_WORKSPACE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_type_okta.rs b/src/datadogV2/model/model_security_monitoring_integration_type_okta.rs new file mode 100644 index 000000000..3892cb480 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_type_okta.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 SecurityMonitoringIntegrationTypeOkta { + OKTA, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityMonitoringIntegrationTypeOkta { + fn to_string(&self) -> String { + match self { + Self::OKTA => String::from("OKTA"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityMonitoringIntegrationTypeOkta { + 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 SecurityMonitoringIntegrationTypeOkta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "OKTA" => Self::OKTA, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_integration_type_sentinel_one.rs b/src/datadogV2/model/model_security_monitoring_integration_type_sentinel_one.rs new file mode 100644 index 000000000..4871c2c3f --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_integration_type_sentinel_one.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 SecurityMonitoringIntegrationTypeSentinelOne { + SENTINELONE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityMonitoringIntegrationTypeSentinelOne { + fn to_string(&self) -> String { + match self { + Self::SENTINELONE => String::from("SENTINELONE"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityMonitoringIntegrationTypeSentinelOne { + 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 SecurityMonitoringIntegrationTypeSentinelOne { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "SENTINELONE" => Self::SENTINELONE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_okta_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_okta_integration_config_create_attributes.rs new file mode 100644 index 000000000..e0e081f5e --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_okta_integration_config_create_attributes.rs @@ -0,0 +1,162 @@ +// 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}; + +/// The attributes of an Okta entity context sync configuration to create. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringOktaIntegrationConfigCreateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for an Okta entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + /// The display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: String, + /// Credentials for an Okta entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringOktaIntegrationConfigCreateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + name: String, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + ) -> SecurityMonitoringOktaIntegrationConfigCreateAttributes { + SecurityMonitoringOktaIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringOktaIntegrationConfigCreateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringOktaIntegrationConfigCreateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringOktaIntegrationConfigCreateAttributesVisitor { + type Value = SecurityMonitoringOktaIntegrationConfigCreateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + > = None; + let mut settings: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = SecurityMonitoringOktaIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityMonitoringOktaIntegrationConfigCreateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_okta_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_okta_integration_config_update_attributes.rs new file mode 100644 index 000000000..34a7609ea --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_okta_integration_config_update_attributes.rs @@ -0,0 +1,200 @@ +// 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}; + +/// Fields to update on an Okta entity context sync configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + /// The new domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: Option, + /// Whether the entity context sync should be enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The source type for an Okta entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + /// The new display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: Option, + /// Credentials for an Okta entity context sync. + #[serde(rename = "secrets")] + pub secrets: Option, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + pub fn new( + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + ) -> SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + domain: None, + enabled: None, + integration_type, + name: None, + secrets: None, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn secrets( + mut self, + value: crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + ) -> Self { + self.secrets = Some(value); + self + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringOktaIntegrationConfigUpdateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringOktaIntegrationConfigUpdateAttributesVisitor { + type Value = SecurityMonitoringOktaIntegrationConfigUpdateAttributes; + + 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 domain: Option = None; + let mut enabled: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + > = None; + let mut settings: 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() { + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + if v.is_null() { + continue; + } + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringOktaIntegrationConfigUpdateAttributes { + domain, + enabled, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityMonitoringOktaIntegrationConfigUpdateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_okta_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_okta_integration_credentials_validate_attributes.rs new file mode 100644 index 000000000..2dd52c706 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_okta_integration_credentials_validate_attributes.rs @@ -0,0 +1,131 @@ +// 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}; + +/// The Okta credentials to validate against the external entity source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for an Okta entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + /// Credentials for an Okta entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + ) -> SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + 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 SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringOktaIntegrationCredentialsValidateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringOktaIntegrationCredentialsValidateAttributesVisitor { + type Value = SecurityMonitoringOktaIntegrationCredentialsValidateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta, + > = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigOktaSecrets, + > = 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeOkta::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "secrets" => { + secrets = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = SecurityMonitoringOktaIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringOktaIntegrationCredentialsValidateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_create_attributes.rs b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_create_attributes.rs new file mode 100644 index 000000000..0c6d5f03f --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_create_attributes.rs @@ -0,0 +1,163 @@ +// 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}; + +/// The attributes of a SentinelOne entity context sync configuration to create. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a SentinelOne entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + /// The display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: String, + /// Credentials for a SentinelOne entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + name: String, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + ) -> SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringSentinelOneIntegrationConfigCreateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringSentinelOneIntegrationConfigCreateAttributesVisitor { + type Value = SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + > = None; + let mut settings: 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes { + domain, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringSentinelOneIntegrationConfigCreateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_update_attributes.rs b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_update_attributes.rs new file mode 100644 index 000000000..8f3bb3c14 --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_config_update_attributes.rs @@ -0,0 +1,202 @@ +// 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}; + +/// Fields to update on a SentinelOne entity context sync configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + /// The new domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: Option, + /// Whether the entity context sync should be enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The source type for a SentinelOne entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + /// The new display name for the entity context sync configuration. + #[serde(rename = "name")] + pub name: Option, + /// Credentials for a SentinelOne entity context sync. + #[serde(rename = "secrets")] + pub secrets: + Option, + /// Free-form, non-sensitive settings for the entity context sync. The accepted keys depend on the source type. + #[serde(rename = "settings")] + pub settings: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + pub fn new( + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + ) -> SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + domain: None, + enabled: None, + integration_type, + name: None, + secrets: None, + settings: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn domain(mut self, value: String) -> Self { + self.domain = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn secrets( + mut self, + value: crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + ) -> Self { + self.secrets = Some(value); + self + } + + pub fn settings( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.settings = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributesVisitor; + impl<'a> Visitor<'a> for SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributesVisitor { + type Value = SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes; + + 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 domain: Option = None; + let mut enabled: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + > = None; + let mut name: Option = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + > = None; + let mut settings: 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() { + "domain" => { + if v.is_null() { + continue; + } + domain = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secrets" => { + if v.is_null() { + continue; + } + secrets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "settings" => { + if v.is_null() { + continue; + } + settings = 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 integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + + let content = SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes { + domain, + enabled, + integration_type, + name, + secrets, + settings, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_credentials_validate_attributes.rs b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_credentials_validate_attributes.rs new file mode 100644 index 000000000..5f1f4273e --- /dev/null +++ b/src/datadogV2/model/model_security_monitoring_sentinel_one_integration_credentials_validate_attributes.rs @@ -0,0 +1,137 @@ +// 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}; + +/// The SentinelOne credentials to validate against the external entity source. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes { + /// The domain associated with the external entity source. + #[serde(rename = "domain")] + pub domain: String, + /// The source type for a SentinelOne entity context sync. + #[serde(rename = "integration_type")] + pub integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + /// Credentials for a SentinelOne entity context sync. + #[serde(rename = "secrets")] + pub secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes { + pub fn new( + domain: String, + integration_type: crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + secrets: crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + ) -> SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes { + SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + 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 SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributesVisitor; + impl<'a> Visitor<'a> + for SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributesVisitor + { + type Value = SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes; + + 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 domain: Option = None; + let mut integration_type: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne, + > = None; + let mut secrets: Option< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigSentinelOneSecrets, + > = 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() { + "domain" => { + domain = 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)?); + if let Some(ref _integration_type) = integration_type { + match _integration_type { + crate::datadogV2::model::SecurityMonitoringIntegrationTypeSentinelOne::UnparsedObject(_integration_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "secrets" => { + secrets = 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 domain = domain.ok_or_else(|| M::Error::missing_field("domain"))?; + let integration_type = + integration_type.ok_or_else(|| M::Error::missing_field("integration_type"))?; + let secrets = secrets.ok_or_else(|| M::Error::missing_field("secrets"))?; + + let content = + SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes { + domain, + integration_type, + secrets, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributesVisitor, + ) + } +} diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index d81e8c9f2..c713293f4 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -1024,7 +1024,7 @@ Feature: Security Monitoring Scenario: Create an entity context sync configuration returns "Bad Request" response Given operation "CreateSecurityMonitoringIntegrationConfig" enabled And new "CreateSecurityMonitoringIntegrationConfig" request - And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration", "secrets": {"admin_email": "test@example.com"}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} When the request is sent Then the response status is 400 Bad Request @@ -1032,7 +1032,7 @@ Feature: Security Monitoring Scenario: Create an entity context sync configuration returns "OK" response Given operation "CreateSecurityMonitoringIntegrationConfig" enabled And new "CreateSecurityMonitoringIntegrationConfig" request - And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration", "secrets": {"admin_email": "test@example.com"}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} When the request is sent Then the response status is 200 OK @@ -3476,7 +3476,7 @@ Feature: Security Monitoring Given operation "UpdateSecurityMonitoringIntegrationConfig" enabled And new "UpdateSecurityMonitoringIntegrationConfig" request And request contains "integration_config_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "test@example.com"}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} When the request is sent Then the response status is 400 Bad Request @@ -3485,7 +3485,7 @@ Feature: Security Monitoring Given operation "UpdateSecurityMonitoringIntegrationConfig" enabled And new "UpdateSecurityMonitoringIntegrationConfig" request And request contains "integration_config_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "test@example.com"}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} When the request is sent Then the response status is 404 Not Found @@ -3494,7 +3494,7 @@ Feature: Security Monitoring Given operation "UpdateSecurityMonitoringIntegrationConfig" enabled And new "UpdateSecurityMonitoringIntegrationConfig" request And request contains "integration_config_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "test@example.com"}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "enabled": true, "integration_type": "GOOGLE_WORKSPACE", "name": "My GWS Integration (renamed)", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}, "settings": {"setting1": "value1"}}, "type": "integration_config"}} When the request is sent Then the response status is 200 OK @@ -3634,7 +3634,7 @@ Feature: Security Monitoring Scenario: Validate entity context sync credentials returns "Bad Request" response Given operation "ValidateSecurityMonitoringIntegrationCredentials" enabled And new "ValidateSecurityMonitoringIntegrationCredentials" request - And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "secrets": {"admin_email": "test@example.com"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}}, "type": "integration_config"}} When the request is sent Then the response status is 400 Bad Request @@ -3642,6 +3642,6 @@ Feature: Security Monitoring Scenario: Validate entity context sync credentials returns "OK" response Given operation "ValidateSecurityMonitoringIntegrationCredentials" enabled And new "ValidateSecurityMonitoringIntegrationCredentials" request - And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "secrets": {"admin_email": "test@example.com"}}, "type": "integration_config"}} + And body with value {"data": {"attributes": {"domain": "siem-test.com", "integration_type": "GOOGLE_WORKSPACE", "secrets": {"admin_email": "admin@example.com", "service_account_json": {"client_email": "svc@my-project.iam.gserviceaccount.com", "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "project_id": "my-project", "type": "service_account"}}}, "type": "integration_config"}} When the request is sent Then the response status is 200 OK