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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
410 changes: 206 additions & 204 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .generator/src/generator/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def reference_to_value(schema, value, print_nullable=True, **kwargs):
if nullable:
function_name = schema_name(schema)
if function_name is None:
if value == "nil":
return "nil"
raise NotImplementedError(f"nullable {schema} is not supported")
return formatter.format(prefix=prefix, function_name=function_name, value=value)
return f"&{value}"
Expand Down
12 changes: 12 additions & 0 deletions .generator/tests/test_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ def test_named_typed_additional_properties_as_array_item_generates_typed_map_sli
result = format_data_with_schema([{"k": "v"}], array_schema)
assert "StringMapItem" not in result
assert "map[string]string" in result


class TestNullableInlineObjectWithNullValue:
"""Nullable inline (anonymous) object schemas must return 'nil' when data is None."""

def test_nullable_inline_object_returns_nil(self):
schema = {"type": "object", "nullable": True}
assert format_data_with_schema(None, schema) == "nil"

def test_nullable_inline_object_with_additional_properties_returns_nil(self):
schema = {"type": "object", "nullable": True, "additionalProperties": {}}
assert format_data_with_schema(None, schema) == "nil"
10 changes: 5 additions & 5 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,30 +701,30 @@ func NewConfiguration() *Configuration {
"v2.ListAWSCloudAuthPersonaMappings": false,
"v2.ActivateContentPack": false,
"v2.BulkExportSecurityMonitoringTerraformResources": false,
"v2.CancelThreatHuntingJob": false,
"v2.CancelHistoricalJob": false,
"v2.ConvertJobResultToSignal": false,
"v2.ConvertSecurityMonitoringTerraformResource": false,
"v2.DeactivateContentPack": false,
"v2.DeleteThreatHuntingJob": false,
"v2.DeleteHistoricalJob": false,
"v2.ExportSecurityMonitoringTerraformResource": false,
"v2.GetContentPacksStates": false,
"v2.GetFinding": false,
"v2.GetHistoricalJob": false,
"v2.GetIndicatorOfCompromise": false,
"v2.GetRuleVersionHistory": false,
"v2.GetSecretsRules": false,
"v2.GetSecurityMonitoringHistsignal": false,
"v2.GetSecurityMonitoringHistsignalsByJobId": false,
"v2.GetThreatHuntingJob": false,
"v2.ListFindings": false,
"v2.ListHistoricalJobs": false,
"v2.ListIndicatorsOfCompromise": false,
"v2.ListMultipleRulesets": false,
"v2.ListScannedAssetsMetadata": false,
"v2.ListSecurityMonitoringHistsignals": false,
"v2.ListThreatHuntingJobs": false,
"v2.ListVulnerabilities": false,
"v2.ListVulnerableAssets": false,
"v2.MuteFindings": false,
"v2.RunThreatHuntingJob": false,
"v2.RunHistoricalJob": false,
"v2.SearchSecurityMonitoringHistsignals": false,
"v2.GetCodeCoverageBranchSummary": false,
"v2.GetCodeCoverageCommitSummary": false,
Expand Down
590 changes: 295 additions & 295 deletions api/datadogV2/api_security_monitoring.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@
// - [SecurityMonitoringApi.BulkEditSecurityMonitoringSignalsState]
// - [SecurityMonitoringApi.BulkExportSecurityMonitoringRules]
// - [SecurityMonitoringApi.BulkExportSecurityMonitoringTerraformResources]
// - [SecurityMonitoringApi.CancelThreatHuntingJob]
// - [SecurityMonitoringApi.CancelHistoricalJob]
// - [SecurityMonitoringApi.ConvertExistingSecurityMonitoringRule]
// - [SecurityMonitoringApi.ConvertJobResultToSignal]
// - [SecurityMonitoringApi.ConvertSecurityMonitoringRuleFromJSONToTerraform]
Expand All @@ -751,12 +751,12 @@
// - [SecurityMonitoringApi.CreateVulnerabilityNotificationRule]
// - [SecurityMonitoringApi.DeactivateContentPack]
// - [SecurityMonitoringApi.DeleteCustomFramework]
// - [SecurityMonitoringApi.DeleteHistoricalJob]
// - [SecurityMonitoringApi.DeleteSecurityFilter]
// - [SecurityMonitoringApi.DeleteSecurityMonitoringCriticalAsset]
// - [SecurityMonitoringApi.DeleteSecurityMonitoringRule]
// - [SecurityMonitoringApi.DeleteSecurityMonitoringSuppression]
// - [SecurityMonitoringApi.DeleteSignalNotificationRule]
// - [SecurityMonitoringApi.DeleteThreatHuntingJob]
// - [SecurityMonitoringApi.DeleteVulnerabilityNotificationRule]
// - [SecurityMonitoringApi.DetachCase]
// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee]
Expand All @@ -767,6 +767,7 @@
// - [SecurityMonitoringApi.GetCriticalAssetsAffectingRule]
// - [SecurityMonitoringApi.GetCustomFramework]
// - [SecurityMonitoringApi.GetFinding]
// - [SecurityMonitoringApi.GetHistoricalJob]
// - [SecurityMonitoringApi.GetIndicatorOfCompromise]
// - [SecurityMonitoringApi.GetInvestigationLogQueriesMatchingSignal]
// - [SecurityMonitoringApi.GetResourceEvaluationFilters]
Expand All @@ -786,11 +787,11 @@
// - [SecurityMonitoringApi.GetSuppressionVersionHistory]
// - [SecurityMonitoringApi.GetSuppressionsAffectingFutureRule]
// - [SecurityMonitoringApi.GetSuppressionsAffectingRule]
// - [SecurityMonitoringApi.GetThreatHuntingJob]
// - [SecurityMonitoringApi.GetVulnerabilityNotificationRule]
// - [SecurityMonitoringApi.GetVulnerabilityNotificationRules]
// - [SecurityMonitoringApi.ListAssetsSBOMs]
// - [SecurityMonitoringApi.ListFindings]
// - [SecurityMonitoringApi.ListHistoricalJobs]
// - [SecurityMonitoringApi.ListIndicatorsOfCompromise]
// - [SecurityMonitoringApi.ListMultipleRulesets]
// - [SecurityMonitoringApi.ListScannedAssetsMetadata]
Expand All @@ -801,13 +802,12 @@
// - [SecurityMonitoringApi.ListSecurityMonitoringRules]
// - [SecurityMonitoringApi.ListSecurityMonitoringSignals]
// - [SecurityMonitoringApi.ListSecurityMonitoringSuppressions]
// - [SecurityMonitoringApi.ListThreatHuntingJobs]
// - [SecurityMonitoringApi.ListVulnerabilities]
// - [SecurityMonitoringApi.ListVulnerableAssets]
// - [SecurityMonitoringApi.MuteFindings]
// - [SecurityMonitoringApi.PatchSignalNotificationRule]
// - [SecurityMonitoringApi.PatchVulnerabilityNotificationRule]
// - [SecurityMonitoringApi.RunThreatHuntingJob]
// - [SecurityMonitoringApi.RunHistoricalJob]
// - [SecurityMonitoringApi.SearchSecurityFindings]
// - [SecurityMonitoringApi.SearchSecurityMonitoringHistsignals]
// - [SecurityMonitoringApi.SearchSecurityMonitoringSignals]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// ConvertJobResultsToSignalsAttributes Attributes for converting threat hunting job results to signals.
// ConvertJobResultsToSignalsAttributes Attributes for converting historical job results to signals.
type ConvertJobResultsToSignalsAttributes struct {
// Request ID.
Id *string `json:"id,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_convert_job_results_to_signals_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// ConvertJobResultsToSignalsData Data for converting threat hunting job results to signals.
// ConvertJobResultsToSignalsData Data for converting historical job results to signals.
type ConvertJobResultsToSignalsData struct {
// Attributes for converting threat hunting job results to signals.
// Attributes for converting historical job results to signals.
Attributes *ConvertJobResultsToSignalsAttributes `json:"attributes,omitempty"`
// Type of payload.
Type *ConvertJobResultsToSignalsDataType `json:"type,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/datadogV2/model_convert_job_results_to_signals_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// ConvertJobResultsToSignalsRequest Request for converting threat hunting job results to signals.
// ConvertJobResultsToSignalsRequest Request for converting historical job results to signals.
type ConvertJobResultsToSignalsRequest struct {
// Data for converting threat hunting job results to signals.
// Data for converting historical job results to signals.
Data *ConvertJobResultsToSignalsData `json:"data,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ type CustomDestinationForwardDestinationSplunk struct {
Endpoint string `json:"endpoint"`
// The Splunk sourcetype for the events sent to this Splunk destination.
//
// If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype`
// field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
// value is used as the sourcetype.
// If the field is absent from the request and no sourcetype has been previously set on this destination, the default sourcetype `_json` is used.
// On update, if the field is absent from the request but a sourcetype was previously set, the previous value is kept.
// If set to `null`, the sourcetype field is omitted from the forwarded event entirely.
// Otherwise, the provided string value is used as the sourcetype.
Sourcetype datadog.NullableString `json:"sourcetype,omitempty"`
// Type of the Splunk HTTP Event Collector (HEC) destination.
Type CustomDestinationForwardDestinationSplunkType `json:"type"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ type CustomDestinationResponseForwardDestinationSplunk struct {
Endpoint string `json:"endpoint"`
// The Splunk sourcetype for the events sent to this Splunk destination.
//
// If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype`
// field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string
// value is used as the sourcetype.
// If the field is absent from the request and no sourcetype has been previously set on this destination, the default sourcetype `_json` is used.
// On update, if the field is absent from the request but a sourcetype was previously set, the previous value is kept.
// If set to `null`, the sourcetype field is omitted from the forwarded event entirely.
// Otherwise, the provided string value is used as the sourcetype.
Sourcetype datadog.NullableString `json:"sourcetype,omitempty"`
// Type of the Splunk HTTP Event Collector (HEC) destination.
Type CustomDestinationResponseForwardDestinationSplunkType `json:"type"`
Expand Down
64 changes: 64 additions & 0 deletions api/datadogV2/model_historical_job_data_type.go
Original file line number Diff line number Diff line change
@@ -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"
)

// HistoricalJobDataType Type of payload.
type HistoricalJobDataType string

// List of HistoricalJobDataType.
const (
HISTORICALJOBDATATYPE_HISTORICALDETECTIONSJOB HistoricalJobDataType = "historicalDetectionsJob"
)

var allowedHistoricalJobDataTypeEnumValues = []HistoricalJobDataType{
HISTORICALJOBDATATYPE_HISTORICALDETECTIONSJOB,
}

// GetAllowedValues reeturns the list of possible values.
func (v *HistoricalJobDataType) GetAllowedValues() []HistoricalJobDataType {
return allowedHistoricalJobDataTypeEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *HistoricalJobDataType) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = HistoricalJobDataType(value)
return nil
}

// NewHistoricalJobDataTypeFromValue returns a pointer to a valid HistoricalJobDataType
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewHistoricalJobDataTypeFromValue(v string) (*HistoricalJobDataType, error) {
ev := HistoricalJobDataType(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for HistoricalJobDataType: valid values are %v", v, allowedHistoricalJobDataTypeEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v HistoricalJobDataType) IsValid() bool {
for _, existing := range allowedHistoricalJobDataTypeEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to HistoricalJobDataType value.
func (v HistoricalJobDataType) Ptr() *HistoricalJobDataType {
return &v
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// ThreatHuntingJobListMeta Metadata about the list of jobs.
type ThreatHuntingJobListMeta struct {
// HistoricalJobListMeta Metadata about the list of jobs.
type HistoricalJobListMeta struct {
// Number of jobs in the list.
TotalCount *int32 `json:"totalCount,omitempty"`
// 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:"-"`
}

// NewThreatHuntingJobListMeta instantiates a new ThreatHuntingJobListMeta object.
// NewHistoricalJobListMeta instantiates a new HistoricalJobListMeta 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 NewThreatHuntingJobListMeta() *ThreatHuntingJobListMeta {
this := ThreatHuntingJobListMeta{}
func NewHistoricalJobListMeta() *HistoricalJobListMeta {
this := HistoricalJobListMeta{}
return &this
}

// NewThreatHuntingJobListMetaWithDefaults instantiates a new ThreatHuntingJobListMeta object.
// NewHistoricalJobListMetaWithDefaults instantiates a new HistoricalJobListMeta 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 NewThreatHuntingJobListMetaWithDefaults() *ThreatHuntingJobListMeta {
this := ThreatHuntingJobListMeta{}
func NewHistoricalJobListMetaWithDefaults() *HistoricalJobListMeta {
this := HistoricalJobListMeta{}
return &this
}

// GetTotalCount returns the TotalCount field value if set, zero value otherwise.
func (o *ThreatHuntingJobListMeta) GetTotalCount() int32 {
func (o *HistoricalJobListMeta) GetTotalCount() int32 {
if o == nil || o.TotalCount == nil {
var ret int32
return ret
Expand All @@ -45,25 +45,25 @@ func (o *ThreatHuntingJobListMeta) GetTotalCount() int32 {

// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ThreatHuntingJobListMeta) GetTotalCountOk() (*int32, bool) {
func (o *HistoricalJobListMeta) GetTotalCountOk() (*int32, bool) {
if o == nil || o.TotalCount == nil {
return nil, false
}
return o.TotalCount, true
}

// HasTotalCount returns a boolean if a field has been set.
func (o *ThreatHuntingJobListMeta) HasTotalCount() bool {
func (o *HistoricalJobListMeta) HasTotalCount() bool {
return o != nil && o.TotalCount != nil
}

// SetTotalCount gets a reference to the given int32 and assigns it to the TotalCount field.
func (o *ThreatHuntingJobListMeta) SetTotalCount(v int32) {
func (o *HistoricalJobListMeta) SetTotalCount(v int32) {
o.TotalCount = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o ThreatHuntingJobListMeta) MarshalJSON() ([]byte, error) {
func (o HistoricalJobListMeta) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
Expand All @@ -79,7 +79,7 @@ func (o ThreatHuntingJobListMeta) MarshalJSON() ([]byte, error) {
}

// UnmarshalJSON deserializes the given payload.
func (o *ThreatHuntingJobListMeta) UnmarshalJSON(bytes []byte) (err error) {
func (o *HistoricalJobListMeta) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
TotalCount *int32 `json:"totalCount,omitempty"`
}{}
Expand Down
Loading
Loading