|
| 1 | +@endpoint(logs-restriction-queries) @endpoint(logs-restriction-queries-v2) |
| 2 | +Feature: Logs Restriction Queries |
| 3 | + **Note: This endpoint is in public beta. If you have any feedback, contact |
| 4 | + [Datadog support](https://docs.datadoghq.com/help/).** A Restriction |
| 5 | + Query is a logs query that restricts which logs the `logs_read_data` |
| 6 | + permission grants read access to. For users whose roles have Restriction |
| 7 | + Queries, any log query they make only returns those log events that also |
| 8 | + match one of their Restriction Queries. This is true whether the user |
| 9 | + queries log events from any log-related feature, including the log |
| 10 | + explorer, Live Tail, re-hydration, or a dashboard widget. Restriction |
| 11 | + Queries currently only support use of the following components of log |
| 12 | + events: - Reserved attributes - The log message - Tags To restrict read |
| 13 | + access on log data, add a team tag to log events to indicate which teams |
| 14 | + own them, and then scope Restriction Queries to the relevant values of the |
| 15 | + team tag. Tags can be applied to log events in many ways, and a log event |
| 16 | + can have multiple tags with the same key (like team) and different values. |
| 17 | + This means the same log event can be visible to roles whose restriction |
| 18 | + queries are scoped to different team values. See [How to Set Up RBAC for |
| 19 | + Logs](https://docs.datadoghq.com/logs/guide/logs-rbac/?tab=api#restrict- |
| 20 | + access-to-logs) for details on how to add restriction queries. |
| 21 | + |
| 22 | + Background: |
| 23 | + Given a valid "apiKeyAuth" key in the system |
| 24 | + And a valid "appKeyAuth" key in the system |
| 25 | + And an instance of "LogsRestrictionQueries" API |
| 26 | + |
| 27 | + @generated @skip @team:DataDog/logs-app |
| 28 | + Scenario: Create a restriction query returns "Bad Request" response |
| 29 | + Given operation "CreateRestrictionQuery" enabled |
| 30 | + And new "CreateRestrictionQuery" request |
| 31 | + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} |
| 32 | + When the request is sent |
| 33 | + Then the response status is 400 Bad Request |
| 34 | + |
| 35 | + @generated @skip @team:DataDog/logs-app |
| 36 | + Scenario: Create a restriction query returns "OK" response |
| 37 | + Given operation "CreateRestrictionQuery" enabled |
| 38 | + And new "CreateRestrictionQuery" request |
| 39 | + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} |
| 40 | + When the request is sent |
| 41 | + Then the response status is 200 OK |
| 42 | + |
| 43 | + @generated @skip @team:DataDog/logs-app |
| 44 | + Scenario: Delete a restriction query returns "Bad Request" response |
| 45 | + Given operation "DeleteRestrictionQuery" enabled |
| 46 | + And new "DeleteRestrictionQuery" request |
| 47 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 48 | + When the request is sent |
| 49 | + Then the response status is 400 Bad Request |
| 50 | + |
| 51 | + @generated @skip @team:DataDog/logs-app |
| 52 | + Scenario: Delete a restriction query returns "Not found" response |
| 53 | + Given operation "DeleteRestrictionQuery" enabled |
| 54 | + And new "DeleteRestrictionQuery" request |
| 55 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 56 | + When the request is sent |
| 57 | + Then the response status is 404 Not found |
| 58 | + |
| 59 | + @generated @skip @team:DataDog/logs-app |
| 60 | + Scenario: Delete a restriction query returns "OK" response |
| 61 | + Given operation "DeleteRestrictionQuery" enabled |
| 62 | + And new "DeleteRestrictionQuery" request |
| 63 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 64 | + When the request is sent |
| 65 | + Then the response status is 204 OK |
| 66 | + |
| 67 | + @generated @skip @team:DataDog/logs-app |
| 68 | + Scenario: Get a restriction query returns "Bad Request" response |
| 69 | + Given operation "GetRestrictionQuery" enabled |
| 70 | + And new "GetRestrictionQuery" request |
| 71 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 72 | + When the request is sent |
| 73 | + Then the response status is 400 Bad Request |
| 74 | + |
| 75 | + @generated @skip @team:DataDog/logs-app |
| 76 | + Scenario: Get a restriction query returns "Not found" response |
| 77 | + Given operation "GetRestrictionQuery" enabled |
| 78 | + And new "GetRestrictionQuery" request |
| 79 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 80 | + When the request is sent |
| 81 | + Then the response status is 404 Not found |
| 82 | + |
| 83 | + @generated @skip @team:DataDog/logs-app |
| 84 | + Scenario: Get a restriction query returns "OK" response |
| 85 | + Given operation "GetRestrictionQuery" enabled |
| 86 | + And new "GetRestrictionQuery" request |
| 87 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 88 | + When the request is sent |
| 89 | + Then the response status is 200 OK |
| 90 | + |
| 91 | + @generated @skip @team:DataDog/logs-app |
| 92 | + Scenario: Get all restriction queries for a given user returns "Bad Request" response |
| 93 | + Given operation "ListUserRestrictionQueries" enabled |
| 94 | + And new "ListUserRestrictionQueries" request |
| 95 | + And request contains "user_id" parameter from "REPLACE.ME" |
| 96 | + When the request is sent |
| 97 | + Then the response status is 400 Bad Request |
| 98 | + |
| 99 | + @generated @skip @team:DataDog/logs-app |
| 100 | + Scenario: Get all restriction queries for a given user returns "OK" response |
| 101 | + Given operation "ListUserRestrictionQueries" enabled |
| 102 | + And new "ListUserRestrictionQueries" request |
| 103 | + And request contains "user_id" parameter from "REPLACE.ME" |
| 104 | + When the request is sent |
| 105 | + Then the response status is 200 OK |
| 106 | + |
| 107 | + @generated @skip @team:DataDog/logs-app |
| 108 | + Scenario: Get restriction query for a given role returns "Bad Request" response |
| 109 | + Given operation "GetRoleRestrictionQuery" enabled |
| 110 | + And new "GetRoleRestrictionQuery" request |
| 111 | + And request contains "role_id" parameter from "REPLACE.ME" |
| 112 | + When the request is sent |
| 113 | + Then the response status is 400 Bad Request |
| 114 | + |
| 115 | + @generated @skip @team:DataDog/logs-app |
| 116 | + Scenario: Get restriction query for a given role returns "OK" response |
| 117 | + Given operation "GetRoleRestrictionQuery" enabled |
| 118 | + And new "GetRoleRestrictionQuery" request |
| 119 | + And request contains "role_id" parameter from "REPLACE.ME" |
| 120 | + When the request is sent |
| 121 | + Then the response status is 200 OK |
| 122 | + |
| 123 | + @generated @skip @team:DataDog/logs-app |
| 124 | + Scenario: Grant role to a restriction query returns "Bad Request" response |
| 125 | + Given operation "AddRoleToRestrictionQuery" enabled |
| 126 | + And new "AddRoleToRestrictionQuery" request |
| 127 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 128 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 129 | + When the request is sent |
| 130 | + Then the response status is 400 Bad Request |
| 131 | + |
| 132 | + @generated @skip @team:DataDog/logs-app |
| 133 | + Scenario: Grant role to a restriction query returns "Not found" response |
| 134 | + Given operation "AddRoleToRestrictionQuery" enabled |
| 135 | + And new "AddRoleToRestrictionQuery" request |
| 136 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 137 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 138 | + When the request is sent |
| 139 | + Then the response status is 404 Not found |
| 140 | + |
| 141 | + @generated @skip @team:DataDog/logs-app |
| 142 | + Scenario: Grant role to a restriction query returns "OK" response |
| 143 | + Given operation "AddRoleToRestrictionQuery" enabled |
| 144 | + And new "AddRoleToRestrictionQuery" request |
| 145 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 146 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 147 | + When the request is sent |
| 148 | + Then the response status is 204 OK |
| 149 | + |
| 150 | + @generated @skip @team:DataDog/logs-app |
| 151 | + Scenario: List restriction queries returns "OK" response |
| 152 | + Given operation "ListRestrictionQueries" enabled |
| 153 | + And new "ListRestrictionQueries" request |
| 154 | + When the request is sent |
| 155 | + Then the response status is 200 OK |
| 156 | + |
| 157 | + @generated @skip @team:DataDog/logs-app |
| 158 | + Scenario: List roles for a restriction query returns "Bad Request" response |
| 159 | + Given operation "ListRestrictionQueryRoles" enabled |
| 160 | + And new "ListRestrictionQueryRoles" request |
| 161 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 162 | + When the request is sent |
| 163 | + Then the response status is 400 Bad Request |
| 164 | + |
| 165 | + @generated @skip @team:DataDog/logs-app |
| 166 | + Scenario: List roles for a restriction query returns "Not found" response |
| 167 | + Given operation "ListRestrictionQueryRoles" enabled |
| 168 | + And new "ListRestrictionQueryRoles" request |
| 169 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 170 | + When the request is sent |
| 171 | + Then the response status is 404 Not found |
| 172 | + |
| 173 | + @generated @skip @team:DataDog/logs-app |
| 174 | + Scenario: List roles for a restriction query returns "OK" response |
| 175 | + Given operation "ListRestrictionQueryRoles" enabled |
| 176 | + And new "ListRestrictionQueryRoles" request |
| 177 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 178 | + When the request is sent |
| 179 | + Then the response status is 200 OK |
| 180 | + |
| 181 | + @generated @skip @team:DataDog/logs-app |
| 182 | + Scenario: Revoke role from a restriction query returns "Bad Request" response |
| 183 | + Given operation "RemoveRoleFromRestrictionQuery" enabled |
| 184 | + And new "RemoveRoleFromRestrictionQuery" request |
| 185 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 186 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 187 | + When the request is sent |
| 188 | + Then the response status is 400 Bad Request |
| 189 | + |
| 190 | + @generated @skip @team:DataDog/logs-app |
| 191 | + Scenario: Revoke role from a restriction query returns "Not found" response |
| 192 | + Given operation "RemoveRoleFromRestrictionQuery" enabled |
| 193 | + And new "RemoveRoleFromRestrictionQuery" request |
| 194 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 195 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 196 | + When the request is sent |
| 197 | + Then the response status is 404 Not found |
| 198 | + |
| 199 | + @generated @skip @team:DataDog/logs-app |
| 200 | + Scenario: Revoke role from a restriction query returns "OK" response |
| 201 | + Given operation "RemoveRoleFromRestrictionQuery" enabled |
| 202 | + And new "RemoveRoleFromRestrictionQuery" request |
| 203 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 204 | + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} |
| 205 | + When the request is sent |
| 206 | + Then the response status is 204 OK |
| 207 | + |
| 208 | + @generated @skip @team:DataDog/logs-app |
| 209 | + Scenario: Update a restriction query returns "Bad Request" response |
| 210 | + Given operation "UpdateRestrictionQuery" enabled |
| 211 | + And new "UpdateRestrictionQuery" request |
| 212 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 213 | + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} |
| 214 | + When the request is sent |
| 215 | + Then the response status is 400 Bad Request |
| 216 | + |
| 217 | + @generated @skip @team:DataDog/logs-app |
| 218 | + Scenario: Update a restriction query returns "Not found" response |
| 219 | + Given operation "UpdateRestrictionQuery" enabled |
| 220 | + And new "UpdateRestrictionQuery" request |
| 221 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 222 | + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} |
| 223 | + When the request is sent |
| 224 | + Then the response status is 404 Not found |
| 225 | + |
| 226 | + @generated @skip @team:DataDog/logs-app |
| 227 | + Scenario: Update a restriction query returns "OK" response |
| 228 | + Given operation "UpdateRestrictionQuery" enabled |
| 229 | + And new "UpdateRestrictionQuery" request |
| 230 | + And request contains "restriction_query_id" parameter from "REPLACE.ME" |
| 231 | + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} |
| 232 | + When the request is sent |
| 233 | + Then the response status is 200 OK |
0 commit comments