diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d57aebc821a..a8908359f48 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -52613,6 +52613,153 @@ components: x-enum-varnames: - DONE - TIMEOUT + SecurityMonitoringContentPackActivation: + description: The activation status of a content pack + enum: + - never_activated + - activated + - deactivated + example: activated + type: string + x-enum-varnames: + - NEVER_ACTIVATED + - ACTIVATED + - DEACTIVATED + SecurityMonitoringContentPackIntegrationStatus: + description: The installation status of the related integration + enum: + - installed + - available + - partially_installed + - detected + - error + example: installed + type: string + x-enum-varnames: + - INSTALLED + - AVAILABLE + - PARTIALLY_INSTALLED + - DETECTED + - ERROR + SecurityMonitoringContentPackStateAttributes: + description: Attributes of a content pack state + 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: + description: Whether filters (Security Filters or Index Query depending + on the pricing model) are configured for logs + example: true + type: boolean + integration_installed_status: + $ref: '#/components/schemas/SecurityMonitoringContentPackIntegrationStatus' + logs_last_collected: + $ref: '#/components/schemas/SecurityMonitoringContentPackTimestampBucket' + logs_seen_from_any_index: + description: Whether logs have been seen from any index + example: true + type: boolean + state: + $ref: '#/components/schemas/SecurityMonitoringContentPackStatus' + required: + - state + - cp_activation + - logs_seen_from_any_index + - logs_last_collected + - cloud_siem_index_incorrect + - filters_configured_for_logs + type: object + SecurityMonitoringContentPackStateData: + description: Content pack state data. + properties: + attributes: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateAttributes' + id: + description: The content pack identifier. + example: aws-cloudtrail + type: string + type: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateType' + required: + - id + - type + - attributes + type: object + SecurityMonitoringContentPackStateMeta: + description: Metadata for content pack states + properties: + cloud_siem_index_incorrect: + description: Whether the cloud SIEM index configuration is incorrect at + the organization level + example: false + type: boolean + sku: + $ref: '#/components/schemas/SecurityMonitoringSKU' + required: + - cloud_siem_index_incorrect + - sku + type: object + SecurityMonitoringContentPackStateType: + description: Type for content pack state object + enum: + - content_pack_state + example: content_pack_state + type: string + x-enum-varnames: + - CONTENT_PACK_STATE + SecurityMonitoringContentPackStatesResponse: + description: Response containing content pack states. + properties: + data: + description: Array of content pack states. + items: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateData' + type: array + meta: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateMeta' + required: + - data + - meta + type: object + SecurityMonitoringContentPackStatus: + description: The current status of a content pack + enum: + - install + - activate + - initializing + - active + - warning + - broken + example: active + type: string + x-enum-varnames: + - INSTALL + - ACTIVATE + - INITIALIZING + - ACTIVE + - WARNING + - BROKEN + SecurityMonitoringContentPackTimestampBucket: + description: Timestamp bucket indicating when logs were last collected + enum: + - not_seen + - within_24_hours + - within_24_to_72_hours + - over_72h_to_30d + - over_30d + example: within_24_hours + type: string + x-enum-varnames: + - NOT_SEEN + - WITHIN_24_HOURS + - WITHIN_24_TO_72_HOURS + - OVER_72H_TO_30D + - OVER_30D SecurityMonitoringCriticalAsset: description: The critical asset's properties. properties: @@ -53740,6 +53887,18 @@ components: - $ref: '#/components/schemas/SecurityMonitoringStandardRulePayload' - $ref: '#/components/schemas/SecurityMonitoringSignalRulePayload' - $ref: '#/components/schemas/CloudConfigurationRulePayload' + SecurityMonitoringSKU: + description: The SIEM pricing model (SKU) for the organization + enum: + - per_gb_analyzed + - per_event_in_siem_index_2023 + - add_on_2024 + example: add_on_2024 + type: string + x-enum-varnames: + - PER_GB_ANALYZED + - PER_EVENT_IN_SIEM_INDEX_2023 + - ADD_ON_2024 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. @@ -94103,6 +94262,123 @@ paths: summary: Get a suppression's version history tags: - Security Monitoring + /api/v2/security_monitoring/content_packs/states: + get: + description: 'Get the activation and configuration states for all security monitoring + content packs. + + This endpoint returns status information about each content pack including + activation state, + + integration status, and log collection status.' + operationId: GetContentPacksStates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityMonitoringContentPackStatesResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get content pack states + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security_monitoring/content_packs/{content_pack_id}/activate: + put: + description: 'Activate a security monitoring content pack. This operation configures + the necessary + + log filters or security filters depending on the pricing model and updates + the content + + pack activation state.' + operationId: ActivateContentPack + parameters: + - description: The ID of the content pack to activate. + in: path + name: content_pack_id + required: true + schema: + example: aws-cloudtrail + type: string + responses: + '202': + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Activate content pack + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate: + put: + description: 'Deactivate a security monitoring content pack. This operation + removes the content pack''s + + configuration from log filters or security filters and updates the content + pack activation state.' + operationId: DeactivateContentPack + parameters: + - description: The ID of the content pack to deactivate. + in: path + name: content_pack_id + required: true + schema: + example: aws-cloudtrail + type: string + responses: + '202': + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Deactivate content pack + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/security_monitoring/rules: get: description: List rules. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index ebf14cfcc2a..a4e3206ae89 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -672,9 +672,12 @@ func NewConfiguration() *Configuration { "v2.GetOpenAPI": false, "v2.ListAPIs": false, "v2.UpdateOpenAPI": false, + "v2.ActivateContentPack": false, "v2.CancelThreatHuntingJob": false, "v2.ConvertJobResultToSignal": false, + "v2.DeactivateContentPack": false, "v2.DeleteThreatHuntingJob": false, + "v2.GetContentPacksStates": false, "v2.GetFinding": false, "v2.GetRuleVersionHistory": false, "v2.GetSecretsRules": false, diff --git a/api/datadogV2/api_security_monitoring.go b/api/datadogV2/api_security_monitoring.go index 878bbdf8fcf..9fadf2d7bd8 100644 --- a/api/datadogV2/api_security_monitoring.go +++ b/api/datadogV2/api_security_monitoring.go @@ -20,6 +20,94 @@ import ( // SecurityMonitoringApi service type type SecurityMonitoringApi datadog.Service +// ActivateContentPack Activate content pack. +// Activate a security monitoring content pack. This operation configures the necessary +// log filters or security filters depending on the pricing model and updates the content +// pack activation state. +func (a *SecurityMonitoringApi) ActivateContentPack(ctx _context.Context, contentPackId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + operationId := "v2.ActivateContentPack" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.ActivateContentPack") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/content_packs/{content_pack_id}/activate" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{content_pack_id}", _neturl.PathEscape(datadog.ParameterToString(contentPackId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // AttachCase Attach security findings to a case. // Attach security findings to a case. // You can attach up to 50 security findings per case. Security findings that are already attached to another case will be detached from their previous case and attached to the specified case. @@ -1308,6 +1396,93 @@ func (a *SecurityMonitoringApi) CreateVulnerabilityNotificationRule(ctx _context return localVarReturnValue, localVarHTTPResponse, nil } +// DeactivateContentPack Deactivate content pack. +// Deactivate a security monitoring content pack. This operation removes the content pack's +// configuration from log filters or security filters and updates the content pack activation state. +func (a *SecurityMonitoringApi) DeactivateContentPack(ctx _context.Context, contentPackId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + operationId := "v2.DeactivateContentPack" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.DeactivateContentPack") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{content_pack_id}", _neturl.PathEscape(datadog.ParameterToString(contentPackId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // DeleteCustomFramework Delete a custom framework. // Delete a custom framework. func (a *SecurityMonitoringApi) DeleteCustomFramework(ctx _context.Context, handle string, version string) (DeleteCustomFrameworkResponse, *_nethttp.Response, error) { @@ -2186,6 +2361,103 @@ func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(ctx _context.C return localVarReturnValue, localVarHTTPResponse, nil } +// GetContentPacksStates Get content pack states. +// Get the activation and configuration states for all security monitoring content packs. +// This endpoint returns status information about each content pack including activation state, +// integration status, and log collection status. +func (a *SecurityMonitoringApi) GetContentPacksStates(ctx _context.Context) (SecurityMonitoringContentPackStatesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringContentPackStatesResponse + ) + + operationId := "v2.GetContentPacksStates" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetContentPacksStates") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/content_packs/states" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // GetCriticalAssetsAffectingRule Get critical assets affecting a specific rule. // Get the list of critical assets that affect a specific existing rule by the rule's ID. func (a *SecurityMonitoringApi) GetCriticalAssetsAffectingRule(ctx _context.Context, ruleId string) (SecurityMonitoringCriticalAssetsResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 0283472d7ae..b167b02c2db 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -586,6 +586,7 @@ // - [RumRetentionFiltersApi.ListRetentionFilters] // - [RumRetentionFiltersApi.OrderRetentionFilters] // - [RumRetentionFiltersApi.UpdateRetentionFilter] +// - [SecurityMonitoringApi.ActivateContentPack] // - [SecurityMonitoringApi.AttachCase] // - [SecurityMonitoringApi.AttachJiraIssue] // - [SecurityMonitoringApi.BulkExportSecurityMonitoringRules] @@ -602,6 +603,7 @@ // - [SecurityMonitoringApi.CreateSecurityMonitoringSuppression] // - [SecurityMonitoringApi.CreateSignalNotificationRule] // - [SecurityMonitoringApi.CreateVulnerabilityNotificationRule] +// - [SecurityMonitoringApi.DeactivateContentPack] // - [SecurityMonitoringApi.DeleteCustomFramework] // - [SecurityMonitoringApi.DeleteSecurityFilter] // - [SecurityMonitoringApi.DeleteSecurityMonitoringCriticalAsset] @@ -614,6 +616,7 @@ // - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] +// - [SecurityMonitoringApi.GetContentPacksStates] // - [SecurityMonitoringApi.GetCriticalAssetsAffectingRule] // - [SecurityMonitoringApi.GetCustomFramework] // - [SecurityMonitoringApi.GetFinding] diff --git a/api/datadogV2/model_security_monitoring_content_pack_activation.go b/api/datadogV2/model_security_monitoring_content_pack_activation.go new file mode 100644 index 00000000000..673d8e2ba50 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_activation.go @@ -0,0 +1,68 @@ +// 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" +) + +// SecurityMonitoringContentPackActivation The activation status of a content pack +type SecurityMonitoringContentPackActivation string + +// List of SecurityMonitoringContentPackActivation. +const ( + SECURITYMONITORINGCONTENTPACKACTIVATION_NEVER_ACTIVATED SecurityMonitoringContentPackActivation = "never_activated" + SECURITYMONITORINGCONTENTPACKACTIVATION_ACTIVATED SecurityMonitoringContentPackActivation = "activated" + SECURITYMONITORINGCONTENTPACKACTIVATION_DEACTIVATED SecurityMonitoringContentPackActivation = "deactivated" +) + +var allowedSecurityMonitoringContentPackActivationEnumValues = []SecurityMonitoringContentPackActivation{ + SECURITYMONITORINGCONTENTPACKACTIVATION_NEVER_ACTIVATED, + SECURITYMONITORINGCONTENTPACKACTIVATION_ACTIVATED, + SECURITYMONITORINGCONTENTPACKACTIVATION_DEACTIVATED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackActivation) GetAllowedValues() []SecurityMonitoringContentPackActivation { + return allowedSecurityMonitoringContentPackActivationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackActivation) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackActivation(value) + return nil +} + +// NewSecurityMonitoringContentPackActivationFromValue returns a pointer to a valid SecurityMonitoringContentPackActivation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackActivationFromValue(v string) (*SecurityMonitoringContentPackActivation, error) { + ev := SecurityMonitoringContentPackActivation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackActivation: valid values are %v", v, allowedSecurityMonitoringContentPackActivationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackActivation) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackActivationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackActivation value. +func (v SecurityMonitoringContentPackActivation) Ptr() *SecurityMonitoringContentPackActivation { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_integration_status.go b/api/datadogV2/model_security_monitoring_content_pack_integration_status.go new file mode 100644 index 00000000000..d7c5f09baec --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_integration_status.go @@ -0,0 +1,72 @@ +// 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" +) + +// SecurityMonitoringContentPackIntegrationStatus The installation status of the related integration +type SecurityMonitoringContentPackIntegrationStatus string + +// List of SecurityMonitoringContentPackIntegrationStatus. +const ( + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_INSTALLED SecurityMonitoringContentPackIntegrationStatus = "installed" + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_AVAILABLE SecurityMonitoringContentPackIntegrationStatus = "available" + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_PARTIALLY_INSTALLED SecurityMonitoringContentPackIntegrationStatus = "partially_installed" + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_DETECTED SecurityMonitoringContentPackIntegrationStatus = "detected" + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_ERROR SecurityMonitoringContentPackIntegrationStatus = "error" +) + +var allowedSecurityMonitoringContentPackIntegrationStatusEnumValues = []SecurityMonitoringContentPackIntegrationStatus{ + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_INSTALLED, + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_AVAILABLE, + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_PARTIALLY_INSTALLED, + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_DETECTED, + SECURITYMONITORINGCONTENTPACKINTEGRATIONSTATUS_ERROR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackIntegrationStatus) GetAllowedValues() []SecurityMonitoringContentPackIntegrationStatus { + return allowedSecurityMonitoringContentPackIntegrationStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackIntegrationStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackIntegrationStatus(value) + return nil +} + +// NewSecurityMonitoringContentPackIntegrationStatusFromValue returns a pointer to a valid SecurityMonitoringContentPackIntegrationStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackIntegrationStatusFromValue(v string) (*SecurityMonitoringContentPackIntegrationStatus, error) { + ev := SecurityMonitoringContentPackIntegrationStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackIntegrationStatus: valid values are %v", v, allowedSecurityMonitoringContentPackIntegrationStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackIntegrationStatus) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackIntegrationStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackIntegrationStatus value. +func (v SecurityMonitoringContentPackIntegrationStatus) Ptr() *SecurityMonitoringContentPackIntegrationStatus { + 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 new file mode 100644 index 00000000000..7d001030df4 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_state_attributes.go @@ -0,0 +1,318 @@ +// 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" +) + +// 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 configured for logs + 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 have been seen from any index + LogsSeenFromAnyIndex bool `json:"logs_seen_from_any_index"` + // The current status of a content pack + State SecurityMonitoringContentPackStatus `json:"state"` + // 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:"-"` +} + +// NewSecurityMonitoringContentPackStateAttributes instantiates a new SecurityMonitoringContentPackStateAttributes 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 NewSecurityMonitoringContentPackStateAttributes(cloudSiemIndexIncorrect bool, cpActivation SecurityMonitoringContentPackActivation, filtersConfiguredForLogs bool, logsLastCollected SecurityMonitoringContentPackTimestampBucket, logsSeenFromAnyIndex bool, state SecurityMonitoringContentPackStatus) *SecurityMonitoringContentPackStateAttributes { + this := SecurityMonitoringContentPackStateAttributes{} + this.CloudSiemIndexIncorrect = cloudSiemIndexIncorrect + this.CpActivation = cpActivation + this.FiltersConfiguredForLogs = filtersConfiguredForLogs + this.LogsLastCollected = logsLastCollected + this.LogsSeenFromAnyIndex = logsSeenFromAnyIndex + this.State = state + return &this +} + +// NewSecurityMonitoringContentPackStateAttributesWithDefaults instantiates a new SecurityMonitoringContentPackStateAttributes 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 NewSecurityMonitoringContentPackStateAttributesWithDefaults() *SecurityMonitoringContentPackStateAttributes { + this := SecurityMonitoringContentPackStateAttributes{} + return &this +} + +// GetCloudSiemIndexIncorrect returns the CloudSiemIndexIncorrect field value. +func (o *SecurityMonitoringContentPackStateAttributes) GetCloudSiemIndexIncorrect() bool { + if o == nil { + var ret bool + return ret + } + return o.CloudSiemIndexIncorrect +} + +// GetCloudSiemIndexIncorrectOk returns a tuple with the CloudSiemIndexIncorrect field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateAttributes) GetCloudSiemIndexIncorrectOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.CloudSiemIndexIncorrect, true +} + +// SetCloudSiemIndexIncorrect sets field value. +func (o *SecurityMonitoringContentPackStateAttributes) SetCloudSiemIndexIncorrect(v bool) { + o.CloudSiemIndexIncorrect = 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 { + if o == nil { + var ret SecurityMonitoringContentPackStatus + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateAttributes) GetStateOk() (*SecurityMonitoringContentPackStatus, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value. +func (o *SecurityMonitoringContentPackStateAttributes) SetState(v SecurityMonitoringContentPackStatus) { + o.State = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackStateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + 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 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// 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"` + }{} + 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.State == nil { + return fmt.Errorf("required field state missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(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"}) + } 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() { + hasInvalidField = true + } else { + o.State = *all.State + } + + 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_state_data.go b/api/datadogV2/model_security_monitoring_content_pack_state_data.go new file mode 100644 index 00000000000..356dee209cd --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_state_data.go @@ -0,0 +1,178 @@ +// 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" +) + +// SecurityMonitoringContentPackStateData Content pack state data. +type SecurityMonitoringContentPackStateData struct { + // Attributes of a content pack state + Attributes SecurityMonitoringContentPackStateAttributes `json:"attributes"` + // The content pack identifier. + Id string `json:"id"` + // Type for content pack state object + Type SecurityMonitoringContentPackStateType `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:"-"` +} + +// NewSecurityMonitoringContentPackStateData instantiates a new SecurityMonitoringContentPackStateData 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 NewSecurityMonitoringContentPackStateData(attributes SecurityMonitoringContentPackStateAttributes, id string, typeVar SecurityMonitoringContentPackStateType) *SecurityMonitoringContentPackStateData { + this := SecurityMonitoringContentPackStateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewSecurityMonitoringContentPackStateDataWithDefaults instantiates a new SecurityMonitoringContentPackStateData 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 NewSecurityMonitoringContentPackStateDataWithDefaults() *SecurityMonitoringContentPackStateData { + this := SecurityMonitoringContentPackStateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringContentPackStateData) GetAttributes() SecurityMonitoringContentPackStateAttributes { + if o == nil { + var ret SecurityMonitoringContentPackStateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateData) GetAttributesOk() (*SecurityMonitoringContentPackStateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringContentPackStateData) SetAttributes(v SecurityMonitoringContentPackStateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *SecurityMonitoringContentPackStateData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SecurityMonitoringContentPackStateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *SecurityMonitoringContentPackStateData) GetType() SecurityMonitoringContentPackStateType { + if o == nil { + var ret SecurityMonitoringContentPackStateType + 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 *SecurityMonitoringContentPackStateData) GetTypeOk() (*SecurityMonitoringContentPackStateType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityMonitoringContentPackStateData) SetType(v SecurityMonitoringContentPackStateType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackStateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackStateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SecurityMonitoringContentPackStateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *SecurityMonitoringContentPackStateType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + 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_state_meta.go b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go new file mode 100644 index 00000000000..dace8bc6df1 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_state_meta.go @@ -0,0 +1,143 @@ +// 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" +) + +// SecurityMonitoringContentPackStateMeta Metadata for content pack states +type SecurityMonitoringContentPackStateMeta struct { + // Whether the cloud SIEM index configuration is incorrect at the organization level + CloudSiemIndexIncorrect bool `json:"cloud_siem_index_incorrect"` + // The 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 + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackStateMeta instantiates a new SecurityMonitoringContentPackStateMeta 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 NewSecurityMonitoringContentPackStateMeta(cloudSiemIndexIncorrect bool, sku SecurityMonitoringSKU) *SecurityMonitoringContentPackStateMeta { + this := SecurityMonitoringContentPackStateMeta{} + this.CloudSiemIndexIncorrect = cloudSiemIndexIncorrect + this.Sku = sku + return &this +} + +// NewSecurityMonitoringContentPackStateMetaWithDefaults instantiates a new SecurityMonitoringContentPackStateMeta 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 NewSecurityMonitoringContentPackStateMetaWithDefaults() *SecurityMonitoringContentPackStateMeta { + this := SecurityMonitoringContentPackStateMeta{} + return &this +} + +// GetCloudSiemIndexIncorrect returns the CloudSiemIndexIncorrect field value. +func (o *SecurityMonitoringContentPackStateMeta) GetCloudSiemIndexIncorrect() bool { + if o == nil { + var ret bool + return ret + } + return o.CloudSiemIndexIncorrect +} + +// GetCloudSiemIndexIncorrectOk returns a tuple with the CloudSiemIndexIncorrect field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateMeta) GetCloudSiemIndexIncorrectOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.CloudSiemIndexIncorrect, true +} + +// SetCloudSiemIndexIncorrect sets field value. +func (o *SecurityMonitoringContentPackStateMeta) SetCloudSiemIndexIncorrect(v bool) { + o.CloudSiemIndexIncorrect = v +} + +// GetSku returns the Sku field value. +func (o *SecurityMonitoringContentPackStateMeta) GetSku() SecurityMonitoringSKU { + if o == nil { + var ret SecurityMonitoringSKU + return ret + } + return o.Sku +} + +// GetSkuOk returns a tuple with the Sku field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStateMeta) GetSkuOk() (*SecurityMonitoringSKU, bool) { + if o == nil { + return nil, false + } + return &o.Sku, true +} + +// SetSku sets field value. +func (o *SecurityMonitoringContentPackStateMeta) SetSku(v SecurityMonitoringSKU) { + o.Sku = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackStateMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["cloud_siem_index_incorrect"] = o.CloudSiemIndexIncorrect + toSerialize["sku"] = o.Sku + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackStateMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CloudSiemIndexIncorrect *bool `json:"cloud_siem_index_incorrect"` + Sku *SecurityMonitoringSKU `json:"sku"` + }{} + 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.Sku == nil { + return fmt.Errorf("required field sku missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cloud_siem_index_incorrect", "sku"}) + } else { + return err + } + + hasInvalidField := false + o.CloudSiemIndexIncorrect = *all.CloudSiemIndexIncorrect + if !all.Sku.IsValid() { + hasInvalidField = true + } else { + o.Sku = *all.Sku + } + + 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_state_type.go b/api/datadogV2/model_security_monitoring_content_pack_state_type.go new file mode 100644 index 00000000000..2921957ae7f --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_state_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" +) + +// SecurityMonitoringContentPackStateType Type for content pack state object +type SecurityMonitoringContentPackStateType string + +// List of SecurityMonitoringContentPackStateType. +const ( + SECURITYMONITORINGCONTENTPACKSTATETYPE_CONTENT_PACK_STATE SecurityMonitoringContentPackStateType = "content_pack_state" +) + +var allowedSecurityMonitoringContentPackStateTypeEnumValues = []SecurityMonitoringContentPackStateType{ + SECURITYMONITORINGCONTENTPACKSTATETYPE_CONTENT_PACK_STATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackStateType) GetAllowedValues() []SecurityMonitoringContentPackStateType { + return allowedSecurityMonitoringContentPackStateTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackStateType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackStateType(value) + return nil +} + +// NewSecurityMonitoringContentPackStateTypeFromValue returns a pointer to a valid SecurityMonitoringContentPackStateType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackStateTypeFromValue(v string) (*SecurityMonitoringContentPackStateType, error) { + ev := SecurityMonitoringContentPackStateType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackStateType: valid values are %v", v, allowedSecurityMonitoringContentPackStateTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackStateType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackStateTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackStateType value. +func (v SecurityMonitoringContentPackStateType) Ptr() *SecurityMonitoringContentPackStateType { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_states_response.go b/api/datadogV2/model_security_monitoring_content_pack_states_response.go new file mode 100644 index 00000000000..7288578dbff --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_states_response.go @@ -0,0 +1,142 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringContentPackStatesResponse Response containing content pack states. +type SecurityMonitoringContentPackStatesResponse struct { + // Array of content pack states. + Data []SecurityMonitoringContentPackStateData `json:"data"` + // 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:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringContentPackStatesResponse instantiates a new SecurityMonitoringContentPackStatesResponse 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 NewSecurityMonitoringContentPackStatesResponse(data []SecurityMonitoringContentPackStateData, meta SecurityMonitoringContentPackStateMeta) *SecurityMonitoringContentPackStatesResponse { + this := SecurityMonitoringContentPackStatesResponse{} + this.Data = data + this.Meta = meta + return &this +} + +// NewSecurityMonitoringContentPackStatesResponseWithDefaults instantiates a new SecurityMonitoringContentPackStatesResponse 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 NewSecurityMonitoringContentPackStatesResponseWithDefaults() *SecurityMonitoringContentPackStatesResponse { + this := SecurityMonitoringContentPackStatesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringContentPackStatesResponse) GetData() []SecurityMonitoringContentPackStateData { + if o == nil { + var ret []SecurityMonitoringContentPackStateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStatesResponse) GetDataOk() (*[]SecurityMonitoringContentPackStateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringContentPackStatesResponse) SetData(v []SecurityMonitoringContentPackStateData) { + o.Data = v +} + +// GetMeta returns the Meta field value. +func (o *SecurityMonitoringContentPackStatesResponse) GetMeta() SecurityMonitoringContentPackStateMeta { + if o == nil { + var ret SecurityMonitoringContentPackStateMeta + return ret + } + return o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringContentPackStatesResponse) GetMetaOk() (*SecurityMonitoringContentPackStateMeta, bool) { + if o == nil { + return nil, false + } + return &o.Meta, true +} + +// SetMeta sets field value. +func (o *SecurityMonitoringContentPackStatesResponse) SetMeta(v SecurityMonitoringContentPackStateMeta) { + o.Meta = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringContentPackStatesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringContentPackStatesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SecurityMonitoringContentPackStateData `json:"data"` + Meta *SecurityMonitoringContentPackStateMeta `json:"meta"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = *all.Data + if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = *all.Meta + + 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_status.go b/api/datadogV2/model_security_monitoring_content_pack_status.go new file mode 100644 index 00000000000..6f335fe55da --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_status.go @@ -0,0 +1,74 @@ +// 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" +) + +// SecurityMonitoringContentPackStatus The current status of a content pack +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" +) + +var allowedSecurityMonitoringContentPackStatusEnumValues = []SecurityMonitoringContentPackStatus{ + SECURITYMONITORINGCONTENTPACKSTATUS_INSTALL, + SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVATE, + SECURITYMONITORINGCONTENTPACKSTATUS_INITIALIZING, + SECURITYMONITORINGCONTENTPACKSTATUS_ACTIVE, + SECURITYMONITORINGCONTENTPACKSTATUS_WARNING, + SECURITYMONITORINGCONTENTPACKSTATUS_BROKEN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackStatus) GetAllowedValues() []SecurityMonitoringContentPackStatus { + return allowedSecurityMonitoringContentPackStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackStatus(value) + return nil +} + +// NewSecurityMonitoringContentPackStatusFromValue returns a pointer to a valid SecurityMonitoringContentPackStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackStatusFromValue(v string) (*SecurityMonitoringContentPackStatus, error) { + ev := SecurityMonitoringContentPackStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackStatus: valid values are %v", v, allowedSecurityMonitoringContentPackStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackStatus) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackStatus value. +func (v SecurityMonitoringContentPackStatus) Ptr() *SecurityMonitoringContentPackStatus { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go b/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go new file mode 100644 index 00000000000..a3add18c230 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_content_pack_timestamp_bucket.go @@ -0,0 +1,72 @@ +// 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" +) + +// SecurityMonitoringContentPackTimestampBucket Timestamp bucket indicating when logs were last collected +type SecurityMonitoringContentPackTimestampBucket string + +// List of SecurityMonitoringContentPackTimestampBucket. +const ( + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_NOT_SEEN SecurityMonitoringContentPackTimestampBucket = "not_seen" + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_WITHIN_24_HOURS SecurityMonitoringContentPackTimestampBucket = "within_24_hours" + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_WITHIN_24_TO_72_HOURS SecurityMonitoringContentPackTimestampBucket = "within_24_to_72_hours" + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_OVER_72H_TO_30D SecurityMonitoringContentPackTimestampBucket = "over_72h_to_30d" + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_OVER_30D SecurityMonitoringContentPackTimestampBucket = "over_30d" +) + +var allowedSecurityMonitoringContentPackTimestampBucketEnumValues = []SecurityMonitoringContentPackTimestampBucket{ + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_NOT_SEEN, + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_WITHIN_24_HOURS, + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_WITHIN_24_TO_72_HOURS, + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_OVER_72H_TO_30D, + SECURITYMONITORINGCONTENTPACKTIMESTAMPBUCKET_OVER_30D, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringContentPackTimestampBucket) GetAllowedValues() []SecurityMonitoringContentPackTimestampBucket { + return allowedSecurityMonitoringContentPackTimestampBucketEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringContentPackTimestampBucket) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringContentPackTimestampBucket(value) + return nil +} + +// NewSecurityMonitoringContentPackTimestampBucketFromValue returns a pointer to a valid SecurityMonitoringContentPackTimestampBucket +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringContentPackTimestampBucketFromValue(v string) (*SecurityMonitoringContentPackTimestampBucket, error) { + ev := SecurityMonitoringContentPackTimestampBucket(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringContentPackTimestampBucket: valid values are %v", v, allowedSecurityMonitoringContentPackTimestampBucketEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringContentPackTimestampBucket) IsValid() bool { + for _, existing := range allowedSecurityMonitoringContentPackTimestampBucketEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringContentPackTimestampBucket value. +func (v SecurityMonitoringContentPackTimestampBucket) Ptr() *SecurityMonitoringContentPackTimestampBucket { + return &v +} diff --git a/api/datadogV2/model_security_monitoring_sku.go b/api/datadogV2/model_security_monitoring_sku.go new file mode 100644 index 00000000000..0db8c66d549 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_sku.go @@ -0,0 +1,68 @@ +// 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" +) + +// SecurityMonitoringSKU The SIEM pricing model (SKU) for the organization +type SecurityMonitoringSKU string + +// List of SecurityMonitoringSKU. +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" +) + +var allowedSecurityMonitoringSKUEnumValues = []SecurityMonitoringSKU{ + SECURITYMONITORINGSKU_PER_GB_ANALYZED, + SECURITYMONITORINGSKU_PER_EVENT_IN_SIEM_INDEX_2023, + SECURITYMONITORINGSKU_ADD_ON_2024, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSKU) GetAllowedValues() []SecurityMonitoringSKU { + return allowedSecurityMonitoringSKUEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSKU) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSKU(value) + return nil +} + +// NewSecurityMonitoringSKUFromValue returns a pointer to a valid SecurityMonitoringSKU +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSKUFromValue(v string) (*SecurityMonitoringSKU, error) { + ev := SecurityMonitoringSKU(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSKU: valid values are %v", v, allowedSecurityMonitoringSKUEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSKU) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSKUEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSKU value. +func (v SecurityMonitoringSKU) Ptr() *SecurityMonitoringSKU { + return &v +} diff --git a/examples/v2/security-monitoring/ActivateContentPack.go b/examples/v2/security-monitoring/ActivateContentPack.go new file mode 100644 index 00000000000..22243a48842 --- /dev/null +++ b/examples/v2/security-monitoring/ActivateContentPack.go @@ -0,0 +1,26 @@ +// Activate content pack returns "Accepted" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ActivateContentPack", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + r, err := api.ActivateContentPack(ctx, "aws-cloudtrail") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ActivateContentPack`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/security-monitoring/DeactivateContentPack.go b/examples/v2/security-monitoring/DeactivateContentPack.go new file mode 100644 index 00000000000..bb892757cad --- /dev/null +++ b/examples/v2/security-monitoring/DeactivateContentPack.go @@ -0,0 +1,26 @@ +// Deactivate content pack returns "Accepted" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeactivateContentPack", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + r, err := api.DeactivateContentPack(ctx, "aws-cloudtrail") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.DeactivateContentPack`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/security-monitoring/GetContentPacksStates.go b/examples/v2/security-monitoring/GetContentPacksStates.go new file mode 100644 index 00000000000..91b80d911d1 --- /dev/null +++ b/examples/v2/security-monitoring/GetContentPacksStates.go @@ -0,0 +1,30 @@ +// Get content pack states returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetContentPacksStates", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.GetContentPacksStates(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.GetContentPacksStates`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.GetContentPacksStates`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index ccc027734e2..df5e32bcc4d 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -9,6 +9,22 @@ Feature: Security Monitoring And a valid "appKeyAuth" key in the system And an instance of "SecurityMonitoring" API + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Activate content pack returns "Accepted" response + Given operation "ActivateContentPack" enabled + And new "ActivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Activate content pack returns "Not Found" response + Given operation "ActivateContentPack" enabled + And new "ActivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-investigation Scenario: Attach security finding to a Jira issue returns "OK" response Given new "AttachJiraIssue" request @@ -681,6 +697,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Deactivate content pack returns "Accepted" response + Given operation "DeactivateContentPack" enabled + And new "DeactivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Deactivate content pack returns "Not Found" response + Given operation "DeactivateContentPack" enabled + And new "DeactivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-cloud-security-platform Scenario: Delete a critical asset returns "Not Found" response Given new "DeleteSecurityMonitoringCriticalAsset" request @@ -1225,6 +1257,20 @@ Feature: Security Monitoring Then the response status is 200 OK And the response "data[0].attributes.name" is equal to "suppression2 {{ unique_hash }}" + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Get content pack states returns "Not Found" response + Given operation "GetContentPacksStates" enabled + And new "GetContentPacksStates" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Get content pack states returns "OK" response + Given operation "GetContentPacksStates" enabled + And new "GetContentPacksStates" request + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-security-platform Scenario: Get critical assets affecting a specific rule returns "Not Found" response Given new "GetCriticalAssetsAffectingRule" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 030260c0f8c..7e549784ee6 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4537,6 +4537,24 @@ "type": "safe" } }, + "GetContentPacksStates": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "ActivateContentPack": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeactivateContentPack": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": {