Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for audit logs data source in dashboards #521

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.4.1.dev11",
"regenerated": "2021-07-14 09:06:55.275340",
"spec_repo_commit": "f0a4221"
"regenerated": "2021-07-15 15:54:38.956828",
"spec_repo_commit": "18eae8f"
},
"v2": {
"apigentools_version": "1.4.1.dev11",
"regenerated": "2021-07-14 09:07:22.355067",
"spec_repo_commit": "f0a4221"
"regenerated": "2021-07-15 15:55:05.776227",
"spec_repo_commit": "18eae8f"
}
}
}
2 changes: 1 addition & 1 deletion docs/v1/FormulaAndFunctionEventsDataSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Data source for event platform-based queries.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | Data source for event platform-based queries. | must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", ]
**value** | **str** | Data source for event platform-based queries. | must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", "audit", ]

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

Expand Down
1 change: 1 addition & 0 deletions docs/v1/QueryValueWidgetRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**aggregator** | [**WidgetAggregator**](WidgetAggregator.md) | | [optional]
**apm_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**audit_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**conditional_formats** | [**[WidgetConditionalFormat]**](WidgetConditionalFormat.md) | List of conditional formats. | [optional]
**event_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**formulas** | [**[WidgetFormula]**](WidgetFormula.md) | List of formulas that operate on queries. **This feature is currently in beta.** | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/v1/TimeseriesWidgetRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Updated timeseries widget.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**apm_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**audit_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**display_type** | [**WidgetDisplayType**](WidgetDisplayType.md) | | [optional]
**event_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**formulas** | [**[WidgetFormula]**](WidgetFormula.md) | List of formulas that operate on queries. **This feature is currently in beta.** | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/v1/ToplistWidgetRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Updated top list widget.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**apm_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**audit_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**conditional_formats** | [**[WidgetConditionalFormat]**](WidgetConditionalFormat.md) | List of conditional formats. | [optional]
**event_query** | [**LogQueryDefinition**](LogQueryDefinition.md) | | [optional]
**formulas** | [**[WidgetFormula]**](WidgetFormula.md) | List of formulas that operate on queries. **This feature is currently in beta.** | [optional]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class FormulaAndFunctionEventsDataSource(ModelSimple):
"RUM": "rum",
"SECURITY_SIGNALS": "security_signals",
"PROFILES": "profiles",
"AUDIT": "audit",
},
}

Expand Down Expand Up @@ -99,10 +100,10 @@ def __init__(self, *args, **kwargs):
Note that value can be passed either in args or in kwargs, but not in both.
Args:
args[0] (str): Data source for event platform-based queries.., must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", ] # noqa: E501
args[0] (str): Data source for event platform-based queries.., must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", "audit", ] # noqa: E501
Keyword Args:
value (str): Data source for event platform-based queries.., must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", ] # noqa: E501
value (str): Data source for event platform-based queries.., must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", "audit", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def openapi_types():
return {
"aggregator": (WidgetAggregator,), # noqa: E501
"apm_query": (LogQueryDefinition,), # noqa: E501
"audit_query": (LogQueryDefinition,), # noqa: E501
"conditional_formats": ([WidgetConditionalFormat],), # noqa: E501
"event_query": (LogQueryDefinition,), # noqa: E501
"formulas": ([WidgetFormula],), # noqa: E501
Expand All @@ -107,6 +108,7 @@ def discriminator():
attribute_map = {
"aggregator": "aggregator", # noqa: E501
"apm_query": "apm_query", # noqa: E501
"audit_query": "audit_query", # noqa: E501
"conditional_formats": "conditional_formats", # noqa: E501
"event_query": "event_query", # noqa: E501
"formulas": "formulas", # noqa: E501
Expand Down Expand Up @@ -171,6 +173,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
aggregator (WidgetAggregator): [optional] # noqa: E501
apm_query (LogQueryDefinition): [optional] # noqa: E501
audit_query (LogQueryDefinition): [optional] # noqa: E501
conditional_formats ([WidgetConditionalFormat]): List of conditional formats.. [optional] # noqa: E501
event_query (LogQueryDefinition): [optional] # noqa: E501
formulas ([WidgetFormula]): List of formulas that operate on queries. **This feature is currently in beta.**. [optional] # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def openapi_types():
lazy_import()
return {
"apm_query": (LogQueryDefinition,), # noqa: E501
"audit_query": (LogQueryDefinition,), # noqa: E501
"display_type": (WidgetDisplayType,), # noqa: E501
"event_query": (LogQueryDefinition,), # noqa: E501
"formulas": ([WidgetFormula],), # noqa: E501
Expand All @@ -110,6 +111,7 @@ def discriminator():

attribute_map = {
"apm_query": "apm_query", # noqa: E501
"audit_query": "audit_query", # noqa: E501
"display_type": "display_type", # noqa: E501
"event_query": "event_query", # noqa: E501
"formulas": "formulas", # noqa: E501
Expand Down Expand Up @@ -176,6 +178,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
apm_query (LogQueryDefinition): [optional] # noqa: E501
audit_query (LogQueryDefinition): [optional] # noqa: E501
display_type (WidgetDisplayType): [optional] # noqa: E501
event_query (LogQueryDefinition): [optional] # noqa: E501
formulas ([WidgetFormula]): List of formulas that operate on queries. **This feature is currently in beta.**. [optional] # noqa: E501
Expand Down
3 changes: 3 additions & 0 deletions src/datadog_api_client/v1/model/toplist_widget_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def openapi_types():
lazy_import()
return {
"apm_query": (LogQueryDefinition,), # noqa: E501
"audit_query": (LogQueryDefinition,), # noqa: E501
"conditional_formats": ([WidgetConditionalFormat],), # noqa: E501
"event_query": (LogQueryDefinition,), # noqa: E501
"formulas": ([WidgetFormula],), # noqa: E501
Expand All @@ -110,6 +111,7 @@ def discriminator():

attribute_map = {
"apm_query": "apm_query", # noqa: E501
"audit_query": "audit_query", # noqa: E501
"conditional_formats": "conditional_formats", # noqa: E501
"event_query": "event_query", # noqa: E501
"formulas": "formulas", # noqa: E501
Expand Down Expand Up @@ -174,6 +176,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
apm_query (LogQueryDefinition): [optional] # noqa: E501
audit_query (LogQueryDefinition): [optional] # noqa: E501
conditional_formats ([WidgetConditionalFormat]): List of conditional formats.. [optional] # noqa: E501
event_query (LogQueryDefinition): [optional] # noqa: E501
formulas ([WidgetFormula]): List of formulas that operate on queries. **This feature is currently in beta.**. [optional] # noqa: E501
Expand Down
8 changes: 8 additions & 0 deletions src/datadog_api_client/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,7 @@ components:
- rum
- security_signals
- profiles
- audit
example: logs
type: string
x-enum-varnames:
Expand All @@ -2106,6 +2107,7 @@ components:
- RUM
- SECURITY_SIGNALS
- PROFILES
- AUDIT
FormulaAndFunctionMetricAggregation:
description: The aggregation methods available for metrics queries.
enum:
Expand Down Expand Up @@ -6754,6 +6756,8 @@ components:
$ref: '#/components/schemas/WidgetAggregator'
apm_query:
$ref: '#/components/schemas/LogQueryDefinition'
audit_query:
$ref: '#/components/schemas/LogQueryDefinition'
conditional_formats:
description: List of conditional formats.
items:
Expand Down Expand Up @@ -10379,6 +10383,8 @@ components:
properties:
apm_query:
$ref: '#/components/schemas/LogQueryDefinition'
audit_query:
$ref: '#/components/schemas/LogQueryDefinition'
display_type:
$ref: '#/components/schemas/WidgetDisplayType'
event_query:
Expand Down Expand Up @@ -10470,6 +10476,8 @@ components:
properties:
apm_query:
$ref: '#/components/schemas/LogQueryDefinition'
audit_query:
$ref: '#/components/schemas/LogQueryDefinition'
conditional_formats:
description: List of conditional formats.
example:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-07-15T15:24:01.025Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
interactions:
- request:
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1626362641
with Audit Logs Query","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"audit","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":2,"y":0}}]}'
headers:
accept:
- application/json, */*;q=0.8
connection:
- close
content-length:
- '398'
content-type:
- application/json
host:
- api.datadoghq.com
user-agent:
- datadog-api-client-typescript/1.0.0-beta.4 (node 14.17.3; os Linux; arch x64)
x-datadog-parent-id:
- '416849553464162765'
x-datadog-trace-id:
- '6183266674255130707'
method: POST
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"p4g-d4h-n7v","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1626362641
with Audit Logs Query","url":"/dashboard/p4g-d4h-n7v/test-createanewdashboardwithanauditlogsquery-1626362641-with-audit-logs-query","created_at":"2021-07-15T15:24:01.201286+00:00","modified_at":"2021-07-15T15:24:01.201286+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"response_format":"timeseries","queries":[{"search":{"query":""},"data_source":"audit","compute":{"aggregation":"count"},"name":"query1","indexes":["*"],"group_by":[]}]}],"type":"timeseries"},"layout":{"y":0,"width":4,"x":2,"height":2},"id":2504710761419893}],"layout_type":"ordered"}'
headers:
cache-control:
- no-cache
connection:
- close
content-length:
- '808'
content-security-policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
content-type:
- application/json
date:
- Thu, 15 Jul 2021 15:24:01 GMT
pragma:
- no-cache
strict-transport-security:
- max-age=15724800;
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- application/json, */*;q=0.8
connection:
- close
host:
- api.datadoghq.com
user-agent:
- datadog-api-client-typescript/1.0.0-beta.4 (node 14.17.3; os Linux; arch x64)
x-datadog-parent-id:
- '3221273726630624468'
x-datadog-trace-id:
- '6183266674255130707'
method: DELETE
uri: https://api.datadoghq.com/api/v1/dashboard/p4g-d4h-n7v
response:
body:
string: '{"deleted_dashboard_id":"p4g-d4h-n7v"}'
headers:
cache-control:
- no-cache
connection:
- close
content-length:
- '38'
content-security-policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
content-type:
- application/json
date:
- Thu, 15 Jul 2021 15:24:01 GMT
pragma:
- no-cache
strict-transport-security:
- max-age=15724800;
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
status:
code: 200
message: OK
version: 1
6 changes: 6 additions & 0 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Feature: Dashboards
When the request is sent
Then the response status is 200 OK

Scenario: Create a new dashboard with an audit logs query
Given new "CreateDashboard" request
And body with value {"layout_type": "ordered", "title": "{{ unique }} with Audit Logs Query", "widgets": [{"definition": {"type": "timeseries","requests": [{"response_format": "timeseries","queries": [{"search": {"query": ""},"data_source": "audit","compute": {"aggregation": "count"},"name": "query1","indexes": ["*"],"group_by": []}]}]},"layout": {"x": 2,"y": 0,"width": 4,"height": 2}}]}
When the request is sent
Then the response status is 200 OK

Scenario: Create a new dashboard with timeseries widget containing style attributes
Given new "CreateDashboard" request
And body with value {"layout_type": "ordered", "title": "{{ unique }} with timeseries widget","widgets": [{"definition": {"type": "timeseries","requests": [{"q": "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()","on_right_yaxis": false,"style": {"palette": "warm","line_type": "solid","line_width": "normal"},"display_type": "bars"}]}}]}
Expand Down