Skip to content

Commit

Permalink
[CreateRuleDoc] Adding query and status as required (#422)
Browse files Browse the repository at this point in the history
* [SecurityMonitoring] Fixing tests

* Added create response

* Using rule response

* Regenerate client from commit 8f4a24d of spec repo

Co-authored-by: Antoine Dussarps <antoine.dussarps@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
3 people authored Jul 31, 2020
1 parent 4099375 commit 9782df8
Show file tree
Hide file tree
Showing 19 changed files with 832 additions and 83 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.2.0",
"regenerated": "2020-07-31 08:09:16.579146",
"spec_repo_commit": "049bffd"
"regenerated": "2020-07-31 09:08:32.032555",
"spec_repo_commit": "8f4a24d"
},
"v2": {
"apigentools_version": "1.2.0",
"regenerated": "2020-07-31 08:09:21.963297",
"spec_repo_commit": "049bffd"
"regenerated": "2020-07-31 09:08:37.531577",
"spec_repo_commit": "8f4a24d"
}
}
}
4 changes: 4 additions & 0 deletions api/v2/datadog/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ docs/RolesType.md
docs/SecurityMonitoringApi.md
docs/SecurityMonitoringListRulesResponse.md
docs/SecurityMonitoringRuleCase.md
docs/SecurityMonitoringRuleCaseCreate.md
docs/SecurityMonitoringRuleCreatePayload.md
docs/SecurityMonitoringRuleEvaluationWindow.md
docs/SecurityMonitoringRuleKeepAlive.md
docs/SecurityMonitoringRuleMaxSignalDuration.md
docs/SecurityMonitoringRuleOptions.md
docs/SecurityMonitoringRuleQuery.md
docs/SecurityMonitoringRuleQueryCreate.md
docs/SecurityMonitoringRuleResponse.md
docs/SecurityMonitoringRuleSeverity.md
docs/SecurityMonitoringRuleUpdatePayload.md
Expand Down Expand Up @@ -263,12 +265,14 @@ model_roles_sort.go
model_roles_type.go
model_security_monitoring_list_rules_response.go
model_security_monitoring_rule_case.go
model_security_monitoring_rule_case_create.go
model_security_monitoring_rule_create_payload.go
model_security_monitoring_rule_evaluation_window.go
model_security_monitoring_rule_keep_alive.go
model_security_monitoring_rule_max_signal_duration.go
model_security_monitoring_rule_options.go
model_security_monitoring_rule_query.go
model_security_monitoring_rule_query_create.go
model_security_monitoring_rule_response.go
model_security_monitoring_rule_severity.go
model_security_monitoring_rule_update_payload.go
Expand Down
2 changes: 2 additions & 0 deletions api/v2/datadog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ Class | Method | HTTP request | Description
- [RolesType](docs/RolesType.md)
- [SecurityMonitoringListRulesResponse](docs/SecurityMonitoringListRulesResponse.md)
- [SecurityMonitoringRuleCase](docs/SecurityMonitoringRuleCase.md)
- [SecurityMonitoringRuleCaseCreate](docs/SecurityMonitoringRuleCaseCreate.md)
- [SecurityMonitoringRuleCreatePayload](docs/SecurityMonitoringRuleCreatePayload.md)
- [SecurityMonitoringRuleEvaluationWindow](docs/SecurityMonitoringRuleEvaluationWindow.md)
- [SecurityMonitoringRuleKeepAlive](docs/SecurityMonitoringRuleKeepAlive.md)
- [SecurityMonitoringRuleMaxSignalDuration](docs/SecurityMonitoringRuleMaxSignalDuration.md)
- [SecurityMonitoringRuleOptions](docs/SecurityMonitoringRuleOptions.md)
- [SecurityMonitoringRuleQuery](docs/SecurityMonitoringRuleQuery.md)
- [SecurityMonitoringRuleQueryCreate](docs/SecurityMonitoringRuleQueryCreate.md)
- [SecurityMonitoringRuleResponse](docs/SecurityMonitoringRuleResponse.md)
- [SecurityMonitoringRuleSeverity](docs/SecurityMonitoringRuleSeverity.md)
- [SecurityMonitoringRuleUpdatePayload](docs/SecurityMonitoringRuleUpdatePayload.md)
Expand Down
79 changes: 62 additions & 17 deletions api/v2/datadog/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ tags:
read access on a specific log index to a role can be done in Datadog from the
[Pipelines page](https://app.datadoghq.com/logs/pipelines).
name: Roles
- description: Detection Rules for generating signals
- description: Detection Rules for generating signals.
name: Security Monitoring
- description: Create, edit, and disable users.
externalDocs:
Expand Down Expand Up @@ -3750,7 +3750,7 @@ components:
x-enum-varnames:
- ROLES
SecurityMonitoringListRulesResponse:
description: List of rules
description: List of rules.
example:
data:
- cases:
Expand Down Expand Up @@ -3859,21 +3859,43 @@ components:
properties:
condition:
description: |-
A rule case contains logical operations (>, >=, &&, ||) to determine if a signal should be generated
A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated
based on the event counts in the previously defined queries.
type: string
name:
description: Name of the case.
type: string
notifications:
description: Notification targets for each rule case
description: Notification targets for each rule case.
items:
description: Notification
description: Notification.
type: string
type: array
status:
$ref: '#/components/schemas/SecurityMonitoringRuleSeverity'
type: object
SecurityMonitoringRuleCaseCreate:
description: Case when signal is generated.
properties:
condition:
description: |-
A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated
based on the event counts in the previously defined queries.
type: string
name:
description: Name of the case.
type: string
notifications:
description: Notification targets for each rule case.
items:
description: Notification.
type: string
type: array
status:
$ref: '#/components/schemas/SecurityMonitoringRuleSeverity'
required:
- status
type: object
SecurityMonitoringRuleCreatePayload:
description: Create a new rule.
example:
Expand All @@ -3891,7 +3913,7 @@ components:
description: Cases for generating signals.
example: []
items:
$ref: '#/components/schemas/SecurityMonitoringRuleCase'
$ref: '#/components/schemas/SecurityMonitoringRuleCaseCreate'
type: array
isEnabled:
description: Whether the rule is enabled.
Expand All @@ -3901,23 +3923,23 @@ components:
description: Message for generated signals.
type: string
name:
description: The name of the rule
description: The name of the rule.
type: string
options:
$ref: '#/components/schemas/SecurityMonitoringRuleOptions'
queries:
description: Queries for selecting logs which are part of the rule.
example: []
items:
$ref: '#/components/schemas/SecurityMonitoringRuleQuery'
$ref: '#/components/schemas/SecurityMonitoringRuleQueryCreate'
type: array
tags:
description: Tags for generated signals.
example:
- env:prod
- team:security
items:
description: Tag
description: Tag.
type: string
type: array
required:
Expand All @@ -3927,7 +3949,6 @@ components:
- name
- options
- queries
- tags
type: object
SecurityMonitoringRuleEvaluationWindow:
description: |-
Expand Down Expand Up @@ -4035,24 +4056,48 @@ components:
distinctFields:
description: Field for which the cardinality is measured. Sent as an array.
items:
description: Field
description: Field.
type: string
type: array
groupByFields:
description: Fields to group by.
items:
description: Field
description: Field.
type: string
type: array
name:
description: Name of the query
description: Name of the query.
type: string
query:
description: Query to run on logs
description: Query to run on logs.
type: string
type: object
SecurityMonitoringRuleQueryCreate:
description: Query for matching rule.
properties:
distinctFields:
description: Field for which the cardinality is measured. Sent as an array.
items:
description: Field.
type: string
type: array
groupByFields:
description: Fields to group by.
items:
description: Field.
type: string
type: array
name:
description: Name of the query.
type: string
query:
description: Query to run on logs.
type: string
required:
- query
type: object
SecurityMonitoringRuleResponse:
description: Detection rule
description: Detection rule.
example:
cases:
- condition: condition
Expand Down Expand Up @@ -4137,7 +4182,7 @@ components:
tags:
description: Tags for generated signals.
items:
description: Tag
description: Tag.
type: string
type: array
version:
Expand Down Expand Up @@ -4222,7 +4267,7 @@ components:
tags:
description: Tags for generated signals.
items:
description: Tag
description: Tag.
type: string
type: array
type: object
Expand Down
2 changes: 1 addition & 1 deletion api/v2/datadog/docs/SecurityMonitoringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {
},
)

body := datadog.SecurityMonitoringRuleCreatePayload{Cases: []SecurityMonitoringRuleCase{datadog.SecurityMonitoringRuleCase{Condition: "Condition_example", Name: "Name_example", Notifications: []string{"Notifications_example"), Status: datadog.SecurityMonitoringRuleSeverity{}}), IsEnabled: true, Message: "Message_example", Name: "Name_example", Options: datadog.SecurityMonitoringRuleOptions{EvaluationWindow: datadog.SecurityMonitoringRuleEvaluationWindow{}, KeepAlive: datadog.SecurityMonitoringRuleKeepAlive{}, MaxSignalDuration: datadog.SecurityMonitoringRuleMaxSignalDuration{}}, Queries: []SecurityMonitoringRuleQuery{datadog.SecurityMonitoringRuleQuery{DistinctFields: []string{"DistinctFields_example"), GroupByFields: []string{"GroupByFields_example"), Name: "Name_example", Query: "Query_example"}), Tags: []string{"Tags_example")} // SecurityMonitoringRuleCreatePayload | (optional)
body := datadog.SecurityMonitoringRuleCreatePayload{Cases: []SecurityMonitoringRuleCaseCreate{datadog.SecurityMonitoringRuleCaseCreate{Condition: "Condition_example", Name: "Name_example", Notifications: []string{"Notifications_example"), Status: datadog.SecurityMonitoringRuleSeverity{}}), IsEnabled: true, Message: "Message_example", Name: "Name_example", Options: datadog.SecurityMonitoringRuleOptions{EvaluationWindow: datadog.SecurityMonitoringRuleEvaluationWindow{}, KeepAlive: datadog.SecurityMonitoringRuleKeepAlive{}, MaxSignalDuration: datadog.SecurityMonitoringRuleMaxSignalDuration{}}, Queries: []SecurityMonitoringRuleQueryCreate{datadog.SecurityMonitoringRuleQueryCreate{DistinctFields: []string{"DistinctFields_example"), GroupByFields: []string{"GroupByFields_example"), Name: "Name_example", Query: "Query_example"}), Tags: []string{"Tags_example")} // SecurityMonitoringRuleCreatePayload | (optional)

configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
Expand Down
4 changes: 2 additions & 2 deletions api/v2/datadog/docs/SecurityMonitoringRuleCase.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Condition** | Pointer to **string** | A rule case contains logical operations (&gt;, &gt;&#x3D;, &amp;&amp;, ||) to determine if a signal should be generated based on the event counts in the previously defined queries. | [optional]
**Condition** | Pointer to **string** | A rule case contains logical operations (&#x60;&gt;&#x60;,&#x60;&gt;&#x3D;&#x60;, &#x60;&amp;&amp;&#x60;, &#x60;||&#x60;) to determine if a signal should be generated based on the event counts in the previously defined queries. | [optional]
**Name** | Pointer to **string** | Name of the case. | [optional]
**Notifications** | Pointer to **[]string** | Notification targets for each rule case | [optional]
**Notifications** | Pointer to **[]string** | Notification targets for each rule case. | [optional]
**Status** | Pointer to [**SecurityMonitoringRuleSeverity**](SecurityMonitoringRuleSeverity.md) | | [optional]

## Methods
Expand Down
129 changes: 129 additions & 0 deletions api/v2/datadog/docs/SecurityMonitoringRuleCaseCreate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# SecurityMonitoringRuleCaseCreate

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Condition** | Pointer to **string** | A rule case contains logical operations (&#x60;&gt;&#x60;,&#x60;&gt;&#x3D;&#x60;, &#x60;&amp;&amp;&#x60;, &#x60;||&#x60;) to determine if a signal should be generated based on the event counts in the previously defined queries. | [optional]
**Name** | Pointer to **string** | Name of the case. | [optional]
**Notifications** | Pointer to **[]string** | Notification targets for each rule case. | [optional]
**Status** | [**SecurityMonitoringRuleSeverity**](SecurityMonitoringRuleSeverity.md) | |

## Methods

### NewSecurityMonitoringRuleCaseCreate

`func NewSecurityMonitoringRuleCaseCreate(status SecurityMonitoringRuleSeverity, ) *SecurityMonitoringRuleCaseCreate`

NewSecurityMonitoringRuleCaseCreate instantiates a new SecurityMonitoringRuleCaseCreate 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

### NewSecurityMonitoringRuleCaseCreateWithDefaults

`func NewSecurityMonitoringRuleCaseCreateWithDefaults() *SecurityMonitoringRuleCaseCreate`

NewSecurityMonitoringRuleCaseCreateWithDefaults instantiates a new SecurityMonitoringRuleCaseCreate 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

### GetCondition

`func (o *SecurityMonitoringRuleCaseCreate) GetCondition() string`

GetCondition returns the Condition field if non-nil, zero value otherwise.

### GetConditionOk

`func (o *SecurityMonitoringRuleCaseCreate) GetConditionOk() (*string, bool)`

GetConditionOk returns a tuple with the Condition field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetCondition

`func (o *SecurityMonitoringRuleCaseCreate) SetCondition(v string)`

SetCondition sets Condition field to given value.

### HasCondition

`func (o *SecurityMonitoringRuleCaseCreate) HasCondition() bool`

HasCondition returns a boolean if a field has been set.

### GetName

`func (o *SecurityMonitoringRuleCaseCreate) GetName() string`

GetName returns the Name field if non-nil, zero value otherwise.

### GetNameOk

`func (o *SecurityMonitoringRuleCaseCreate) GetNameOk() (*string, bool)`

GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetName

`func (o *SecurityMonitoringRuleCaseCreate) SetName(v string)`

SetName sets Name field to given value.

### HasName

`func (o *SecurityMonitoringRuleCaseCreate) HasName() bool`

HasName returns a boolean if a field has been set.

### GetNotifications

`func (o *SecurityMonitoringRuleCaseCreate) GetNotifications() []string`

GetNotifications returns the Notifications field if non-nil, zero value otherwise.

### GetNotificationsOk

`func (o *SecurityMonitoringRuleCaseCreate) GetNotificationsOk() (*[]string, bool)`

GetNotificationsOk returns a tuple with the Notifications field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetNotifications

`func (o *SecurityMonitoringRuleCaseCreate) SetNotifications(v []string)`

SetNotifications sets Notifications field to given value.

### HasNotifications

`func (o *SecurityMonitoringRuleCaseCreate) HasNotifications() bool`

HasNotifications returns a boolean if a field has been set.

### GetStatus

`func (o *SecurityMonitoringRuleCaseCreate) GetStatus() SecurityMonitoringRuleSeverity`

GetStatus returns the Status field if non-nil, zero value otherwise.

### GetStatusOk

`func (o *SecurityMonitoringRuleCaseCreate) GetStatusOk() (*SecurityMonitoringRuleSeverity, bool)`

GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetStatus

`func (o *SecurityMonitoringRuleCaseCreate) SetStatus(v SecurityMonitoringRuleSeverity)`

SetStatus sets Status field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


Loading

0 comments on commit 9782df8

Please sign in to comment.