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

[monitor] Fix location of restricted roles. #687

Merged
merged 3 commits into from
Jan 29, 2021
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.dev2",
"regenerated": "2021-01-29 12:49:30.230912",
"spec_repo_commit": "bc876ff"
"regenerated": "2021-01-29 22:08:12.954191",
"spec_repo_commit": "23b373b"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-29 12:49:37.749364",
"spec_repo_commit": "bc876ff"
"regenerated": "2021-01-29 22:08:19.609436",
"spec_repo_commit": "23b373b"
}
}
}
26 changes: 10 additions & 16 deletions api/v1/datadog/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12268,6 +12268,9 @@ components:
query: query
message: message
priority: 3
restricted_roles:
- restricted_roles
- restricted_roles
multi: true
tags:
- tags
Expand All @@ -12285,9 +12288,6 @@ components:
metric: metrics.name
group_by: host
type: count
restricted_roles:
- restricted_roles
- restricted_roles
evaluation_delay: 6
notify_audit: false
min_location_failed: 5
Expand Down Expand Up @@ -12369,6 +12369,13 @@ components:
query:
description: The monitor query.
type: string
restricted_roles:
description: A list of role identifiers that can be pulled from the Roles
API. Cannot be used with `locked` option.
items:
description: A role UUID.
type: string
type: array
state:
$ref: '#/components/schemas/MonitorState'
tags:
Expand Down Expand Up @@ -12417,9 +12424,6 @@ components:
metric: metrics.name
group_by: host
type: count
restricted_roles:
- restricted_roles
- restricted_roles
evaluation_delay: 6
notify_audit: false
min_location_failed: 5
Expand Down Expand Up @@ -12542,13 +12546,6 @@ components:
We highly recommend you set this to `false` for sparse metrics,
otherwise some evaluations are skipped. Default is false.
type: boolean
restricted_roles:
description: A list of role identifiers that can be pulled from the Roles
API. Cannot be used with `locked`.
items:
description: A role UUID.
type: string
type: array
silenced:
additionalProperties:
description: ID of the downtime applied to the monitor.
Expand Down Expand Up @@ -12817,9 +12814,6 @@ components:
metric: metrics.name
group_by: host
type: count
restricted_roles:
- restricted_roles
- restricted_roles
evaluation_delay: 6
notify_audit: false
min_location_failed: 5
Expand Down
26 changes: 26 additions & 0 deletions api/v1/datadog/docs/Monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Name | Type | Description | Notes
**OverallState** | Pointer to [**MonitorOverallStates**](MonitorOverallStates.md) | | [optional]
**Priority** | Pointer to **int64** | Integer from 1 (high) to 5 (low) indicating alert severity. | [optional]
**Query** | Pointer to **string** | The monitor query. | [optional]
**RestrictedRoles** | Pointer to **[]string** | A list of role identifiers that can be pulled from the Roles API. Cannot be used with `locked` option. | [optional]
**State** | Pointer to [**MonitorState**](MonitorState.md) | | [optional]
**Tags** | Pointer to **[]string** | Tags associated to your monitor. | [optional]
**Type** | Pointer to [**MonitorType**](MonitorType.md) | | [optional]
Expand Down Expand Up @@ -349,6 +350,31 @@ SetQuery sets Query field to given value.

HasQuery returns a boolean if a field has been set.

### GetRestrictedRoles

`func (o *Monitor) GetRestrictedRoles() []string`

GetRestrictedRoles returns the RestrictedRoles field if non-nil, zero value otherwise.

### GetRestrictedRolesOk

`func (o *Monitor) GetRestrictedRolesOk() (*[]string, bool)`

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

### SetRestrictedRoles

`func (o *Monitor) SetRestrictedRoles(v []string)`

SetRestrictedRoles sets RestrictedRoles field to given value.

### HasRestrictedRoles

`func (o *Monitor) HasRestrictedRoles() bool`

HasRestrictedRoles returns a boolean if a field has been set.

### GetState

`func (o *Monitor) GetState() MonitorState`
Expand Down
26 changes: 0 additions & 26 deletions api/v1/datadog/docs/MonitorOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Name | Type | Description | Notes
**NotifyNoData** | Pointer to **bool** | A Boolean indicating whether this monitor notifies when data stops reporting. | [optional] [default to false]
**RenotifyInterval** | Pointer to **NullableInt64** | The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved. | [optional]
**RequireFullWindow** | Pointer to **bool** | A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to `false` for sparse metrics, otherwise some evaluations are skipped. Default is false. | [optional]
**RestrictedRoles** | Pointer to **[]string** | A list of role identifiers that can be pulled from the Roles API. Cannot be used with `locked`. | [optional]
**Silenced** | Pointer to **map[string]int64** | Information about the downtime applied to the monitor. | [optional]
**SyntheticsCheckId** | Pointer to **NullableString** | ID of the corresponding Synthetic check. | [optional]
**ThresholdWindows** | Pointer to [**MonitorThresholdWindowOptions**](MonitorThresholdWindowOptions.md) | | [optional]
Expand Down Expand Up @@ -480,31 +479,6 @@ SetRequireFullWindow sets RequireFullWindow field to given value.

HasRequireFullWindow returns a boolean if a field has been set.

### GetRestrictedRoles

`func (o *MonitorOptions) GetRestrictedRoles() []string`

GetRestrictedRoles returns the RestrictedRoles field if non-nil, zero value otherwise.

### GetRestrictedRolesOk

`func (o *MonitorOptions) GetRestrictedRolesOk() (*[]string, bool)`

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

### SetRestrictedRoles

`func (o *MonitorOptions) SetRestrictedRoles(v []string)`

SetRestrictedRoles sets RestrictedRoles field to given value.

### HasRestrictedRoles

`func (o *MonitorOptions) HasRestrictedRoles() bool`

HasRestrictedRoles returns a boolean if a field has been set.

### GetSilenced

`func (o *MonitorOptions) GetSilenced() map[string]int64`
Expand Down
41 changes: 39 additions & 2 deletions api/v1/datadog/model_monitor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions api/v1/datadog/model_monitor_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/api/v1/datadog/api_monitors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func testMonitor(ctx context.Context, t *testing.T) datadog.Monitor {
Warning: *datadog.NewNullableFloat64(datadog.PtrFloat64(1)),
},
},
RestrictedRoles: &[]string{
"a0dfe496-dc09-4464-83be-a8037625bc31",
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/api/v1/datadog/cassettes/TestMonitorDowntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
interactions:
- request:
body: |
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorDowntime-local-1589290245","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","tags":["test","client:go"],"type":"log alert"}
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorDowntime-local-1589290245","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"tags":["test","client:go"],"type":"log alert"}
form: {}
headers:
Accept:
Expand All @@ -23,7 +23,7 @@ interactions:
url: https://api.datadoghq.com/api/v1/monitor
method: POST
response:
body: '{"restricted_roles":null,"tags":["test","client:go"],"deleted":null,"query":"logs(\"service:foo
body: '{"restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"tags":["test","client:go"],"deleted":null,"query":"logs(\"service:foo
AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 2","message":"some
message Notify: @hipchat-channel","id":18411324,"multi":false,"name":"go-TestMonitorDowntime-local-1589290245","created":"2020-05-12T13:30:45.236030+00:00","created_at":1589290245000,"creator":{"id":1379826,"handle":"slavek.kabrda@datadoghq.com","name":"Slavek
Kabrda","email":"slavek.kabrda@datadoghq.com"},"org_id":321813,"modified":"2020-05-12T13:30:45.236030+00:00","overall_state_modified":null,"overall_state":"No
Expand Down
6 changes: 3 additions & 3 deletions tests/api/v1/datadog/cassettes/TestMonitorLifecycle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
interactions:
- request:
body: |
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorLifecycle-local-1589290365","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","tags":["test","client:go"],"type":"log alert"}
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorLifecycle-local-1589290365","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"tags":["test","client:go"],"type":"log alert"}
form: {}
headers:
Accept:
Expand All @@ -23,7 +23,7 @@ interactions:
url: https://api.datadoghq.com/api/v1/monitor
method: POST
response:
body: '{"restricted_roles":null,"tags":["test","client:go"],"deleted":null,"priority":3,"query":"logs(\"service:foo
body: '{"tags":["test","client:go"],"deleted":null,"priority":3,"restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"query":"logs(\"service:foo
AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 2","message":"some
message Notify: @hipchat-channel","id":18411369,"multi":false,"name":"go-TestMonitorLifecycle-local-1589290365","created":"2020-05-12T13:32:45.206017+00:00","created_at":1589290365000,"creator":{"id":1379826,"handle":"slavek.kabrda@datadoghq.com","name":"Slavek
Kabrda","email":"slavek.kabrda@datadoghq.com"},"org_id":321813,"modified":"2020-05-12T13:32:45.206017+00:00","overall_state_modified":null,"overall_state":"No
Expand Down Expand Up @@ -92,7 +92,7 @@ interactions:
url: https://api.datadoghq.com/api/v1/monitor/18411369
method: PUT
response:
body: '{"restricted_roles":null,"tags":["test","client:go"],"deleted":null,"priority":3,"query":"logs(\"service:foo
body: '{"tags":["test","client:go"],"deleted":null,"priority":3,"restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"query":"logs(\"service:foo
AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 2","message":"some
message Notify: @hipchat-channel","id":18411369,"multi":false,"name":"go-TestMonitorLifecycle-local-1589290365-updated","created":"2020-05-12T13:32:45.206017+00:00","created_at":1589290365000,"org_id":321813,"modified":"2020-05-12T13:32:45.527651+00:00","overall_state_modified":null,"overall_state":"No
Data","type":"log alert","options":{"notify_audit":false,"locked":false,"timeout_h":null,"silenced":{},"include_tags":true,"thresholds":{"critical":2.0},"new_host_delay":null,"notify_no_data":false,"renotify_interval":null,"evaluation_delay":null}}'
Expand Down
6 changes: 3 additions & 3 deletions tests/api/v1/datadog/cassettes/TestMonitorPagination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
interactions:
- request:
body: |
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorPagination-local-1589290366","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","tags":["test","client:go"],"type":"log alert"}
{"message":"some message Notify: @hipchat-channel","name":"go-TestMonitorPagination-local-1589290366","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":60},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") \u003e 2","restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"tags":["test","client:go"],"type":"log alert"}
form: {}
headers:
Accept:
Expand All @@ -23,7 +23,7 @@ interactions:
url: https://api.datadoghq.com/api/v1/monitor
method: POST
response:
body: '{"restricted_roles":null,"tags":["test","client:go"],"deleted":null,"priority":3,"query":"logs(\"service:foo
body: '{"tags":["test","client:go"],"deleted":null,"priority":3,"restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"query":"logs(\"service:foo
AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 2","message":"some
message Notify: @hipchat-channel","id":18411370,"multi":false,"name":"go-TestMonitorPagination-local-1589290366","created":"2020-05-12T13:32:46.963135+00:00","created_at":1589290366000,"creator":{"id":1379826,"handle":"slavek.kabrda@datadoghq.com","name":"Slavek
Kabrda","email":"slavek.kabrda@datadoghq.com"},"org_id":321813,"modified":"2020-05-12T13:32:46.963135+00:00","overall_state_modified":null,"overall_state":"No
Expand Down Expand Up @@ -155,7 +155,7 @@ interactions:
url: https://api.datadoghq.com/api/v1/monitor?id_offset=18411369&page_size=1
method: GET
response:
body: '[{"restricted_roles":null,"tags":["test","client:go"],"deleted":null,"priority":3,"query":"logs(\"service:foo
body: '[{"tags":["test","client:go"],"deleted":null,"priority":3,"restricted_roles":["a0dfe496-dc09-4464-83be-a8037625bc31"],"query":"logs(\"service:foo
AND type:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 2","message":"some
message Notify: @hipchat-channel","matching_downtimes":[],"id":18411370,"multi":false,"name":"go-TestMonitorPagination-local-1589290366","created":"2020-05-12T13:32:46.963135+00:00","created_at":1589290366000,"creator":{"id":1379826,"handle":"slavek.kabrda@datadoghq.com","name":"Slavek
Kabrda","email":"slavek.kabrda@datadoghq.com"},"org_id":321813,"modified":"2020-05-12T13:32:46.963135+00:00","overall_state_modified":null,"overall_state":"No
Expand Down
Loading