diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e1fcef0a81a..422aab5ad80 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -89430,6 +89430,57 @@ components: - NEVER_ACTIVATED - ACTIVATED - DEACTIVATED + SecurityMonitoringContentPackAppSecDetails: + description: Details for an Application Security content pack. + properties: + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackAppSecDetailsType" + required: + - type + type: object + SecurityMonitoringContentPackAppSecDetailsType: + description: Type for Application Security content pack details. + enum: + - appsec + example: appsec + type: string + x-enum-varnames: + - APPSEC + SecurityMonitoringContentPackAuditDetails: + description: Details for an audit trail content pack. + properties: + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackAuditDetailsType" + required: + - type + type: object + SecurityMonitoringContentPackAuditDetailsType: + description: Type for audit trail content pack details. + enum: + - audit + example: audit + type: string + x-enum-varnames: + - AUDIT + SecurityMonitoringContentPackEntityDetails: + description: Details for an entity or identity content pack. + properties: + cp_activation: + $ref: "#/components/schemas/SecurityMonitoringContentPackActivation" + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackEntityDetailsType" + required: + - type + - cp_activation + type: object + SecurityMonitoringContentPackEntityDetailsType: + description: Type for entity content pack details. + enum: + - entity + example: entity + type: string + x-enum-varnames: + - ENTITY SecurityMonitoringContentPackIntegrationStatus: description: The installation status of the related integration. enum: @@ -89452,16 +89503,14 @@ components: - PARTIALLY_INSTALLED - DETECTED - ERROR - SecurityMonitoringContentPackStateAttributes: - description: Attributes of a content pack state + SecurityMonitoringContentPackLogsDetails: + description: Details for a logs-based content pack. properties: - cloud_siem_index_incorrect: - description: Whether the cloud SIEM index configuration is incorrect (only applies to certain pricing models) - example: false - type: boolean cp_activation: $ref: "#/components/schemas/SecurityMonitoringContentPackActivation" - filters_configured_for_logs: + data_last_seen: + $ref: "#/components/schemas/SecurityMonitoringContentPackTimestampBucket" + filters_configured: description: |- Whether filters (Security Filters or Index Query depending on the pricing model) are present and correctly configured to route logs into Cloud SIEM. @@ -89469,21 +89518,59 @@ components: type: boolean integration_installed_status: $ref: "#/components/schemas/SecurityMonitoringContentPackIntegrationStatus" - logs_last_collected: - $ref: "#/components/schemas/SecurityMonitoringContentPackTimestampBucket" logs_seen_from_any_index: - description: Whether logs for this content pack have been seen in any Datadog index within the last 72 hours. + description: Whether logs for this content pack have been seen in any Datadog index in the last 72 hours. example: true type: boolean - state: - $ref: "#/components/schemas/SecurityMonitoringContentPackStatus" + siem_index_incorrect: + description: Whether the Cloud SIEM index configuration is incorrect (only applies to certain pricing models). + example: false + type: boolean + type: + $ref: "#/components/schemas/SecurityFilterFilteredDataType" required: - - state + - type - cp_activation + - data_last_seen + - integration_installed_status + - filters_configured - logs_seen_from_any_index - - logs_last_collected - - cloud_siem_index_incorrect - - filters_configured_for_logs + - siem_index_incorrect + type: object + SecurityMonitoringContentPackOnboardingDetails: + description: |- + Content pack details returned when Cloud SIEM is inactive for the requesting organization. + properties: + integration_installed_status: + $ref: "#/components/schemas/SecurityMonitoringContentPackIntegrationStatus" + logs_seen_from_any_index: + description: Whether logs for this content pack have been seen in any Datadog index in the last 72 hours. + example: true + type: boolean + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackOnboardingDetailsType" + required: + - type + - logs_seen_from_any_index + type: object + SecurityMonitoringContentPackOnboardingDetailsType: + description: Type for onboarding content pack details. + enum: + - onboarding + example: onboarding + type: string + x-enum-varnames: + - ONBOARDING + SecurityMonitoringContentPackStateAttributes: + description: Attributes of a content pack state. + properties: + details: + $ref: "#/components/schemas/SecurityMonitoringContentPackStateDetails" + status: + $ref: "#/components/schemas/SecurityMonitoringContentPackStatus" + required: + - status + - details type: object SecurityMonitoringContentPackStateData: description: Content pack state data. @@ -89501,13 +89588,42 @@ components: - type - attributes type: object + SecurityMonitoringContentPackStateDetails: + description: |- + Type-specific details for a content pack state. The set of fields present depends + on the content pack's `type`. When Cloud SIEM is inactive for the requesting organization, `onboarding` is returned instead of the content pack's usual type, such as `logs` or `vulnerability`.` + discriminator: + mapping: + appsec: "#/components/schemas/SecurityMonitoringContentPackAppSecDetails" + audit: "#/components/schemas/SecurityMonitoringContentPackAuditDetails" + entity: "#/components/schemas/SecurityMonitoringContentPackEntityDetails" + logs: "#/components/schemas/SecurityMonitoringContentPackLogsDetails" + onboarding: "#/components/schemas/SecurityMonitoringContentPackOnboardingDetails" + threat_intel: "#/components/schemas/SecurityMonitoringContentPackThreatIntelDetails" + vulnerability: "#/components/schemas/SecurityMonitoringContentPackVulnerabilityDetails" + propertyName: type + oneOf: + - $ref: "#/components/schemas/SecurityMonitoringContentPackLogsDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackThreatIntelDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackEntityDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackAuditDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackAppSecDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackVulnerabilityDetails" + - $ref: "#/components/schemas/SecurityMonitoringContentPackOnboardingDetails" SecurityMonitoringContentPackStateMeta: - description: Metadata for content pack states + description: Metadata for content pack states. properties: cloud_siem_index_incorrect: - description: Whether the cloud SIEM index configuration is incorrect at the organization level + description: Whether the Cloud SIEM index configuration is incorrect for the organization. example: false type: boolean + retention_months: + description: |- + The number of months that standard logs are retained for organizations on the standalone_indexed` pricing model. This field is omitted for other pricing models. + example: 15 + format: int32 + maximum: 60 + type: integer sku: $ref: "#/components/schemas/SecurityMonitoringSKU" required: @@ -89545,6 +89661,7 @@ components: - active - warning - broken + - not_configured example: active type: string x-enum-descriptions: @@ -89554,6 +89671,7 @@ components: - Activated; logs received within the last 24 hours. - Activated; integration not installed or logs last seen 24 to 72 hours ago. - Activated; no logs for over 72 hours, filter missing, or Cloud SIEM index incorrectly ordered. + - Activated, but no credentials are configured (entity content packs only). x-enum-varnames: - INSTALL - ACTIVATE @@ -89561,6 +89679,32 @@ components: - ACTIVE - WARNING - BROKEN + - NOT_CONFIGURED + SecurityMonitoringContentPackThreatIntelDetails: + description: Details for a threat intelligence content pack. + properties: + cp_activation: + $ref: "#/components/schemas/SecurityMonitoringContentPackActivation" + data_last_seen: + $ref: "#/components/schemas/SecurityMonitoringContentPackTimestampBucket" + integration_installed_status: + $ref: "#/components/schemas/SecurityMonitoringContentPackIntegrationStatus" + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackThreatIntelDetailsType" + required: + - type + - cp_activation + - data_last_seen + - integration_installed_status + type: object + SecurityMonitoringContentPackThreatIntelDetailsType: + description: Type for threat intelligence content pack details. + enum: + - threat_intel + example: threat_intel + type: string + x-enum-varnames: + - THREAT_INTEL SecurityMonitoringContentPackTimestampBucket: description: Timestamp bucket indicating when logs were last collected. enum: @@ -89583,6 +89727,31 @@ components: - WITHIN_24_TO_72_HOURS - OVER_72H_TO_30D - OVER_30D + SecurityMonitoringContentPackVulnerabilityDetails: + description: Details for a vulnerability content pack. + properties: + cp_activation: + $ref: "#/components/schemas/SecurityMonitoringContentPackActivation" + data_last_seen: + $ref: "#/components/schemas/SecurityMonitoringContentPackTimestampBucket" + integration_installed_status: + $ref: "#/components/schemas/SecurityMonitoringContentPackIntegrationStatus" + type: + $ref: "#/components/schemas/SecurityMonitoringContentPackVulnerabilityDetailsType" + required: + - type + - cp_activation + - data_last_seen + - integration_installed_status + type: object + SecurityMonitoringContentPackVulnerabilityDetailsType: + description: Type for vulnerability content pack details. + enum: + - vulnerability + example: vulnerability + type: string + x-enum-varnames: + - VULNERABILITY SecurityMonitoringCriticalAsset: description: The critical asset's properties. properties: @@ -91954,12 +92123,16 @@ components: - per_gb_analyzed - per_event_in_siem_index_2023 - add_on_2024 + - standalone_indexed + - unknown example: add_on_2024 type: string x-enum-varnames: - PER_GB_ANALYZED - PER_EVENT_IN_SIEM_INDEX_2023 - ADD_ON_2024 + - STANDALONE_INDEXED + - UNKNOWN SecurityMonitoringSchedulingOptions: description: Options for scheduled rules. When this field is present, the rule runs based on the schedule. When absent, it runs real-time on ingested logs. nullable: true @@ -183928,12 +184101,15 @@ paths: value: data: - attributes: - cloud_siem_index_incorrect: false - cp_activation: activated - filters_configured_for_logs: true - logs_last_collected: within_24_hours - logs_seen_from_any_index: true - state: active + details: + cp_activation: activated + data_last_seen: within_24_hours + filters_configured: true + integration_installed_status: installed + logs_seen_from_any_index: true + siem_index_incorrect: false + type: logs + status: active id: aws-cloudtrail type: content_pack_state meta: diff --git a/api/datadogV2/model_security_monitoring_content_pack_app_sec_details.go b/api/datadogV2/model_security_monitoring_content_pack_app_sec_details.go new file mode 100644 index 00000000000..fc5e6ad9431 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_app_sec_details.go @@ -0,0 +1,111 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackAppSecDetails Details for an Application Security content pack. +type SecurityMonitoringContentPackAppSecDetails struct { + // Type for Application Security content pack details. + Type SecurityMonitoringContentPackAppSecDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackAppSecDetails instantiates a new SecurityMonitoringContentPackAppSecDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackAppSecDetails(typeVar SecurityMonitoringContentPackAppSecDetailsType) *SecurityMonitoringContentPackAppSecDetails { + this := SecurityMonitoringContentPackAppSecDetails{} + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackAppSecDetailsWithDefaults instantiates a new SecurityMonitoringContentPackAppSecDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackAppSecDetailsWithDefaults() *SecurityMonitoringContentPackAppSecDetails { + this := SecurityMonitoringContentPackAppSecDetails{} + return &this +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackAppSecDetails) GetType() SecurityMonitoringContentPackAppSecDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackAppSecDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackAppSecDetails) GetTypeOk() (*SecurityMonitoringContentPackAppSecDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackAppSecDetails) SetType(v SecurityMonitoringContentPackAppSecDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackAppSecDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackAppSecDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Type *SecurityMonitoringContentPackAppSecDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"type"}) + } else { + return err + } + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_app_sec_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_app_sec_details_type.go new file mode 100644 index 00000000000..852cc3c2b26 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_app_sec_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackAppSecDetailsType Type for Application Security content pack details. +type SecurityMonitoringContentPackAppSecDetailsType string + +// List of SecurityMonitoringContentPackAppSecDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKAPPSECDETAILSTYPE_APPSEC SecurityMonitoringContentPackAppSecDetailsType = "appsec" +) + +var allowedSecurityMonitoringContentPackAppSecDetailsTypeEnumValues = []SecurityMonitoringContentPackAppSecDetailsType{ + SECURITYMONITORINGCONTENTPACKAPPSECDETAILSTYPE_APPSEC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackAppSecDetailsType) GetAllowedValues() []SecurityMonitoringContentPackAppSecDetailsType { + return allowedSecurityMonitoringContentPackAppSecDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackAppSecDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackAppSecDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackAppSecDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackAppSecDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackAppSecDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackAppSecDetailsType, error) { + ev := SecurityMonitoringContentPackAppSecDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackAppSecDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackAppSecDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackAppSecDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackAppSecDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackAppSecDetailsType value. +func (v SecurityMonitoringContentPackAppSecDetailsType) Ptr() *SecurityMonitoringContentPackAppSecDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_audit_details.go b/api/datadogV2/model_security_monitoring_content_pack_audit_details.go new file mode 100644 index 00000000000..c07dfce6dd9 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_audit_details.go @@ -0,0 +1,111 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackAuditDetails Details for an audit trail content pack. +type SecurityMonitoringContentPackAuditDetails struct { + // Type for audit trail content pack details. + Type SecurityMonitoringContentPackAuditDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackAuditDetails instantiates a new SecurityMonitoringContentPackAuditDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackAuditDetails(typeVar SecurityMonitoringContentPackAuditDetailsType) *SecurityMonitoringContentPackAuditDetails { + this := SecurityMonitoringContentPackAuditDetails{} + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackAuditDetailsWithDefaults instantiates a new SecurityMonitoringContentPackAuditDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackAuditDetailsWithDefaults() *SecurityMonitoringContentPackAuditDetails { + this := SecurityMonitoringContentPackAuditDetails{} + return &this +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackAuditDetails) GetType() SecurityMonitoringContentPackAuditDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackAuditDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackAuditDetails) GetTypeOk() (*SecurityMonitoringContentPackAuditDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackAuditDetails) SetType(v SecurityMonitoringContentPackAuditDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackAuditDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackAuditDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Type *SecurityMonitoringContentPackAuditDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"type"}) + } else { + return err + } + + hasInvalidField := false + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_audit_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_audit_details_type.go new file mode 100644 index 00000000000..2d1e251d9ed --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_audit_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackAuditDetailsType Type for audit trail content pack details. +type SecurityMonitoringContentPackAuditDetailsType string + +// List of SecurityMonitoringContentPackAuditDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKAUDITDETAILSTYPE_AUDIT SecurityMonitoringContentPackAuditDetailsType = "audit" +) + +var allowedSecurityMonitoringContentPackAuditDetailsTypeEnumValues = []SecurityMonitoringContentPackAuditDetailsType{ + SECURITYMONITORINGCONTENTPACKAUDITDETAILSTYPE_AUDIT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackAuditDetailsType) GetAllowedValues() []SecurityMonitoringContentPackAuditDetailsType { + return allowedSecurityMonitoringContentPackAuditDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackAuditDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackAuditDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackAuditDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackAuditDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackAuditDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackAuditDetailsType, error) { + ev := SecurityMonitoringContentPackAuditDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackAuditDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackAuditDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackAuditDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackAuditDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackAuditDetailsType value. +func (v SecurityMonitoringContentPackAuditDetailsType) Ptr() *SecurityMonitoringContentPackAuditDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_entity_details.go b/api/datadogV2/model_security_monitoring_content_pack_entity_details.go new file mode 100644 index 00000000000..7ca3cc7cef7 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_entity_details.go @@ -0,0 +1,147 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackEntityDetails Details for an entity or identity content pack. +type SecurityMonitoringContentPackEntityDetails struct { + // The activation status of a content pack. + CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` + // Type for entity content pack details. + Type SecurityMonitoringContentPackEntityDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackEntityDetails instantiates a new SecurityMonitoringContentPackEntityDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackEntityDetails(cpActivation SecurityMonitoringContentPackActivation, typeVar SecurityMonitoringContentPackEntityDetailsType) *SecurityMonitoringContentPackEntityDetails { + this := SecurityMonitoringContentPackEntityDetails{} + this.CpActivation = cpActivation + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackEntityDetailsWithDefaults instantiates a new SecurityMonitoringContentPackEntityDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackEntityDetailsWithDefaults() *SecurityMonitoringContentPackEntityDetails { + this := SecurityMonitoringContentPackEntityDetails{} + return &this +} + +// GetCpActivation returns the CpActivation field value. +func (o *SecurityMonitoringContentPackEntityDetails) GetCpActivation() SecurityMonitoringContentPackActivation { + if o == nil { + var ret SecurityMonitoringContentPackActivation + return ret + } + return o.CpActivation +} + +// GetCpActivationOk returns a tuple with the CpActivation field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackEntityDetails) GetCpActivationOk() (*SecurityMonitoringContentPackActivation, bool) { + if o == nil { + return nil, false + } + return &o.CpActivation, true +} + +// SetCpActivation sets field value. +func (o *SecurityMonitoringContentPackEntityDetails) SetCpActivation(v SecurityMonitoringContentPackActivation) { + o.CpActivation = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackEntityDetails) GetType() SecurityMonitoringContentPackEntityDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackEntityDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackEntityDetails) GetTypeOk() (*SecurityMonitoringContentPackEntityDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackEntityDetails) SetType(v SecurityMonitoringContentPackEntityDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackEntityDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["cp_activation"] = o.CpActivation + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackEntityDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CpActivation *SecurityMonitoringContentPackActivation `json:"cp_activation"` + Type *SecurityMonitoringContentPackEntityDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CpActivation == nil { + return fmt.Errorf("required field cp_activation missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cp_activation", "type"}) + } else { + return err + } + + hasInvalidField := false + if !all.CpActivation.IsValid() { + hasInvalidField = true + } else { + o.CpActivation = *all.CpActivation + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_entity_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_entity_details_type.go new file mode 100644 index 00000000000..27629ce95ea --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_entity_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackEntityDetailsType Type for entity content pack details. +type SecurityMonitoringContentPackEntityDetailsType string + +// List of SecurityMonitoringContentPackEntityDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKENTITYDETAILSTYPE_ENTITY SecurityMonitoringContentPackEntityDetailsType = "entity" +) + +var allowedSecurityMonitoringContentPackEntityDetailsTypeEnumValues = []SecurityMonitoringContentPackEntityDetailsType{ + SECURITYMONITORINGCONTENTPACKENTITYDETAILSTYPE_ENTITY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackEntityDetailsType) GetAllowedValues() []SecurityMonitoringContentPackEntityDetailsType { + return allowedSecurityMonitoringContentPackEntityDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackEntityDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackEntityDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackEntityDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackEntityDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackEntityDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackEntityDetailsType, error) { + ev := SecurityMonitoringContentPackEntityDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackEntityDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackEntityDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackEntityDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackEntityDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackEntityDetailsType value. +func (v SecurityMonitoringContentPackEntityDetailsType) Ptr() *SecurityMonitoringContentPackEntityDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_logs_details.go b/api/datadogV2/model_security_monitoring_content_pack_logs_details.go new file mode 100644 index 00000000000..82ddd49c65c --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_logs_details.go @@ -0,0 +1,316 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackLogsDetails Details for a logs-based content pack. +type SecurityMonitoringContentPackLogsDetails struct { + // The activation status of a content pack. + CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` + // Timestamp bucket indicating when logs were last collected. + DataLastSeen SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + // Whether filters (Security Filters or Index Query depending on the pricing model) are + // present and correctly configured to route logs into Cloud SIEM. + FiltersConfigured bool `json:"filters_configured"` + // The installation status of the related integration. + IntegrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + // Whether logs for this content pack have been seen in any Datadog index in the last 72 hours. + LogsSeenFromAnyIndex bool `json:"logs_seen_from_any_index"` + // Whether the Cloud SIEM index configuration is incorrect (only applies to certain pricing models). + SiemIndexIncorrect bool `json:"siem_index_incorrect"` + // The filtered data type. + Type SecurityFilterFilteredDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackLogsDetails instantiates a new SecurityMonitoringContentPackLogsDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackLogsDetails(cpActivation SecurityMonitoringContentPackActivation, dataLastSeen SecurityMonitoringContentPackTimestampBucket, filtersConfigured bool, integrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus, logsSeenFromAnyIndex bool, siemIndexIncorrect bool, typeVar SecurityFilterFilteredDataType) *SecurityMonitoringContentPackLogsDetails { + this := SecurityMonitoringContentPackLogsDetails{} + this.CpActivation = cpActivation + this.DataLastSeen = dataLastSeen + this.FiltersConfigured = filtersConfigured + this.IntegrationInstalledStatus = integrationInstalledStatus + this.LogsSeenFromAnyIndex = logsSeenFromAnyIndex + this.SiemIndexIncorrect = siemIndexIncorrect + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackLogsDetailsWithDefaults instantiates a new SecurityMonitoringContentPackLogsDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackLogsDetailsWithDefaults() *SecurityMonitoringContentPackLogsDetails { + this := SecurityMonitoringContentPackLogsDetails{} + return &this +} + +// GetCpActivation returns the CpActivation field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetCpActivation() SecurityMonitoringContentPackActivation { + if o == nil { + var ret SecurityMonitoringContentPackActivation + return ret + } + return o.CpActivation +} + +// GetCpActivationOk returns a tuple with the CpActivation field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetCpActivationOk() (*SecurityMonitoringContentPackActivation, bool) { + if o == nil { + return nil, false + } + return &o.CpActivation, true +} + +// SetCpActivation sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetCpActivation(v SecurityMonitoringContentPackActivation) { + o.CpActivation = v +} + +// GetDataLastSeen returns the DataLastSeen field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetDataLastSeen() SecurityMonitoringContentPackTimestampBucket { + if o == nil { + var ret SecurityMonitoringContentPackTimestampBucket + return ret + } + return o.DataLastSeen +} + +// GetDataLastSeenOk returns a tuple with the DataLastSeen field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetDataLastSeenOk() (*SecurityMonitoringContentPackTimestampBucket, bool) { + if o == nil { + return nil, false + } + return &o.DataLastSeen, true +} + +// SetDataLastSeen sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetDataLastSeen(v SecurityMonitoringContentPackTimestampBucket) { + o.DataLastSeen = v +} + +// GetFiltersConfigured returns the FiltersConfigured field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetFiltersConfigured() bool { + if o == nil { + var ret bool + return ret + } + return o.FiltersConfigured +} + +// GetFiltersConfiguredOk returns a tuple with the FiltersConfigured field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetFiltersConfiguredOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FiltersConfigured, true +} + +// SetFiltersConfigured sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetFiltersConfigured(v bool) { + o.FiltersConfigured = v +} + +// GetIntegrationInstalledStatus returns the IntegrationInstalledStatus field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetIntegrationInstalledStatus() SecurityMonitoringContentPackIntegrationStatus { + if o == nil { + var ret SecurityMonitoringContentPackIntegrationStatus + return ret + } + return o.IntegrationInstalledStatus +} + +// GetIntegrationInstalledStatusOk returns a tuple with the IntegrationInstalledStatus field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetIntegrationInstalledStatusOk() (*SecurityMonitoringContentPackIntegrationStatus, bool) { + if o == nil { + return nil, false + } + return &o.IntegrationInstalledStatus, true +} + +// SetIntegrationInstalledStatus sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetIntegrationInstalledStatus(v SecurityMonitoringContentPackIntegrationStatus) { + o.IntegrationInstalledStatus = v +} + +// GetLogsSeenFromAnyIndex returns the LogsSeenFromAnyIndex field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetLogsSeenFromAnyIndex() bool { + if o == nil { + var ret bool + return ret + } + return o.LogsSeenFromAnyIndex +} + +// GetLogsSeenFromAnyIndexOk returns a tuple with the LogsSeenFromAnyIndex field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetLogsSeenFromAnyIndexOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.LogsSeenFromAnyIndex, true +} + +// SetLogsSeenFromAnyIndex sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetLogsSeenFromAnyIndex(v bool) { + o.LogsSeenFromAnyIndex = v +} + +// GetSiemIndexIncorrect returns the SiemIndexIncorrect field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetSiemIndexIncorrect() bool { + if o == nil { + var ret bool + return ret + } + return o.SiemIndexIncorrect +} + +// GetSiemIndexIncorrectOk returns a tuple with the SiemIndexIncorrect field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetSiemIndexIncorrectOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.SiemIndexIncorrect, true +} + +// SetSiemIndexIncorrect sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetSiemIndexIncorrect(v bool) { + o.SiemIndexIncorrect = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackLogsDetails) GetType() SecurityFilterFilteredDataType { + if o == nil { + var ret SecurityFilterFilteredDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackLogsDetails) GetTypeOk() (*SecurityFilterFilteredDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackLogsDetails) SetType(v SecurityFilterFilteredDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackLogsDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["cp_activation"] = o.CpActivation + toSerialize["data_last_seen"] = o.DataLastSeen + toSerialize["filters_configured"] = o.FiltersConfigured + toSerialize["integration_installed_status"] = o.IntegrationInstalledStatus + toSerialize["logs_seen_from_any_index"] = o.LogsSeenFromAnyIndex + toSerialize["siem_index_incorrect"] = o.SiemIndexIncorrect + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackLogsDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CpActivation *SecurityMonitoringContentPackActivation `json:"cp_activation"` + DataLastSeen *SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + FiltersConfigured *bool `json:"filters_configured"` + IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + LogsSeenFromAnyIndex *bool `json:"logs_seen_from_any_index"` + SiemIndexIncorrect *bool `json:"siem_index_incorrect"` + Type *SecurityFilterFilteredDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CpActivation == nil { + return fmt.Errorf("required field cp_activation missing") + } + if all.DataLastSeen == nil { + return fmt.Errorf("required field data_last_seen missing") + } + if all.FiltersConfigured == nil { + return fmt.Errorf("required field filters_configured missing") + } + if all.IntegrationInstalledStatus == nil { + return fmt.Errorf("required field integration_installed_status missing") + } + if all.LogsSeenFromAnyIndex == nil { + return fmt.Errorf("required field logs_seen_from_any_index missing") + } + if all.SiemIndexIncorrect == nil { + return fmt.Errorf("required field siem_index_incorrect missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cp_activation", "data_last_seen", "filters_configured", "integration_installed_status", "logs_seen_from_any_index", "siem_index_incorrect", "type"}) + } else { + return err + } + + hasInvalidField := false + if !all.CpActivation.IsValid() { + hasInvalidField = true + } else { + o.CpActivation = *all.CpActivation + } + if !all.DataLastSeen.IsValid() { + hasInvalidField = true + } else { + o.DataLastSeen = *all.DataLastSeen + } + o.FiltersConfigured = *all.FiltersConfigured + if !all.IntegrationInstalledStatus.IsValid() { + hasInvalidField = true + } else { + o.IntegrationInstalledStatus = *all.IntegrationInstalledStatus + } + o.LogsSeenFromAnyIndex = *all.LogsSeenFromAnyIndex + o.SiemIndexIncorrect = *all.SiemIndexIncorrect + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_onboarding_details.go b/api/datadogV2/model_security_monitoring_content_pack_onboarding_details.go new file mode 100644 index 00000000000..076d88a13c3 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_onboarding_details.go @@ -0,0 +1,182 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackOnboardingDetails Content pack details returned when Cloud SIEM is inactive for the requesting organization. +type SecurityMonitoringContentPackOnboardingDetails struct { + // The installation status of the related integration. + IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status,omitempty"` + // Whether logs for this content pack have been seen in any Datadog index in the last 72 hours. + LogsSeenFromAnyIndex bool `json:"logs_seen_from_any_index"` + // Type for onboarding content pack details. + Type SecurityMonitoringContentPackOnboardingDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackOnboardingDetails instantiates a new SecurityMonitoringContentPackOnboardingDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackOnboardingDetails(logsSeenFromAnyIndex bool, typeVar SecurityMonitoringContentPackOnboardingDetailsType) *SecurityMonitoringContentPackOnboardingDetails { + this := SecurityMonitoringContentPackOnboardingDetails{} + this.LogsSeenFromAnyIndex = logsSeenFromAnyIndex + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackOnboardingDetailsWithDefaults instantiates a new SecurityMonitoringContentPackOnboardingDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackOnboardingDetailsWithDefaults() *SecurityMonitoringContentPackOnboardingDetails { + this := SecurityMonitoringContentPackOnboardingDetails{} + return &this +} + +// GetIntegrationInstalledStatus returns the IntegrationInstalledStatus field value if set, zero value otherwise. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetIntegrationInstalledStatus() SecurityMonitoringContentPackIntegrationStatus { + if o == nil || o.IntegrationInstalledStatus == nil { + var ret SecurityMonitoringContentPackIntegrationStatus + return ret + } + return *o.IntegrationInstalledStatus +} + +// GetIntegrationInstalledStatusOk returns a tuple with the IntegrationInstalledStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetIntegrationInstalledStatusOk() (*SecurityMonitoringContentPackIntegrationStatus, bool) { + if o == nil || o.IntegrationInstalledStatus == nil { + return nil, false + } + return o.IntegrationInstalledStatus, true +} + +// HasIntegrationInstalledStatus returns a boolean if a field has been set. +func (o *SecurityMonitoringContentPackOnboardingDetails) HasIntegrationInstalledStatus() bool { + return o != nil && o.IntegrationInstalledStatus != nil +} + +// SetIntegrationInstalledStatus gets a reference to the given SecurityMonitoringContentPackIntegrationStatus and assigns it to the IntegrationInstalledStatus field. +func (o *SecurityMonitoringContentPackOnboardingDetails) SetIntegrationInstalledStatus(v SecurityMonitoringContentPackIntegrationStatus) { + o.IntegrationInstalledStatus = &v +} + +// GetLogsSeenFromAnyIndex returns the LogsSeenFromAnyIndex field value. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetLogsSeenFromAnyIndex() bool { + if o == nil { + var ret bool + return ret + } + return o.LogsSeenFromAnyIndex +} + +// GetLogsSeenFromAnyIndexOk returns a tuple with the LogsSeenFromAnyIndex field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetLogsSeenFromAnyIndexOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.LogsSeenFromAnyIndex, true +} + +// SetLogsSeenFromAnyIndex sets field value. +func (o *SecurityMonitoringContentPackOnboardingDetails) SetLogsSeenFromAnyIndex(v bool) { + o.LogsSeenFromAnyIndex = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetType() SecurityMonitoringContentPackOnboardingDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackOnboardingDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackOnboardingDetails) GetTypeOk() (*SecurityMonitoringContentPackOnboardingDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackOnboardingDetails) SetType(v SecurityMonitoringContentPackOnboardingDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackOnboardingDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IntegrationInstalledStatus != nil { + toSerialize["integration_installed_status"] = o.IntegrationInstalledStatus + } + toSerialize["logs_seen_from_any_index"] = o.LogsSeenFromAnyIndex + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackOnboardingDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status,omitempty"` + LogsSeenFromAnyIndex *bool `json:"logs_seen_from_any_index"` + Type *SecurityMonitoringContentPackOnboardingDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.LogsSeenFromAnyIndex == nil { + return fmt.Errorf("required field logs_seen_from_any_index missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"integration_installed_status", "logs_seen_from_any_index", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.IntegrationInstalledStatus != nil && !all.IntegrationInstalledStatus.IsValid() { + hasInvalidField = true + } else { + o.IntegrationInstalledStatus = all.IntegrationInstalledStatus + } + o.LogsSeenFromAnyIndex = *all.LogsSeenFromAnyIndex + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_onboarding_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_onboarding_details_type.go new file mode 100644 index 00000000000..c3d9ccba389 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_onboarding_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackOnboardingDetailsType Type for onboarding content pack details. +type SecurityMonitoringContentPackOnboardingDetailsType string + +// List of SecurityMonitoringContentPackOnboardingDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKONBOARDINGDETAILSTYPE_ONBOARDING SecurityMonitoringContentPackOnboardingDetailsType = "onboarding" +) + +var allowedSecurityMonitoringContentPackOnboardingDetailsTypeEnumValues = []SecurityMonitoringContentPackOnboardingDetailsType{ + SECURITYMONITORINGCONTENTPACKONBOARDINGDETAILSTYPE_ONBOARDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackOnboardingDetailsType) GetAllowedValues() []SecurityMonitoringContentPackOnboardingDetailsType { + return allowedSecurityMonitoringContentPackOnboardingDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackOnboardingDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackOnboardingDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackOnboardingDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackOnboardingDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackOnboardingDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackOnboardingDetailsType, error) { + ev := SecurityMonitoringContentPackOnboardingDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackOnboardingDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackOnboardingDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackOnboardingDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackOnboardingDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackOnboardingDetailsType value. +func (v SecurityMonitoringContentPackOnboardingDetailsType) Ptr() *SecurityMonitoringContentPackOnboardingDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go b/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go index 39470a89cce..c9a6d0ef4a7 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go +++ b/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go @@ -10,23 +10,13 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackStateAttributes Attributes of a content pack state +// SecurityMonitoringContentPackStateAttributes Attributes of a content pack state. type SecurityMonitoringContentPackStateAttributes struct { - // Whether the cloud SIEM index configuration is incorrect (only applies to certain pricing models) - CloudSiemIndexIncorrect bool `json:"cloud_siem_index_incorrect"` - // The activation status of a content pack. - CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` - // Whether filters (Security Filters or Index Query depending on the pricing model) are - // present and correctly configured to route logs into Cloud SIEM. - FiltersConfiguredForLogs bool `json:"filters_configured_for_logs"` - // The installation status of the related integration. - IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status,omitempty"` - // Timestamp bucket indicating when logs were last collected. - LogsLastCollected SecurityMonitoringContentPackTimestampBucket `json:"logs_last_collected"` - // Whether logs for this content pack have been seen in any Datadog index within the last 72 hours. - LogsSeenFromAnyIndex bool `json:"logs_seen_from_any_index"` + // Type-specific details for a content pack state. The set of fields present depends + // on the content pack's `type`. When Cloud SIEM is inactive for the requesting organization, `onboarding` is returned instead of the content pack's usual type, such as `logs` or `vulnerability`.` + Details SecurityMonitoringContentPackStateDetails `json:"details"` // The current operational status of a content pack. - State SecurityMonitoringContentPackStatus `json:"state"` + Status SecurityMonitoringContentPackStatus `json:"status"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -36,14 +26,10 @@ type SecurityMonitoringContentPackStateAttributes struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSecurityMonitoringContentPackStateAttributes(cloudSiemIndexIncorrect bool, cpActivation SecurityMonitoringContentPackActivation, filtersConfiguredForLogs bool, logsLastCollected SecurityMonitoringContentPackTimestampBucket, logsSeenFromAnyIndex bool, state SecurityMonitoringContentPackStatus) *SecurityMonitoringContentPackStateAttributes { +func NewSecurityMonitoringContentPackStateAttributes(details SecurityMonitoringContentPackStateDetails, status SecurityMonitoringContentPackStatus) *SecurityMonitoringContentPackStateAttributes { this := SecurityMonitoringContentPackStateAttributes{} - this.CloudSiemIndexIncorrect = cloudSiemIndexIncorrect - this.CpActivation = cpActivation - this.FiltersConfiguredForLogs = filtersConfiguredForLogs - this.LogsLastCollected = logsLastCollected - this.LogsSeenFromAnyIndex = logsSeenFromAnyIndex - this.State = state + this.Details = details + this.Status = status return &this } @@ -55,170 +41,50 @@ func NewSecurityMonitoringContentPackStateAttributesWithDefaults() *SecurityMoni return &this } -// GetCloudSiemIndexIncorrect returns the CloudSiemIndexIncorrect field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetCloudSiemIndexIncorrect() bool { +// GetDetails returns the Details field value. +func (o *SecurityMonitoringContentPackStateAttributes) GetDetails() SecurityMonitoringContentPackStateDetails { if o == nil { - var ret bool + var ret SecurityMonitoringContentPackStateDetails return ret } - return o.CloudSiemIndexIncorrect + return o.Details } -// GetCloudSiemIndexIncorrectOk returns a tuple with the CloudSiemIndexIncorrect field value +// GetDetailsOk returns a tuple with the Details field value // and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetCloudSiemIndexIncorrectOk() (*bool, bool) { +func (o *SecurityMonitoringContentPackStateAttributes) GetDetailsOk() (*SecurityMonitoringContentPackStateDetails, bool) { if o == nil { return nil, false } - return &o.CloudSiemIndexIncorrect, true + return &o.Details, true } -// SetCloudSiemIndexIncorrect sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetCloudSiemIndexIncorrect(v bool) { - o.CloudSiemIndexIncorrect = v +// SetDetails sets field value. +func (o *SecurityMonitoringContentPackStateAttributes) SetDetails(v SecurityMonitoringContentPackStateDetails) { + o.Details = v } -// GetCpActivation returns the CpActivation field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetCpActivation() SecurityMonitoringContentPackActivation { - if o == nil { - var ret SecurityMonitoringContentPackActivation - return ret - } - return o.CpActivation -} - -// GetCpActivationOk returns a tuple with the CpActivation field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetCpActivationOk() (*SecurityMonitoringContentPackActivation, bool) { - if o == nil { - return nil, false - } - return &o.CpActivation, true -} - -// SetCpActivation sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetCpActivation(v SecurityMonitoringContentPackActivation) { - o.CpActivation = v -} - -// GetFiltersConfiguredForLogs returns the FiltersConfiguredForLogs field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetFiltersConfiguredForLogs() bool { - if o == nil { - var ret bool - return ret - } - return o.FiltersConfiguredForLogs -} - -// GetFiltersConfiguredForLogsOk returns a tuple with the FiltersConfiguredForLogs field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetFiltersConfiguredForLogsOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.FiltersConfiguredForLogs, true -} - -// SetFiltersConfiguredForLogs sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetFiltersConfiguredForLogs(v bool) { - o.FiltersConfiguredForLogs = v -} - -// GetIntegrationInstalledStatus returns the IntegrationInstalledStatus field value if set, zero value otherwise. -func (o *SecurityMonitoringContentPackStateAttributes) GetIntegrationInstalledStatus() SecurityMonitoringContentPackIntegrationStatus { - if o == nil || o.IntegrationInstalledStatus == nil { - var ret SecurityMonitoringContentPackIntegrationStatus - return ret - } - return *o.IntegrationInstalledStatus -} - -// GetIntegrationInstalledStatusOk returns a tuple with the IntegrationInstalledStatus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetIntegrationInstalledStatusOk() (*SecurityMonitoringContentPackIntegrationStatus, bool) { - if o == nil || o.IntegrationInstalledStatus == nil { - return nil, false - } - return o.IntegrationInstalledStatus, true -} - -// HasIntegrationInstalledStatus returns a boolean if a field has been set. -func (o *SecurityMonitoringContentPackStateAttributes) HasIntegrationInstalledStatus() bool { - return o != nil && o.IntegrationInstalledStatus != nil -} - -// SetIntegrationInstalledStatus gets a reference to the given SecurityMonitoringContentPackIntegrationStatus and assigns it to the IntegrationInstalledStatus field. -func (o *SecurityMonitoringContentPackStateAttributes) SetIntegrationInstalledStatus(v SecurityMonitoringContentPackIntegrationStatus) { - o.IntegrationInstalledStatus = &v -} - -// GetLogsLastCollected returns the LogsLastCollected field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetLogsLastCollected() SecurityMonitoringContentPackTimestampBucket { - if o == nil { - var ret SecurityMonitoringContentPackTimestampBucket - return ret - } - return o.LogsLastCollected -} - -// GetLogsLastCollectedOk returns a tuple with the LogsLastCollected field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetLogsLastCollectedOk() (*SecurityMonitoringContentPackTimestampBucket, bool) { - if o == nil { - return nil, false - } - return &o.LogsLastCollected, true -} - -// SetLogsLastCollected sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetLogsLastCollected(v SecurityMonitoringContentPackTimestampBucket) { - o.LogsLastCollected = v -} - -// GetLogsSeenFromAnyIndex returns the LogsSeenFromAnyIndex field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetLogsSeenFromAnyIndex() bool { - if o == nil { - var ret bool - return ret - } - return o.LogsSeenFromAnyIndex -} - -// GetLogsSeenFromAnyIndexOk returns a tuple with the LogsSeenFromAnyIndex field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetLogsSeenFromAnyIndexOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.LogsSeenFromAnyIndex, true -} - -// SetLogsSeenFromAnyIndex sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetLogsSeenFromAnyIndex(v bool) { - o.LogsSeenFromAnyIndex = v -} - -// GetState returns the State field value. -func (o *SecurityMonitoringContentPackStateAttributes) GetState() SecurityMonitoringContentPackStatus { +// GetStatus returns the Status field value. +func (o *SecurityMonitoringContentPackStateAttributes) GetStatus() SecurityMonitoringContentPackStatus { if o == nil { var ret SecurityMonitoringContentPackStatus return ret } - return o.State + return o.Status } -// GetStateOk returns a tuple with the State field value +// GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. -func (o *SecurityMonitoringContentPackStateAttributes) GetStateOk() (*SecurityMonitoringContentPackStatus, bool) { +func (o *SecurityMonitoringContentPackStateAttributes) GetStatusOk() (*SecurityMonitoringContentPackStatus, bool) { if o == nil { return nil, false } - return &o.State, true + return &o.Status, true } -// SetState sets field value. -func (o *SecurityMonitoringContentPackStateAttributes) SetState(v SecurityMonitoringContentPackStatus) { - o.State = v +// SetStatus sets field value. +func (o *SecurityMonitoringContentPackStateAttributes) SetStatus(v SecurityMonitoringContentPackStatus) { + o.Status = v } // MarshalJSON serializes the struct using spec logic. @@ -227,15 +93,8 @@ func (o SecurityMonitoringContentPackStateAttributes) MarshalJSON() ([]byte, err if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["cloud_siem_index_incorrect"] = o.CloudSiemIndexIncorrect - toSerialize["cp_activation"] = o.CpActivation - toSerialize["filters_configured_for_logs"] = o.FiltersConfiguredForLogs - if o.IntegrationInstalledStatus != nil { - toSerialize["integration_installed_status"] = o.IntegrationInstalledStatus - } - toSerialize["logs_last_collected"] = o.LogsLastCollected - toSerialize["logs_seen_from_any_index"] = o.LogsSeenFromAnyIndex - toSerialize["state"] = o.State + toSerialize["details"] = o.Details + toSerialize["status"] = o.Status for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -246,65 +105,31 @@ func (o SecurityMonitoringContentPackStateAttributes) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringContentPackStateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - CloudSiemIndexIncorrect *bool `json:"cloud_siem_index_incorrect"` - CpActivation *SecurityMonitoringContentPackActivation `json:"cp_activation"` - FiltersConfiguredForLogs *bool `json:"filters_configured_for_logs"` - IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status,omitempty"` - LogsLastCollected *SecurityMonitoringContentPackTimestampBucket `json:"logs_last_collected"` - LogsSeenFromAnyIndex *bool `json:"logs_seen_from_any_index"` - State *SecurityMonitoringContentPackStatus `json:"state"` + Details *SecurityMonitoringContentPackStateDetails `json:"details"` + Status *SecurityMonitoringContentPackStatus `json:"status"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if all.CloudSiemIndexIncorrect == nil { - return fmt.Errorf("required field cloud_siem_index_incorrect missing") - } - if all.CpActivation == nil { - return fmt.Errorf("required field cp_activation missing") - } - if all.FiltersConfiguredForLogs == nil { - return fmt.Errorf("required field filters_configured_for_logs missing") - } - if all.LogsLastCollected == nil { - return fmt.Errorf("required field logs_last_collected missing") - } - if all.LogsSeenFromAnyIndex == nil { - return fmt.Errorf("required field logs_seen_from_any_index missing") + if all.Details == nil { + return fmt.Errorf("required field details missing") } - if all.State == nil { - return fmt.Errorf("required field state missing") + if all.Status == nil { + return fmt.Errorf("required field status missing") } additionalProperties := make(map[string]interface{}) if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"cloud_siem_index_incorrect", "cp_activation", "filters_configured_for_logs", "integration_installed_status", "logs_last_collected", "logs_seen_from_any_index", "state"}) + datadog.DeleteKeys(additionalProperties, &[]string{"details", "status"}) } else { return err } hasInvalidField := false - o.CloudSiemIndexIncorrect = *all.CloudSiemIndexIncorrect - if !all.CpActivation.IsValid() { - hasInvalidField = true - } else { - o.CpActivation = *all.CpActivation - } - o.FiltersConfiguredForLogs = *all.FiltersConfiguredForLogs - if all.IntegrationInstalledStatus != nil && !all.IntegrationInstalledStatus.IsValid() { - hasInvalidField = true - } else { - o.IntegrationInstalledStatus = all.IntegrationInstalledStatus - } - if !all.LogsLastCollected.IsValid() { - hasInvalidField = true - } else { - o.LogsLastCollected = *all.LogsLastCollected - } - o.LogsSeenFromAnyIndex = *all.LogsSeenFromAnyIndex - if !all.State.IsValid() { + o.Details = *all.Details + if !all.Status.IsValid() { hasInvalidField = true } else { - o.State = *all.State + o.Status = *all.Status } if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_data.go b/api/datadogV2/model_security_monitoring_content_pack_state_data.go index 3d7b1be851b..3ce3b51381a 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_state_data.go +++ b/api/datadogV2/model_security_monitoring_content_pack_state_data.go @@ -12,7 +12,7 @@ import ( // SecurityMonitoringContentPackStateData Content pack state data. type SecurityMonitoringContentPackStateData struct { - // Attributes of a content pack state + // Attributes of a content pack state. Attributes SecurityMonitoringContentPackStateAttributes `json:"attributes"` // The content pack identifier. Id string `json:"id"` diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_details.go b/api/datadogV2/model_security_monitoring_content_pack_state_details.go new file mode 100644 index 00000000000..d10c93dee8e --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_state_details.go @@ -0,0 +1,220 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackStateDetails - Type-specific details for a content pack state. The set of fields present depends +// on the content pack's `type`. When Cloud SIEM is inactive for the requesting organization, `onboarding` is returned instead of the content pack's usual type, such as `logs` or `vulnerability`.` +type SecurityMonitoringContentPackStateDetails struct { + SecurityMonitoringContentPackLogsDetails *SecurityMonitoringContentPackLogsDetails + SecurityMonitoringContentPackThreatIntelDetails *SecurityMonitoringContentPackThreatIntelDetails + SecurityMonitoringContentPackEntityDetails *SecurityMonitoringContentPackEntityDetails + SecurityMonitoringContentPackAuditDetails *SecurityMonitoringContentPackAuditDetails + SecurityMonitoringContentPackAppSecDetails *SecurityMonitoringContentPackAppSecDetails + SecurityMonitoringContentPackVulnerabilityDetails *SecurityMonitoringContentPackVulnerabilityDetails + SecurityMonitoringContentPackOnboardingDetails *SecurityMonitoringContentPackOnboardingDetails + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SecurityMonitoringContentPackLogsDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackLogsDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackLogsDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackLogsDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackLogsDetails: v} +} + +// SecurityMonitoringContentPackThreatIntelDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackThreatIntelDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackThreatIntelDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackThreatIntelDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackThreatIntelDetails: v} +} + +// SecurityMonitoringContentPackEntityDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackEntityDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackEntityDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackEntityDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackEntityDetails: v} +} + +// SecurityMonitoringContentPackAuditDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackAuditDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackAuditDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackAuditDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackAuditDetails: v} +} + +// SecurityMonitoringContentPackAppSecDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackAppSecDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackAppSecDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackAppSecDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackAppSecDetails: v} +} + +// SecurityMonitoringContentPackVulnerabilityDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackVulnerabilityDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackVulnerabilityDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackVulnerabilityDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackVulnerabilityDetails: v} +} + +// SecurityMonitoringContentPackOnboardingDetailsAsSecurityMonitoringContentPackStateDetails is a convenience function that returns SecurityMonitoringContentPackOnboardingDetails wrapped in SecurityMonitoringContentPackStateDetails. +func SecurityMonitoringContentPackOnboardingDetailsAsSecurityMonitoringContentPackStateDetails(v *SecurityMonitoringContentPackOnboardingDetails) SecurityMonitoringContentPackStateDetails { + return SecurityMonitoringContentPackStateDetails{SecurityMonitoringContentPackOnboardingDetails: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SecurityMonitoringContentPackStateDetails) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = datadog.Unmarshal(data, &jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup.") + } + // check if the discriminator value is 'appsec' + if jsonDict["type"] == "appsec" { + // try to unmarshal JSON data into SecurityMonitoringContentPackAppSecDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackAppSecDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackAppSecDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackAppSecDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackAppSecDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'audit' + if jsonDict["type"] == "audit" { + // try to unmarshal JSON data into SecurityMonitoringContentPackAuditDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackAuditDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackAuditDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackAuditDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackAuditDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'entity' + if jsonDict["type"] == "entity" { + // try to unmarshal JSON data into SecurityMonitoringContentPackEntityDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackEntityDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackEntityDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackEntityDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackEntityDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'logs' + if jsonDict["type"] == "logs" { + // try to unmarshal JSON data into SecurityMonitoringContentPackLogsDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackLogsDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackLogsDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackLogsDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackLogsDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'onboarding' + if jsonDict["type"] == "onboarding" { + // try to unmarshal JSON data into SecurityMonitoringContentPackOnboardingDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackOnboardingDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackOnboardingDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackOnboardingDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackOnboardingDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'threat_intel' + if jsonDict["type"] == "threat_intel" { + // try to unmarshal JSON data into SecurityMonitoringContentPackThreatIntelDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackThreatIntelDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackThreatIntelDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackThreatIntelDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackThreatIntelDetails: %s", err.Error()) + } + } + // check if the discriminator value is 'vulnerability' + if jsonDict["type"] == "vulnerability" { + // try to unmarshal JSON data into SecurityMonitoringContentPackVulnerabilityDetails + err = datadog.Unmarshal(data, &obj.SecurityMonitoringContentPackVulnerabilityDetails) + if err == nil { + return nil // data stored in obj.SecurityMonitoringContentPackVulnerabilityDetails, return on the first match + } else { + obj.SecurityMonitoringContentPackVulnerabilityDetails = nil + return fmt.Errorf("failed to unmarshal SecurityMonitoringContentPackStateDetails as SecurityMonitoringContentPackVulnerabilityDetails: %s", err.Error()) + } + } + return nil +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SecurityMonitoringContentPackStateDetails) MarshalJSON() ([]byte, error) { + if obj.SecurityMonitoringContentPackLogsDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackLogsDetails) + } + + if obj.SecurityMonitoringContentPackThreatIntelDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackThreatIntelDetails) + } + + if obj.SecurityMonitoringContentPackEntityDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackEntityDetails) + } + + if obj.SecurityMonitoringContentPackAuditDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackAuditDetails) + } + + if obj.SecurityMonitoringContentPackAppSecDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackAppSecDetails) + } + + if obj.SecurityMonitoringContentPackVulnerabilityDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackVulnerabilityDetails) + } + + if obj.SecurityMonitoringContentPackOnboardingDetails != nil { + return datadog.Marshal(&obj.SecurityMonitoringContentPackOnboardingDetails) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SecurityMonitoringContentPackStateDetails) GetActualInstance() interface{} { + if obj.SecurityMonitoringContentPackLogsDetails != nil { + return obj.SecurityMonitoringContentPackLogsDetails + } + + if obj.SecurityMonitoringContentPackThreatIntelDetails != nil { + return obj.SecurityMonitoringContentPackThreatIntelDetails + } + + if obj.SecurityMonitoringContentPackEntityDetails != nil { + return obj.SecurityMonitoringContentPackEntityDetails + } + + if obj.SecurityMonitoringContentPackAuditDetails != nil { + return obj.SecurityMonitoringContentPackAuditDetails + } + + if obj.SecurityMonitoringContentPackAppSecDetails != nil { + return obj.SecurityMonitoringContentPackAppSecDetails + } + + if obj.SecurityMonitoringContentPackVulnerabilityDetails != nil { + return obj.SecurityMonitoringContentPackVulnerabilityDetails + } + + if obj.SecurityMonitoringContentPackOnboardingDetails != nil { + return obj.SecurityMonitoringContentPackOnboardingDetails + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_state_meta.go b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go index f95dcdaebda..bda10381beb 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_state_meta.go +++ b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go @@ -10,10 +10,12 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SecurityMonitoringContentPackStateMeta Metadata for content pack states +// SecurityMonitoringContentPackStateMeta Metadata for content pack states. type SecurityMonitoringContentPackStateMeta struct { - // Whether the cloud SIEM index configuration is incorrect at the organization level + // Whether the Cloud SIEM index configuration is incorrect for the organization. CloudSiemIndexIncorrect bool `json:"cloud_siem_index_incorrect"` + // The number of months that standard logs are retained for organizations on the standalone_indexed` pricing model. This field is omitted for other pricing models. + RetentionMonths *int32 `json:"retention_months,omitempty"` // The Cloud SIEM pricing model (SKU) for the organization. Sku SecurityMonitoringSKU `json:"sku"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -63,6 +65,34 @@ func (o *SecurityMonitoringContentPackStateMeta) SetCloudSiemIndexIncorrect(v bo o.CloudSiemIndexIncorrect = v } +// GetRetentionMonths returns the RetentionMonths field value if set, zero value otherwise. +func (o *SecurityMonitoringContentPackStateMeta) GetRetentionMonths() int32 { + if o == nil || o.RetentionMonths == nil { + var ret int32 + return ret + } + return *o.RetentionMonths +} + +// GetRetentionMonthsOk returns a tuple with the RetentionMonths field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateMeta) GetRetentionMonthsOk() (*int32, bool) { + if o == nil || o.RetentionMonths == nil { + return nil, false + } + return o.RetentionMonths, true +} + +// HasRetentionMonths returns a boolean if a field has been set. +func (o *SecurityMonitoringContentPackStateMeta) HasRetentionMonths() bool { + return o != nil && o.RetentionMonths != nil +} + +// SetRetentionMonths gets a reference to the given int32 and assigns it to the RetentionMonths field. +func (o *SecurityMonitoringContentPackStateMeta) SetRetentionMonths(v int32) { + o.RetentionMonths = &v +} + // GetSku returns the Sku field value. func (o *SecurityMonitoringContentPackStateMeta) GetSku() SecurityMonitoringSKU { if o == nil { @@ -93,6 +123,9 @@ func (o SecurityMonitoringContentPackStateMeta) MarshalJSON() ([]byte, error) { return datadog.Marshal(o.UnparsedObject) } toSerialize["cloud_siem_index_incorrect"] = o.CloudSiemIndexIncorrect + if o.RetentionMonths != nil { + toSerialize["retention_months"] = o.RetentionMonths + } toSerialize["sku"] = o.Sku for key, value := range o.AdditionalProperties { @@ -105,6 +138,7 @@ func (o SecurityMonitoringContentPackStateMeta) MarshalJSON() ([]byte, error) { func (o *SecurityMonitoringContentPackStateMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { CloudSiemIndexIncorrect *bool `json:"cloud_siem_index_incorrect"` + RetentionMonths *int32 `json:"retention_months,omitempty"` Sku *SecurityMonitoringSKU `json:"sku"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { @@ -118,13 +152,14 @@ func (o *SecurityMonitoringContentPackStateMeta) UnmarshalJSON(bytes []byte) (er } additionalProperties := make(map[string]interface{}) if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"cloud_siem_index_incorrect", "sku"}) + datadog.DeleteKeys(additionalProperties, &[]string{"cloud_siem_index_incorrect", "retention_months", "sku"}) } else { return err } hasInvalidField := false o.CloudSiemIndexIncorrect = *all.CloudSiemIndexIncorrect + o.RetentionMonths = all.RetentionMonths if !all.Sku.IsValid() { hasInvalidField = true } else { diff --git a/api/datadogV2/model_security_monitoring_content_pack_states_response.go b/api/datadogV2/model_security_monitoring_content_pack_states_response.go index fa0065b5e4b..1577cffe842 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_states_response.go +++ b/api/datadogV2/model_security_monitoring_content_pack_states_response.go @@ -14,7 +14,7 @@ import ( type SecurityMonitoringContentPackStatesResponse struct { // Array of content pack states. Data []SecurityMonitoringContentPackStateData `json:"data"` - // Metadata for content pack states + // Metadata for content pack states. Meta SecurityMonitoringContentPackStateMeta `json:"meta"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_security_monitoring_content_pack_status.go b/api/datadogV2/model_security_monitoring_content_pack_status.go index 850ff7bc235..b2c02cc2f84 100644 --- a/api/datadogV2/model_security_monitoring_content_pack_status.go +++ b/api/datadogV2/model_security_monitoring_content_pack_status.go @@ -15,12 +15,13 @@ type SecurityMonitoringContentPackStatus string // List of SecurityMonitoringContentPackStatus. const ( - SECURITYMONITORINGCONTENTPACKSTATUS_INSTALL SecurityMonitoringContentPackStatus = "install" - SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVATE SecurityMonitoringContentPackStatus = "activate" - SECURITYMONITORINGCONTENTPACKSTATUS_INITIALIZING SecurityMonitoringContentPackStatus = "initializing" - SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVE SecurityMonitoringContentPackStatus = "active" - SECURITYMONITORINGCONTENTPACKSTATUS_WARNING SecurityMonitoringContentPackStatus = "warning" - SECURITYMONITORINGCONTENTPACKSTATUS_BROKEN SecurityMonitoringContentPackStatus = "broken" + SECURITYMONITORINGCONTENTPACKSTATUS_INSTALL SecurityMonitoringContentPackStatus = "install" + SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVATE SecurityMonitoringContentPackStatus = "activate" + SECURITYMONITORINGCONTENTPACKSTATUS_INITIALIZING SecurityMonitoringContentPackStatus = "initializing" + SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVE SecurityMonitoringContentPackStatus = "active" + SECURITYMONITORINGCONTENTPACKSTATUS_WARNING SecurityMonitoringContentPackStatus = "warning" + SECURITYMONITORINGCONTENTPACKSTATUS_BROKEN SecurityMonitoringContentPackStatus = "broken" + SECURITYMONITORINGCONTENTPACKSTATUS_NOT_CONFIGURED SecurityMonitoringContentPackStatus = "not_configured" ) var allowedSecurityMonitoringContentPackStatusEnumValues = []SecurityMonitoringContentPackStatus{ @@ -30,6 +31,7 @@ var allowedSecurityMonitoringContentPackStatusEnumValues = []SecurityMonitoringC SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVE, SECURITYMONITORINGCONTENTPACKSTATUS_WARNING, SECURITYMONITORINGCONTENTPACKSTATUS_BROKEN, + SECURITYMONITORINGCONTENTPACKSTATUS_NOT_CONFIGURED, } // GetAllowedValues reeturns the list of possible values. diff --git a/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details.go b/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details.go new file mode 100644 index 00000000000..9c33d6b1eac --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details.go @@ -0,0 +1,219 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackThreatIntelDetails Details for a threat intelligence content pack. +type SecurityMonitoringContentPackThreatIntelDetails struct { + // The activation status of a content pack. + CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` + // Timestamp bucket indicating when logs were last collected. + DataLastSeen SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + // The installation status of the related integration. + IntegrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + // Type for threat intelligence content pack details. + Type SecurityMonitoringContentPackThreatIntelDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackThreatIntelDetails instantiates a new SecurityMonitoringContentPackThreatIntelDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackThreatIntelDetails(cpActivation SecurityMonitoringContentPackActivation, dataLastSeen SecurityMonitoringContentPackTimestampBucket, integrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus, typeVar SecurityMonitoringContentPackThreatIntelDetailsType) *SecurityMonitoringContentPackThreatIntelDetails { + this := SecurityMonitoringContentPackThreatIntelDetails{} + this.CpActivation = cpActivation + this.DataLastSeen = dataLastSeen + this.IntegrationInstalledStatus = integrationInstalledStatus + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackThreatIntelDetailsWithDefaults instantiates a new SecurityMonitoringContentPackThreatIntelDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackThreatIntelDetailsWithDefaults() *SecurityMonitoringContentPackThreatIntelDetails { + this := SecurityMonitoringContentPackThreatIntelDetails{} + return &this +} + +// GetCpActivation returns the CpActivation field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetCpActivation() SecurityMonitoringContentPackActivation { + if o == nil { + var ret SecurityMonitoringContentPackActivation + return ret + } + return o.CpActivation +} + +// GetCpActivationOk returns a tuple with the CpActivation field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetCpActivationOk() (*SecurityMonitoringContentPackActivation, bool) { + if o == nil { + return nil, false + } + return &o.CpActivation, true +} + +// SetCpActivation sets field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) SetCpActivation(v SecurityMonitoringContentPackActivation) { + o.CpActivation = v +} + +// GetDataLastSeen returns the DataLastSeen field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetDataLastSeen() SecurityMonitoringContentPackTimestampBucket { + if o == nil { + var ret SecurityMonitoringContentPackTimestampBucket + return ret + } + return o.DataLastSeen +} + +// GetDataLastSeenOk returns a tuple with the DataLastSeen field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetDataLastSeenOk() (*SecurityMonitoringContentPackTimestampBucket, bool) { + if o == nil { + return nil, false + } + return &o.DataLastSeen, true +} + +// SetDataLastSeen sets field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) SetDataLastSeen(v SecurityMonitoringContentPackTimestampBucket) { + o.DataLastSeen = v +} + +// GetIntegrationInstalledStatus returns the IntegrationInstalledStatus field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetIntegrationInstalledStatus() SecurityMonitoringContentPackIntegrationStatus { + if o == nil { + var ret SecurityMonitoringContentPackIntegrationStatus + return ret + } + return o.IntegrationInstalledStatus +} + +// GetIntegrationInstalledStatusOk returns a tuple with the IntegrationInstalledStatus field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetIntegrationInstalledStatusOk() (*SecurityMonitoringContentPackIntegrationStatus, bool) { + if o == nil { + return nil, false + } + return &o.IntegrationInstalledStatus, true +} + +// SetIntegrationInstalledStatus sets field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) SetIntegrationInstalledStatus(v SecurityMonitoringContentPackIntegrationStatus) { + o.IntegrationInstalledStatus = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetType() SecurityMonitoringContentPackThreatIntelDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackThreatIntelDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackThreatIntelDetails) GetTypeOk() (*SecurityMonitoringContentPackThreatIntelDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackThreatIntelDetails) SetType(v SecurityMonitoringContentPackThreatIntelDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackThreatIntelDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["cp_activation"] = o.CpActivation + toSerialize["data_last_seen"] = o.DataLastSeen + toSerialize["integration_installed_status"] = o.IntegrationInstalledStatus + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackThreatIntelDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CpActivation *SecurityMonitoringContentPackActivation `json:"cp_activation"` + DataLastSeen *SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + Type *SecurityMonitoringContentPackThreatIntelDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CpActivation == nil { + return fmt.Errorf("required field cp_activation missing") + } + if all.DataLastSeen == nil { + return fmt.Errorf("required field data_last_seen missing") + } + if all.IntegrationInstalledStatus == nil { + return fmt.Errorf("required field integration_installed_status missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cp_activation", "data_last_seen", "integration_installed_status", "type"}) + } else { + return err + } + + hasInvalidField := false + if !all.CpActivation.IsValid() { + hasInvalidField = true + } else { + o.CpActivation = *all.CpActivation + } + if !all.DataLastSeen.IsValid() { + hasInvalidField = true + } else { + o.DataLastSeen = *all.DataLastSeen + } + if !all.IntegrationInstalledStatus.IsValid() { + hasInvalidField = true + } else { + o.IntegrationInstalledStatus = *all.IntegrationInstalledStatus + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details_type.go new file mode 100644 index 00000000000..daf14aa8828 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_threat_intel_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackThreatIntelDetailsType Type for threat intelligence content pack details. +type SecurityMonitoringContentPackThreatIntelDetailsType string + +// List of SecurityMonitoringContentPackThreatIntelDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKTHREATINTELDETAILSTYPE_THREAT_INTEL SecurityMonitoringContentPackThreatIntelDetailsType = "threat_intel" +) + +var allowedSecurityMonitoringContentPackThreatIntelDetailsTypeEnumValues = []SecurityMonitoringContentPackThreatIntelDetailsType{ + SECURITYMONITORINGCONTENTPACKTHREATINTELDETAILSTYPE_THREAT_INTEL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackThreatIntelDetailsType) GetAllowedValues() []SecurityMonitoringContentPackThreatIntelDetailsType { + return allowedSecurityMonitoringContentPackThreatIntelDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackThreatIntelDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackThreatIntelDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackThreatIntelDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackThreatIntelDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackThreatIntelDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackThreatIntelDetailsType, error) { + ev := SecurityMonitoringContentPackThreatIntelDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackThreatIntelDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackThreatIntelDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackThreatIntelDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackThreatIntelDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackThreatIntelDetailsType value. +func (v SecurityMonitoringContentPackThreatIntelDetailsType) Ptr() *SecurityMonitoringContentPackThreatIntelDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details.go b/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details.go new file mode 100644 index 00000000000..ef97ae1893a --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details.go @@ -0,0 +1,219 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackVulnerabilityDetails Details for a vulnerability content pack. +type SecurityMonitoringContentPackVulnerabilityDetails struct { + // The activation status of a content pack. + CpActivation SecurityMonitoringContentPackActivation `json:"cp_activation"` + // Timestamp bucket indicating when logs were last collected. + DataLastSeen SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + // The installation status of the related integration. + IntegrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + // Type for vulnerability content pack details. + Type SecurityMonitoringContentPackVulnerabilityDetailsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackVulnerabilityDetails instantiates a new SecurityMonitoringContentPackVulnerabilityDetails object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringContentPackVulnerabilityDetails(cpActivation SecurityMonitoringContentPackActivation, dataLastSeen SecurityMonitoringContentPackTimestampBucket, integrationInstalledStatus SecurityMonitoringContentPackIntegrationStatus, typeVar SecurityMonitoringContentPackVulnerabilityDetailsType) *SecurityMonitoringContentPackVulnerabilityDetails { + this := SecurityMonitoringContentPackVulnerabilityDetails{} + this.CpActivation = cpActivation + this.DataLastSeen = dataLastSeen + this.IntegrationInstalledStatus = integrationInstalledStatus + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackVulnerabilityDetailsWithDefaults instantiates a new SecurityMonitoringContentPackVulnerabilityDetails object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringContentPackVulnerabilityDetailsWithDefaults() *SecurityMonitoringContentPackVulnerabilityDetails { + this := SecurityMonitoringContentPackVulnerabilityDetails{} + return &this +} + +// GetCpActivation returns the CpActivation field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetCpActivation() SecurityMonitoringContentPackActivation { + if o == nil { + var ret SecurityMonitoringContentPackActivation + return ret + } + return o.CpActivation +} + +// GetCpActivationOk returns a tuple with the CpActivation field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetCpActivationOk() (*SecurityMonitoringContentPackActivation, bool) { + if o == nil { + return nil, false + } + return &o.CpActivation, true +} + +// SetCpActivation sets field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) SetCpActivation(v SecurityMonitoringContentPackActivation) { + o.CpActivation = v +} + +// GetDataLastSeen returns the DataLastSeen field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetDataLastSeen() SecurityMonitoringContentPackTimestampBucket { + if o == nil { + var ret SecurityMonitoringContentPackTimestampBucket + return ret + } + return o.DataLastSeen +} + +// GetDataLastSeenOk returns a tuple with the DataLastSeen field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetDataLastSeenOk() (*SecurityMonitoringContentPackTimestampBucket, bool) { + if o == nil { + return nil, false + } + return &o.DataLastSeen, true +} + +// SetDataLastSeen sets field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) SetDataLastSeen(v SecurityMonitoringContentPackTimestampBucket) { + o.DataLastSeen = v +} + +// GetIntegrationInstalledStatus returns the IntegrationInstalledStatus field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetIntegrationInstalledStatus() SecurityMonitoringContentPackIntegrationStatus { + if o == nil { + var ret SecurityMonitoringContentPackIntegrationStatus + return ret + } + return o.IntegrationInstalledStatus +} + +// GetIntegrationInstalledStatusOk returns a tuple with the IntegrationInstalledStatus field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetIntegrationInstalledStatusOk() (*SecurityMonitoringContentPackIntegrationStatus, bool) { + if o == nil { + return nil, false + } + return &o.IntegrationInstalledStatus, true +} + +// SetIntegrationInstalledStatus sets field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) SetIntegrationInstalledStatus(v SecurityMonitoringContentPackIntegrationStatus) { + o.IntegrationInstalledStatus = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetType() SecurityMonitoringContentPackVulnerabilityDetailsType { + if o == nil { + var ret SecurityMonitoringContentPackVulnerabilityDetailsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) GetTypeOk() (*SecurityMonitoringContentPackVulnerabilityDetailsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) SetType(v SecurityMonitoringContentPackVulnerabilityDetailsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackVulnerabilityDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["cp_activation"] = o.CpActivation + toSerialize["data_last_seen"] = o.DataLastSeen + toSerialize["integration_installed_status"] = o.IntegrationInstalledStatus + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackVulnerabilityDetails) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CpActivation *SecurityMonitoringContentPackActivation `json:"cp_activation"` + DataLastSeen *SecurityMonitoringContentPackTimestampBucket `json:"data_last_seen"` + IntegrationInstalledStatus *SecurityMonitoringContentPackIntegrationStatus `json:"integration_installed_status"` + Type *SecurityMonitoringContentPackVulnerabilityDetailsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CpActivation == nil { + return fmt.Errorf("required field cp_activation missing") + } + if all.DataLastSeen == nil { + return fmt.Errorf("required field data_last_seen missing") + } + if all.IntegrationInstalledStatus == nil { + return fmt.Errorf("required field integration_installed_status missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cp_activation", "data_last_seen", "integration_installed_status", "type"}) + } else { + return err + } + + hasInvalidField := false + if !all.CpActivation.IsValid() { + hasInvalidField = true + } else { + o.CpActivation = *all.CpActivation + } + if !all.DataLastSeen.IsValid() { + hasInvalidField = true + } else { + o.DataLastSeen = *all.DataLastSeen + } + if !all.IntegrationInstalledStatus.IsValid() { + hasInvalidField = true + } else { + o.IntegrationInstalledStatus = *all.IntegrationInstalledStatus + } + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details_type.go b/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details_type.go new file mode 100644 index 00000000000..528dd46fc86 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_vulnerability_details_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackVulnerabilityDetailsType Type for vulnerability content pack details. +type SecurityMonitoringContentPackVulnerabilityDetailsType string + +// List of SecurityMonitoringContentPackVulnerabilityDetailsType. +const ( + SECURITYMONITORINGCONTENTPACKVULNERABILITYDETAILSTYPE_VULNERABILITY SecurityMonitoringContentPackVulnerabilityDetailsType = "vulnerability" +) + +var allowedSecurityMonitoringContentPackVulnerabilityDetailsTypeEnumValues = []SecurityMonitoringContentPackVulnerabilityDetailsType{ + SECURITYMONITORINGCONTENTPACKVULNERABILITYDETAILSTYPE_VULNERABILITY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackVulnerabilityDetailsType) GetAllowedValues() []SecurityMonitoringContentPackVulnerabilityDetailsType { + return allowedSecurityMonitoringContentPackVulnerabilityDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackVulnerabilityDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackVulnerabilityDetailsType(value) + return nil +} + +// NewSecurityMonitoringContentPackVulnerabilityDetailsTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackVulnerabilityDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackVulnerabilityDetailsTypeFromValue(v string) (*SecurityMonitoringContentPackVulnerabilityDetailsType, error) { + ev := SecurityMonitoringContentPackVulnerabilityDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackVulnerabilityDetailsType: valid values are %v", v, allowedSecurityMonitoringContentPackVulnerabilityDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackVulnerabilityDetailsType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackVulnerabilityDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackVulnerabilityDetailsType value. +func (v SecurityMonitoringContentPackVulnerabilityDetailsType) Ptr() *SecurityMonitoringContentPackVulnerabilityDetailsType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_sku.go b/api/datadogV2/model_security_monitoring_sku.go index 24e83bbce3f..e79c17f61c2 100644 --- a/api/datadogV2/model_security_monitoring_sku.go +++ b/api/datadogV2/model_security_monitoring_sku.go @@ -18,12 +18,16 @@ const ( SECURITYMONITORINGSKU_PER_GB_ANALYZED SecurityMonitoringSKU = "per_gb_analyzed" SECURITYMONITORINGSKU_PER_EVENT_IN_SIEM_INDEX_2023 SecurityMonitoringSKU = "per_event_in_siem_index_2023" SECURITYMONITORINGSKU_ADD_ON_2024 SecurityMonitoringSKU = "add_on_2024" + SECURITYMONITORINGSKU_STANDALONE_INDEXED SecurityMonitoringSKU = "standalone_indexed" + SECURITYMONITORINGSKU_UNKNOWN SecurityMonitoringSKU = "unknown" ) var allowedSecurityMonitoringSKUEnumValues = []SecurityMonitoringSKU{ SECURITYMONITORINGSKU_PER_GB_ANALYZED, SECURITYMONITORINGSKU_PER_EVENT_IN_SIEM_INDEX_2023, SECURITYMONITORINGSKU_ADD_ON_2024, + SECURITYMONITORINGSKU_STANDALONE_INDEXED, + SECURITYMONITORINGSKU_UNKNOWN, } // GetAllowedValues reeturns the list of possible values.